Listing and pagination
Browse Raims API results with page sizes and cursors.
Paginated Raims API lists divide results across requests. Items are returned
in list, and the information for navigating between pages is in page.
Browsing results
First request
Make the first request without
afterorbefore.Process results
Process the items received in
list, including on the last page.Continue or finish
If
page.has_nextistrue, copypage.next_aftertoafterand repeat the request. When it isfalse, finish the listing.
Copy the entire cursor without interpreting its contents, changing its value or calculating the next cursor. Keep the same filters and sorting, when the endpoint allows you to choose them, as you browse pages.
For example, in List customers, start with:
GET /v1/customers?page_size=10In subsequent requests, set after to the cursor from the previous response:
| Page | page_size | after |
|---|---|---|
| First | 10 | Omitted |
| Second | 10 | page.next_after value from the first response |
| Third | 10 | page.next_after value from the second response |
Each new request uses the cursor from the page you just received.
Recognize the end and prepare the next URL
This List customers example is already on its last
page. has_next: false and next_after: null mean the query is complete:
Customers found
{
"page": {
"page_size": 10,
"has_next": false,
"has_previous": false,
"next_after": null,
"previous_before": null
}
}When a response contains has_next: true, build the next URL from the current
one to keep its filters. This function copies the returned cursor and removes
the backward cursor; it does not send a request:
function nextPageUrl(currentUrl, page) {
if (!page.has_next) return null;
const url = new URL(currentUrl);
url.searchParams.delete('before');
url.searchParams.set('after', page.next_after);
return url.toString();
}Process list before calling the function, including when it returns null.
Pass the complete query URL as currentUrl, without the credential.
Page size and forward navigation
| Field | Where it appears | Description |
|---|---|---|
page_size | Request | Maximum items per page. Accepts 1 to 100; a positive integer above the maximum uses the maximum. Omitted, empty, zero, negative, text or decimal values use 10. |
after | Request | Cursor received in page.next_after to retrieve the next page. |
list | Response | Items found on the page. Returns an empty array when there are no results. |
page.page_size | Response | Page size applied to the request. |
page.has_next | Response | Indicates whether there is a next page. |
page.next_after | Response | Cursor for moving forward. Returns null when there is no next page. |
page_size is a limit: a page may contain fewer items than requested. Use
page.has_next to decide whether to continue.
Going back one page
When page.has_previous is true, send page.previous_before in before,
keeping the filters and sorting. Remove after when moving back. Remove
before when moving forward.
| Field | Where it appears | Description |
|---|---|---|
before | Request | Cursor received in page.previous_before to retrieve the previous page. |
page.has_previous | Response | Indicates whether there is a previous page. |
page.previous_before | Response | Cursor for moving back. Returns null when there is no previous page. |
Send only one cursor per request. Providing values for both after and
before in the same request returns 400 INVALID_FIELDS, with
MUTUALLY_EXCLUSIVE in the details of both fields. Remove the cursor for
the direction you will not use. If you will not use a cursor, omit the
field. Leaving it empty or containing only spaces has the same effect.
Cursor considerations
The cursor belongs to the authenticated company and environment, and to the
filters and sorting used in the request. To change these criteria, start
a new listing without a cursor. A modified cursor or one used with a
different query may be rejected by validation. If you receive
INVALID_CURSOR in error.details, restart the listing without after
or before, keeping the filters you want.
In the documentation console, enter these values in Query Params. They are included in the request URL and code examples. Empty fields are omitted.
Filtered queries
See the listing endpoint's reference for its filters, sorting and cursor rules.