Pagination
Learn how to paginate through list endpoints in the Warp API using cursor-based pagination.
All list endpoints in the Warp API support cursor-based pagination. These endpoints share a common structure and accept the limit, afterId, and beforeId parameters.
Response Format
Section titled “Response Format”List endpoints return a response with a data array and a hasMore boolean indicating whether additional results are available.
{ "hasMore": true, "data": [ { "id": "wrk_abc123", ... }, { "id": "wrk_def456", ... } ]}| Field | Type | Description |
|---|---|---|
hasMore | boolean | true if there are more results available beyond this page |
data | array | Array of resource objects |
Parameters
Section titled “Parameters”- Optional, default is
25 - Specifies the number of objects to return, ranging between
1and100
afterId
Section titled “afterId”- Optional, object ID
- A cursor for forward pagination.
afterIdis an object ID that defines your place in the list. For example, if you make a list request and receive 25 objects ending withwrk_foo, your subsequent call can includeafterId=wrk_footo fetch the next page of the list.
beforeId
Section titled “beforeId”- Optional, object ID
- A cursor for backward pagination.
beforeIdis an object ID that defines your place in the list. For example, if you make a list request and receive 25 objects starting withwrk_bar, your subsequent call can includebeforeId=wrk_barto fetch the previous page of the list.
Example
Section titled “Example”Fetch the first page of workers:
curl https://api.warp.dev/v1/workers?limit=10 \ -H "x-api-key: wrp_company_your_api_key"Response:
{ "hasMore": true, "data": [ { "id": "wrk_abc123", "name": "Alice Smith" }, { "id": "wrk_def456", "name": "Bob Jones" }, ... { "id": "wrk_xyz789", "name": "Carol White" } ]}Fetch the next page using afterId:
curl https://api.warp.dev/v1/workers?limit=10&afterId=wrk_xyz789 \ -H "x-api-key: wrp_company_your_api_key"