Purser Cloud API

Version 1.7.0 · OpenAPI 3.1 · /openapi.json · A2A Agent Card · Ways to connect

Everything a company's finance runs on, in one place: invoices, documents, suppliers, payments, the ledger and its reports. Test money only until a company goes live.

The safety boundary. A key reads (scope read) and files an invoice's payment for the CFO's approval (scope propose). No key, agent, integration or chat message approves: approving is a signed-in person's passkey over the exact terms, in Purser Cloud. Test money only until a company goes live.

Company

The company's books, read-only for read keys: invoices, documents, suppliers, payments, the transactions register, the ledger and its reports; and the owner's settings.

GET /v1/health

For an uptime monitor: whether the database and the document store answer, the version, the mail waiting in all, and whether any security alarm was raised in the last 24 hours (security.ok: false when one was, or when the database does not answer; how many and which rule only in the platform operator's security log); 503 when something is down.

operationId getHealth · needs public

GET /v1/status

Where the company stands, for its owners: the last push from the runner, the mail queue, today's mail quota, the runner's alert codes and the webhook (never its secret).

operationId getCompanyStatus · needs admin

POST /v1/health/report

The runner reports its health: alert codes and severities (their words are dropped). Alerts raised or cleared since the last report go to the company's webhook.

operationId reportRunnerHealth · needs sync

GET /v1/integrations

Where the company's accounting links stand (Moneybird): not_connected, connected or attention, the last sync, what was sent, what failed and what waits for a person; from the runner's ERP sync results in the audit log, never a credential.

operationId getIntegrations · needs admin

GET /v1/webhook

The company's alert webhook (its URL and delivery state; never its secret).

operationId getWebhook · needs admin

POST /v1/webhook

Set the alert webhook (https, a public host name); returns the signing secret once. Events are signed: x-purser-signature t=<seconds>,v1=<HMAC-SHA256 hex of t.body>. A session needs a fresh passkey assertion (x-purser-step-up); every owner is told; a webhook it replaces gets webhook.replaced first; the new one hears nothing before active_from (24 hours by default) unless a second owner confirms it (POST /v1/alerts/pending/{id}/confirm).

operationId setWebhook · needs admin · step-up: always for a session: a fresh passkey assertion (x-purser-step-up); the sign-in alone does not count

DELETE /v1/webhook

Remove the alert webhook; it gets webhook.removed first, and every owner is told. A session needs a fresh passkey assertion.

operationId removeWebhook · needs admin · step-up: always for a session: a fresh passkey assertion (x-purser-step-up); the sign-in alone does not count

GET /v1/evidence-sink

The company's evidence sink (Settings, Security): the S3-compatible bucket outside Purser's account that receives every new audit checkpoint and every security event, one signed JSON object each under a content-addressed key, never overwritten. Where it writes, how many objects, the last status; never a secret. { sink: null } when none is set.

operationId getEvidenceSink · needs admin

POST /v1/evidence-sink

Set the company's evidence sink: { endpoint (https origin), bucket, region, prefix, access_key_id, secret_access_key }, credentials that may only PUT under the prefix, ideally to an Object Lock bucket in an account Purser has no part in. Answers the objects' signing secret once (HMAC-SHA256 over each object; the bucket's secret is never answered). A signed-in owner after a fresh passkey assertion, never a key; every owner is told; it writes nothing before active_from (24 hours by default) unless a second owner confirms it (POST /v1/alerts/pending/evidence.main/confirm).

operationId setEvidenceSink · needs admin · step-up: always: a signed-in owner, with a fresh passkey assertion (x-purser-step-up); the sign-in alone does not count

DELETE /v1/evidence-sink

Remove the company's evidence sink (what it holds stays in the bucket). A signed-in owner after a fresh passkey assertion; every owner is told.

operationId removeEvidenceSink · needs admin · step-up: always: a signed-in owner, with a fresh passkey assertion (x-purser-step-up); the sign-in alone does not count

GET /v1/alerts

Approval alerts (Settings, Alerts): who hears that a payment waits for the CFO's Face ID and on which channel (e-mail, Slack, Teams, the signed webhook), targets masked, and the latest deliveries with their status. An alert only tells; nothing in it approves.

operationId getAlertSettings · needs admin

POST /v1/alerts/targets

Add an alert target: { channel: email | slack | teams, target } (an address, or a Slack or Teams webhook URL). A signed-in owner after a fresh passkey assertion (x-purser-step-up; the sign-in alone does not count); never a key. Every owner is told; the target hears nothing before active_from (24 hours by default) unless a second owner confirms it (POST /v1/alerts/pending/{id}/confirm). Answers the target masked.

operationId addAlertTarget · needs admin · step-up: always: a signed-in owner, with a fresh passkey assertion (x-purser-step-up); the sign-in alone does not count

DELETE /v1/alerts/targets/{id}

Remove an alert target (a signed-in owner after a fresh passkey assertion). The removed target is told on its own channel, and every owner is told.

operationId removeAlertTarget · needs admin · step-up: always: a signed-in owner, with a fresh passkey assertion (x-purser-step-up); the sign-in alone does not count

  • id path

POST /v1/alerts/pending/{id}/confirm

A second owner confirms a new or changed alert target (alert.<id>), chat hook (chat.slack, chat.teams), the signed webhook (webhook.main) or the evidence sink (evidence.main) before its wait ends: it hears from now on. A signed-in owner after a fresh passkey assertion, never the owner who made the change (409) and never a key. Every owner is told. GET /v1/alerts lists what waits (pending).

operationId confirmPendingTarget · needs admin · step-up: always: a signed-in owner, with a fresh passkey assertion (x-purser-step-up); the sign-in alone does not count

  • id path

GET /v1/chat-hooks

Slack and Teams (Settings): whether the company's Slack and Teams incoming webhooks are set (their host only, never the URL), and each one's delivery state. Purser posts approval.needed, payment.paid and books.closed there; a message only tells and links to Purser Cloud, it never approves.

operationId listChatHooks · needs admin

POST /v1/chat-hooks/{product}

Set the company's Slack (product slack: https://hooks.slack.com/services/...) or Teams (product teams: a Teams Workflow's webhook URL) incoming webhook: { url }. A signed-in owner after a fresh passkey assertion; never a key. Every owner is told, a hook it replaces is told, and the new one hears nothing before active_from (24 hours by default) unless a second owner confirms it. Answers the host only.

operationId setChatHook · needs admin · step-up: always: a signed-in owner, with a fresh passkey assertion (x-purser-step-up); the sign-in alone does not count

  • product path

DELETE /v1/chat-hooks/{product}

Remove the company's Slack or Teams webhook (a signed-in owner after a fresh passkey assertion); the hook is told first, and every owner is told.

operationId removeChatHook · needs admin · step-up: always: a signed-in owner, with a fresh passkey assertion (x-purser-step-up); the sign-in alone does not count

  • product path

POST /v1/chat-hooks/{product}/test

Post one test message to the company's Slack or Teams webhook now, so the owner sees it arrive: { delivered, status } (the status Slack or Teams answered; 0 when nothing answered). A working test switches a hook that was off back on.

operationId testChatHook · needs admin

  • product path

GET /v1/airwallex/account

The company's Airwallex account opened through Purser as a platform: its id and onboarding status (created, pending, action_required, active, refused, dormant, closed); whether the cloud offers it at all.

operationId getAirwallexAccount · needs admin

POST /v1/airwallex/account

Open the company's Airwallex account through Purser (a signed-in owner, who agreed to Airwallex's terms first). One per company.

operationId openAirwallexAccount · needs admin · step-up: when the company asks again before sensitive changes: a session's passkey checked in the last five minutes

GET /v1/airwallex/binding

The company's binding to its own Airwallex account, signed by Purser's platform key for an hour: the runner pays only from the account in it, only while it is active. 404 while there is none.

operationId getAirwallexBinding · needs sync

POST /v1/airwallex/webhook

Airwallex's account.* webhooks (signed: x-timestamp, x-signature): the onboarding status of an account opened through Purser.

operationId receiveAirwallexAccountEvent · needs public

POST /v1/airwallex/account/refresh

Read the onboarding status of the company's Airwallex account from Airwallex now (for a late or missed webhook); only its id and status are kept.

operationId refreshAirwallexAccount · needs admin

GET /v1/connect

The accounts the company connected by OAuth (Airwallex, Moneybird): status, the Airwallex account id, scopes and when; never a token.

operationId listConnectedAccounts · needs admin

POST /v1/connect/{provider}/start

Start connecting the company's own account (airwallex or moneybird) for the signed-in owner: returns the provider's sign-in and consent URL (state, and PKCE where the provider takes it).

operationId startConnect · needs admin · step-up: when the company asks again before sensitive changes: a session's passkey checked in the last five minutes

  • provider path

GET /v1/connect/{provider}/callback

Where the provider sends the owner's browser back: forwards the code and state to the console (in the address's fragment), where the signed-in owner finishes the connection. Stores nothing.

operationId connectCallback · needs public

  • provider path

POST /v1/connect/{provider}/finish

