Skip to main content

Migration

ERPNext Xero Integration & Two-Way Sync (2026 Guide)

How to sync Xero with ERPNext through the APIs or n8n, what to keep in each system, and when to integrate and when to migrate instead.

Updated 12 Oct 20269 min readBy ManojFirst published 20 Jul 2026

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, and I lead ERPNext and Frappe implementations at MithTech, a team of Frappe specialists in Bengaluru. I get this question from businesses that run operations in ERPNext but keep their accountant on Xero. This is the approach I use: how the two APIs talk, what to sync and what to leave alone, and whether to integrate at all or migrate. Honest take: a two-way sync is real engineering, not a checkbox, and many businesses that ask for one are better served by moving fully into ERPNext.

What is ERPNext Xero integration?

ERPNext Xero integration means 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 usual reason is a split of jobs. Operations, stock, manufacturing and sales live in ERPNext, which is open source under GPLv3. The outside accountant or bookkeeper, often for a group entity abroad, 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:

Xero side
Auth modelAPI key + secret (token key:secret header)OAuth 2.0 with rotating refresh tokens
Push changes outWebhooks on DocType eventsWebhooks on invoices, contacts, bills
Pull / write dataREST API on any DocTypeAccounting API endpoints
Multi-entityCompanies within one instanceTenant selected via Xero-Tenant-Id header
Licence modelOpen source, self-hostableSubscription 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.

1

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.

2

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.

3

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.

4

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.

5

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.

6

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:

VolumeLow to moderate document countsHigh-throughput, frequent syncs
LogicStraightforward field mappingComplex conditional rules, many edge cases
TeamNon-developers will maintain itYou have Frappe/Python capacity in-house
Speed to liveFastest to a working prototypeSlower to start, cleaner at scale
HostingSelf-host alongside ERPNextShips inside your bench as an app

For most small and mid-sized businesses I start with n8n. 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.

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 does a job ERPNext cannot, and migrate when Xero only holds a ledger that ERPNext could hold. ERPNext has full double-entry accounting, multi-currency and financial statements, with Indian GST through the India Compliance app, so for many businesses 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 a whole category of drift, duplicate-record and rate-limit problems. I cover the move in Xero to ERPNext migration.

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.

Frequently asked questions

+

Is there a ready-made ERPNext Xero connector?

Some third-party automation platforms and connector services advertise ERPNext-to-Xero links, but there is no 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 soon after a change. 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 time.

Your next step

Not sure whether to sync Xero or move fully into ERPNext?

Next step · Migration

Now see how a move off Xero would run

What we move from Xero, how we reconcile it and how the cutover runs without stopping billing.

Comments & ratings

No comments yet. Start a new discussion.

0

Manoj · Published on 20 July 2026

Worked with us? Leave a Google review

Questions about this? Talk to the team.

Book a 30-minute Google Meet, WhatsApp us, or send a message. The engineer who works on this replies.

Send us a message
Your details go to our team's CRM and are used only to reply.