DeluxHostAPI Reference

Pagination

Cursor pagination, and polling the notifications feed for changes.

Lists that grow forever, such as invoices, are paginated with a cursor. Lists that stay small by nature, such as your services, return everything in one response.

Paging through a list

Paginated endpoints accept limit (1–100, default 25) and return items plus nextCursor. Pass nextCursor back as before to get the next, older page. nextCursor is null on the last page.

curl "https://api.deluxhost.net/v1/invoices?limit=50" \
  -H "Authorization: Bearer $DELUXHOST_TOKEN"
# → { "items": [...], "nextCursor": 18342 }

curl "https://api.deluxhost.net/v1/invoices?limit=50&before=18342" \
  -H "Authorization: Bearer $DELUXHOST_TOKEN"
async function* invoices(token: string) {
  let before: number | null = null;
  do {
    const url = new URL("https://api.deluxhost.net/v1/invoices");
    url.searchParams.set("limit", "100");
    if (before !== null) url.searchParams.set("before", String(before));
    const res = await fetch(url, { headers: { Authorization: `Bearer ${token}` } });
    const page = await res.json();
    yield* page.items;
    before = page.nextCursor;
  } while (before !== null);
}

Unknown filter values are rejected with a 400 rather than silently ignored.

Watching for changes

To react to events (a service provisioned or suspended, an invoice raised, a failed charge), poll GET /v1/notifications instead of diffing /v1/services and /v1/invoices against your own copy.

The feed has two cursors that walk in opposite directions:

  • before pages back through history, newest first.
  • after returns everything since an id, oldest first. This is the polling cursor: with newest-first ordering, a client that fell more than limit rows behind would skip what it never read.
# remember the highest id you processed, then ask for what came after it
curl "https://api.deluxhost.net/v1/notifications?after=9120" \
  -H "Authorization: Bearer $DELUXHOST_TOKEN"

nextCursor always goes back in the same parameter you used. Notification ids can have gaps, because dismissed notifications are deleted: never assume they are contiguous.

Something unclear or missing? Open a ticket and the team will get back to you.

On this page