> ## Documentation Index
> Fetch the complete documentation index at: https://docs.layerfi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Pagination

Listing endpoints, for example [List all Businesses](/api-reference/business/list) and [List all Bank Transactions](/api-reference/bank-transaction/list) support cursor-based pagination. Pagination can be controlled via query string parameters:

* `sort_by` which supports some timestamp, integer and string keys. Valid sort keys are noted in documentation where applicable. Sort key is optional.
* `sort_order` specifies either ASC or DESC ordering for the sort key. Optional, ASC by default.
* `cursor` returned by the previous list request. Do not specify for the initial listing API call.
* `limit` constrains the number of results to be returned. Defaults to 100 for most endpoints.
* `show_total_count` causes the `total_count` field (total number of entities matching the query) to be returned in the pagination metadata.

```bash Request theme={null}
curl https://sandbox.layerfi.com/v1/businesses/{business_id}/bank-transactions?sort_by=date&sort_order=DESC&limit=50&show_total_count=true \
  -H "Authorization: Bearer <access_token>"
```

Responses to paginating endpoints will include pagination data in the meta response field.

```json Response theme={null}
{
  "data": [
    // Data omitted
  ],
  "meta": {
	"pagination": {
"sort_by": "date",
       	"sort_order": ASC,
       	"cursor": "VGhhbmtzIGZvciByZWFsbHkgcmVhZGluZyB0aGUgZG9jdW1lbnRhdGlvbiE="
       	"has_more": true,
       	"total_count": 456
	}
   }
}
```

When the `has_more` field is true, use the returned cursor in an additional request to fetch the next page of results.

`show_total_count` has a performance cost, so it **defaults to false**. We recommend only setting this flag when specifically needed.
