Create, read, update, delete, void, deactivate, send and PDF for the QuickBooks Online entities this package supports. Every function takes the entity name as Intuit spells it ("Invoice", "BillPayment", "JournalEntry"; case-insensitive) and an optional opts Map (see ::quickbooks::api).

EntityKindCreate / updateDeleteVoidSend / PDF
Customer, Vendor, Item, Account, Class, Department, Employeename listyesno: deactivate-entitynono
TaxCodename listread onlynonono
Invoicetransactionyesyesyesyes
Estimate, CreditMemotransactionyesyesnoyes
SalesReceipttransactionyesyesyesyes
Payment, BillPaymenttransactionyesyesyesPayment: PDF and send
Bill, Purchase, JournalEntry, Deposit, Transfertransactionyesyesnono

Updates and SyncToken. QuickBooks uses optimistic locking: every update and delete must carry the entity's current SyncToken (from the last read). A stale token fails with a ValidationFault (code 5010, "Stale Object Error"); read the entity again and retry. sparse-update sends only the fields you pass (with sparse: true), which is what you almost always want: a full update-entity clears every writable field you leave out.

::qb ::quickbooks::entities

customer ::qb/create-entity("Customer", {DisplayName: "Acme Corp", PrimaryEmailAddr: {Address: "ap@acme.example"}})
invoice ::qb/create-entity("Invoice", {
  CustomerRef: {value: customer.Id},
  Line: [{DetailType: "SalesItemLineDetail", Amount: 1200.0, SalesItemLineDetail: {ItemRef: {value: "1"}}}]
}, {request-id: "order-4411-invoice"})
::qb/sparse-update("Invoice", invoice.Id, invoice.SyncToken, {DueDate: "2026-12-31"})
::qb/send-entity("Invoice", invoice.Id, "ap@acme.example")
pdf ::qb/entity-pdf("Invoice", invoice.Id)

Values

ENTITIES

ENTITIES: Map {
  Account: {
    path: "account",
    kind: "name-list",
    ops: [
      "create",
      "read",
      "update"
    ]
  },
  Bill: {
    path: "bill",
    kind: "transaction",
    ops: [
      "create",
      "read",
      "update",
      "delete"
    ]
  },
  BillPayment: {
    path: "billpayment",
    kind: "transaction",
    ops: [
      "create",
      "read",
      "update",
      "delete",
      "void"
    ]
  },
  Class: {
    path: "class",
    kind: "name-list",
    ops: [
      "create",
      "read",
      "update"
    ]
  },
  CompanyInfo: {
    path: "companyinfo",
    kind: "settings",
    ops: [
      "read",
      "update"
    ]
  },
  CreditMemo: {
    path: "creditmemo",
    kind: "transaction",
    ops: [
      "create",
      "read",
      "update",
      "delete",
      "send",
      "pdf"
    ]
  },
  Customer: {
    path: "customer",
    kind: "name-list",
    ops: [
      "create",
      "read",
      "update"
    ]
  },
  Department: {
    path: "department",
    kind: "name-list",
    ops: [
      "create",
      "read",
      "update"
    ]
  },
  Deposit: {
    path: "deposit",
    kind: "transaction",
    ops: [
      "create",
      "read",
      "update",
      "delete"
    ]
  },
  Employee: {
    path: "employee",
    kind: "name-list",
    ops: [
      "create",
      "read",
      "update"
    ]
  },
  Estimate: {
    path: "estimate",
    kind: "transaction",
    ops: [
      "create",
      "read",
      "update",
      "delete",
      "send",
      "pdf"
    ]
  },
  Invoice: {
    path: "invoice",
    kind: "transaction",
    ops: [
      "create",
      "read",
      "update",
      "delete",
      "void",
      "send",
      "pdf"
    ]
  },
  Item: {
    path: "item",
    kind: "name-list",
    ops: [
      "create",
      "read",
      "update"
    ]
  },
  JournalEntry: {
    path: "journalentry",
    kind: "transaction",
    ops: [
      "create",
      "read",
      "update",
      "delete"
    ]
  },
  Payment: {
    path: "payment",
    kind: "transaction",
    ops: [
      "create",
      "read",
      "update",
      "delete",
      "void",
      "send",
      "pdf"
    ]
  },
  Purchase: {
    path: "purchase",
    kind: "transaction",
    ops: [
      "create",
      "read",
      "update",
      "delete"
    ]
  },
  SalesReceipt: {
    path: "salesreceipt",
    kind: "transaction",
    ops: [
      "create",
      "read",
      "update",
      "delete",
      "void",
      "send",
      "pdf"
    ]
  },
  TaxCode: {
    path: "taxcode",
    kind: "name-list",
    ops: [
      "read"
    ]
  },
  Transfer: {
    path: "transfer",
    kind: "transaction",
    ops: [
      "create",
      "read",
      "update",
      "delete"
    ]
  },
  Vendor: {
    path: "vendor",
    kind: "name-list",
    ops: [
      "create",
      "read",
      "update"
    ]
  }
}

