Trustpair's API returns paginated results for listed endpoints. By default, the number of items returned is 10.
However, if you want to retrieve more items in the answer of your requests to Trustpair's API, you can use a cursor-based pagination system.
Cursor-based Pagination
Trustpair uses a cursor-based pagination system. Here are the following cursors that you can use in order to customize the number of results you want to get from your queries.
Cursor | Description | Required |
---|---|---|
limit | Number of objects to be returned between 1 and 100. | optional, default is 10 |
ending_before | Specifies the ID of the object from which your list request will end | optional |
starting_after | Specifies the ID of the object from which your list request will start | optional |
⚠️ Note that the results from the query will be sorted in reverse chronological order.
Examples
Usage of the limit cursor
Initial request
https://app-sandbox.trustpair.com/api/v1/company_account_audits?limit=15
Example of an extract from the paginated response
"links": {
"self": "https://app-sandbox.trustpair.com/api/v1/company_account_audits?limit=15",
"first": "https://app-sandbox.trustpair.com/api/v1/company_account_audits?limit=15",
"prev": "https://app-sandbox.trustpair.com/api/v1/company_account_audits?limit=15&starting_after=8384be90-e3b5-4156-a4fb-7c4d3f938861",
"next": "https://app-sandbox.trustpair.com/api/v1/company_account_audits?ending_before=ca204f10-9897-4b7d-a642-d6137be2e8b6&limit=15"
},
"meta": {
"count": 15,
"total": 32
}
Usage of the starting_after and ending_before cursor
Initial request
https://app-sandbox.trustpair.com/api/v1/company_account_audits/recents?starting_after='92d6a4a4-543a-4cd2-8a94-c376fb75b50d'&limit=50
Example of an extract from the paginated response
"links": {
"self": "https://app-sandbox.trustpair.com/api/v1/company_account_checks/recents?limit=50&starting_after=%2792d6a4a4-543a-4cd2-8a94-c376fb75b50d%27",
"first": "https://app-sandbox.trustpair.com/api/v1/company_account_checks/recents?limit=50",
"prev": "https://app-sandbox.trustpair.com/api/v1/company_account_checks/recents?limit=50&starting_after=92d6a4a4-543a-4cd2-8a94-c376fb75b50d",
"next": "https://app-sandbox.trustpair.com/api/v1/company_account_checks/recents?ending_before=57377d8e-c2a2-46dc-b42f-3d3455ff377d&limit=50"
},
"meta": {
"count": 9,
"total": 9
}
}