Our GraphQL API follows the Relay pagination spec.

When fetching collections from our API you can control how much data is returned. We will return 25 records per request by default and the maximum page size is 100 records.

We support two forms of page control arguments:

  1. Forward pagination with after (cursor) & first (numeric count)
  2. Reverse pagination with before (cursor) & last (numeric count)

Note that these must not be mixed, e.g performing a query with values for first & before will result in a validation error.

Endpoints which return paginated results will return a pageInfo object along with a totalCount field which allows you to make subsequent calls with page controls. Using the getCustomers API as an example this would look as follows:

import { PlainClient } from '@team-plain/typescript-sdk';

const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });

const firstPage = client.getCustomers({});

if (firstPage.error) {
} else {
  const { pageInfo } = firstPage.data;
  const secondPage = await client.getCustomers({
    after: pageInfo.endCursor,
    first: 50,

Notice how we use the cursor information from the first page to fetch the second page. The returned pageInfo looks as follows:

  "customers": [
    // Customers would be here, elided for clarity
  "totalCount": 1047,
  "pageInfo": {
    "hasPreviousPage": false,
    "hasNextPage": true,
    "startCursor": "eyJjdXN0b21lcnMuZnVsbF9uYW1lIjoiQWlzaGEgSGF5ZXMiLCJjdXN0b21lcnMuaWQiOiJjXzAxRllFWjlBRTk2S1c4SFJHSDhWVEZKU1JIIn0=",
    "endCursor": "eyJjdXN0b21lcnMuZnVsbF9uYW1lIjoiQWxsYW4gQnJhdW4iLCJjdXN0b21lcnMuaWQiOiJjXzAxSDFSQkRBV1BFQlpIRzlIODVORzE5SFdQIn0="