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
Parameter | Description | Type | Required | Default |
---|---|---|---|---|
limit | A positive integer representing the maximum number of items to return in the response. Must be less than or equal to 1000. | Query param | no | 25 |
afterId | A cursor representing your place in a list of elements. Requests containing afterId will return elements after the cursor. | Query param | no | n/a |
beforeId | A cursor representing your place in a list of elements. Requests containing beforeId will return elements before the cursor. | Query param | no | n/a |
afterValue | Works like afterId if a sortBy is provided. Requests containing afterValue will return elements after the cursor. | Query param | if sortBy | n/a |
beforeValue | Works like beforeId if a sortBy is provided. Requests containing beforeValue will return elements before the cursor. | Query param | if sortBy | n/a |
sortBy | The column to sort the result by. | Query param | no | the id column |
sortOrder | The order in which to sort the result by. Can be ASC or DESC | Query param | no | ASC |
Request
- Curl
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"
}
]