Finish connecting: the signed-in owner who started it sends the code and state back; Purser exchanges the code with the provider and keeps the tokens sealed for this company only.

operationId finishConnect · needs admin

  • provider path

GET /v1/connect/{provider}/token

For the company's own runner (a sync key): a short-lived access token for the company's connected account, refreshed when needed. Every call for this company then uses it; it is never for another company.

operationId getConnectAccessToken · needs sync

  • provider path

DELETE /v1/connect/{provider}

Disconnect: Purser removes the company's tokens at once (Moneybird: revoked at Moneybird too). Airwallex documents no revocation for apps: the owner also removes Purser in Airwallex's settings.

operationId disconnectAccount · needs admin · step-up: when the company asks again before sensitive changes: a session's passkey checked in the last five minutes

  • provider path

POST /v1/connect/xero/bills

Send the company's supplier invoices that its connected Xero organisation does not hold yet to Xero as DRAFT bills (a signed-in owner): { from?, to? } (issue days). Each invoice goes once; at most 25 a push. Purser never authorises, pays or marks a bill paid in Xero: a person approves each draft there. Answers { pushed, already, failed, remaining }.

operationId pushBillsToXero · needs admin

POST /v1/connect/airwallex/webhook

Airwallex's partner_connection.disconnected webhook (signed: x-timestamp, x-signature): the connections of the accounts it names end.

operationId receiveAirwallexPartnerEvent · needs public

GET /v1/export/csv/{format}/{kind}

Supplier invoices (kind bills: xero, quickbooks, exact) or ledger journals (kind journals: xero, exact) as a CSV file in that product's import columns; from and to (days) narrow it. A format export, not a live integration: the file is imported by a person.

operationId exportCsv · needs read

  • format path
  • kind path

GET /v1/connections/mine

Your connections: every way this company is connected (API keys, MCP, the signed webhook, Slack, Teams, approval alerts, the e-mail inbox, Airwallex, Moneybird, Xero, QuickBooks Online, Exact Online, and the signed-in person's Google, Microsoft and Apple sign-in), each connected, not_connected (the company switches it on itself in Settings) or not_available (the platform has not configured it). Never a secret.

operationId listMyConnections · needs admin

GET /v1/connections

Every connection Purser has to other systems, what each does, its label (live, sandbox, testnet, format export, built and not tested live) and its guide; the payment rails, which move money only under the CFO's limits or Face ID, listed apart.

operationId listConnections · needs public

GET /v1/sessions

The signed-in person's active sessions: when each began, until when, the browser and the network it signed in from; the current one marked. Never a token.

operationId listSessions · needs read

DELETE /v1/sessions/{id}

End one of the signed-in person's sessions: its token stops at once; the others keep working.

operationId endSession · needs read

  • id path

POST /v1/company

Change the company's display name (its address, the slug, stays) or the pages' language for everyone (nl or en).

operationId updateCompany · needs admin · step-up: when the company asks again before sensitive changes: a session's passkey checked in the last five minutes

GET /v1/invoices

Supplier invoices; filter by status, due_from, due_to; paginated (limit, cursor).

operationId listInvoices · needs read

  • status query ready, paid, held, ...
  • due_from query YYYY-MM-DD
  • due_to query YYYY-MM-DD
  • limit query 1 to 200 (default 50)
  • cursor query next_cursor of the page before
Answer
{
  "$ref": "#/components/schemas/InvoicePage"
}

GET /v1/invoices/{id}

One invoice, with its earlier versions.

operationId getInvoice · needs read

  • id path
Answer
{
  "$ref": "#/components/schemas/InvoiceDetail"
}

GET /v1/invoices/{id}/document

The invoice's document, as received.

operationId getInvoiceDocument · needs read

  • id path

GET /v1/vendors

Suppliers; paginated.

operationId listVendors · needs read

GET /v1/payments

Payments; paginated.

operationId listPayments · needs read

GET /v1/transactions

The transactions register: every money movement on every rail, newest first; filter by rail, currency, from, to, reconciliation, moved; paginated (limit, cursor).

operationId listTransactions · needs read

GET /v1/transactions/summary

Totals per currency (money that moved only) and the checks: unreconciled, without approval, without booking or proof; the same filters.

operationId getTransactionSummary · needs read

GET /v1/transactions/export.csv

The register as CSV, the same filters; one line per movement.

operationId exportTransactionsCsv · needs read

GET /v1/transactions/{id}

One movement, with its earlier versions.

operationId getTransaction · needs read

  • id path

GET /v1/ledger/entries

Ledger entries with their lines; filter by from, to; paginated.

operationId listLedgerEntries · needs read

GET /v1/reports/{name}

trial, pnl, balance, vat (?quarter=2026Q4), payables, receivables: computed from the ledger.

operationId getReport · needs read

  • name path

GET /v1/agents

The company's agents from its own records: job, Claude model, what each may and may not do, card limits as issued, rails, status and newest decisions with who decided. Read only.

operationId listAgents · needs read

GET /v1/authority-map

Who may pay what, per agent, as the runner last pushed it (null before the first push). Read only.

operationId getAuthorityMap · needs read

GET /v1/treasury

Cash & FX as the runner last pushed it (null before the first push): cash per currency against the CFO's floors, the 13-week forecast (a forecast, not a promise of cash), the FX exposure with the advisor's decision and the conversions it filed for the CFO's passkey. Test money. Read only: nothing here approves or converts.

operationId getTreasury · needs read

GET /v1/receivables

Receivables as the runner last pushed them (null before the first push): invoices by number and amount, the payments matched to them, the payments waiting for a person, aged debtors and the reminder steps (drafts a person sends). No customer or payer name. Test money. Read only.

operationId getReceivables · needs read

GET /v1/compliance

The runner's compliance evidence in short, as it last pushed it (null before the first push): per framework how many requirements have evidence in the last 30 days, no records, documentation only or gaps; per control its records; the gaps. Counts only. Read only.

operationId getCompliance · needs read

GET /v1/cards

The agents' live Airwallex sandbox cards (test money): for each agent its card's last four digits (never the full number or the CVV), live status, limits against the CFO policy, and its newest authorizations with their ids; whether card actions are on (admin switch awx_cards) and today's caps.

operationId listCards · needs read

GET /v1/cards/scope

Whether the Airwallex sandbox key may use Issuing: { issuing: ok | forbidden | no_key | no_gateway | unavailable }. One read of Airwallex a minute at most, for everyone; no card data.

operationId getCardScope · needs public

GET /v1/cards/edge/latest

The newest one-cent-over test at the Airwallex sandbox: an agent's card at its limit L, then L + 0.01, with Airwallex's own answers (approved or declined with its reason code), their ids and times. The run record docs/runs keeps; sandbox, test money, the card's last four digits only. 404 when none has run.

operationId getLatestCardEdgeTest · needs public

POST /v1/cards/actions

Ask for a card action (a signed-in owner): { kind: issue | freeze | unfreeze | limits | test, agent }. Answers the exact action as signed text, its SHA-256 and the passkey challenge (that hash). Nothing reaches Airwallex before POST /v1/cards/actions/{id}/sign.

operationId requestCardAction · needs admin

POST /v1/cards/actions/{id}/sign

Sign a card action with your own passkey (a signed-in owner): { credential_id, assertion } over the action's challenge. The action then runs once at the Airwallex sandbox (test money); the same signed action again answers what it did. Answers { status: done | failed, card or tx, reason }.

operationId signCardAction · needs admin

  • id path

GET /v1/partner-rails

T:0 at every payment and the agents' payment tokens: each settled payment's T:0 entry (its T:0 id, GL account, cost centre, agent and terms hash), the reconcile check of T:0 against the rails, and each agent's token (its id and last four, never the token) with its mandate, status, uses and refusals. From the company's own records when it has them, else the recorded live sandbox run, labelled. Also whether Apple Wallet passes are configured.

operationId getPartnerRails · needs read

GET /v1/agents/{id}/wallet-pass

The agent card as an Apple Wallet pass (application/vnd.apple.pkpass): the agent's name, its card's limits and last four, its status. Only when the owner configured passes (PASS_TYPE_ID, TEAM_ID and the signing certificate); 404 otherwise or for an agent without a card.

operationId getAgentWalletPass · needs read

  • id path

GET /v1/card-design

The company's card design for the Agents page: its colour, initials or a small logo, and a designed preset per agent; cosmetic only. Also whether this caller may save it (an owner or admin, never the demo company's guest).

operationId getCardDesign · needs read

POST /v1/card-design

Save the company's card design: { color (#rrggbb or null), initials (1 to 3 of A-Z, 0-9, or null), logo (a PNG, JPEG or WebP data URL of at most 48 KB, or null), styles ({agent: preset}) }. Cosmetic only: it changes no limit, card or payment. Anything not valid is dropped. Not for the demo company.

operationId setCardDesign · needs admin

GET /v1/negotiation/recorded

The Sourcing agent's recorded negotiation for the Agents page: an early-payment discount with a simulated supplier's agent, four turns written in advance (not a live model call), each checked by the CFO's rails in code now; the turn the rails refuse says why.

operationId getRecordedNegotiation · needs read

