Pagination
List endpoints return pages of results. Use page and per_page, and has_more to know when to stop.
On this page
The list object
Endpoints that return many items — envelopes, templates, webhook endpoints, deliveries and the audit trail — return a list object:
GET /v1/envelopes?per_page=20
{
"object": "list",
"data": [
{ "object": "envelope", "id": "9b2f4c1e-7a3d-4e8b-9c51-2d6f8a0b3e47", "status": "sent", "…": "…" }
],
"page": 1,
"per_page": 20,
"total": 57,
"has_more": true
}Lists are sorted newest first (the audit trail oldest first). If envelopes are created while you page through, items can shift between pages — filter with created_before set to the time you started for a stable snapshot.
Iterating through every page
Fetch every page
async function* allEnvelopes(filters = {}) {
for (let page = 1; ; page++) {
const query = new URLSearchParams({ ...filters, page: String(page), per_page: '100' });
const res = await fetch(`https://signkoi.com/api/v1/envelopes?${query}`, {
headers: { Authorization: `Bearer ${process.env.SIGNKOI_API_KEY}` },
});
const list = await res.json();
if (!res.ok) throw new Error(list.error.message);
yield* list.data;
if (!list.has_more) return;
}
}
for await (const envelope of allEnvelopes({ status: 'completed' })) {
console.log(envelope.id, envelope.title);
}