You can connect ERPNext and Xero with a two-way sync using either a direct API integration or an automation layer like n8n. ERPNext pushes changes out through webhooks and pulls data back through its REST API; Xero receives and returns data through its OAuth 2.0 accounting API. The hard part is not the plumbing, it is deciding what belongs in each system.
Short answer
To integrate ERPNext with Xero, authenticate against Xero's accounting API using OAuth 2.0, then move records both ways: ERPNext fires webhooks on document events and reads or writes Xero through the API, while Xero fires webhooks back on invoices, contacts, and bills. Most teams build this with n8n or a small custom app rather than a ready-made connector, because the field mapping is business-specific.
I am Manoj, an ERPNext implementation consultant at Mith Tech in Bengaluru, and I get this question from Indian SMBs who run operations in ERPNext but keep their accountant on Xero. This guide is the playbook I actually use: how the two APIs talk, what to sync and what to leave alone, and the honest question of whether you should integrate at all or just migrate. My honest take: a two-way sync is real engineering, not a checkbox, and half the businesses that ask for one are better served by moving fully into ERPNext instead.
What is ERPNext Xero integration?
ERPNext Xero integration is the practice of wiring ERPNext, an open-source ERP, to Xero, a cloud accounting platform, so that records like contacts, invoices, and payments stay consistent across both. Data flows through each product's API rather than manual re-entry, and a well-built link keeps the two ledgers agreeing without a person copying numbers between screens.
The reason Indian SMBs want this is division of labour. Operations, inventory, manufacturing, and sales live comfortably in ERPNext, which is free and open source under the GPLv3 licence. Meanwhile the external accountant or bookkeeper already works in Xero and does not want to move. Integration lets each side keep its preferred tool while the invoices and payments reconcile automatically. Whether that is worth the engineering is the real question, and I will come back to it.
Skimmable summary: ERPNext Xero integration keeps contacts, invoices, and payments consistent across both platforms through their APIs instead of manual re-entry.
How does ERPNext connect to Xero?
ERPNext connects to Xero through two REST APIs that never talk directly — an integration layer sits between them. ERPNext exposes its own REST API and fires webhooks on document events. Xero exposes its accounting API secured by OAuth 2.0. A middle piece (n8n or a custom app) authenticates to both, listens for changes, maps fields, and writes records across.
Here is how the halves compare, so you know what each side gives you:
| Capability | ERPNext side | Xero side |
|---|---|---|
| Auth model | API key + secret (token key:secret header) | OAuth 2.0 with rotating refresh tokens |
| Push changes out | Webhooks on DocType events | Webhooks on invoices, contacts, bills |
| Pull / write data | REST API on any DocType | Accounting API endpoints |
| Multi-entity | Companies within one instance | Tenant selected via Xero-Tenant-Id header |
| Licence model | Open source, self-hostable | Subscription SaaS (pricing varies by edition — check the vendor's official page) |
The one detail that shapes every design: Xero's webhooks are deliberately lean. When an invoice changes, Xero sends you the resource ID and event type, not the full invoice. Your integration verifies the signature, then calls Xero back to fetch the actual record. Plan for that round trip.
Skimmable summary: The two REST APIs connect through a middle layer that authenticates to both, listens for webhooks, maps fields, and writes records across.
How do I set up a two-way sync between ERPNext and Xero?
Setting up a two-way sync means building four moving parts in order: authentication to both systems, a field map, an ERPNext-to-Xero flow, and a Xero-to-ERPNext flow. Do not start with the data flows. Start with credentials and mapping, because a wrong field map corrupts both ledgers faster than any code bug.
Authenticate to both systems
Generate an API key and secret in ERPNext under the user's API Access, and pass them as an Authorization: token key:secret header. On the Xero side, register an app in the Xero developer portal and complete the OAuth 2.0 authorization-code flow. Xero access tokens are short-lived, so your integration must store the refresh token and renew automatically — never hardcode a token that will expire.
Decide the system of record for each object
Before mapping anything, write down which system owns each data type. A common split: ERPNext owns customers and items, Xero owns the chart of accounts and tax rates. Whoever owns an object is the only side allowed to create it; the other side mirrors. This single decision prevents duplicate-record chaos.
Build the field map
Map ERPNext fields to Xero fields explicitly — customer to contact, sales invoice to invoice, payment entry to payment. Match tax codes and account heads carefully, because Indian GST rates and HSN handling in ERPNext will not line up with Xero's tax setup by default. Store the cross-reference IDs (ERPNext name ↔ Xero GUID) so updates target the right record.
Wire the ERPNext-to-Xero flow
Create an ERPNext webhook (Integrations > Webhook) that fires on the event you care about, such as a Sales Invoice on_submit. Point it at your integration endpoint. The endpoint receives the ERPNext payload, looks up or creates the matching Xero contact, then posts the invoice to Xero's accounting API.
Wire the Xero-to-ERPNext flow
Subscribe to Xero webhooks for the events you need. Because the payload carries only an ID, your endpoint must verify the HMAC-SHA256 signature on the raw body, return a fast 200, then call Xero back for the full record and write it into ERPNext through the REST API.
Add idempotency, retries, and logging
Guard every write so a replayed webhook does not create a duplicate — check your stored ID cross-reference first. Add retry logic for transient failures and respect Xero's rate limits (roughly a per-minute and per-day cap per tenant, plus an app-wide ceiling). Log every sync so you can reconcile when something drifts.
Skimmable summary: Build in order — authenticate both sides, pick a system of record per object, map fields, then wire each direction with signature checks, idempotency, and retries.
Should I build the sync with n8n or a custom app?
Both n8n and a custom Frappe app can run the sync; the choice comes down to volume and logic complexity. n8n, an open-source automation tool, gives you a visual, self-hosted layer that handles the OAuth refresh, retries, and HTTP calls without much code. A custom app buys you tighter control when the mapping logic grows beyond what a visual flow keeps readable.
Here is how I decide on client projects:
| Factor | Favours n8n | Favours a custom Frappe app |
|---|---|---|
| Volume | Low to moderate document counts | High-throughput, frequent syncs |
| Logic | Straightforward field mapping | Complex conditional rules, many edge cases |
| Team | Non-developers will maintain it | You have Frappe/Python capacity in-house |
| Speed to live | Fastest to a working prototype | Slower to start, cleaner at scale |
| Hosting | Self-host alongside ERPNext | Ships inside your bench as an app |
For most Indian SMBs I steer toward n8n first. It is free to self-host, it keeps the flow visible to non-developers, and you can graduate to a custom app later if volume demands it. If you want the full n8n setup, I wrote a dedicated walkthrough in ERPNext n8n integration. The Frappe and ERPNext platform itself gives you the REST API and webhook framework either way.
Skimmable summary: Use n8n for low-to-moderate volume and simple mapping; move to a custom Frappe app when throughput or conditional logic grows.
What should I keep in ERPNext versus Xero?
Keep the operational and inventory side in ERPNext and the statutory ledger in Xero, if you keep both at all. ERPNext is stronger at orders, stock, manufacturing, and CRM, while Xero is a focused accounting tool. Draw the line at the invoice: ERPNext authors the transaction, Xero records the accounting entry. Never let both create the same object.
The cleanest split I use looks like this. ERPNext owns customers, suppliers, items, sales and purchase orders, stock movements, and the sales invoice as a business document. Xero owns the chart of accounts, bank reconciliation, and the formal ledger your accountant files from. Payments are the one area to think hardest about — decide whether a payment is recorded first in ERPNext and mirrored to Xero, or the reverse, and hold that rule everywhere.
Two systems means two truths — plan for it
Every duplicated data type is a future reconciliation problem. If a customer's address can be edited in both ERPNext and Xero, the two will eventually disagree. Pick one authoring side per object and make the other read-only for that field. This discipline, not the code, is what keeps a two-way sync trustworthy.
Skimmable summary: ERPNext owns operations, inventory, and the sales invoice as a document; Xero owns the chart of accounts and the statutory ledger — never both authoring the same object.
Should I integrate ERPNext with Xero or migrate off Xero entirely?
Integrate when Xero genuinely does a job ERPNext cannot, and migrate when Xero is only holding a ledger that ERPNext could hold natively. ERPNext has a full double-entry accounting module — GST-ready, multi-currency, with financial statements — so for many Indian SMBs Xero is a duplicate ledger rather than a unique capability.
Ask three questions. First, does anyone outside your team depend on Xero, such as an external accountant who refuses to switch? Second, does Xero hold history or a workflow you cannot reproduce in ERPNext? Third, is the sync engineering and its ongoing reconciliation cheaper than moving once? If Xero is mostly a habit, migrating removes an entire category of drift, duplicate-record, and rate-limit problems forever. I cover the move end to end in Xero to ERPNext migration.
The pattern I see most often
The businesses happiest with a permanent integration are those whose accountant is contractually on Xero. The businesses happiest six months later are usually the ones who migrated fully into ERPNext and stopped maintaining two ledgers. Be honest about which camp you are in before you build.
If your accounting habit is actually QuickBooks rather than Xero, the same reasoning applies — see ERPNext QuickBooks integration for that variant.
Skimmable summary: Integrate when Xero does something ERPNext cannot or an external accountant requires it; migrate when Xero is just a duplicate ledger ERPNext could hold natively.
Frequently asked questions
Is there a ready-made ERPNext Xero connector?
There are third-party automation platforms and connector services that advertise ERPNext-to-Xero links, but no single official one-click connector maintained by both vendors. In practice most reliable syncs are built with n8n or a small custom app, because the field mapping — especially Indian GST tax codes and account heads — is specific to your business and no generic connector maps it correctly out of the box.
How does Xero authentication work for the integration?
Xero uses OAuth 2.0. You register an app in Xero's developer portal, complete the authorization-code flow to get access and refresh tokens, and include the Xero-Tenant-Id header to say which organisation you are writing to. Access tokens are short-lived, so your integration must store the refresh token and renew credentials automatically rather than relying on a static key.
Will the sync handle Indian GST correctly?
Not automatically. ERPNext models Indian GST with HSN codes, tax templates, and place-of-supply logic that Xero's tax setup does not mirror one-to-one. You have to map tax codes and account heads deliberately during the field-mapping step, and test with real invoices. This mismatch is one of the strongest reasons to consider keeping all accounting inside ERPNext.
Can the two-way sync run in real time?
Close to it. ERPNext webhooks fire on document events and Xero webhooks fire on invoice, contact, and bill changes, so both sides push updates within seconds. The Xero webhook only carries a resource ID, so there is a short round trip while your integration calls back for the full record — near-real-time in practice, not instantaneous.
What happens if the same record is edited in both systems?
You get a conflict, and a naive sync can overwrite the newer edit with the older one or create a duplicate. The fix is not clever code, it is discipline: assign one authoring system per object and make the other side read-only for that field. This is why the very first setup step is deciding the system of record, not writing the sync.
Is it cheaper to integrate or to migrate?
It depends on whether Xero earns its place. Integration has an ongoing cost — build, maintenance, reconciliation, and two subscriptions where one might do. Migration is a one-time project. If an external accountant requires Xero, integration wins; if Xero is a duplicate of accounting ERPNext already does under its open-source licence, migrating usually costs less over any real time horizon.
About the author
I am Manoj, an ERPNext implementation consultant at Mith Tech, an independent open-source ERPNext and Frappe studio in Bengaluru. I build ERPNext integrations and run migrations for Indian SMBs, and I spend as much time talking clients out of unnecessary syncs as building them. Mith Tech is vendor-independent, so my advice is about what fits your operation, not what sells a licence.