Skip to main content

Overview

Caspen APIs use cursor-based pagination. Each paginated response includes links.prev and links.next entries with fully qualified URLs. When another page is unavailable, the corresponding link is null.

Request parameters

NameRequiredTypeDescription
limitNointegerMaximum number of records to return per page (1-100). If omitted, the endpoint uses its default page size (10 unless otherwise noted).
cursorNostringCursor token that identifies the page to fetch. Use the value embedded in the links.next or links.prev URL from the previous response.

Response structure

Every paginated response returns the resource collection plus a links object that guides you to neighbouring pages.
{
  "data": [
    { "id": "..." }
  ],
  "links": {
    "prev": null,
    "next": "https://api.caspen.com/v1/clients?cursor=eyJ0eXBlIjoiY3Vyc29yIiwgLi4u"
  }
}
  • links.prev: URL for the previous page or null when you are at the beginning of the dataset.
  • links.next: URL for the next page or null once you have reached the end.

Fetching the next page

  1. Request the first page, optionally setting limit to control page size.
curl https://api.caspen.com/v1/clients \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"
  1. Read links.next from the response. If it is not null, issue another request using that URL verbatim.
curl "https://api.caspen.com/v1/clients?cursor=eyJ0eXBlIjoiY3Vyc29yIiwgLi4u" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"
Repeat this process until links.next becomes null.