Skip to main content

Pagination & Sorting

All API endpoints that return a collection of objects (ex. Warrants, Tenants, Users, Permissions and Roles) support cursor-based pagination via the limit, afterId, and beforeId query parameters. They also support sorting (and paginated sorting) via the sortBy, sortOrder, afterValue, and beforeValue query parameters:

GET /users?limit=2&afterId=8fa971de-29e4-4b02-9f34-0ea581739a13
ParameterDescriptionTypeRequiredDefault
limitA positive integer representing the maximum number of items to return in the response. Must be less than or equal to 1000.Query paramno25
afterIdA cursor representing your place in a list of elements. Requests containing afterId will return elements after the cursor.Query paramnon/a
beforeIdA cursor representing your place in a list of elements. Requests containing beforeId will return elements before the cursor.Query paramnon/a
afterValueWorks like afterId if a sortBy is provided. Requests containing afterValue will return elements after the cursor.Query paramif sortByn/a
beforeValueWorks like beforeId if a sortBy is provided. Requests containing beforeValue will return elements before the cursor.Query paramif sortByn/a
sortByThe column to sort the result by.Query paramnothe id column
sortOrderThe order in which to sort the result by. Can be ASC or DESCQuery paramnoASC

Request

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

Response

[
{
"userId": "newUser2",
"email": "emailA@warrant.dev"
},
{
"userId": "newUser3",
"email": "emailB@warrant.dev"
}
]