We provide the ability to paginate all our list endpoints, e.g. listing employees, users and jobs, unless otherwise stated. This does not apply to any asynchronous data exports, e.g. exporting employee assumptions. Our pagination scheme consists of two parts: query parameters and a specific response body structure.

Query Parameters

Query ParameterDescriptionExample Usage
limitThe maximum number of results to return. Default is 50, with a maximum of 1000./employees/?limit=50
offsetThe number of results to offset your request by. For example, if you wanted to skip the first 50 results, you would set offset=50./employees/?offset=50

These optional parameters may be combined together to request specific subsets of data, e.g. /employees/?limit=100&offset=200.

Paginated Response Body

Response Body Properties

PropertyData TypeDescriptionExample Value
nextstring | nullThe url for the next set of results. null if there are no additional results."https://api.captivateiq.com/ciq/v1/employees/?limit=50&offset=50"
previousstring | nullThe url for the previous set of results. null if you are at the beginning."https://api.captivateiq.com/ciq/v1/employees/?limit=50&offset=0"
total_countintegerThe number of total results available.115
dataarray of objectsThe requested data.

Example Response

{
  "object": "list",
  "next": "/ciq/v1/employees/?limit=50&offset=50",
  "previous": null,
  "total_count": 115,
  "data": [
    ...
  ]
}

Example Usage: Fetching All Data

To fetch all data for a given resource, after submitting the initial request, keep iterating until the next property is null.

import requests

headers = {
  'Authorization': 'Token mytokenvalue'
}

url = 'https://api.captivateiq.com/ciq/v1/employees/'
# `limit` query parameter is optional. The default value is 50 and max is 1000.
response = requests.get(f'{url}?limit=100', headers=header)
body = response.json()
employees = body['data']
# `next` will continue to have a value until no more data is left.
while body['next'] is not None:
  response = requests.get(body['next'], headers=headers)
  body = response.json()
  employees += body['data']

print('All employees:', employees)