Pagination

How to paginate through list endpoints
View as Markdown

Offset-based pagination

All list endpoints (GET /plans, GET /customers, GET /subscriptions, GET /invoices) use offset-based pagination with two query parameters:

ParameterTypeDefaultDescription
limitinteger20Maximum items to return per page (1-100)
offsetinteger0Number of items to skip before returning results

Request example

$# First page (items 0-19)
$curl "https://api.prolifi.co/api/v1/public/customers?limit=20&offset=0" \
> -H "Authorization: Bearer sk_test_..."
$
$# Second page (items 20-39)
$curl "https://api.prolifi.co/api/v1/public/customers?limit=20&offset=20" \
> -H "Authorization: Bearer sk_test_..."

Response format

Every paginated response includes a pagination object alongside the data array:

1{
2 "data": [
3 { "id": "...", "email": "user1@example.com", "..." : "..." },
4 { "id": "...", "email": "user2@example.com", "..." : "..." }
5 ],
6 "pagination": {
7 "total": 150,
8 "limit": 20,
9 "offset": 0,
10 "has_more": true
11 }
12}
FieldTypeDescription
totalintegerTotal number of items matching the query
limitintegerItems per page (echoed from request)
offsetintegerCurrent offset (echoed from request)
has_morebooleantrue if more items exist beyond the current page

Iterating through all pages

To retrieve all results, increment offset by limit on each request until has_more is false:

1offset = 0
2limit = 100
3all_items = []
4
5while True:
6 response = api.get("/customers", params={"limit": limit, "offset": offset})
7 all_items.extend(response["data"])
8
9 if not response["pagination"]["has_more"]:
10 break
11
12 offset += limit