Pagination (SDA)

Endpoints that return lists of resources support pagination, which splits the response into multiple "pages" of results. Use pagination for API calls that will return a large number of results (e.g., GET List all Transactions linked to an Account).

note

Currently, the Digital Assets API only supports Limit-Offset pagination. Support for Cursor-based pagination will be added in the future.

Limit-Offset pagination

To paginate the response of an API call, you must include the following query parameters in the request:

  • pagination[page]: Specifies the number of results pages to return.
  • pagination[size]: Specifies the number of results to return on each page. The default value is 100.

Both parameters must have integer values.

When you make a paginated request, the response will contain a pagination object that includes the values for the next page (next) and the previous page (prev). When there is no previous or next page, the respective value will be null.

You can use Limit-Offset pagination in combination with sorting and filtering.

Example

In this example, the API will return two pages with 200 results each.

GET .../transactions?pagination[page]=2&pagination[size]=200
Copy
Copied
// 200 OK

{
  "items": [
    {
      "id": "bf20c716075ea82a4b1f3f0b49657161atrx",
      "account_id": "9c41ec8a82fb99b57cb5078ae0a8b569acct",
      "type": "DEPOSIT",
      "state": "COMPLETED",
      "amount": "1.12340000",
      "fee_amount": "0.00000000",
      "created_at": "2020-10-09T13:15:47Z",
      "updated_at": "2020-10-09T13:15:47Z"
    },
    {
      "id": "bf20c716075ea82a4b1f3v0b49a57182atrx",
      "account_id": "9c41ec8a82fb99b57cb5078ae0a8b569acct",
      "type": "DEPOSIT",
      "state": "COMPLETED",
      "amount": "1.00010000",
      "fee_amount": "0.00000000",
      "created_at": "2020-10-01T11:17:47Z",
      "updated_at": "2020-10-01T11:17:47Z"
    }
  ],
  "pagination": {
    "next": 2,
    "prev": null
  }
}