Connect to Xero
Connect PlaidCloud to Xero’s Accounting API to pull chart of accounts, contacts, invoices, credit notes, payments, manual journals, and more with no query to hand-write, and post documents back. This guide covers the connection, the import step, and the post step.
Prerequisites
Section titled “Prerequisites”You need, in Xero:
- A Xero login with access to the organisation you want to read and post to.
- Permission to authorize a connected app for that organisation — Xero asks you to approve the grant during setup.
That is the whole list. PlaidCloud registers the OAuth app, so there is no developer account, client id, or client secret to obtain.
Create the Connection
Section titled “Create the Connection”-
Open Tools > Connections and click
New Connection. -
Choose REST - Xero from the menu.
-
Give the connection a name, for example
Xero Prod. -
Click Connect to Xero, sign in to Xero, and approve access to the organisations you want PlaidCloud to reach.
-
Connection Status now reports how many organisations the grant covers. Pick the one this connection targets from Organisation.
-
Click
Create.
Smoke-Test the Connection
Section titled “Smoke-Test the Connection”-
Add a Xero: Import Entity step to a workflow.
-
Set Xero Connection to your connection, Entity Type to
Chart of Accounts, and Target Table to a scratch table. -
Run the step (see Running one step in a workflow).
A populated target table confirms the grant and the organisation selection are both correct. An error names the problem — an expired grant, or an organisation the login no longer has access to.
Import Data
Section titled “Import Data”-
Add a Xero: Import Entity step and set Xero Connection and Target Table.
-
Set Entity Type to the record you want: Chart of Accounts, Contacts, Invoices, Credit Notes, Payments, Manual Journals, Bank Transactions, Items, Tracking Categories, Tax Rates, or Currencies.
-
Narrow the pull with the optional filters — Status (a single Xero status such as
AUTHORISEDorPAID), Date From and Date To (YYYY-MM-DDbounds on the entity’s date), and Updated After (a modified-since cutoff). -
Run the step and check the target table.
Post Documents
Section titled “Post Documents”The Xero: Post Document step posts five document types through the same shared write pipeline every ERP post step uses: ManualJournal, Invoice, Bill, Payment, and CreditNote.
-
Build a header table — one row per document — with columns for
ref(your document identifier),doc_type(ManualJournal,Invoice,Bill,Payment, orCreditNote),posting_date, and, where the document type needs them,currency_id,party_id(the Xero contact),memo, anddue_date. A Payment also takestotal_amt,deposit_account_id,bank_account_id, andlinked_invoice_id; a CreditNote takescredit_note_type(ACCRECCREDITfor sales, the default, orACCPAYCREDITfor purchases). A single batch can mix document types — PlaidCloud partitions it bydoc_typebefore posting. -
Build a lines table — one or more rows per
ref, each carrying thatref— shaped to the document type:Doc Type Line Columns ManualJournal account_id,debit,credit, and optionallyclass_id/department_idfor trackingInvoice item_id,qty,unit_price,amountBill account_id,amountCreditNote item_id,qty,unit_price,amountPayment linked_txn_id(the invoice the line applies to),amounttax_typeandmemoare optional on any line. -
Add a Xero: Post Document step, set Xero Connection, Environment (which of the connection’s PlaidCloud environments to post through), Header Table, Lines Table, and a Result Table.
-
Map your own column names onto those fields on the Header Fields and Line Fields tabs.
-
Leave Test Only Mode checked and run the step — PlaidCloud builds and checks every document without a ledger claim and without posting anything.
-
Review the result table (one row per document:
ref,doc_type,natural_key,xero_id,status,message). Fix anyerrorrow and re-validate. -
Uncheck Test Only Mode and run again to post for real. Leave Continue posting remaining documents if one document fails checked unless you want a batch to stop dead on its first failed document.
How Posting Works
Section titled “How Posting Works”Each document is claimed in PlaidCloud’s idempotency ledger before it is submitted, so a re-run never posts a document that already reached posted. The ledger key is prefixed by document type, so an invoice and a bill sharing the same ref never collide even though Xero posts both through the same endpoint.
Where an outcome is ambiguous — a timeout, a dropped response — PlaidCloud queries Xero back by the document number it stamped, and treats a match as proof only when the document is in a terminal posted status. Xero’s invoice and credit note numbers are not guaranteed unique, so a draft, voided, or duplicate-numbered match is quarantined rather than recorded as this write’s outcome.
Capability Limits — Read Before Posting Live
Section titled “Capability Limits — Read Before Posting Live”Related
Section titled “Related”- Xero REST Connector — field reference.
- Xero: Import Entity
- Xero: Post Document
- Review ERP Post History — the standing record of every Xero post attempt and its live state.
- Create and Manage a Connection