REST API v2
Pagination & filtering

Pagination & filtering

The API uses cursor-based pagination for efficient navigation through large datasets. Most list endpoints also support date filters and sorting.

Pagination

Parameters

ParameterDescription
beforeCursor/document ID to paginate before (previous page)
afterCursor/document ID to paginate after (next page)
limitPage size (endpoint-specific defaults, max: 1000)
hasCountInclude total counts (may increase response time)

Default limits

EndpointItems per page
Customers20
Activities10
Rewards10

Navigate between pages

Use the item ID from responses:

  • Next page: send the last item's ID as after.
  • Previous page: send the first item's ID as before.
# First page
curl "https://api.joy.so/rest_api/v2/customers?limit=20&hasCount=true"
 
# Next page (using last item's ID from previous response)
curl "https://api.joy.so/rest_api/v2/customers?after=abc123&limit=20"
 
# Previous page (using first item's ID)
curl "https://api.joy.so/rest_api/v2/customers?before=abc123&limit=20"

The response carries meta.pagination (hasNext, hasPre, and total / totalPage when hasCount=true). See Response format.

Filter by date

Most list endpoints support these date filters:

ParameterDescription
created_at_minFilter records created after this date
created_at_maxFilter records created before this date
updated_at_minFilter records updated after this date
updated_at_maxFilter records updated before this date

Sort results

order sets the sort order. Values vary by endpoint; common values are createdAt_desc, createdAt_asc, updatedAt_desc and updatedAt_asc.

Example with filters

curl "https://api.joy.so/rest_api/v2/customers?\
created_at_min=2023-01-01T00:00:00Z&\
created_at_max=2023-12-31T23:59:59Z&\
order=createdAt_desc&\
limit=50"