Pagination

How to paginate through large result sets using cursor-based pagination.

Overview

All list endpoints use cursor-based pagination. This provides stable, consistent pagination even when data is being created or deleted between requests.

Parameters

ParameterTypeDefaultDescription
limitinteger10Maximum records per page (1-100)
starting_afterstring--Cursor: ID of the last item from the previous page
ending_beforestring--Reverse cursor: ID of the first item from the previous page

You cannot use starting_after and ending_before in the same request.

Response Format

Every list response follows the same structure:

jsonJSON
1{
2 "object": "list",
3 "url": "/v1/customers",
4 "data": [...],
5 "has_more": true,
6 "next_cursor": "cus_a1b2c3d4e5f6"
7}
FieldDescription
objectAlways "list"
urlThe endpoint path
dataArray of resources
has_moretrue if there are more pages
next_cursorID to pass as starting_after for the next page, or null

Examples

Bash
1# First page
2curl "https://api.corebill.io/v1/customers?company_id=com_abc123&limit=10" \
3 -H "Authorization: Bearer sk_live_your_api_key"
4
5# Next page (use next_cursor from previous response)
6curl "https://api.corebill.io/v1/customers?company_id=com_abc123&limit=10&starting_after=cus_a1b2c3d4e5f6" \
7 -H "Authorization: Bearer sk_live_your_api_key"