calvana/Docs
Docs pages

Pagination and syncing

Last updated: November 19, 2026

How to page through a list, filter and sort it, keep a copy of your data in sync, and catch up on every change from the event log.

Cursors

Every list answers one page at a time:

A list
GET /v1/bookings?status=scheduled&limit=100

{
  "object": "list",
  "data": [ { "id": "bkg_01jc8r2s4t6v8x0z2b4d6f8h0j", "object": "booking", "...": "..." } ],
  "has_more": true,
  "next_cursor": "eyJrIjpbIjIwMjYtMTEtMTJUMTY6MDA6MDBaIiwiYmtnXzAxai4uLiJdLCJmIjoiOWEzYyJ9"
}
  • limit is 1 to 200, and 50 when you leave it out.
  • For the next page, send cursor set to next_cursor, with the same filters and sort. limit may change between pages.
  • next_cursor is null on the last page, except on GET /v1/events.
  • A cursor is opaque and signed, and it doesn't expire. An edited cursor, or one sent with other filters or another sort, gets 400 invalid_cursor.
  • Each page continues from the last item's sort key and ID, so inserts and deletes while you page never skip or repeat an item whose sort key stays the same. Sorted by updated_at, an object that changes while you page can come back on a later page. Dedupe on id.
  • Lists don't return a total count.
Node: every scheduled booking
const headers = { Authorization: `Bearer ${process.env.CALVANA_API_KEY}` };
const url = new URL("https://api.calvana.com/v1/bookings");
url.searchParams.set("status", "scheduled");
url.searchParams.set("limit", "200");

const bookings = [];
for (;;) {
  const response = await fetch(url, { headers });
  if (!response.ok) throw new Error(`Calvana answered ${response.status}`);
  const page = await response.json();
  bookings.push(...page.data);
  if (!page.has_more) break;
  url.searchParams.set("cursor", page.next_cursor);
}

Filters and sorting

  • An ID filter takes one ID or a comma-separated list: ?calendar_id=cal_...,cal_.... An ID from outside the workspace gets 404. role on members and type on events take lists too.
  • status on bookings and submissions takes one value.
  • Time filters are <field>_after and <field>_before, both exclusive, as RFC 3339 timestamps with an offset.
  • sort takes the values the list names. A leading - sorts descending.
ListFiltersSort
GET /v1/bookingscalendar_id, host_member_id, prospect_id, form_id, status, start_after, start_before, created_after, updated_afterstart_at (default), -start_at, -created_at, updated_at
GET /v1/submissionsform_id, prospect_id, status, created_after, updated_after-created_at (default), updated_at
GET /v1/prospectsemail (exact, any case), phone (exact, E.164), created_after, updated_after-created_at (default), updated_at
GET /v1/membersrole, takes_calls, activeBy name, then ID
GET /v1/calendarsactiveOldest first
GET /v1/formslive, kindOldest first
GET /v1/eventstype, object_id, created_after, created_beforeLog order

Syncing with updated_after

To keep a copy of bookings, submissions or prospects, store the highest updated_at you have seen. On the next run, ask for updated_after that time minus 5 minutes, sorted by updated_at, and dedupe on id. The overlap catches a change from a long transaction that committed after a later change you already read.

Request
GET /v1/bookings?updated_after=2026-11-12T15:55:00Z&sort=updated_at&limit=200
  • updated_at is the time of the object's latest change that v1 shows. A change to any of the object's own fields moves it.
  • Some values change without moving it: attendance going from upcoming to unknown when a call's time passes with no outcome, a prospect's form_progress, and summaries inside other objects, such as a booking's prospect.email. Sync prospects as well to follow their email.

The event log

GET /v1/events is the log behind webhooks. It holds every event in the workspace from the last 30 days, in the order Calvana published them, with no gaps. A key sees only the events about objects it may read. Poll it when your server was down longer than the 3-day retry schedule, or when you would rather not run an inbound URL.

  • next_cursor is never null. At the end of the log has_more is false and next_cursor points past the last event, so you store it and ask again later.
  • The first call without a cursor starts at the oldest event the log keeps.
  • object_id takes a full ID, so sub_X and bkg_X select different events about the same form attempt.
Node: poll the event log
// Run on a schedule. Store the cursor it returns and pass it to the next run.
async function pollEvents(cursor, handle) {
  const headers = { Authorization: `Bearer ${process.env.CALVANA_API_KEY}` };
  for (;;) {
    const url = new URL("https://api.calvana.com/v1/events");
    url.searchParams.set("limit", "200");
    if (cursor) url.searchParams.set("cursor", cursor);
    const response = await fetch(url, { headers });
    if (!response.ok) throw new Error(`Calvana answered ${response.status}`);
    const page = await response.json();
    for (const event of page.data) await handle(event);
    cursor = page.next_cursor;
    if (!page.has_more) return cursor;
  }
}

IDs that stop resolving

  • Deleting a form deletes its answers and keeps its bookings. Its submissions then answer 404, and their bookings show form: null, submission_id: null and no answers. Calvana sends submission.deleted for each.
  • An offboarded member stays readable with active: false, so a booking's host always resolves.
  • A calendar with booked calls can't be deleted, so a booking's calendar always resolves.

Treat a 404 on an ID you stored as a deletion, not as an error in your data.