Skip to main content

Pagination & Sorting

All API endpoints returning a list of results (e.g. Tenants, Users, Permissions, Roles, Pricing Tiers, Features, Object Types, and Warrants) support cursor-based pagination via a combination of the limit, afterId, and beforeId query parameters. They also support sorting (and paginated sorting) via the sortBy, sortOrder, afterValue, and beforeValue query parameters:

ParameterDescriptionRequiredDefault
limitA positive integer representing the maximum number of items to return in the response. Must be less than or equal to 1000.no25
afterIdA cursor representing your place in a list of results. Requests containing afterId will return elements after the cursor.non/a
beforeIdA cursor representing your place in a list of results. Requests containing beforeId will return elements before the cursor.non/a
afterValueWorks like afterId if a sortBy is provided. Requests containing afterValue will return elements after the cursor.if sortByn/a
beforeValueWorks like beforeId if a sortBy is provided. Requests containing beforeValue will return elements before the cursor.if sortByn/a
sortByThe column to sort the result by.nothe id column
sortOrderThe order in which to sort the result by. Valid values are ASC and DESCnoASC

Request

curl "https://api.warrant.dev/v1/users?sortBy=email&sortOrder=ASC&afterId=user123&afterValue=emailA%40warrant.dev&limit=2" \
-H "Authorization: ApiKey YOUR_KEY"

Response

200 OK
[
{
"userId": "userXYZ",
"email": "emailB@warrant.dev"
},
{
"userId": "userABC",
"email": "emailC@warrant.dev"
}
]