API
Pagination
Hoursmith list endpoints use cursor-based pagination. Learn the cursor and limit parameters and how to page through results.
List endpoints return results in pages using cursor-based (keyset) pagination — fast and stable even as records change underneath you.
Parameters
| Parameter | Default | Max | Description |
|---|---|---|---|
limit | 50 | 200 | How many records to return. |
cursor | — | — | The nextCursor from the previous page. Omit for the first page. |
Response shape
List responses wrap the array in data and include a pagination object:
{
"data": [ { "id": "...", "name": "Globex" } ],
"pagination": {
"nextCursor": "eyJ2IjoiMjAyNi0wNi0xMSIsImlkIjoiYWJjИ",
"limit": 50
}
}When there are no more records, nextCursor is null.
There's no total count. Cursor pagination trades a grand total for consistency and speed: pages won't skip or duplicate records when data changes between requests.
Paging through everything
async function listAll(path, token) {
const out = [];
let cursor;
do {
const url = new URL(`https://hoursmith.app/api/v1/${path}`);
url.searchParams.set('limit', '200');
if (cursor) url.searchParams.set('cursor', cursor);
const res = await fetch(url, { headers: { Authorization: `Bearer ${token}` } });
const body = await res.json();
out.push(...body.data);
cursor = body.pagination.nextCursor;
} while (cursor);
return out;
}def list_all(path, token):
out, cursor = [], None
while True:
params = {"limit": 200}
if cursor:
params["cursor"] = cursor
r = requests.get(f"https://hoursmith.app/api/v1/{path}",
headers={"Authorization": f"Bearer {token}"}, params=params)
body = r.json()
out.extend(body["data"])
cursor = body["pagination"]["nextCursor"]
if not cursor:
return outThe cursor is opaque — encode it into your "next page" requests verbatim; don't try to parse or construct it yourself.
Was this page helpful?