Pagination

Learn how to retrieve all objects in a collection.

All endpoints that retrieve a collection of objects support cursor-based pagination. When you make a request to one of these endpoints, it will respond with the first page of objects in the collection. If the collection includes additional objects, the response will also include a next_page property that can be used to request the next page of objects.

Example pagination requests and responses

Requesting the first page

GET /2023-04-11/customers
curl -G $PLIRO_API_BASE_URL/2023-04-11/customers \
  -u "$PLIRO_API_KEY:" \
  -d limit=2
Response
{
  "objects": [
    {
      "id": "cus_1BxEmDZEfaMhFQxkysiGtm",
      "email": "jane@example.com",
      "name": "Jane Doe",
      "newsletter_slugs": [],
      "plan_slug": null
    },
    {
      "id": "cus_1BxEm4QKh4Rb5v6Qvu2THx",
      "email": "john@example.com",
      "name": "John Doe",
      "newsletter_slugs": [],
      "plan_slug": null
    }
  ],
  "next_page": "Y3VzXzFCeEVtM1I1bjRQU1lVN3ZwZWFpY3E"
}

Requesting the second page

GET /2023-04-11/customers
curl -G $PLIRO_API_BASE_URL/2023-04-11/customers \
  -u "$PLIRO_API_KEY:" \
  -d page=Y3VzXzFCeEVtM1I1bjRQU1lVN3ZwZWFpY3E \
  -d limit=2
Response
{
  "objects": [
    {
      "id": "cus_1BxEm3R5n4PSYU7vpeaicq",
      "email": "richard@example.com",
      "name": "Richard Roe",
      "newsletter_slugs": [],
      "plan_slug": null
    }
  ],
  "next_page": null
}

Pagination parameters

limit integer The maximum number of objects to retrieve.

page string Omit this parameter to request the first page. Provide the next_page value returned in a previous response to request the next page.

The page object

{
  "objects": [
    {
      "id": "cus_1BxEmDZEfaMhFQxkysiGtm",
      "email": "jane@example.com",
      "name": "Jane Doe",
      "newsletter_slugs": [],
      "plan_slug": null
    },
    {
      "id": "cus_1BxEm4QKh4Rb5v6Qvu2THx",
      "email": "john@example.com",
      "name": "John Doe",
      "newsletter_slugs": [],
      "plan_slug": null
    }
  ],
  "next_page": "Y3VzXzFCeEVtM1I1bjRQU1lVN3ZwZWFpY3E"
}

Properties

objects array An array of objects in reverse chronological order.

next_page optional string A cursor for the next page of objects.

Last updated