Xero and QuickBooks
Agents in Xero or QuickBooks Online ask before they approve or pay a bill, post a journal or change bank details, and the approver sees what the ledger knows.
Xero and QuickBooks Online both let outside agents work in the books: Xero through its MCP server and agent toolkit, Intuit through its QuickBooks MCP server, and both through their APIs. An agent can enter a bill, record a payment, post a journal or change where a supplier is paid. Deliverd puts a person, or a rule you wrote, in front of each of those, and keeps the record of who agreed.
The finance actions
Every write an agent makes to the books is one of these, with the same fields whichever ledger it went to: ledger, tool, amount, currency, counterparty, reference, recordId, and what Deliverd found in the ledger: newCounterparty, closedPeriod, the masked bank details before and after, and checks (a likely duplicate, a bill much larger than usual, the last three). A read, such as listing invoices or running a report, asks nobody.
| Action | What it covers |
|---|---|
finance.approve_bill | Approve a bill for payment |
finance.record_payment | Record a payment |
finance.post_journal | Post a journal |
finance.bank_transaction | Post a bank transaction |
finance.change_supplier_bank_details | Change a supplier's bank details |
finance.send_invoice | Issue or send an invoice |
finance.issue_credit_note | Issue a credit note or refund |
finance.approve_payroll | Approve payroll |
finance.void_record | Void or delete a ledger record |
finance.ledger_write | Change the ledger |
A QuickBooks bill is payable as soon as it is saved, so creating one is finance.approve_bill. A Xero bill is only payable once approved, so a draft or one sent for approval is finance.ledger_write, and approving it is finance.approve_bill.
1. Connect the ledger
An owner, administrator or agent admin opens Xero or QuickBooks Online under Connect and signs in on the ledger's own page, choosing the organisation or company. Tokens are kept sealed and refreshed by Deliverd; no agent ever holds them. Each connection shows a gateway address for agents and what Deliverd does with the ledger's events.
2. Write the rules
The "Agents in the books" starter kit (under Kits) adds these as draft rules: a supplier's bank details always need two people, bills and payments of 5,000 or more need two, a new supplier or a locked period always asks, and every other bill, payment and journal needs one person. Or write your own on the same fields. Gate policy rules apply on Business Starter, Business and Enterprise; without them every finance action goes to a person.
deliverd.policy.json
{
"name": "Agents in the books",
"rules": [
{
"name": "Supplier bank details",
"priority": 10,
"effect": "require_human",
"match": { "actions": ["finance.change_supplier_bank_details"] },
"params": { "requiredApprovals": 2, "approvers": ["finance-leads"] },
"explanation": "Two people, and the first rings the supplier on a number already on file."
},
{
"name": "Large bills and payments",
"priority": 20,
"effect": "require_human",
"match": {
"actions": ["finance.approve_bill", "finance.record_payment"],
"input": { "amount": { "gte": 5000 } }
},
"params": { "requiredApprovals": 2, "approvers": ["finance-leads"] }
},
{
"name": "Small bills from suppliers we know",
"priority": 30,
"effect": "allow",
"match": {
"actions": ["finance.approve_bill"],
"input": { "amount": { "lt": 250 }, "newCounterparty": { "eq": false } }
}
}
]
}newCounterparty and closedPeriod are set only when Deliverd could read the ledger. A rule that keys on them never matches on a guess: if the ledger did not answer, the field is left out and the next rule decides.
3. Point the agent through Deliverd
The ledger gateway
For an agent that calls the ledger's API: call /api/gateway/ledger/<connection>/<path> with the agent's own Deliverd key (gates:write and gates:execute) instead of the ledger. Reads pass straight through. A write is a finance action first, and only a yes reaches the ledger; a no comes back as 403 with the reason and the approval link. Deliverd-Session scopes a retry, as on the HTTP gateway (AI gateways).
# Xero: the path after the connection is Xero's own.
curl -X POST "$DELIVERD_URL/api/gateway/ledger/$CONNECTION/api.xro/2.0/Payments" \
-H "Authorization: Bearer $DELIVERD_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "Invoice": { "InvoiceID": "…" }, "Account": { "Code": "090" }, "Amount": 1200 }'
# QuickBooks Online: the company is already in the connection.
curl "$DELIVERD_URL/api/gateway/ledger/$CONNECTION/query?query=select%20*%20from%20Bill"In front of an MCP server
For Xero's or Intuit's MCP server: run it behind the MCP gate from the agent hooks pack with --ledger xero or --ledger quickbooks. Every tool that changes the books becomes a finance action with its amount and counterparty; reads go through untouched. The gate itself runs where the agent runs and holds no ledger credentials of its own.
.mcp.json
{
"mcpServers": {
"xero": {
"command": "node",
"args": [".deliverd/mcp-gate.mjs", "--ledger", "xero", "--", "npx", "-y", "@xeroapi/xero-mcp-server@latest"],
"env": { "DELIVERD_API_KEY": "dlv_…", "XERO_CLIENT_ID": "…", "XERO_CLIENT_SECRET": "…" }
}
}
}From your own code
For an agent built with Xero's agent toolkit or your own tools: the same map is in the SDKs. classifyLedgerTool (TypeScript, @deliverd/sdk/adapters) and classify_ledger_tool (Python, deliverd.ledgers) turn a tool name and its arguments into the finance action, or nothing for a read.
import { Deliverd } from "@deliverd/sdk";
import { classifyLedgerTool } from "@deliverd/sdk/adapters";
const deliverd = new Deliverd();
const call = classifyLedgerTool("quickbooks", toolName, toolArgs);
if (call) {
const gate = await deliverd.gates.check({
actionId: call.actionId,
input: call.input,
externalId: `${runId}:${toolName}:${call.input.recordId ?? call.input.reference ?? ""}`,
description: call.summary,
});
if (!gate.canExecute) return `Not done: ${gate.status}`;
}
// … make the callfrom deliverd import Deliverd
from deliverd.ledgers import classify_ledger_tool
call = classify_ledger_tool("xero", tool_name, tool_args)
if call is not None:
gate = Deliverd().gates.check(
call.action_id,
call.input,
f"{run_id}:{tool_name}:{call.input.get('recordId', '')}",
description=call.summary,
)Approving Xero bills here
Switch on Approve bills here on a Xero connection and a bill sent for approval in Xero (Awaiting approval) becomes a Deliverd approval, with the supplier's last bills and any duplicate on the card. A yes approves it in Xero within five minutes; a no leaves it awaiting approval with a note in its history. If the bill changed after it was asked about, it is not approved and the record says why. The person who connected Xero is the requester, so they cannot approve these themselves: name other approvers in the rules.
Watching for changes made around Deliverd
With Watch for changes on, the ledger's events reach Deliverd and anything that changes the books without an approval behind it shows under Agents → Agents, on the page of changes made with no approval behind them: a Xero bill approved, an invoice paid, a credit note issued; a QuickBooks bill, payment, journal entry, purchase, transfer or credit saved. A supplier's or vendor's bank details changing is always flagged, with the masked account before and after. Xero names who made a change, so people you list are not flagged; QuickBooks' events do not say who, so every change is.
What your administrator sets up
- Xero: an app in the Xero developer portal, with the redirect
https://<your Deliverd>/api/integrations/ledgers/xero/callbackand a webhook to/api/webhooks/ledgers/xero(contacts, invoices and credit notes). Its client id, secret and webhook key go inXERO_CLIENT_ID,XERO_CLIENT_SECRETandXERO_WEBHOOK_KEY. - QuickBooks Online: an app in the Intuit developer portal, with the redirect
/api/integrations/ledgers/quickbooks/callbackand a webhook to/api/webhooks/ledgers/quickbooks. Its keys go inQUICKBOOKS_CLIENT_ID,QUICKBOOKS_CLIENT_SECRETandQUICKBOOKS_WEBHOOK_VERIFIER, andQUICKBOOKS_ENVIRONMENTsayssandboxorproduction. - On Deliverd's own service this is done for you once the connections are live.
Try it on your own agent.
Free to start, no card. Sign up with Google, Microsoft or GitHub, and the first page after hands you an API key.