For the complete documentation index, see llms.txt. This page is also available as Markdown.

Pagination

Retrieve large collections page by page with cursor pagination

Every OCTO list endpoint returns results in pages of up to 100 records. To read a whole collection, follow the Octo-Next-Page response header from one request to the next until it is no longer returned.

Endpoints

Cursor pagination applies to every OCTO collection endpoint, including:

Parameters

Parameter
Where
Description

limit

Query

Maximum number of records to return, from 1 to 100. Defaults to 100. Send it on every request.

page

Query

The cursor from the previous response's Octo-Next-Page header. Omit it on the first request.

Response header
Description

Octo-Next-Page

An opaque cursor for the next page. Absent on the last page or when there are no results.

The response body keeps its usual shape: an array of records.

How to paginate

1

Make the first request without page

Keep your usual filters, headers and capabilities.

2

Read Octo-Next-Page

3

Send it back as page

Use the exact value, with the same endpoint, filters, ordering, limit, authentication and capabilities. Let your HTTP client URL-encode it.

4

Repeat until Octo-Next-Page is absent

When the header is missing, you have the whole collection.

Example

The same loop works for products, bookings, orders and webhooks.

Rules

  • Treat the cursor as opaque. Don't decode, modify, construct or increment it.

  • Fetch pages in order. Each cursor comes from the previous response, so pages can't be requested in parallel.

  • Keep the request the same while traversing. Changing filters or ordering starts a new traversal. Changing limit between pages is allowed.

  • There is no total count. Use the absence of Octo-Next-Page as the stopping condition.

  • Results are not a snapshot. A record that changes while you traverse can move between pages. Syncs that must not miss changes should also use Webhooks.

  • Browser clients can read Octo-Next-Page; it is exposed to cross-origin requests.

Migrating from numbered pages

Before
Now

perPage=100

limit=100

page=1, page=2, …

No page on the first request, then page=<value of Octo-Next-Page>

Stop when you reach Octo-Total-Pages

Stop when Octo-Next-Page is absent. Octo-Total-Pages is no longer returned

Omitting page returned the whole collection

Omitting page returns the first page only. Follow Octo-Next-Page or you will only read the first 100 records

Errors

Pagination errors return 400 Bad Request with error: "BAD_REQUEST", an errorCode and a descriptive errorMessage. The errorCode is also returned in the Ventrata-Error-Code response header.

errorCode

Cause

CURSOR_PAGINATION_REQUIRED

A numeric page was sent. Start without page and follow Octo-Next-Page.

PER_PAGE_RENAMED

The obsolete perPage parameter was sent. Use limit.

INVALID_LIMIT

limit is not a whole number from 1 to 100.

A malformed or altered cursor returns BAD_REQUEST.

Questions

For help with pagination or anything else in your integration, contact connectivity@ventrata.com.