Pagination

Handle paginated list responses from the Reloop API.

All list endpoints in the Reloop API use offset-based pagination. You control the page size and page number using query parameters, and the response includes metadata so you can calculate total pages and build navigation.

Query Parameters

ParameterTypeDefaultMaxDescription
pagenumber1The page number to retrieve (1-indexed).
limitnumber20100The number of records to return per page.

Example request:

curl "https://reloop.sh/api/contacts/v1/list?page=2&limit=50" \
  -H "x-api-key: rl_prod_YOUR_API_KEY"

Response Structure

Pagination metadata is returned at the root of the JSON response alongside the data array. The exact field names vary by endpoint, but every paginated response includes total, page, and limit.

Contacts

The contacts list endpoint includes additional aggregate counts:

{
  "object": "contact",
  "contacts": [...],
  "total": 120,
  "page": 1,
  "limit": 20,
  "totalContacts": 120,
  "subscribedContacts": 100,
  "unsubscribedContacts": 20,
  "event": "contact.list"
}
FieldTypeDescription
contactsarrayThe list of contact objects for the current page.
totalnumberTotal number of contacts matching the query.
pagenumberThe current page number.
limitnumberThe page size used for this request.
totalContactsnumberTotal contacts in the organization.
subscribedContactsnumberNumber of contacts with an active subscription.
unsubscribedContactsnumberNumber of contacts who have unsubscribed.

Templates

{
  "templates": [...],
  "total": 45,
  "page": 1,
  "limit": 20,
  "event": "template.list"
}
FieldTypeDescription
templatesarrayThe list of template objects for the current page.
totalnumberTotal number of templates matching the query.
pagenumberThe current page number.
limitnumberThe page size used for this request.

Calculating Total Pages

Use the total and limit fields to calculate the number of pages:

const totalPages = Math.ceil(response.total / response.limit);
const hasNextPage = response.page < totalPages;

Was this page helpful?

Edit this page