Pagination
Every endpoint that returns a list returns it one page at a time. This page explains the list shape, how to set the page size and how to walk every page.
The list object
List endpoints, such as GET /v1/emails, GET /v1/domains or GET /v1/webhooks/{id}/deliveries, all return the same shape. Items come newest first, by when they were created.
curl "https://api.sendfern.com/v1/emails?status=bounced&limit=50" \
-H "Authorization: Bearer $SENDFERN_API_KEY"{
"data": [
{"id": "em_VNqV5JEIqYYeYbZRhbPrJ6", "object": "email", "status": "bounced", ...},
{"id": "em_2Xb9QmT4kLp8RvN1cY7hWd", "object": "email", "status": "bounced", ...}
],
"has_more": true,
"next": "https://api.sendfern.com/v1/emails?cursor=cD0yMDI2LTExLTI4KzEwJTNBMTk&limit=50&status=bounced"
}dataarray- The items on this page, newest first.
has_morebooleantruewhen there are older items after this page.nextstring | null- The full URL of the next page, or
nullon the last page.
Page size
Set the page size with the limit query parameter: 1 to 100, default 20. A value over 100 returns 100 items. Use 100 when you want to read a whole list, since fewer pages means fewer requests against your rate limit.
Get the next page
Request the next URL exactly as given, with the same API key. It already carries your limit and filters, plus a cursor that marks where the page ended:
curl "https://api.sendfern.com/v1/emails?cursor=cD0yMDI2LTExLTI4KzEwJTNBMTk&limit=50&status=bounced" \ -H "Authorization: Bearer $SENDFERN_API_KEY"
- Treat the
cursoras opaque. Don't build or change it yourself, and don't change the filters while you follow it. - Stop when
nextisnull.has_moreisfalseon the same page. - Items created while you page don't shift the pages you haven't read yet: the cursor follows a position in the list, not a page number. New items appear at the start of the list, so read the first page again to pick them up.
Walk every page with the SDKs
Both SDKs have a paginate helper that follows next for you and yields one item at a time. Pass it the list method and its parameters.
# Keep requesting "next" until it is null.
url="https://api.sendfern.com/v1/emails?status=bounced&limit=100"
while [ "$url" != "null" ]; do
page=$(curl -s "$url" -H "Authorization: Bearer $SENDFERN_API_KEY")
echo "$page" | jq -r '.data[].id'
url=$(echo "$page" | jq -r '.next')
doneLists that need an id
Some lists belong to a parent object, such as the contacts of an audience. In Node.js, wrap the call in a function. In Python, pass the parent id as a keyword argument.
curl "https://api.sendfern.com/v1/audiences/aud_.../contacts?limit=100" \
-H "Authorization: Bearer $SENDFERN_API_KEY"Filters
Filters go in the query string next to limit. The email list, for example, filters by status, to, tag and creation date. Each endpoint's filters are in the API reference.