Skip to main content
Every list endpoint in the BlooBank API follows the same pagination contract. Read this once and you know how to paginate any collection.

Request parameters

Response shape

Every list response is shaped:

page_size

You may change page_size between pages without invalidating a token.

page_token

page_token is a pagination cursor generated by the server. Clients must treat it as fully opaque.

What it encodes (conceptually)

  • The pagination protocol version
  • Issuance and expiration timestamps
  • A fingerprint of the original query context (filter and order_by)
  • The cursor position corresponding to the last item of the previous page
The payload is serialized using MessagePack and cryptographically signed to prevent tampering.

Guarantees

  • Bound to query context. Using a token with a different filter or order_by (or against a different endpoint) returns INVALID_PAGE_TOKEN.
  • Bounded lifetime. Tokens expire — typically within 48 hours. Expired tokens return INVALID_PAGE_TOKEN. Restart pagination from the beginning when this happens.
  • Tokens do not grant authorization. Every paginated request is authorized independently.

Rules

Parameter stability across pages

When using page_token, all request parameters must match the original request, with one exception. Inconsistent requests fail with INVALID_PAGE_TOKEN (HTTP 400).

order_by

The order_by parameter is a comma-separated list of ordering expressions.

Syntax

  • Ascending is the default: field
  • Descending uses the desc suffix: field desc
  • Whitespace is ignored.
  • Ordering applies left-to-right.

Examples

Field restrictions

Ordering fields are explicitly whitelisted by each endpoint. The allowed fields are documented per endpoint (e.g., wallets list allows createdAt).

Stable tie-breaking

When multiple items share the ordering values you specified, the service appends an internal tie-breaker (typically the resource id) so pagination is deterministic. Clients must not rely on the presence, name, or direction of the tie-breaker.

URL encoding

Query parameters travel through URLs and must follow RFC 3986.
  • Spaces → %20
  • >%3E, <%3C, =%3D, ,%2C
Most HTTP clients encode automatically. Hand-built URLs must encode explicitly.

End-of-collection

When no more results exist:
  • nextPageToken is null (not omitted, not empty string — explicitly null).
  • Clients should treat nextPageToken === null as end-of-collection.

Errors

See Errors for the full envelope contract.

End-to-end example

Page 1 — request:
Response:
Page 2 — request (same filter and order_by, different page_size, with token):
Response — end of collection:

Client best practices

  1. Treat page_token as opaque — do not parse, encode, or persist alongside business state.
  2. Keep filter and order_by stable across pages of the same iteration.
  3. Tune page_size to the consumer — small (10–25) for interactive UIs; large (up to 100) for batch jobs.
  4. Iterate until nextPageToken is null — that is the only end-of-collection signal.
  5. Restart on INVALID_PAGE_TOKEN — tokens expire; restart pagination from the beginning if the user resumes hours later.

Next

Pagination concepts

The mental model behind cursor pagination, when to paginate.

Ordering concepts

How to choose stable ordering fields.