GET /v1/tokenisation

Tokenisation as the records hold it: the invoice token on Alta testnet (mint, finance, settle), the agents' Airwallex cards and the Visa credential via Airi, each labelled as its record labels it.

operationId getTokenisation · needs read

GET /v1/airwallex-live/{view}

The live Airwallex tab, read-only, from the Airwallex sandbox (test money) through the site Worker's gateway: balances, accounts, financial, rates, transfers, beneficiaries, issuing, calls, events (the webhooks Airwallex sent the site, signature verified: type, object id and time only), or reconcile (Purser's ledger of the recorded awx-1 run against Airwallex's financial transactions). Each answer says when it was read, or why the sandbox is unavailable.

operationId getAirwallexLiveView · needs read

  • view path

GET /v1/books/bookings

For each supplier invoice, the ledger entries that book it (its accrual and its payment).

operationId listBookings · needs read

GET /v1/books/invoices/{id}/journal

The ledger entries that book one supplier invoice, with their lines.

operationId getInvoiceJournal · needs read

  • id path

GET /v1/dashboard

The start screen in one answer, every figure counted from the company's own rows: cash in and out by day, spend by who started it, approvals per week, invoices by state, and the newest decisions in words.

operationId getDashboard · needs read

GET /v1/insights

Payables at a glance: open, due, overdue, waiting, blocked, spend per supplier.

operationId getInsights · needs read

GET /v1/documents/{sha256}

A document the company holds, by its SHA-256 (the export lists them).

operationId getDocument · needs read

  • sha256 path

POST /v1/sync

The runner's push: vendors, invoices, documents, payments, the transactions register, ledger entries, audit rows. Idempotent. Never passkeys.

operationId pushSync · needs sync

GET /v1/sync/state

Where the cloud's copy stands: the heads of the audit and ledger chains, and the documents it holds.

operationId getSyncState · needs sync

GET /v1/mail/forwarding-confirmations

Gmail's forwarding confirmation codes that reached the company's Purser address in the last seven days (code and Gmail address only), for the owner who is setting up forwarding from Gmail.

operationId listForwardingConfirmations · needs admin

GET /v1/mail

Inbound e-mail waiting for the runner; paginated (limit, cursor).

operationId listMail · needs sync

GET /v1/mail/{id}/raw

One inbound e-mail, raw (RFC 822).

operationId getRawMail · needs sync

  • id path

POST /v1/mail/{id}/done

The runner filed (done) or refused an inbound e-mail.

operationId markMailDone · needs sync

  • id path

GET /v1/audit/checkpoint-keys

The public keys that sign the company's audit checkpoints in Purser Cloud's engine (raw, base64url): since 30 Nov each checkpoint is hybrid, signed with Ed25519 and ML-DSA-65 (FIPS 204), and both keys are listed, each with its algorithm, key id and when it was first seen: with the audit.checkpoint events the company's signed webhook receives, enough to check its ledger outside Purser (npm run verify-audit -- --trust <Ed25519 key>,<ML-DSA-65 key>). Public by nature; empty while checkpoints are off.

operationId listCheckpointKeys · needs read

GET /v1/export

Everything the cloud holds for the company; documents listed, each fetched from /v1/documents/{sha256}. Needs admin and read.

operationId exportCompany · needs admin

POST /v1/export/staged

Build the company's export into the store in parts (one at a time, kept a day); returns a 15-minute, single-use signed link to its manifest, which needs no key: manifest_link (a bare URL and the x-purser-export-link header to send, for a program) or manifest_url (the same signature in the query, for a browser). Needs admin and read.

operationId stageExport · needs admin · step-up: when the company asks again before sensitive changes: a session's passkey checked in the last five minutes

GET /v1/export/staged/{id}

A staged export's state, with a fresh 15-minute link to its manifest while it is ready. Needs admin and read.

operationId getStagedExport · needs admin

  • id path

GET /v1/export/download/{id}/{part}

One part (or the manifest) of a staged export, by its signed link (no key): the signature in the x-purser-export-link header, or in the query; each link is good once, for 15 minutes. The manifest carries a signed link per part.

operationId downloadExportPart · needs public

  • id path
  • part path

POST /v1/close

Close the company's account: access ends; records are kept for a 30-day grace period, then purged (to archive the books seven years, offboard with archive_years: 7).

operationId closeCompany · needs admin · step-up: when the company asks again before sensitive changes: a session's passkey checked in the last five minutes

POST /v1/offboarding

Offboard the company after its export (docs/privacy/retention.md): a signed-in owner, passkey checked in the last five minutes, names the staged export they downloaded and types the company's address. The account closes; names become pseudonyms, e-mails, passkeys, sessions, keys and message targets go; the bookkeeping is kept for a 30-day grace period, or archived seven years when the body says archive_years: 7 (the company's instruction, recorded), then purged.

operationId offboardCompany · needs admin · step-up: always: a signed-in owner, passkey checked in the last five minutes

Request body
{
  "type": "object",
  "properties": {
    "confirm": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "export_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "archive_years": {
      "type": "number",
      "const": 7
    }
  },
  "required": [
    "confirm",
    "export_id"
  ],
  "additionalProperties": false
}

GET /v1/autopilot

The company's nightly autopilot (the Cron Trigger's first firing each UTC day): each day its engine follows the payments, books and archives, and writes a digest: invoices by status, the overdue ones, payments waiting for an approval, whether both hash chains verify. It never pays. ?limit=<1 to 90> (default 14); { items }, newest first. 404 when the cloud runs no engine.

operationId getAutopilot · needs read

GET /v1/stats

The cloud's own counters per day (UTC), across every company, with no company's id or amount: requests, refused (401, 403), rate_limited (429), errors (5xx), uploads, payments_filed, approvals, engine_refusals. ?days=<1 to 90> (default 14); { metrics, days }, newest first. 404 when the counters are off.

operationId getStats · needs public

POST /v1/ask

Ask Purser (public, from this site's own pages): one question about Purser, answered by an agent with read-only tools over Purser's public docs (README, llms.txt, docs/) and the demo company's records (made-up data, read only), streamed as one JSON object a line (meta with the passages used, step for each read, source, delta, reset, done with the sources cited). Body { question (at most 600 characters), history? (the conversation's last turns, kept by the browser), attachment? { name, type (PDF, CSV, text, PNG, JPEG, WebP or GIF), data (base64, at most 5 MB) }, context? { kind (the console page: overview, invoices, invoice, transactions, payment, agents, policy, books, audit or proof), id? (the record's id, letters, digits and _.:- only), demo? (the person is in the demo company) } }. Read-only: it cannot pay, approve, change a limit or read a real company's data; such a request, and any instruction aimed at the assistant, is answered by code. Claude (Haiku) only under the hands-on deployment's switches claude and ask and its caps; otherwise the docs answer alone (or code reads the demo company's records), labelled. 6 a minute and ask_per_address_hour an hour per address (429 { code: limit }). Nothing is kept but hourly counts: no question, answer or file.

operationId askPurser · needs public

Engine (payments)

The company's engine (test money): propose an invoice's payment (read + propose); approving is a signed-in person's passkey only, never a key.

GET /v1/engine

Where the company's engine stands: the mode (test_money: it pays on a stand-in bank), the approval passkey, the stand-in bank's balances, and whether the audit and ledger chains verify. 404 on every /v1/engine route when the cloud runs no engine.

operationId getEngineStatus · needs read

POST /v1/engine/documents

Upload a supplier invoice to the engine: { filename (1 to 200 characters), mime?, base64 }, at most 15 MB once decoded. It is filed, read and checked; answers { kind, sha256, invoice }. The same file again answers kind duplicate_document. An owner, an admin key or the AP clerk (the ap scope).

operationId uploadDocument · needs ap

Request body
{
  "type": "object",
  "properties": {
    "filename": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
    },
    "mime": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "base64": {
      "type": "string",
      "minLength": 1,
      "maxLength": 22000000
    }
  },
  "required": [
    "filename",
    "base64"
  ],
  "additionalProperties": false
}

GET /v1/engine/exceptions

