API
Checking Raims account

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

  1. First request

    Make the first request without after or before.

  2. Process results

    Process the items received in list, including on the last page.

  3. Continue or finish

    If page.has_next is true, copy page.next_after to after and repeat the request. When it is false, 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:

HTTP
GET /v1/customers?page_size=10

In subsequent requests, set after to the cursor from the previous response:

Pagepage_sizeafter
First10Omitted
Second10page.next_after value from the first response
Third10page.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:

HTTP 200 response example excerptGET /v1/customers

Customers found

JSON
{
  "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:

JavaScript
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

FieldWhere it appearsDescription
page_sizeRequestMaximum 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.
afterRequestCursor received in page.next_after to retrieve the next page.
listResponseItems found on the page. Returns an empty array when there are no results.
page.page_sizeResponsePage size applied to the request.
page.has_nextResponseIndicates whether there is a next page.
page.next_afterResponseCursor 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.

FieldWhere it appearsDescription
beforeRequestCursor received in page.previous_before to retrieve the previous page.
page.has_previousResponseIndicates whether there is a previous page.
page.previous_beforeResponseCursor 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.