Pagination
Page through your graphs with cursors.
GET /v1/graphs returns one page at a time. A response looks like:
{
"data": [{ "id": "6f1d7c1e-2b0a-4a43-9c1e-0d5f3e8a7b21", "name": "My Revenue Flow", "targetAnnualRevenue": 120000, "targetAnnualProfit": 60000, "createdAt": "2026-10-01T12:00:00Z", "updatedAt": "2026-10-20T08:30:00Z" }],
"nextCursor": "R1JBUEgjNmYxZDdjMWUtMmIwYS00YTQzLTljMWUtMGQ1ZjNlOGE3YjIx"
}
| Parameter | Default | Meaning |
|---|---|---|
limit | 25 | Graphs per page, 1 to 100. |
cursor | none | The previous response’s nextCursor. Omit it for the first page. |
When nextCursor is null you have the last page. A page can be shorter than limit without being the last, so loop until nextCursor is null rather than until a page is short.
Cursors are opaque: do not parse or build them. A cursor only ever reads your own account’s graphs.
async function allGraphs(key) {
const graphs = [];
let cursor = null;
do {
const url = new URL("https://api.incomegraph.net/v1/graphs");
url.searchParams.set("limit", "100");
if (cursor) url.searchParams.set("cursor", cursor);
const res = await fetch(url, { headers: { Authorization: `Bearer ${key}` } });
const page = await res.json();
graphs.push(...page.data);
cursor = page.nextCursor;
} while (cursor);
return graphs;
}