Change data capture: every entity of the given types created, updated or deleted since a timestamp, in one call. The basis of an incremental sync: store the response time, and ask for changes since it on the next run.

Limits (Intuit): the look-back is at most 30 days, and each entity type returns at most 1000 changes per call; when a type hits 1000, narrow the window. Deleted entities come back with only Id, status: "Deleted" and MetaData.

::cdc ::quickbooks::cdc

changes ::cdc/changes-since(["Invoice", "Payment", "Customer"], "2026-10-31T00:00:00Z")
changes.changed.Invoice   // Vec of invoices created or updated
changes.deleted.Invoice   // Vec of deleted invoice Ids
changes.time              // save as the next changedSince

Pair it with webhooks: a webhook tells you something changed now, CDC catches up on anything a missed delivery left out.

Functions

build-params

fn (entities: Str | Vec, changed-since: Str): Map

The CDC query params {entities: "A,B", changedSince} (pure). Entity names are checked and canonicalised; changed-since must be an ISO 8601 timestamp or date.

Example

::quickbooks::cdc/build-params(["invoice", "Payment"], "2026-10-31T00:00:00Z")
// {entities: "Invoice,Payment", changedSince: "2026-10-31T00:00:00Z"}

is-err(::quickbooks::cdc/build-params("Invoice", "yesterday"))  // true

changes-since

fn (entities: Str | Vec, changed-since: Str): Map
fn (entities: Str | Vec, changed-since: Str, opts: Map): Map

GET /cdc: changes to entities (Vec or comma-separated Str) since changed-since. Returns parse-changes output.

Example

changes ::quickbooks::cdc/changes-since("Invoice,Customer", "2026-10-31T00:00:00Z", {realm-id: "9341453"})
length(or(changes.changed.Invoice, []))

// Save this as the next changed-since
changes.time

is-deleted

fn (row: Any): Bool

True for a CDC row that reports a deletion (status: "Deleted").

Example

::quickbooks::cdc/is-deleted({Id: "88", status: "Deleted"})  // true
::quickbooks::cdc/is-deleted({Id: "130", SyncToken: "1"})  // false

parse-changes

fn (body: Map): Map

Parse a CDC response body (pure) into {changed, deleted, time}: changed maps each entity name to its created or updated rows, deleted maps each name to the deleted Ids, and time is the server time to use as the next changedSince.

Example

body {time: "2026-11-01T00:00:00Z", CDCResponse: [{QueryResponse: [{Invoice: [
  {Id: "130", SyncToken: "1"},
  {Id: "88", status: "Deleted"}
]}]}]}
changes ::quickbooks::cdc/parse-changes(body)
map(changes.changed.Invoice, %.Id)  // ["130"]
changes.deleted  // {Invoice: ["88"]}
changes.time  // "2026-11-01T00:00:00Z"