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"| Parameter | Type | Default | Max | Description |
|---|---|---|---|---|
page[limit] | integer | 25 | 1000 | Records 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"
}
}| Field | Description |
|---|---|
meta.total_records | Total matching records across all pages |
meta.total_pages | Total number of pages |
meta.offset | Current page offset |
meta.limit | Current page size |
links.next | URL for the next page (absent on last page) |
links.prev | URL 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"| Parameter | Description |
|---|---|
sortOrder[column] | Field name to sort by |
sortOrder[dir] | ASC or DESC |