All Go backend list endpoints return a consistent paginated response envelope. Two modes are supported: offset (page-numbered) and cursor (token-based).
Response Shape
items array always contains the page of data. The pagination object contains navigation metadata.
Offset Mode
Use for static datasets where total count is known and users may jump to arbitrary pages (e.g. audit logs, reports).Cursor Mode
Use for frequently-updated lists where consistent ordering matters (e.g. activity feeds, inventory, transactions).Field Reference
hasNext and hasPrev are always present in both modes — use them to enable/disable navigation controls without branching on mode.
hasNext / hasPrev Semantics
Both fields are computed server-side at response time.
Switching Modes
Send theX-Pagination-Type request header to select the mode. Defaults to offset when the header is absent.
Cursor Mode with Total Count
By default cursor responses omittotalPages and totalRecords to avoid an extra COUNT query. Pass ?include_total=true to opt in:
Request Parameters
Handler Usage (Go)
pagination.Wrap function always produces { "items": ..., "pagination": ... } — handlers must not construct the envelope manually.
Limit Cap
The maximum allowedlimit is 100. Requests with limit > 100 fall back to the default of 20.