The exceptions queue: every invoice the engine holds (blocked, needs review, needs a new supplier), due date first, with its reason codes (the checks' finding codes), whether one concerns the bank details, the work people did on it (notes, call-backs asked for and recorded, who and when) and the last call-back recorded on a number on file; { items }. Reads only.

operationId listExceptions · needs read

POST /v1/engine/invoices/{id}/notes

Add a note to a held invoice (a session only; the ap scope: an owner or the AP clerk): { text } of 1 to 500 characters. Answers { work }. A note changes nothing else: the invoice stays held.

operationId addInvoiceNote · needs ap

  • id path

POST /v1/engine/invoices/{id}/callback-request

Ask for the supplier to be called back on a number already on file (a session only; the ap scope): { note? } of at most 500 characters, never a number. Answers { work }. It records the request and nothing else.

operationId requestSupplierCallback · needs ap

  • id path

POST /v1/engine/invoices/{id}/callback-confirmed

Record that the supplier confirmed its bank details on a call-back to a number already on file (a session only; the ap scope): { on_file: true } and nothing else; the number itself is never sent nor stored. Answers { work, approves: false }: it records the call-back only, who and when. It approves nothing, releases nothing and changes no payee; the invoice is still paid only on the CFO's passkey.

operationId confirmSupplierCallback · needs ap

  • id path

GET /v1/engine/invoices

The engine's invoices: status, whether it can be paid, what the checks found, and its payment proposal if one was filed; { items }.

operationId listPayableInvoices · needs read

Answer
{
  "$ref": "#/components/schemas/EngineInvoices"
}

POST /v1/engine/invoices/{id}/pay

File the invoice's payment for approval: answers { proposal } with the exact terms' hash and what the passkey signs; 409 with the engine's reason when it will not (the invoice is held, waiting or paid). Nothing is paid before the approval, except within the company's limit to pay alone (a test company of /try): when the agents and code's checks say pay, code approves the exact terms and the agent pays at once, and the answer adds { alone: { limit, by, why }, settled, airwallex_payout (the Airwallex sandbox transfer of the policy-approved terms, or why the simulated bank alone paid) }. Needs the propose scope (an admin key or an owner covers it); no key approves.

operationId proposePayment · needs propose

  • id path
  • Idempotency-Key header Optional; any unique value, such as a UUID (the SDKs send one on every POST). Per company and key, for 24 hours: the same key with the same method, path and body answers the first answer's status and body again (header Idempotent-Replayed: true) and nothing runs twice; with another body or route, 422; while the first request still runs, 409. A 5xx or 429 is not kept: send the same key again.
Answer
{
  "$ref": "#/components/schemas/ProposeAnswer"
}

GET /v1/engine/proposals/{id}

One payment proposal: its status, the hash of its exact terms, the challenge a passkey signs and the facts a person reads; { proposal }.

operationId getProposal · needs read

  • id path
Answer
{
  "$ref": "#/components/schemas/ProposalAnswer"
}

GET /v1/engine/proposals/{id}/bank-file

The SEPA credit transfer file (ISO 20022 pain.001.001.09) an approved bank file payment was executed as: { bank_file: { proposal_id, request_id, terms_sha256, msg_id, format, xml, xml_sha256, filed_at } }; 404 when none was filed. Reads only: the file is made once, by execution after the CFO's passkey over the exact terms, and every read returns the same bytes. Purser sends it to no bank; test money only.

operationId getBankFile · needs approve

  • id path

GET /v1/engine/proposals/{id}/dossier

One payment's authorisation dossier, for an auditor or a bank dispute (a proposal's id, or its invoice's): the payee and amount, the exact terms and their hash, who signed them (passkey id and label) and when, the CFO policy in force when filed and signed, the checks that ran and their results, the rail's transfer id and status, the audit rows with the chain head and the latest signed checkpoint, and how to check it offline (npm run dossier -- --verify). Answers { dossier }; ?format=pdf answers it as an A4 PDF. Read only. Test money only.

operationId getPaymentDossier · needs read

  • id path

POST /v1/engine/passkey/start

Start the approval passkey of the signed-in person (a session only, never a key): the challenge and code of a short enrolment window, the relying party, the person, and the passkeys to exclude. Optional body { add: true }: one more approval key beside the person's own (a security key kept in the company safe, a second device; at most three each), which replaces nothing; without it the new key replaces the one under the person's name. Either way the new key needs an active key's endorsement or a second owner, and cools off before it approves. 409 when the person already holds three.

operationId startApprovalPasskey · needs approve · step-up: when the company asks again before sensitive changes: a session's passkey checked in the last five minutes

Request body
{
  "type": "object",
  "properties": {
    "add": {
      "type": "boolean"
    }
  },
  "additionalProperties": false
}

POST /v1/engine/passkey/finish

Finish the approval passkey (a session only; the approve scope): { code, credential } with the passkey the browser made for the challenge; it is labelled with the signed-in person's name. Answers { credential_id, how, cooling_until }. The company's first key needs nothing more; while another approval key is active, the first answer is 409 endorsement_required with the challenge (endorse), and the same request again must carry endorsement (an active approval key's assertion over it) or cosign { credential_id, assertion } (another owner's passkey over it); a recovered owner's first new key needs neither. 403 endorsement_refused for a bad one. Such a key approves nothing before cooling_until (72 hours; 0 on a /try test company, said in cooling_note). 409 with the engine's reason when it is refused otherwise.

operationId finishApprovalPasskey · needs approve · step-up: when the company asks again before sensitive changes: a session's passkey checked in the last five minutes

Request body
{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "minLength": 1,
      "maxLength": 32
    },
    "credential": {
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {}
    },
    "endorsement": {
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {}
    },
    "cosign": {
      "type": "object",
      "properties": {
        "credential_id": {
          "type": "string",
          "minLength": 8,
          "maxLength": 400
        },
        "assertion": {
          "type": "object",
          "properties": {
            "authenticatorData": {
              "type": "string",
              "maxLength": 4000
            },
            "clientDataJSON": {
              "type": "string",
              "maxLength": 8000
            },
            "signature": {
              "type": "string",
              "maxLength": 400
            }
          },
          "required": [
            "authenticatorData",
            "clientDataJSON",
            "signature"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "credential_id",
        "assertion"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "code",
    "credential"
  ],
  "additionalProperties": false
}

POST /v1/engine/passkeys/{credential}/revoke

Stop an approval key (a person signed in with their passkey, after a fresh passkey assertion: x-purser-step-up). Another person's key only while it is in its cooling-off (new, added or recovered): the veto, by an owner or by an approver whose own key is past its cooling-off, never by the key's own person; it also cancels that person's recovery that can still be stopped. One's own key (a lost phone) only while keeping another key past its cooling-off. What the key signed that has not run goes back for a new signature (voided). Every owner and the webhook are told. Answers { revoked, person, mode (veto or own), how, voided, recoveries_cancelled }; 403 for a caller who may not, 404 for no such active key, 409 with the reason when the key may not be stopped so.

operationId revokeApprovalKey · needs read

  • credential path

POST /v1/engine/policy/second-key

Propose the CFO's rule for high-risk payments (off by default): { changes: [{ key, to }] } of approval.second_key_eur (an amount or ""), approval.second_key_new_payee, approval.second_key_bank_changed, approval.second_key_new_country (on or off). Answers { proposal }, a policy change the CFO approves with Face ID (POST /v1/engine/proposals/{id}/approve); nothing changes before that.

operationId proposeSecondKeyRule · needs admin

POST /v1/engine/emergency-stop

The CFO's emergency stop (a session only; the approve scope: the CFO, or an owner of a company with no CFO): { on: true } pulls it, { on: false } lifts it. Answers { proposal }, a policy change the CFO approves with the passkey (POST /v1/engine/proposals/{id}/approve); nothing changes before that, and a key cannot ask. Once approved, nothing of this company is paid: proposals are still filed, but every payment executor refuses when it begins and again immediately before each create at the bank (the rail asks too), the agent pays nothing alone and nothing is sent to the Airwallex sandbox. GET /v1/engine says { emergency_stop: { on, since, proposal_id } }; both directions are in the audit log (policy.changed) and told to every owner. 409 when it already stands as asked.

operationId setEmergencyStop · needs approve

Request body
{
  "type": "object",
  "properties": {
    "on": {
      "type": "boolean"
    }
  },
  "required": [
    "on"
  ],
  "additionalProperties": false
}

POST /v1/engine/security-key/start

Start registering a security key for the signed-in person (a session only): the second key of high-risk payments (USB or NFC, such as a YubiKey), beside their approval passkey, which must exist. Answers the challenge, the user handle, the relying party and the credentials to exclude; the page asks with authenticatorAttachment cross-platform.

operationId startSecurityKey · needs approve · step-up: when the company asks again before sensitive changes: a session's passkey checked in the last five minutes

POST /v1/engine/security-key/finish

Finish registering the security key (a session only): { credential } as the browser made it; a credential the browser reports as a platform authenticator (Face ID, Touch ID) is refused, and so is one already registered.

operationId finishSecurityKey · needs approve · step-up: when the company asks again before sensitive changes: a session's passkey checked in the last five minutes

POST /v1/engine/proposals/{id}/approve

Approve a proposal with the approval passkey (a session only; the approve scope: the CFO, or an owner of a company with no CFO): { terms_sha256, credential } with the passkey's signature over the proposal's challenge. Answers { status, message, settled }: only status approved pays (on the stand-in bank), and settled says paid, booked, archived and fed; a signature over other terms is refused and nothing runs. A key still in its cooling-off (new or recovered) is refused: 403 cooling_off with cooling_until, nothing paid, told to the owners.

operationId approveProposal · needs approve

  • id path
Request body
{
  "type": "object",
  "properties": {
    "terms_sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "credential": {
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {}
    }
  },
  "required": [
    "terms_sha256",
    "credential"
  ],
  "additionalProperties": false
}

POST /v1/engine/proposals/{id}/cancel

Cancel an approved payment before it is paid (a session only; the approve scope: the CFO, or an owner of a company with no CFO), typically in the CFO's cancel window after the confirmation on another channel showed terms you did not mean. A batch is cancelled with its lines. Answers { cancelled }; the proposal is closed for good (NEEDS_REAPPROVAL), proposal.cancelled is in the audit log, and every owner is told. 409 with the reason when it is not an approved payment that waits (paid, running, never approved, already cancelled). A key cannot cancel.

operationId cancelProposal · needs approve

  • id path

POST /v1/engine/proposals/{id}/release

Release an approved payment held because the confirmation of what was signed reached no alert target (a session only; the approve scope: the CFO, or an owner of a company with no CFO). It is then paid when its cancel window ends, at once when that has passed, every check asked again. Answers { released, status, settled }; payment.hold_released is in the audit log and every owner is told. 409 with the reason when it is not held. A key cannot release.

operationId releaseProposal · needs approve

  • id path

POST /v1/engine/policy/cooldown

Propose the CFO's cancel window (off by default): { minutes } of 0, 5, 10, 15 or 30. With it set, an approved payment waits that long before it is paid, so the CFO can read the confirmation sent to the company's alert targets and cancel it (POST /v1/engine/proposals/{id}/cancel). Answers { proposal }, a policy change the CFO approves with the passkey; nothing changes before that. A session only.

operationId proposeCancelWindow · needs admin

Request body
{
  "type": "object",
  "properties": {
    "minutes": {
      "anyOf": [
        {
          "type": "number",
          "const": 0
        },
        {
          "type": "number",
          "const": 5
        },
        {
          "type": "number",
          "const": 10
        },
        {
          "type": "number",
          "const": 15
        },
        {
          "type": "number",
          "const": 30
        }
      ]
    }
  },
  "required": [
    "minutes"
  ],
  "additionalProperties": false
}

POST /v1/engine/proposals/{id}/retry

Try again: an approved payment whose execution failed (the bank was away, say), or that the executor refused before it began (approved while the emergency stop was on, say), is run once more by the executor's own resume path, every check asked again, which never pays twice; so is an approved payment whose cancel window is over (one still in it answers 409 with until when). Answers { status: retried, message, settled } with where things stand; 409 with the engine's reason when there is nothing to retry (paid, never approved, refused).

operationId retryProposal · needs admin

  • id path

GET /v1/engine/airwallex

Which bank each invoice was planned and paid at (the Airwallex sandbox or the simulated bank, test money either way), with Airwallex's ids: the payee (beneficiary id), the payee's bank check, the quote and conversion for a shortfall, the transfer (id, request_id, status, approval hash), a batch; the caps used today; and the labels of every fallback. { airwallex: { on, why }, caps, invoices, deposits, notes }.

operationId getEngineBanks · needs read

POST /v1/engine/invoices/{id}/supplier

A new supplier from an invoice waiting for one (a session only): { how, street, city, postcode }, how you confirmed the account on a contact you already had. The payee's bank is asked whether the account carries the supplier's name (Airwallex's account verification, or a labelled stand-in), then a payee_add proposal waits for the CFO's passkey; once signed, the supplier is added at the bank (Airwallex: schema, validation, create). Answers { proposal, name_check }; 409 with the reason and the check when it is refused.

operationId addSupplierFromInvoice · needs admin

  • id path
Request body
{
  "type": "object",
  "properties": {
    "how": {
      "type": "string",
      "minLength": 20,
      "maxLength": 300
    },
    "street": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "city": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "postcode": {
      "type": "string",
      "minLength": 1,
      "maxLength": 20
    }
  },
  "required": [
    "how",
    "street",
    "city",
    "postcode"
  ],
  "additionalProperties": false
}

POST /v1/engine/batch

Pay all approved: { invoice_ids } (1 to 20 ready invoices). Each is planned as on its own (its own exact terms, FX for its shortfall only), then one batch proposal over them waits for one passkey signature over the batch's totals and every line. At the Airwallex sandbox the signed batch runs as one batch transfer. Answers { proposal, planned, not_planned }; 409 when none could be planned.

operationId proposeBatch · needs admin

  • Idempotency-Key header Optional; any unique value, such as a UUID (the SDKs send one on every POST). Per company and key, for 24 hours: the same key with the same method, path and body answers the first answer's status and body again (header Idempotent-Replayed: true) and nothing runs twice; with another body or route, 422; while the first request still runs, 409. A 5xx or 429 is not kept: send the same key again.
Request body
{
  "type": "object",
  "properties": {
    "invoice_ids": {
      "minItems": 1,
      "maxItems": 20,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64
      }
    }
  },
  "required": [
    "invoice_ids"
  ],
  "additionalProperties": false
}

POST /v1/engine/deposit

Money in (a session only): { amount } up to 500.00 USD, a deposit on the bank's simulation into the company's USD account (the Airwallex sandbox's deposit simulation, or the simulated bank), recorded once and booked as a payment that names no invoice (held in suspense). Test money. Answers { deposit_id, status, amount, currency, settled }.

operationId depositTestMoney · needs admin

  • Idempotency-Key header Optional; any unique value, such as a UUID (the SDKs send one on every POST). Per company and key, for 24 hours: the same key with the same method, path and body answers the first answer's status and body again (header Idempotent-Replayed: true) and nothing runs twice; with another body or route, 422; while the first request still runs, 409. A 5xx or 429 is not kept: send the same key again.
Request body
{
  "type": "object",
  "properties": {
    "amount": {
      "type": "string",
      "pattern": "^\\d{1,3}\\.\\d{2}$"
    }
  },
  "required": [
    "amount"
  ],
  "additionalProperties": false
}

POST /v1/engine/sync

Follow the payments, book them, archive and feed the read model again; safe to repeat. Answers where things stand (ledger_entries, vault_added, fed, error).

operationId syncEngine · needs admin

GET /v1/engine/events

What the engine did, oldest first: ?after=<seq>&limit=<1 to 200>; { items, next }, where next is the seq to ask after. An event carries a short list of fields, never a bank account. 429 slow_down with retry_ms past 2 reads a second per company.

operationId listEngineEvents · needs read

GET /v1/engine/vault

The files of the company's archive as its indexes list them: { files: [{ path, kind, bytes, sha256, added_at }] }.

operationId listArchiveFiles · needs read

GET /v1/engine/vault/file

One file of the archive, ?path= as the list gives it; 404 for a path the archive's index does not list.

operationId getArchiveFile · needs read

POST /v1/engine/shadow

Shadow mode, the back-test: past paid supplier invoices as a CSV body (Content-Type: text/csv, at most 2 MB; the columns and their variants: docs/shadow/README.md) replayed oldest first through Purser's checks under the company's CFO policy in force: for each row what Purser would have done (paid alone within the limit, sent to the CFO, held for a person) and why, and a summary (duplicates, IBAN changes, amounts above usual, totals by outcome). ?alone_limit=<EUR amount> or none sets the limit for this replay only. Answers { report }; ?format=md or html answers the report as a page. Code only: no model, no rail, nothing written. A file it cannot read: 400 with the line. Test money only.

operationId runShadowMode · needs read

GET /v1/engine/samples

The hands-on demo's sample invoices, in the tray's order: { items: [{ key, title, filename }] }. Each title says what you do, never what the engine will answer. Test invoices (fake).

operationId listSampleInvoices · needs read

POST /v1/engine/samples/{key}

Send a sample invoice to the engine's inbox, as an upload of its PDF: answers as POST /v1/engine/documents ({ kind, sha256, invoice }); 404 for a key that is not a sample; 400 in the engine's words when it is refused (a test company's limit of 8 documents).

operationId sendSampleInvoice · needs admin

  • key path

POST /v1/engine/invoices/{id}/clear

Sandbox override of a hold (a test company of the hands-on demo only): a possible duplicate by the same total is cleared with the inbox's own person's path (kept per pair and in the audit log), then checked again; nothing is paid before the passkey signs the exact terms. In production a second person would review it. Answers { invoice }; 409 with the engine's reason for any other hold (a number match, an exact duplicate, new bank details, a new supplier: those can only be rejected).

operationId clearInvoiceHold · needs admin

  • id path

POST /v1/engine/invoices/{id}/reject

Reject a held invoice (a test company of the hands-on demo only): the inbox's own rejection, its reason kept; nothing is paid. Answers { invoice }; 409 with the engine's reason when it cannot be rejected (paid, or waiting for the passkey).

operationId rejectInvoice · needs approve

  • id path

GET /v1/engine/suppliers

The suppliers the company has on file, as the engine's seed recorded them: { items: [{ key, name, iban, bic }] }. Their IBANs are published test IBANs, not anyone's account.

operationId listSuppliersOnFile · needs read

POST /v1/engine/compose

Write your own invoice (a test company of the hands-on demo only): { supplier_key, invoice_no, amount (100.00 to 5000.00; written as people write it, such as 1850.00, 1.850,00 or 1k, read as two decimals), issue_date, due_date (YYYY-MM-DD, within 60 days of today), iban (mod 97), and optionally payee_name (the payee's name as printed; the supplier's on file without it), currency (EUR or USD; EUR without it) and note (one line of at most 240 characters, printed as typed) }. It is written in the sample's layout (an enterprise invoice, src/engine/invoicePdf.ts), rendered to a PDF inside the engine and filed through its inbox: answers as POST /v1/engine/documents; a refused field is 400 { code, message, field }.

operationId composeInvoice · needs admin

GET /v1/engine/proposals/{id}/terms

A proposal's exact terms as the passkey signs them: { proposal_id, status, terms, canonical (the canonical JSON), terms_sha256 (its SHA-256, the signature's challenge), approved (whether an approval is stored), expires_at }; 404 for a proposal the company's engine does not hold.

operationId getProposalTerms · needs read

  • id path

POST /v1/engine/proposals/{id}/pay

Pay with your signature (a test company of the hands-on demo only; at most 8 KB, 30 a company): { terms, credential } with the terms to pay (only amount, currency, beneficiary_name, iban_last4, bic and invoice_no may differ from the signed ones) and the passkey's signature this browser made at the approval. Two layers answer, always both: the product's verifier on that signature over the sent terms, and the executor's own gate asked with the sent terms (inside a transaction that is always rolled back). Only when both say yes is the held payment run, from the stored terms, on the simulated bank (test money). Answers { outcome (paid, refused, paid_once, not_signed, expired, failed), layers, signed_sha256, sent_sha256, changed, transfers_before, transfers_after, sandbox_calls, settled, request_id, airwallex_payout? (when paid: the Airwallex sandbox transfer of the signed payment, or why the simulated bank alone paid) }; 400 when the terms' shape does not fit.

operationId payProposal · needs approve

  • id path

POST /v1/engine/proposals/{id}/payout/simulate

Sandbox: move to PAID (a test company of the hands-on demo only): the Airwallex sandbox transfer of this paid proposal moved by the sandbox's own simulation to SENT, then PAID; no money anywhere. Answers { ok, note (the transfer's id and status), reason? (in_approval: it waits for a person in Airwallex; switched_off; no_transfer; ...) }.

