Pagination
List endpoints are page based and return the total count, so you always know how far to go.
Parameters#
| Parameter | Default | Rules |
|---|---|---|
page | 1 | 1 based page number. |
limit | 25 | Items per page, maximum 100. |
Response#
json
{
"data": [ { "id": "..." } ],
"meta": { "page": 2, "limit": 25, "total": 137 }
}GET /v1/interviews also returns kpis next to data and meta, computed over your whole organization.
Iterating all pages#
typescript
async function* all<T>(path: string) {
for (let page = 1; ; page++) {
const res = await fetch(`https://api.rubikyt.com${path}?page=${page}&limit=100`, {
headers: { Authorization: `Bearer ${process.env.RUBI_API_KEY}` },
});
const body = (await res.json()) as { data: T[]; meta: { page: number; limit: number; total: number } };
yield* body.data;
if (page * body.meta.limit >= body.meta.total) return;
}
}