Across our API, we provide endpoints that allow you to "list" core resources. We use cursor-based pagination and offset-based pagination. These are managed via the path parameters on the request.

As we are using Hypertext Language Application (HAL), although we have two distinct types of pagination, we encourage you to leverage the _links provided as part of the response to navigate through the requests.

Link keyDescription
selfURI for the returned collection of resources.
nextURI for the next page. Not present when there are no more resources to paginate.
firstURI for the first page. Provides the first collection of resources available according to the filters applied.
lastURI for the last page. Provides the last collection of resources available according to the filters applied.
prevURI for the previous page. Not present on the first response when starting pagination (no previous page).

A collection resource always provides the self and next links. The first, last, and prev links are only available on offset-based pagination.

Cursor-based Pagination

ParameterDescription
cursorThe cursor to use for pagination. It identifies your place on the list.
limitSpecifies a limit on the number of items to return. Allows values between 1 and 100.
curl -X GET \
  https://api.astrada.co/subaccounts?limit=10 \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer ...'
{
  "_links": {
    "self": { "href": "/subaccounts" },
    "next": { "href": "/subaccounts?cursor=ZXhhbXBsZQ==" },
  },
  "_embedded": {
    "subaccounts": [
      { ... },
      { ... },
    ]
  }
}

Offset-based Pagination

ParameterDescription
offsetThe offset of the first item returned in the collection. For the first request, no offset needs to be provided.
limitSpecifies a limit on the number of items to return. Allows values between 1 and 100.
curl -X GET \
  https://api.astrada.co/cards?offset=10&limit=10 \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer ...'
{
  "_links": {
    "self": { "href": "/cards?offset=10&limit=10" },
    "prev": { "href": "/cards?limit=10" },
    "next": { "href": "/cards?offset=20&limit=10" },
    "first": { "href": "/cards?limit=10" },
    "last": { "href": "/cards?offset=900&limit=10" }
  },
  "_embedded": {
    "cards": [
      { ... },
      { ... },
    ]
  },
  "totalItems": 30
}

Note: offset-based pagination returns totalItems as part of the response body with the total amount of resources matching the search criteria.