Pagination

All list endpoints use cursor-based pagination for efficient and consistent data retrieval. Unlike offset-based pagination, cursor pagination ensures you won't miss items or see duplicates when the underlying data changes during pagination.

Request Parameters

Parameter
Type
Default
Max
Description

limit

integer

50

100

Number of items to return per page

next

string

-

-

Cursor token from a previous response's next_cursor field. Use for forward pagination.

prev

string

-

-

Cursor token from a previous response's prev_cursor field. Use for backward pagination.

circle-exclamation

Response Structure

All paginated endpoints return a paging object:

Field
Type
Description

has_more

boolean

true if there are more items available beyond this page

next_cursor

string | null

Cursor token to fetch the next page. null if no more pages.

prev_cursor

string | null

Cursor token to fetch the previous page. null if on the first page.

Request Examples

# First page (no cursor needed)
GET /api/v1/trading/orders?limit=10

# Next page (use next_cursor value from previous response)
GET /api/v1/trading/orders?limit=10&next=eyJpZCI6Im9yZGVyXzEyMyJ9

# Previous page (use prev_cursor value from previous response)
GET /api/v1/trading/orders?limit=10&prev=eyJpZCI6Im9yZGVyXzQzRUtVWUwzNE5XQVNMSVIifQ

Response Example

Cursor Encoding

Cursor values are base64-encoded strings. When passing these as query parameters:

  • The cursor value can be passed as-is (without URL encoding)

  • The server accepts both URL-encoded and non-encoded forms

  • If your HTTP client automatically URL-encodes query parameters, this is also acceptable

Best Practices

  • Always check has_more before requesting the next page

  • Cursors are opaque strings—do not parse or modify them

  • Cursors may expire—they are meant for immediate sequential pagination, not long-term storage

  • Results maintain consistent ordering across pages when using cursors from the same initial request

  • Use appropriate limit values: higher for bulk operations, lower for UI display

Last updated

Was this helpful?