Merge Docs


Learn how to paginate bulk data requests to the Merge API.

Any data you interact with via the Merge API is able to be paginated. Pagination is specified via the cursor and page_size query parameters. The next and previous cursors are attached to paginated API responses. Their values inform the cursor where to point to next.

Query Parameters

Denotes the starting position in the data list from where a paginated API endpoint should return bulk data. Get this value from the next or previous property of any previous paginated response. When next or previous is null there are no more pages to paginate through.

Limit on number of objects to return per request. Defaults to 30, maximum of 100.

Sample HTTP Request

Below is an sample request using pagination in HTTP. The page_size is set to 20, and the cursor is pointing to a value for the next page.

GET /api/ats/v1/candidates?page_size=20&cursor=cD0yMDIxLTA3LTI4KzE5JTNBMzglM0EzNi42NzUxNTMlMkIwMCUzQTAw
X-Account-Token: {Linked Account Token Here}
Authorization: Bearer {Production API Key Here}

Getting the Cursor

In the response payload of an API request to a paginated endpoint, you can find next and previous cursors.

Paginated API Response Payload
"next": "cD0yMDIxLTAxLTA2KzAzJTNBMjQlM0E1My40MzQzMjYlMkIwMCUzQTAw",
"previous": null,
"results": [

Using the Cursor

These cursors can be attached to future requests to paginated API endpoints to query the next (or previous) page of results, as demonstrated in the following code sample using the Merge SDK:

Paginating via Merge SDK
1# See SDK docs for configuration information
2api_client = MergeHRISClient.ApiClient(configuration)
3api_instance = MergeHRISClient.EmployeesApi(api_client)
4x_account_token = 'END_USER_ACCOUNT_TOKEN'
5cursor = ''
7while cursor != None:
8 try:
9 api_response = api_instance.employees_list(x_account_token, cursor)
10 pprint(api_response)
11 cursor =
12 except MergeHRISClient.ApiException as e:
13 print('Exception when calling EmployeesApi->employees_list: %s' % e)

If you don't want to use the Merge SDK and want to form your own API requests instead, you can do so as illustrated below:

Paginating via Manual API Request
1import requests
3endpoint_url = ""
5headers = {"Accept": "application/json", "Authorization": "Bearer YOUR_API_KEY", "X-Account-Token": "END_USER_ACCOUNT_TOKEN"}
6response = requests.request("GET", endpoint_url, headers=headers)
8cursor = response.json()["next"]
10while cursor:
11 page_url = f"{endpoint_url}?cursor={cursor}"
12 response = requests.request("GET", page_url, headers=headers)
13 print(response.json()["results"])
14 cursor = response.json()["next"]