Pagination

In order to paginate through a large list response, you can use our cursor-based pagination using
the id field of a given object in the list.

There is a limit of 20 objects per list response ordered ascending by ID. So, you can get to items
after the last one in the list, by taking the last item's ID and submitting it in a list request
as the value of an after URL parameter. For example:

# The first 20 contacts are returned without any pagination nor ordering params:
$ curl 'https://myteam.myclickfunnels.com/api/v2/workspaces/3/contacts' --header 'Authorization: Bearer ...'
[{"id": 1, "email_address": "[email protected]" ...}, {"id": 4, ...} ... {"id": 55, "email_address": "[email protected]", ...}]

$ curl 'https://myteam.myclickfunnels.com/api/v2/workspaces/3/contacts?after=55' --header 'Authorization: Bearer ...'
[{"id": 56, ...}] # There is one more record after ID 55.

The after param always acts as if you are "turning the next page". So if you order in a descending
order, you will also use after to get to the next records:

$ curl 'https://myteam.myclickfunnels.com/api/v2/workspaces/3/contacts?sort_order=desc' --header 'Authorization: Bearer ...'
[{"id": 56, ...},  {"id": 55, ...}, {"id": 4, ...}] # All contacts in descending order.

$ curl 'https://myteam.myclickfunnels.com/api/v2/workspaces/3/contacts?sort_order=desc&after=4' --header 'Authorization: Bearer ...'
[{"id": 1, ...}] # There is one more contact on the next page after ID 55.

You can also use the Pagination-Next header to get the last ID value directly:

# Example header.
Pagination-Next: 55

And you can use the Link header to get the next page directly without needing to calculate it
yourself:

# Example header.
Link: <https://localteam.myclickfunnels.com/api/v2/workspaces/3/contacts?after=55>; rel="next"