operationId simulatePayout · needs admin

  • id path

GET /v1/engine/export

Download the company in the product's sync format (purser.cloud-sync/v1): { format, company, made_at, batches }, the batches a runner's push sends (the invoices with their documents, payments, transactions, the ledger and the audit log), as a file. No archive files. At most 5 MB; a test company may download it 5 times.

operationId exportEngine · needs read

GET /v1/engine/export.pdf

Download the company's records as an A4 PDF a person reads: a cover with the totals, each invoice with its trail (read, checked, signed with the passkey, paid, booked), the journal, the audit log and the documents' and terms' fingerprints, built from the same records as /v1/engine/export. A test company may download it 5 times.

operationId exportEnginePdf · needs read

Access

Who may do what: passkey sign-in, sessions, API keys (read, sync, admin, propose) and people.

GET /v1/security/settings

The company's security settings: step_up, whether sensitive settings ask for the passkey again after five minutes ("Ask again before sensitive changes"; off by default).

operationId getSecuritySettings · needs admin

POST /v1/security/settings

Switch "Ask again before sensitive changes" on or off: { step_up: boolean }. A signed-in owner, after a fresh passkey assertion (x-purser-step-up; the sign-in alone does not count), whatever the setting; never a key. Recorded in the security events and told to every owner.

