Guides / Accounts payable / Xero
How to automate accounts payable in Xero with Hubdoc and n8n
Let Hubdoc, which comes with Xero, capture and code your bills. Add purchase order matching and review alerts with n8n. Adapted from the workflow that cut a NetSuite team’s weekly AP from 3 hours to 10 minutes.
Who this is for
Small finance teams on Xero who raise purchase orders and want every bill checked against one before it’s approved.
No purchase orders? If each supplier always maps to one account, Hubdoc’s supplier rules on their own may be all you need. Set those up and skip the n8n part.
What gets automated
- Capture
- Code by supplier rule
- Publish to Xero
- Match to PO
- Flag exceptions
- Approve in Xero
- Ready to pay
The first three steps run in Hubdoc. Matching and alerts run in n8n.
What you need
| Service | What it does | What to set up |
|---|---|---|
| Xero | Holds purchase orders and bills | A plan with bills and purchase orders |
| Hubdoc | Captures bills, applies supplier rules, publishes to Xero with the document attached | Included with Xero’s Starter, Standard and Premium plans in Singapore. Connect it to Xero and set up supplier rules. |
| n8n | Matches new bills to POs and sends alerts | n8n Cloud, or the free self-hosted edition |
| Xero API app | Lets n8n read bills and purchase orders | A web app in the Xero Developer portal, connected through n8n’s Xero credential, with read-only access. Xero’s free Starter tier allows up to 5 connected organisations and 1,000 API calls a day. Custom Connections are not available in Singapore. |
| Slack | Alerts the reviewer | Any plan |
n8n’s built-in Xero node covers contacts and invoices (bills are invoices in Xero’s API). Reading purchase orders needs n8n’s HTTP Request node, using the same credential. Xero changed its API pricing in March 2026, so check developer.xero.com/pricing for current limits.
Step by step
-
Send every bill to Hubdoc
Give suppliers your Hubdoc email address, or forward bills to it. Hubdoc also accepts uploads and photos from its mobile app.
-
Set a rule for each supplier
In Hubdoc, save a supplier rule with the default account, tax rate and tracking category, and choose how bills publish to Xero. Rules apply one account per supplier, so leave suppliers whose bills span several accounts for manual coding.
-
Hubdoc publishes the bill to Xero
Hubdoc reads the supplier, date, amount and GST, and publishes the bill to Xero with the original document attached.
-
n8n matches it to a purchase order
On a schedule, n8n picks up new bills through the Xero API and looks up approved purchase orders. A bill matches when its reference quotes the PO number, or when the supplier and total match a PO exactly. Hubdoc reads totals rather than line items, so matching happens at the bill level.
-
Exceptions go to a person
If there’s no exact match, or the bill’s account differs from the PO’s, n8n sends a Slack message with a link to the bill. Nothing is guessed.
-
Approve in Xero
A person reviews each bill and approves it in Xero before it’s paid.
Test before you rely on it
- Run 20 recent bills through Hubdoc and check what it reads correctly.
- Check how bills arrive in Xero in your setup. You want them waiting for approval, not ready to pay.
- Watch for documents published as the wrong type, such as a bill arriving as a credit note.
Where the controls sit
- Every bill is approved by a person in Xero before it’s paid.
- Only exact matches go through. Everything else goes to a person, with a Slack alert.
- n8n has read-only access to Xero.
Using NetSuite? Read the NetSuite version, which reads line items with the Gemini API.