ClarifyClarify APIBeta
Getting Started

Pagination

Paginate through large result sets

List endpoints return paginated results. The maximum page size is 1000 records.

Request

Control page size with the page[limit] parameter:

curl --globoff \
  -H "Authorization: api-key YOUR_API_KEY" \
  "https://api.clarify.ai/v1/workspaces/acme/objects/person/resources?page[limit]=100"
ParameterTypeDefaultMaxDescription
page[limit]integer251000Records per page

Response

The response includes pagination metadata and navigation links:

{
  "data": [...],
  "meta": {
    "total_records": 1250,
    "total_pages": 13,
    "offset": 0,
    "limit": 100
  },
  "links": {
    "next": "https://api.clarify.ai/v1/workspaces/acme/objects/person/resources?page[limit]=100&page[offset]=100"
  }
}
FieldDescription
meta.total_recordsTotal matching records across all pages
meta.total_pagesTotal number of pages
meta.offsetCurrent page offset
meta.limitCurrent page size
links.nextURL for the next page (absent on last page)
links.prevURL for the previous page (absent on first page)

Fetching all pages

Follow the links.next URL until it's absent:

async function fetchAll(workspace, object, apiKey) {
  const records = [];
  let url = `https://api.clarify.ai/v1/workspaces/${workspace}/objects/${object}/resources?page[limit]=100`;

  while (url) {
    const res = await fetch(url, {
      headers: { 'Authorization': `api-key ${apiKey}` },
    });
    const json = await res.json();
    records.push(...json.data);
    url = json.links?.next;
  }

  return records;
}

Ordering

Sort results with the sortOrder parameter:

curl --globoff \
  -H "Authorization: api-key YOUR_API_KEY" \
  "https://api.clarify.ai/v1/workspaces/acme/objects/deal/resources?sortOrder[column]=amount&sortOrder[dir]=DESC"
ParameterDescription
sortOrder[column]Field name to sort by
sortOrder[dir]ASC or DESC