operationId setSecuritySettings · needs admin · step-up: always: a signed-in owner, with a fresh passkey assertion (x-purser-step-up); the sign-in alone does not count

GET /v1/recovery

The company's owner recoveries that can still be stopped: each request waiting for its second platform admin (awaiting_second_admin) or approved with its one-day recovery key not redeemed yet (issued_not_redeemed); who asked, how the owner was checked, until when. An owner, or an approver whose own approval key is past its cooling-off; never a key.

operationId listRecoveries · needs read

POST /v1/recovery/{request}/cancel

Cancel an owner recovery from inside the company, after a fresh passkey assertion (x-purser-step-up): a request still waiting for its second admin can no longer be approved; an issued recovery key not redeemed yet is revoked, with any invite it started. An owner, or an approver whose own approval key is past its cooling-off; never a key. Every owner and the webhook are told. Answers { cancelled, owner_id, was, recovery_key_revoked }; 409 when it can no longer be stopped here (expired, cancelled or redeemed: a recovered approval key cools off, and POST /v1/engine/passkeys/{credential}/revoke stops it).

operationId cancelRecovery · needs read

  • request path

POST /v1/auth/challenge

Start a passkey sign-in: a one-time challenge for the company.

operationId startSignIn · needs public

POST /v1/auth/login

Finish a passkey sign-in; returns a 15-minute session token.

operationId signIn · needs public

POST /v1/auth/enrol

Enrol a person's passkey with the single-use enrolment an owner started: the new passkey signs the enrolment's secret.

operationId enrolPasskey · needs public

POST /v1/auth/invite

What an invite is for, from its secret: the company's address and name and the person; nothing is used up.

operationId readInvite · needs public

POST /v1/auth/guest

Try as guest: a read-only session (viewer, 15 minutes) for the demo company, made from demo data (no real money, no real company); no passkey, no e-mail.

operationId signInAsGuest · needs public

GET /v1/auth/oidc

Which sign-in providers this cloud offers besides the passkey (google, microsoft, apple), for the sign-in page. A person links one to their own membership first (Settings, while signed in with the passkey); a sign-in with it reads only.

operationId listSignInProviders · needs public

POST /v1/auth/oidc/{provider}/start

Start signing in to a company with a linked Google, Microsoft or Apple account: { tenant }. Answers the provider's URL (state, nonce, PKCE where documented) and a browser secret the page keeps until it finishes.

operationId startOidcSignIn · needs public

  • provider path

GET /v1/auth/oidc/{provider}/callback

Where Google or Microsoft sends the browser back: forwards the code and state to the console (in the address's fragment, which no server sees), where the page that started it finishes. Stores nothing.

operationId oidcCallback · needs public

  • provider path

POST /v1/auth/oidc/apple/callback

Where Apple posts the browser back (response_mode form_post): forwards the code and state to the console's fragment, as the GET callback does. Stores nothing; the ID token Apple posts along is not used (the code is exchanged and its token checked).

operationId appleOidcCallback · needs public

POST /v1/auth/oidc/{provider}/finish

Finish signing in with a linked account: { code, state, browser_secret }. Answers a 15-minute read-only session (read_only: true) for the person the account is linked to; 401 when it is linked to no one in that company.

operationId finishOidcSignIn · needs public

  • provider path

GET /v1/me/identities

The signed-in person's own linked sign-in accounts (Google, Microsoft, Apple: provider, verified e-mail if the provider gave one, when linked) and which providers this cloud offers.

operationId listMyIdentities · needs read

DELETE /v1/me/identities/{provider}

Unlink your own Google, Microsoft or Apple account: it signs you in no more.

operationId unlinkIdentity · needs read

  • provider path

POST /v1/auth/step-up/start

Start a fresh passkey check for sensitive settings (a signed-in person only): a one-time challenge for five minutes.

operationId startStepUp · needs read

POST /v1/auth/step-up

Finish the passkey check: { challenge_id, credential_id, assertion } signed with the signed-in person's own passkey. Answers a step-up token for five minutes, bound to this session; send it as x-purser-step-up on sensitive settings.

operationId finishStepUp · needs read

POST /v1/auth/logout

Sign out: every session of the signed-in person ends.

operationId signOut · needs read

GET /v1/me

Who is calling: the company, and the key's scopes or the person's role; approves says why a person may approve (cfo, or owner_without_cfo: an owner of a company with no CFO), null when they may not.

operationId getMe · needs read

Answer
{
  "$ref": "#/components/schemas/Me"
}

POST /v1/me/language

The signed-in person's own language for the pages (nl or en), or null to follow the company's.

operationId setMyLanguage · needs read

GET /v1/security/events

What happened to the company's access: owner recoveries, staged exports and their downloads (newest last).

operationId listSecurityEvents · needs admin

GET /v1/keys

The company's API keys (never their secrets); paginated (limit, cursor).

operationId listApiKeys · needs admin

POST /v1/keys

A new API key; returned once.

operationId createApiKey · needs admin · step-up: when the company asks again before sensitive changes: a session's passkey checked in the last five minutes

Request body
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "scopes": {
      "minItems": 1,
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "read",
          "sync",
          "admin",
          "propose"
        ]
      }
    },
    "expires_in_days": {
      "type": "integer",
      "minimum": 1,
      "maximum": 365
    }
  },
  "required": [
    "name",
    "scopes"
  ],
  "additionalProperties": false
}

DELETE /v1/keys/{id}

Revoke an API key.

operationId revokeApiKey · needs admin · step-up: when the company asks again before sensitive changes: a session's passkey checked in the last five minutes

  • id path

GET /v1/users

The company's people and their roles; paginated (limit, cursor).

operationId listUsers · needs admin

POST /v1/users

Add a person (owner, cfo, accountant, viewer); they then enrol a passkey with an enrolment an owner starts.

operationId addUser · needs admin · step-up: when the company asks again before sensitive changes: a session's passkey checked in the last five minutes

POST /v1/users/{id}/enrolment

