Pagination
Management API list endpoints support two pagination modes, mirroring Auth0:
- Offset pagination —
page/per_page(+ optionalinclude_totals). Works everywhere, but pages can shift when rows are inserted mid-walk, and computing totals gets expensive on large tables. - Checkpoint pagination —
from/takewith an opaquenextcursor. Stable under concurrent writes and cheap at any depth. Preferred for exports and full-table walks.
Offset pagination
GET /api/v2/users?page=0&per_page=50&include_totals=truepagedefaults to0,per_pageto50.- Without
include_totals=truethe response is a bare array; with it you get the Auth0 totals envelope (start,limit,length,totalplus the items array).
Checkpoint pagination
GET /api/v2/users?take=50{
"users": [ ... ],
"next": "eyJpIjoiZW1haWx8..."
}Pass next back verbatim as from to continue:
GET /api/v2/users?take=50&from=eyJpIjoiZW1haWx8...takedefaults to 50 when omitted.nextis an opaque cursor — do not parse or construct it. It is absent on the last page, which is the termination signal.- The response is a plain
{ <items>, next? }envelope;include_totalsis ignored in checkpoint mode — nototalis computed.
Supported endpoints
| Endpoint | Items field |
|---|---|
GET /api/v2/users | users |
GET /api/v2/logs | logs |
GET /api/v2/clients | clients |
GET /api/v2/client-grants | client_grants |
GET /api/v2/organizations | organizations |
GET /api/v2/organizations/{id}/members | members |
GET /api/v2/roles/{id}/users | users |
GET /api/v2/connections | connections |
GET /api/v2/resource-servers | resource_servers |
GET /api/v2/roles | roles |
GET /api/v2/roles/{id}/permissions | permissions |
GET /api/v2/hooks | hooks |
GET /api/v2/actions/actions | actions |
GET /api/v2/forms | forms |
GET /api/v2/flows | flows |
GET /api/v2/grants | grants |
GET /api/v2/users/{id}/connected-clients | connected_clients |
GET /api/v2/failed-events | events |
GET /api/v2/users/{id}/sessions | sessions |
GET /api/v2/users/{id}/logs | logs |
GET /api/v2/users/{id}/organizations | organizations |
GET /api/v2/users/{id}/permissions | permissions |
GET /api/v2/users/{id}/roles | roles |
GET /api/v2/organizations/{id}/invitations | invitations |
GET /api/v2/organizations/{id}/enabled_connections | connections |
GET /api/v2/organizations/{id}/members/{user_id}/roles | roles |
Other list endpoints accept from/take in their query schema but ignore them and never return next — they stay offset-paginated.
Mode selection and sorting
- Supplying either
fromortakeswitches the whole request to checkpoint mode;pageandper_pageare then ignored. - Checkpoint walks are ordered by creation time descending (users/logs also accept ascending). On
/usersonlysort=created_at:1|-1is honored and on/logsonlysort=date:1|-1; any other sort column returns400./roles/{id}/permissionswalks by resource server identifier, then permission name, ascending./rolesand/roles/{id}/permissionsreturn400whensortis combined with checkpoint mode; the remaining endpoints use a fixed order and ignoresort. /users/{id}/permissionswalks by resource server identifier, permission name, then organization id, ascending, and returns400whensortorqis combined with checkpoint mode./users/{id}/roleswalks distinct global roles by role id; a role held under several organization scopes is not repeated./users/{id}/sessionsand/users/{id}/organizationswalk newest first;/users/{id}/logsfollows/logs(date, descending by default)./organizations/{id}/invitationswalks newest first and ignoressortin checkpoint mode./organizations/{id}/enabled_connectionswalks by connection id ascending./organizations/{id}/members/{user_id}/roleswalks distinct roles by role id./hooks,/actions/actions,/forms,/flowsand/grantswalk newest first with a fixed order (sortis ignored);qand the/grantsfilters stay in effect./users/{id}/connected-clientswalks newest first (soft-deleted clients are dropped, so a page can be shorter thantake)./failed-eventswalks the most recently dead-lettered events first.- A cursor is bound to the sort it was minted under — replaying it with a different
sortreturns400. GET /roles/{id}/userscapstake(andper_page) at 100, matching Auth0.
Differences from Auth0
- Auth0 does not offer checkpoint pagination on
GET /users(offset only, capped at 1000 results); AuthHero does, so full user exports don't needqpartitioning tricks. - Auth0 also pages
GET /roles,GET /roles/{id}/permissionsandGET /resource-serversby offset only; checkpoint mode on those is an AuthHero extension.GET /connectionssupports checkpoint in Auth0 too, with the same{ connections, next }shape. - Auth0 documents
fromas an id; AuthHero keeps it fully opaque so the encoding can evolve. - Checkpoint walks on
/usersreturn primary users only — linked accounts appear asidentitieson their primary user rather than as separate rows.
Adapter note
The DynamoDB (@authhero/aws) adapter backs checkpoint mode with DynamoDB's own LastEvaluatedKey, so its cursors are not interchangeable with the SQL adapters'. Its last page can carry a next that leads to an empty page, so stop on an empty page as well as on a missing next. GET /roles/{id}/users is not implemented on DynamoDB, and it has no index by role, so that endpoint stays unsupported there. User permissions, user roles and organization connections page within the DynamoDB partition they are stored in: user permissions and roles are partitioned per organization, so /users/{id}/permissions and /users/{id}/roles list the global partition, and /organizations/{id}/members/{user_id}/roles lists that organization's.