GET request at the endpoint /api/leads will always be paginated, as there could be thousands of entries in leads.
Paginated responses from the API will have a data field for the entries at this page, as well as links and meta fields that provide you with information about the pagination in the response.
Show example of a paginated response from the leads endpoint
Show example of a paginated response from the leads endpoint
200
Retrieving the data programmatically
Send a request to your desired paginated endpoint. After processing the data received, you would then send a request to the endpoint provided atlinks.next in the response, if it is not null.
Alternatively, you could loop the query by adding the page number as a paremeter for your request, incrementing the page number until you reach meta.last_page.
This looks like YOUR_URL.com/api/leads?page={page_number}, where {page_number} is incremented by 1 each time until you reach meta.last_page.
Retrieving a specific page
Add a query paramter to the end of your request with the page number. This looks likeYOUR_URL.com/api/leads?page={page_number}, where {page_number} is the page you would like to retrieve.
Cursor Pagination vs Default Page Pagination
The main difference between the two is thatcursor pagination lets you traverse data much faster than the traditional page based pagination.
If you or your team is requesting large amounts of data to loop through, we recommend using cursor pagination.
How does cursor pagination work?
When using cursor pagination, pass in an extra query parameter calledpagination_type set to cursor.
This will instruct the API to return the response with values for the next_cursor and prev_cursor.
Think of a cursor as a “pointer,” where each dataset belongs to a cursor. To request the next page, your request will need to contain that page’s cursor.
Example
Request the first page of leads and setpagination_type to cursor:
YOUR_URL.com/api/leads?pagination_type=cursor
You’ll get your list of leads along with the following meta info:
next_cursor value as the cursor query parameter:
YOUR_URL.com/api/leads?pagination_type=cursor&cursor=eyJpZCI6NzQ1NjAsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0
That page will then return a meta object containing cursors for both the previous and next page:
next_cursor value from each response as the cursor query parameter on your next request to traverse the full dataset.