Start a person's passkey enrolment: a single-use secret for 30 minutes (an owner's passkey: a signed-in owner only, once any owner has one). Also returns the invite link (the secret after the #, so opening it sends the secret to no server) and its QR code as SVG.

operationId startPasskeyEnrolment · needs admin · step-up: when the company asks again before sensitive changes: a session's passkey checked in the last five minutes

  • id path

GET /v1/users/{id}/passkeys

A person's passkeys (their ids and when each was enrolled).

operationId listUserPasskeys · needs admin

  • id path

DELETE /v1/users/{id}/passkeys/{credential}

Remove a passkey (a signed-in owner only): it signs in no more, and the person's sessions end. Never the last owner passkey.

operationId removeUserPasskey · needs admin · step-up: when the company asks again before sensitive changes: a session's passkey checked in the last five minutes

  • id path
  • credential path

POST /v1/users/{id}/erase

Erase a person's personal data (bookkeeping records are kept for 7 years).

operationId eraseUser · needs admin · step-up: when the company asks again before sensitive changes: a session's passkey checked in the last five minutes

  • id path

AI agents (MCP, OAuth)

Purser as a remote MCP server for AI clients, its connector tokens and its OAuth sign-in.

GET /v1/claude/connectors

The company's Claude connector tokens (never their secrets): name, whether it may propose payments, when made, when it expires, when last used, whether revoked.

operationId listConnectorTokens · needs admin

POST /v1/claude/connectors

Make a Claude connector token (a signed-in owner): { name, propose?, expires_in_days? }. It reads the books at /mcp; with propose it also files an invoice's payment for the CFO's approval, which only the CFO's Face ID gives. Returned once; only its hash is kept.

operationId createConnectorToken · needs admin · step-up: when the company asks again before sensitive changes: a session's passkey checked in the last five minutes

DELETE /v1/claude/connectors/{id}

Revoke a Claude connector token (a signed-in owner): Claude's connection with it, and every access token signed for it, ends at once.

operationId revokeConnectorToken · needs admin · step-up: when the company asks again before sensitive changes: a session's passkey checked in the last five minutes

  • id path

POST /mcp

Purser as a remote MCP server (Streamable HTTP; JSON answers, no session) for Claude: read the books, and with a token made to propose, file an invoice's payment for the CFO's approval. Never approves or pays. A Claude connector token (or an access token from /oauth/token) as Authorization: Bearer; the demo company's public token reads the demo company.

operationId mcp · needs read

POST /mcp/airwallex

The Airwallex sandbox (test money), read only, as a Code Mode MCP server (docs/codemode.md): two tools, search over a small OpenAPI document of the allowed reads and execute running a declarative plan of GET calls. Never writes, pays or converts. A Claude connector token (or an access token from /oauth/token) as Authorization: Bearer; not the demo company's public token.

operationId mcpAirwallex · needs read

GET /connect-ai

How to connect each AI client (Claude, ChatGPT, Cursor, VS Code, Gemini CLI, Windsurf) to /mcp: a tab per client with an exact config or a one-click install link.

operationId getConnectAiPage · needs public

GET /.well-known/oauth-protected-resource

OAuth protected resource metadata (RFC 9728) for /mcp: this cloud is its authorization server.

operationId getProtectedResourceMetadata · needs public

GET /.well-known/oauth-protected-resource/mcp

The same metadata at the path RFC 9728 derives from /mcp.

operationId getProtectedResourceMetadataForMcp · needs public

GET /.well-known/oauth-authorization-server

OAuth authorization server metadata (RFC 8414): registration, the consent page and the token endpoint; PKCE S256; public clients.

operationId getAuthorizationServerMetadata · needs public

POST /oauth/register

Dynamic client registration (RFC 7591) for a public client: { redirect_uris, client_name? }; its id is signed, nothing is stored.

operationId registerOAuthClient · needs public

GET /oauth/authorize

The consent page: connect Claude with a connector token made in Purser Cloud, or open the demo company (read only). PKCE S256 required.

operationId getOAuthConsent · needs public

POST /oauth/authorize

The consent page's answer: the form's own token (signed, bound to this request, ten minutes, good once), then a live connector token (or the demo), then back to the client with a one-time code (five minutes).

operationId answerOAuthConsent · needs public

POST /oauth/token

A code and its PKCE verifier for an access token (authorization_code, public client). The token names the connector token it was issued for, never its secret; revoking that ends it.

operationId getOAuthToken · needs public

Discovery

Machine-readable descriptions: this document, the A2A Agent Card and the API reference page.

GET /v1/openapi.json

This API, as OpenAPI 3.1.

operationId getOpenApi · needs public

GET /v1/openapi.read.json

The read API alone (every GET a read-scoped key may call), as OpenAPI 3.1.

operationId getReadOpenApi · needs public

GET /openapi.json

This API, as OpenAPI 3.1 (the same document as /v1/openapi.json).

operationId getOpenApiDocument · needs public

GET /api

The API reference: the OpenAPI document as one HTML page (no script).

operationId getApiReference · needs public

GET /.well-known/agent.json

The A2A Agent Card (Agent2Agent protocol): Purser's skills (read and propose; never approve), its auth scheme and where to call it.

operationId getAgentCard · needs public

GET /.well-known/agent-card.json

The same A2A Agent Card at the newer well-known name.

operationId getAgentCardAtNewName · needs public

Platform

The platform operator's routes (the platform admin token).

GET /v1/admin/companies

The companies on this cloud for the platform operator: each one's Airwallex account and status, the supplier payouts that moved and those waiting, and Purser's fees taken, from what the runners pushed (never a key or an account number).

operationId getV1AdminCompanies · needs platform

GET /v1/admin/security-log

The cloud's security event log for the platform operator, newest first (kind, since, limit up to 500): sign-ins and their failures, refusals, rate-limit hits, the admin's actions, key, passkey and policy changes, webhook signature failures, tamper alarms and the alarms they raised. Ids and networks only; never a secret.

operationId getV1AdminSecurityLog · needs platform

POST /v1/admin/tenants

Create a company and its first owner; returns the owner's API key once.

operationId postV1AdminTenants · needs platform

POST /v1/admin/tenants/{id}/recovery

An owner lost their passkey. The first of two platform admins, after checking out of band who asks: { owner_id, check } (check: video_call, in_person or phone_callback). Answers 202 with the request (a day long, one open per owner); no key is issued until a second, different named admin key approves it. The legacy admin token takes no part. The company's webhook and security events record it.

operationId postV1AdminTenantsByIdRecovery · needs platform

  • id path

POST /v1/admin/tenants/{id}/recovery/{request}/approve

The second platform admin approves an owner's recovery request: a named admin key other than the one that asked, while the request is open. Only then is the one-time recovery key issued for that owner, good for one day and one passkey enrolment of that owner; redeemed, the owner's old passkeys and sessions end, and a new approval key they enrol cools off before it approves. One open recovery per company; the company's webhook and security events record both admins.

operationId postV1AdminTenantsByIdRecoveryByRequestApprove · needs platform

  • id path
  • request path

POST /v1/try/admin

The hands-on deployment's controls (the platform admin's token): { op: get } the switches and today's counters; { op: set, key, value } one switch within its ceiling; { op: token, pool, until } a new event or jury token, shown once.

operationId postV1TryAdmin · needs platform

POST /v1/try/ops

The owner's read-only aggregates (the platform admin's token): starts and finishes in the last hour and day, errors by kind, p50 and p95 latency (bucket bounds), Claude spend today against the caps, who read the invoices, the switches (tokens as a count), the feedback box. No addresses, no ids.

operationId postV1TryOps · needs platform

Hands-on demo

The hands-on demo's own routes (/try): a visitor's test company, for a day, test money.

GET /v1/try/books/effect

The effect of one invoice on the books (the hands-on demo): { effect: { currency, entries, period, quarter, pnl: { before, after }, vat: { before, after }, vat_notice } | null, t0 }. Computed by the ledger's own report code over the company's posted lines; null until the invoice is in the books. ?invoice_no=&vendor=.

operationId getV1TryBooksEffect · needs read

GET /v1/try/scenarios/{seed}

The scenario a seed picks (the hands-on demo): { seed, id, title, company, files }. The right answer is not here; it comes with the engine's answer when the scenario is played.

operationId getV1TryScenariosBySeed · needs read

  • seed path

POST /v1/try/scenarios/{seed}

Play the scenario a seed picks in your test company: its invoices go through the engine's inbox in order, as uploads (test invoices, fake). Answers { seed, id, title, company, setup (files filed before the last), answer (the engine's answer to the last, as POST /v1/engine/documents), decided: { action, why }, expect: { action, reason } }; 400 in the engine's words when it refuses a file (a test company's limit of 8 documents).

operationId postV1TryScenariosBySeed · needs admin

  • seed path

POST /v1/try/negotiate

Agents negotiate an early-payment discount on a test invoice (a test company only): Purser's Sourcing agent and a simulated supplier's agent, both Claude, at most 4 signed offers, each checked by the CFO's rails and policy in code. Answers the offers, the outcome (agreed, escalated to the CFO, no deal), the agreement and its SHA-256, and compose. Claude off or capped: the recorded negotiation, labelled. 3 a company.

