Overview
All Flextell list endpoints use cursor-based pagination. Instead of page numbers, you pass a cursor value from the previous response to fetch the next set of results. This approach is stable even when records are added or removed between requests.
Response structure
Every list endpoint returns a data array and a meta object:
{
"data": [
{ "id": "res_001", "name": "First result" },
{ "id": "res_002", "name": "Second result" }
],
"meta": {
"cursor": "cursor_eyJpZCI6InJlc18wMDIifQ",
"has_more": true,
"total": 84
}
}
| Field | Type | Description |
|---|
cursor | string | An opaque string to pass as the cursor parameter in your next request. null when there are no more pages. |
has_more | boolean | true if there are additional results beyond this page. |
total | number | The total number of results across all pages. |
Request parameters
| Parameter | Type | Default | Max | Description |
|---|
limit | number | 20 | 100 | Number of results to return per page. |
cursor | string | — | — | Cursor from the previous response’s meta.cursor. Omit on the first request. |
Example: fetching pages
First request
Omit the cursor parameter to start from the beginning:
curl --request GET \
--url "https://dev.flextell.ai/api/resources?limit=20" \
--header "Authorization: Bearer <your_token>" \
--header "Accept: application/json"
Response:
{
"data": [
{ "id": "res_001", "name": "First result" },
{ "id": "res_002", "name": "Second result" }
],
"meta": {
"cursor": "cursor_eyJpZCI6InJlc18wMDIifQ",
"has_more": true,
"total": 84
}
}
Next request
Pass meta.cursor from the previous response as the cursor query parameter:
curl --request GET \
--url "https://dev.flextell.ai/api/resources?limit=20&cursor=cursor_eyJpZCI6InJlc18wMDIifQ" \
--header "Authorization: Bearer <your_token>" \
--header "Accept: application/json"
Continue passing the new cursor value on each request until has_more is false.
Cursor values are opaque strings — do not parse or construct them manually. Always use the exact value returned in meta.cursor.
Fetching all pages automatically
Use a loop that continues until has_more is false:
async function fetchAllResources(token) {
const results = [];
let cursor = null;
do {
const url = new URL('https://dev.flextell.ai/api/resources');
url.searchParams.set('limit', '100');
if (cursor) {
url.searchParams.set('cursor', cursor);
}
const response = await fetch(url.toString(), {
headers: {
'Authorization': `Bearer ${token}`,
'Accept': 'application/json',
},
});
if (!response.ok) {
throw new Error(`Request failed with status ${response.status}`);
}
const { data, meta } = await response.json();
results.push(...data);
cursor = meta.has_more ? meta.cursor : null;
} while (cursor !== null);
return results;
}
Set limit to 100 (the maximum) when fetching all pages to minimize the number of requests.
Fetching all pages can result in many API requests for large datasets. If you only need a subset of results, use filtering parameters on the endpoint instead of paginating through everything.