The supported entities: canonical name to {path, kind, ops}. ops lists what the API allows: create, read, update, delete, void, send, pdf. Every entity can also be queried (::quickbooks::query).

VOID_BY_UPDATE

VOID_BY_UPDATE: Vec [
  "Payment",
  "BillPayment"
]

Functions

build-delete-body

fn (id: Str, sync-token: Str): Map

The body of a delete or void: {Id, SyncToken} (pure).

Example

::quickbooks::entities/build-delete-body("130", "2")  // {Id: "130", SyncToken: "2"}

build-sparse-body

fn (id: Str, sync-token: Str, fields: Map): Map

The body of a sparse update: fields plus Id, SyncToken and sparse: true (pure). Null fields are dropped; set a field to "" or a value to change it.

Example

::quickbooks::entities/build-sparse-body("58", "3", {Active: false})
// {Active: false, Id: "58", SyncToken: "3", sparse: true}

canonical-name

fn (name: Str): Str

The canonical entity name for name (case-insensitive, e.g. "invoice" gives "Invoice"), or an Err listing the supported names.

Example

::quickbooks::entities/canonical-name("invoice")  // "Invoice"
is-err(::quickbooks::entities/canonical-name("Widget"))  // true

create-entity

fn (entity: Str, body: Map): Map
fn (entity: Str, body: Map, opts: Map): Map

POST /{entity} - create an entity and return it (with Id and SyncToken). Pass opts.request-id to make the create safe to retry.

Example

customer ::quickbooks::entities/create-entity("Customer", {DisplayName: "Acme Corp"})
customer.Id

// request-id makes the create safe to retry
::quickbooks::entities/create-entity("Invoice", {
  CustomerRef: {value: customer.Id},
  Line: [{DetailType: "SalesItemLineDetail", Amount: 1200.0, SalesItemLineDetail: {ItemRef: {value: "1"}}}]
}, {request-id: "order-4411-invoice"})

deactivate-entity

fn (entity: Str, id: Str | Int, sync-token: Str | Int): Map
fn (entity: Str, id: Str | Int, sync-token: Str | Int, opts: Map): Map

Make a name-list entity (Customer, Vendor, Item, Account, Class, Department, Employee) inactive with a sparse Active: false update. This is how QuickBooks "deletes" them; history is kept.

Example

customer ::quickbooks::entities/get-entity("Customer", "58")
::quickbooks::entities/deactivate-entity("Customer", customer.Id, customer.SyncToken)

delete-entity

fn (entity: Str, id: Str | Int, sync-token: Str | Int): Map
fn (entity: Str, id: Str | Int, sync-token: Str | Int, opts: Map): Map

POST /{entity}?operation=delete - delete a transaction. Returns {Id, status: "Deleted"}. Name-list entities cannot be deleted: use deactivate-entity.

Example

bill ::quickbooks::entities/get-entity("Bill", "88")
deleted ::quickbooks::entities/delete-entity("Bill", bill.Id, bill.SyncToken)
deleted.status

entity-from

fn (name: Str, body: Any): Any

The entity object in a write or read response: body[Name] (e.g. body.Invoice), else the body itself.

Example

::quickbooks::entities/entity-from("Invoice", {Invoice: {Id: "130"}, time: "2026-11-01T00:00:00Z"})  // {Id: "130"}
::quickbooks::entities/entity-from("Invoice", {Id: "130"})  // {Id: "130"}

entity-info

fn (name: Str): Map

{name, path, kind, ops} for an entity, or an Err.

Example

info ::quickbooks::entities/entity-info("billpayment")
info.name  // "BillPayment"
info.kind  // "transaction"