operationId postV1TryNegotiate · needs admin

POST /v1/try/negotiate/agreed

File a negotiation's agreed (or escalated) terms, { agreement_sha256, compose, turns, invoice_id?, agreement, keys, offers } as negotiated: the agreed invoice, ready to sign, replacing invoice_id's. Only terms this company negotiated, filed once; the signed offers must form one chain, each signed by its agent's key, ending at the offer the agreement names (409 broken_chain otherwise). The agreement and the offers' hashes are kept with the invoice and carried in its proof. Answers { invoice, superseded }.

operationId postV1TryNegotiateAgreed · needs admin

POST /v1/try/start

Start a test company of your own on Purser's engine (test money, a simulated bank, deleted after 24 hours): { token? } (an event or jury token). With the switch turnstile on, also { turnstile } (the Turnstile widget's token), checked with Cloudflare's siteverify (403 { code: turnstile } when refused). Answers 201 { tenant, session, visitor_token, expires_at, session_expires_at, company, pool, mode }; 429 { code: limit } over a limit; 503 { code: paused } while the demo is paused.

operationId postV1TryStart · needs public

POST /v1/try/challenge

The bot check before a start: { required: false } while it is off; else { required: true, challenge, difficulty (leading zero bits of SHA-256), expires_at }. The browser finds a nonce so that SHA-256(challenge + ":" + nonce) has that many leading zero bits, and sends { proof: { challenge, nonce } } with POST /v1/try/start.

operationId postV1TryChallenge · needs public

POST /v1/try/session

A fresh 15-minute session for your test company: { tenant_id, visitor_token }. Answers { session, expires_at (the session's end), company_expires_at }; 410 { code: gone } once the company was deleted. Limited per company, never per address.

operationId postV1TrySession · needs public

GET /v1/try/counter

The hands-on demo's live counter, counted from its own tallies (no ids, no addresses): { played, caught, signed, without_signature, since, counted_at, line }. without_signature is counted, never typed. Up to about 60 seconds old.

operationId getV1TryCounter · needs public

POST /v1/try/feedback

Anonymous feedback on the hands-on demo: { choice: useful | unclear | broken, note? (at most 200 characters kept) }. Kept with its hour only: no id, no address, no browser. Never shown back publicly. 3 an hour per network.

operationId postV1TryFeedback · needs public

GET /v1/try/ops

The owner's read-only page during judging. The page holds no figure; it asks for the admin token and reads POST /v1/try/ops.

operationId getV1TryOps · needs public

GET /v1/try/stage/stats

Stage mode's wall (the finals): the event pool's counts since a moment (?since=ISO 8601, at most 24 hours back, read to the minute) and the latest steps in plain words, with no company, name, id or address: { live, test_money, since, counted_at, counts: { started, read_by_claude, signed, paid, refused }, ticker: [{ at, kind, text }] }. live false and zeros while the event pool is off (the switch starts off, or no live event token). About 2 seconds old; 120 a minute per address.

operationId getV1TryStageStats · needs public

POST /v1/try/stage/qr

Stage mode's QR code with the presenter's event token: { token } (made with POST /v1/try/admin { op: token, pool: event }). Answers { url_shown, size, d, until }: the QR code's side and path of /try?pool=event#e=<token> on this host, and the token's end; 400 { code: not_event_token } when it is not a live event token. The token is checked by its SHA-256 and kept nowhere.

operationId postV1TryStageQr · needs public

GET /v1/try/negotiate/recorded

The recorded negotiation (public), labelled, its rails checked live; nothing to sign. ?why=limit|paused|start.

operationId getV1TryNegotiateRecorded · needs public

Site

Icons and pages.

GET /favicon.ico

Purser's icon (ICO, 32 and 48 px).

operationId getFaviconIco · needs public

GET /favicon.svg

Purser's icon (SVG).

operationId getFaviconSvg · needs public

GET /apple-touch-icon.png

Purser's icon for a home screen (PNG, 180 px).

operationId getAppleTouchIconPng · needs public

GET /icon.png

Purser's icon (PNG, 512 px): the MCP server's and the OAuth sign-in's.

operationId getIconPng · needs public

Schemas

Invoice
{
  "type": "object",
  "required": [
    "id",
    "version"
  ],
  "additionalProperties": true,
  "description": "A supplier invoice as the company's records hold it (the runner's or the engine's copy, versioned).",
  "properties": {
    "id": {
      "type": "string",
      "description": "Like AP-0004"
    },
    "version": {
      "type": "integer"
    },
    "vendor": {
      "type": "string"
    },
    "invoice_no": {
      "type": "string"
    },
    "due_date": {
      "type": "string",
      "description": "YYYY-MM-DD"
    },
    "currency": {
      "type": "string"
    },
    "total": {
      "type": "string",
      "description": "A decimal amount, like 1309.00"
    },
    "status": {
      "type": "string"
    }
  }
}
InvoiceDetail
{
  "allOf": [
    {
      "$ref": "#/components/schemas/Invoice"
    },
    {
      "type": "object",
      "properties": {
        "earlier_versions": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "version": {
                "type": "integer"
              },
              "replaced_at": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  ]
}
InvoicePage
{
  "type": "object",
  "required": [
    "items",
    "next_cursor"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Invoice"
      }
    },
    "next_cursor": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Send as cursor for the next page; null on the last page"
    }
  }
}
Proposal
{
  "type": "object",
  "required": [
    "id",
    "kind",
    "status",
    "terms_sha256"
  ],
  "additionalProperties": true,
  "description": "A payment proposal: the exact terms the CFO's passkey signs. PENDING_APPROVAL waits for the CFO; only their passkey moves it on.",
  "properties": {
    "id": {
      "type": "string",
      "description": "Like P-0009"
    },
    "kind": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "description": "PENDING_APPROVAL, APPROVED, EXECUTED, FAILED, REJECTED or EXPIRED"
    },
    "terms_sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "challenge": {
      "type": "string",
      "description": "What the CFO's passkey signs over the terms"
    },
    "facts": {
      "type": "array",
      "items": {
        "type": "array",
        "prefixItems": [
          {
            "type": "string"
          },
          {
            "type": "string"
          }
        ],
        "minItems": 2,
        "maxItems": 2
      },
      "description": "[label, value] pairs a person reads"
    },
    "warnings": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  }
}
ProposalAnswer
{
  "type": "object",
  "required": [
    "proposal"
  ],
  "properties": {
    "proposal": {
      "$ref": "#/components/schemas/Proposal"
    }
  }
}
ProposeAnswer
{
  "type": "object",
  "required": [
    "proposal"
  ],
  "additionalProperties": true,
  "description": "The filed proposal. Nothing is paid until the CFO approves these exact terms with their passkey, except within a pay-alone limit the CFO set (off unless set), which `alone` then names.",
  "properties": {
    "proposal": {
      "$ref": "#/components/schemas/Proposal"
    },
    "alone": {
      "type": "object"
    },
    "settled": {
      "anyOf": [
        {
          "type": "object"
        },
        {
          "type": "null"
        }
      ]
    }
  }
}
EngineInvoice
{
  "type": "object",
  "required": [
    "id",
    "status",
    "payable",
    "vendor",
    "currency",
    "total"
  ],
  "additionalProperties": true,
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "type": "string"
    },
    "status_words": {
      "type": "string"
    },
    "payable": {
      "type": "boolean",
      "description": "Whether a payment can be proposed now"
    },
    "vendor": {
      "type": "string"
    },
    "invoice_no": {
      "type": "string"
    },
    "currency": {
      "type": "string"
    },
    "total": {
      "type": "string"
    },
    "due_date": {
      "type": "string"
    },
    "findings": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "level": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      }
    },
    "proposal": {
      "anyOf": [
        {
          "$ref": "#/components/schemas/Proposal"
        },
        {
          "type": "null"
        }
      ]
    }
  }
}
EngineInvoices
{
  "type": "object",
  "required": [
    "items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/EngineInvoice"
      }
    }
  }
}
Me
{
  "type": "object",
  "required": [
    "tenant",
    "kind",
    "scopes"
  ],
  "additionalProperties": true,
  "properties": {
    "tenant": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "slug": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "language": {
          "type": "string"
        }
      }
    },
    "kind": {
      "type": "string",
      "enum": [
        "key",
        "session"
      ]
    },
    "scopes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "read",
          "sync",
          "admin",
          "propose"
        ]
      }
    },
    "role": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    }
  }
}
Error
{
  "type": "object",
  "required": [
    "error",
    "code"
  ],
  "properties": {
    "error": {
      "type": "string",
      "description": "What went wrong, for a person"
    },
    "code": {
      "type": "string",
      "enum": [
        "bad_request",
        "unauthorized",
        "forbidden",
        "not_found",
        "method_not_allowed",
        "conflict",
        "too_large",
        "unsupported_media_type",
        "unprocessable",
        "rate_limited",
        "internal",
        "upstream",
        "step_up_required"
      ],
      "description": "Stable, for a program"
    }
  }
}