API Reference
Pagination
List endpoints use cursor-based pagination for stable navigation, even as data changes between requests.
API Reference
List endpoints use cursor-based pagination for stable navigation, even as data changes between requests.
Paginated responses include:
dataThe list of returned items.hasMoreWhether there are more items available.Navigate through results using the following query parameters:
limitNumber of items to return per page (1–100, default 50).afterCursor to get the next page of results.beforeCursor to get the previous page of results.Use the _id of objects as the cursor for pagination. The cursor itself is excluded from the results. You can use either after or before, not both.
{
"data": [
{ "_id": "abc123", ... },
{ "_id": "def456", ... }
],
"hasMore": true
}# First page
curl -H "Authorization: Bearer INTERVALS_PARTNER_API_KEY" \
"https://api.intervals.run/events?limit=20"
# Next page (use _id of last item from previous response)
curl -H "Authorization: Bearer INTERVALS_PARTNER_API_KEY" \
"https://api.intervals.run/events?limit=20&after=def456"async function fetchAllEvents(apiKey) {
const events = [];
let after = undefined;
while (true) {
const params = new URLSearchParams({ limit: "50" });
if (after) params.set("after", after);
const res = await fetch(
`https://api.intervals.run/events?${params}`,
{ headers: { Authorization: `Bearer ${apiKey}` } }
);
const page = await res.json();
events.push(...page.data);
if (!page.hasMore) break;
after = page.data.at(-1)._id;
}
return events;
}# Previous page (use _id of first item from current page)
curl -H "Authorization: Bearer INTERVALS_PARTNER_API_KEY" \
"https://api.intervals.run/events?limit=20&before=abc123"hasMore before requesting additional pageslimit that balances performance and usability — smaller pages for real-time UIs, larger for bulk processingPagination requests may return the following validation errors:
| Error | Description |
|---|---|
VALIDATION_ERROR | Invalid cursor format or limit out of range (1–100) |
VALIDATION_ERROR | Both before and after provided |
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters",
"errors": {
"limit": ["Number must be less than or equal to 100"]
}
}
}