entity-pdf

fn (entity: Str, id: Str | Int): Bytes
fn (entity: Str, id: Str | Int, opts: Map): Bytes

GET /{entity}/{id}/pdf - the form as PDF Bytes (Invoice, Estimate, CreditMemo, SalesReceipt, Payment).

Example

pdf ::quickbooks::entities/entity-pdf("Estimate", "41")
length(pdf)

get-entity

fn (entity: Str, id: Str | Int): Map
fn (entity: Str, id: Str | Int, opts: Map): Map

GET /{entity}/{id} - read one entity by Id.

Example

invoice ::quickbooks::entities/get-entity("Invoice", "130")
invoice.Balance

::quickbooks::entities/get-entity("Customer", 58, {realm-id: "9341453"})

invoice-pdf

fn (id: Str | Int): Bytes
fn (id: Str | Int, opts: Map): Bytes

An invoice as PDF Bytes; see entity-pdf.

Example

pdf ::quickbooks::entities/invoice-pdf("130")
length(pdf)

require-op

fn (name: Str, op: Str): Map

The entity info when the entity supports op, else an Err that says what to do instead.

Example

::quickbooks::entities/require-op("Invoice", "void").path  // "invoice"
is-err(::quickbooks::entities/require-op("Customer", "delete"))  // true

send-entity

fn (entity: Str, id: Str | Int): Map
fn (entity: Str, id: Str | Int, send-to: Str?): Map
fn (entity: Str, id: Str | Int, send-to: Str?, opts: Map): Map

POST /{entity}/{id}/send - email the form (Invoice, Estimate, CreditMemo, SalesReceipt, Payment). send-to overrides the address on the entity (its BillEmail) and is saved back to it; pass null to use the stored address. Returns the entity with EmailStatus and DeliveryInfo updated.

Example

sent ::quickbooks::entities/send-entity("Invoice", "130", "ap@acme.example")
sent.EmailStatus

// Null uses the address stored on the entity
::quickbooks::entities/send-entity("Estimate", "41", null, {realm-id: "9341453"})

send-invoice

fn (id: Str | Int, send-to: Str?): Map
fn (id: Str | Int, send-to: Str?, opts: Map): Map

Email an invoice; see send-entity.

Example

sent ::quickbooks::entities/send-invoice("130", "ap@acme.example")
sent.DeliveryInfo

sparse-update

fn (entity: Str, id: Str | Int, sync-token: Str | Int, fields: Map): Map
fn (entity: Str, id: Str | Int, sync-token: Str | Int, fields: Map, opts: Map): Map

POST /{entity} with sparse: true - change only fields. Needs the entity's current SyncToken; a stale one fails with code 5010.

::quickbooks::entities/sparse-update("Customer", "58", "3", {PrimaryPhone: {FreeFormNumber: "+1 555 0100"}})

update-entity

fn (entity: Str, body: Map): Map
fn (entity: Str, body: Map, opts: Map): Map

POST /{entity} - a full update: body must carry Id and the current SyncToken, and every writable field you leave out is cleared. Prefer sparse-update. Set sparse: true in body to make it sparse.

Example

vendor ::quickbooks::entities/get-entity("Vendor", "56")

// Send the whole entity: fields left out are cleared
::quickbooks::entities/update-entity("Vendor", {...vendor, CompanyName: "Acme Supplies"})

void-entity

fn (entity: Str, id: Str | Int, sync-token: Str | Int): Map
fn (entity: Str, id: Str | Int, sync-token: Str | Int, opts: Map): Map

Void a transaction (Invoice, SalesReceipt, Payment, BillPayment): amounts become zero and the record stays for the audit trail. Returns the voided entity.

Example

invoice ::quickbooks::entities/get-entity("Invoice", "130")
voided ::quickbooks::entities/void-entity("Invoice", invoice.Id, invoice.SyncToken)
voided.Balance

void-request

fn (name: Str, id: Str, sync-token: Str): Map

The {params, body} of a void for an entity (pure): operation=void for invoices and sales receipts, operation=update&include=void with a sparse body for payments and bill payments.

Example

::quickbooks::entities/void-request("Invoice", "130", "2").params  // {operation: "void"}
::quickbooks::entities/void-request("Payment", "95", "1").params  // {operation: "update", include: "void"}