RespireSoft InvoicingAPI docsReferenceWebhooks

Pagination and expanding

Lists are cursor based, so a page never skips or repeats an object that is made while you read.

Lists

{ "object": "list", "url": "/v1/invoices", "has_more": true, "data": [ { "id": "inv_…" } ] }
curl
curl "https://api.invoicing.respiresoft.com/v1/invoices?limit=100&starting_after=inv_abc" \
  -H "Authorization: Bearer $RESPIRESOFT_KEY"
Node
let after
do {
  const url = new URL("https://api.invoicing.respiresoft.com/v1/invoices")
  url.searchParams.set("limit", "100")
  if (after) url.searchParams.set("starting_after", after)
  const page = await (await fetch(url, { headers: { Authorization: `Bearer ${process.env.RESPIRESOFT_KEY}` } })).json()
  for (const invoice of page.data) console.log(invoice.id)
  after = page.has_more ? page.data.at(-1).id : null
} while (after)
PHP
$after = null;
do {
    $url = "https://api.invoicing.respiresoft.com/v1/invoices?limit=100" . ($after ? "&starting_after=$after" : "");
    $ch = curl_init($url);
    curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("RESPIRESOFT_KEY")]]);
    $page = json_decode(curl_exec($ch), true);
    foreach ($page["data"] as $invoice) echo $invoice["id"], "\n";
    $after = $page["has_more"] ? end($page["data"])["id"] : null;
} while ($after);
Python
import os, requests
after = None
while True:
    params = {"limit": 100, **({"starting_after": after} if after else {})}
    page = requests.get("https://api.invoicing.respiresoft.com/v1/invoices", params=params,
                        headers={"Authorization": "Bearer " + os.environ["RESPIRESOFT_KEY"]}).json()
    for invoice in page["data"]:
        print(invoice["id"])
    if not page["has_more"]:
        break
    after = page["data"][-1]["id"]

Events are different

GET /v1/events?after=<evt_id> returns events newer than that one, oldest first, so you can process them in order and keep the last id as your cursor. Without after it behaves like every other list.

Expanding

Related objects show as ids. Ask for the whole object with expand[], for example GET /v1/invoices/inv_…?expand[]=customer. Each reference page lists what can be expanded.