API Pagination

View Markdown

Overview

List endpoints use cursor-based pagination. You navigate through results using the after and before parameters with resource IDs as cursors.


Parameters

ParameterTypeDescription
limitintegerNumber of results to return (1–100, default: 20)
afterstringReturn results after this resource ID
beforestringReturn results before this resource ID
orderstringSort order: asc or desc (default: desc)

Basic usage

Fetch the first page of results:

curl "https://api.ittybit.com/tasks?limit=10" \
-H "Authorization: Bearer ITTYBIT_API_KEY"

Fetch the next page using the last ID from the previous response:

curl "https://api.ittybit.com/tasks?limit=10&after=task_abcdefgh12345678" \
-H "Authorization: Bearer ITTYBIT_API_KEY"

Response headers

List responses include the following pagination headers:

Navigation URLs following RFC 5988:

Link: <https://api.ittybit.com/tasks?limit=10&after=task_xyz>; rel="next"

Has-More

A boolean indicating whether there are more results beyond the current page:

Has-More: true

Limit

The limit that was applied to the current request:

Limit: 10

Example

# First page
curl "https://api.ittybit.com/tasks?limit=5&order=desc" \
-H "Authorization: Bearer ITTYBIT_API_KEY"

# Response headers:
# Link: <https://api.ittybit.com/tasks?limit=5&after=task_last_id>; rel="next"
# Has-More: true
# Limit: 5

# Next page
curl "https://api.ittybit.com/tasks?limit=5&order=desc&after=task_last_id" \
-H "Authorization: Bearer ITTYBIT_API_KEY"

Filtering

Many list endpoints support additional query parameters for filtering:

EndpointFilters
GET /tasksstatus, kind, run_id, created_by
GET /runsstatus
GET /eventskind
curl "https://api.ittybit.com/tasks?status=succeeded&kind=video&limit=10" \
-H "Authorization: Bearer ITTYBIT_API_KEY"

On this page