ml-connector
XeroCin7

Xero and Cin7 integration

Xero handles your accounting, Cin7 Core manages your inventory and orders. When a sale or purchase happens in Cin7, you need the financial impact recorded in Xero without manual re-entry. ml-connector watches Cin7 for order and purchase events, translates them into Xero invoices or journal entries, and posts them to your GL accounts and cost dimensions. Your financial records stay in sync with your operational reality.

How Xero works

Xero exposes contacts, invoices, purchase orders, payments, accounts, tracking categories, and journal entries through the Xero Accounting API at https://api.xero.com/api.xro/2.0/. Authentication uses OAuth2 Authorization Code flow with 30-minute access tokens and 60-day refresh tokens. Xero publishes webhooks for invoice, purchase order, payment, and journal events with metadata only, requiring a follow-up GET to fetch the full record. The API enforces a Xero-tenant-id header to target the specific organization, a 5 concurrent call limit, and 60 calls per minute per tenant. Deleted records are not returned by default, and tracking categories limit to 2 active per organization.

How Cin7 works

Cin7 Core exposes suppliers, purchases, sales, customers, products, and chart of accounts through REST endpoints at https://inventory.dearsystems.com/externalapi/v2/. Authentication uses custom API key headers (api-auth-accountid and api-auth-applicationkey), not OAuth or Basic Auth. Cin7 publishes webhooks for sales, purchases, suppliers, customers, and stock changes via the Automation module, but the webhook payloads are not HMAC-signed and the platform recommends mTLS or a query-param token for webhook security. The chart of accounts is read-only via API. Purchases span the full procure-to-pay lifecycle (order, invoice, receive) tracked by an Approach field.

What moves between them

The main flow runs from Cin7 into Xero. When a sale is created or updated in Cin7, ml-connector posts it into Xero as either a Xero Invoice (if accounting impact) or a record for audit and tax purposes. When a purchase is created in Cin7, it flows into Xero as an Accounts Payable invoice, allocated to the correct GL account via product-to-account mappings. Payments in Cin7 flow into Xero as payment records tied to the corresponding invoices. Customer and supplier records are synchronized bidirectionally to keep contact lists aligned, and product pricing flows from Cin7 into Xero's item catalog where needed.

How ml-connector handles it

ml-connector stores Xero OAuth2 credentials (access token refreshed every 20 minutes before expiry) and Cin7 API keys encrypted. It polls Cin7 at a frequency you set (typically after each sale or purchase, or on a schedule) via the Automation webhooks or by querying the Sale and Purchase endpoints directly. Each Cin7 sale or purchase is enriched with product and customer data, then mapped to Xero GL accounts based on your item-to-account rules. Because Xero enforces a 5 concurrent call limit and 60 per minute per tenant, ml-connector batches requests and queues large syncs to avoid rate-limit returns. Purchase records in Cin7 use an Approach field (ORDER, INVOICE, RECEIVE) to indicate lifecycle stage; ml-connector only posts invoices once the Approach is INVOICE to avoid creating duplicate GL entries. Xero's tracking categories are mapped from Cin7 sale or purchase dimensions where available. Because Cin7 webhooks are unsigned, ml-connector validates inbound payloads by querying Cin7 immediately and comparing record IDs. Every create, update, and error is logged in the audit trail and can be replayed if a downstream Xero call fails.

A real-world example

A mid-market e-commerce business runs Cin7 Core to manage inventory, multi-channel orders, and supplier replenishment, and uses Xero for accounting and tax compliance. Before the integration, the finance team exported daily sales reports from Cin7, manually categorized them by product type, and entered the resulting GL entries into Xero by hand. Supplier invoices arrived via email and were keyed into Cin7 for receiving, then re-entered into Xero as AP invoices, creating duplicate work and frequent reconciliation gaps at month-end. With Cin7 and Xero connected, every sale posts into Xero at the moment it completes in Cin7, allocated to the correct revenue and asset accounts, and supplier invoices enter Xero as AP records tied directly to Cin7 purchase orders. The finance team now spends month-end on analysis rather than re-keying, and the two systems are always in agreement.

What you can do

  • Post Cin7 sales into Xero as invoices or journal entries, allocated to the correct GL accounts and tracking categories.
  • Create Xero accounts payable records from Cin7 purchases, mapped by product and supplier.
  • Keep Xero contacts synchronized with Cin7 customers and suppliers.
  • Authenticate Xero via OAuth2 and Cin7 via API key, refreshing tokens and managing rate limits across the Xero 5 concurrent call hard ceiling.
  • Poll Cin7 on a schedule or in response to webhook events, with full audit trail and replay on every record posted to Xero.

Questions

Which direction do sales and purchases flow between Cin7 and Xero?
Sales and purchases flow from Cin7 into Xero. Each Cin7 sale becomes a Xero invoice (or journal entry if needed for tax or analytical purposes), and each Cin7 purchase becomes an Xero accounts payable invoice. Payments in Cin7 post as payment records in Xero tied to the corresponding invoices. Customer and supplier records sync bidirectionally to keep contact lists aligned.
How does ml-connector handle Xero's 5 concurrent call limit and Cin7's unsigned webhooks?
Xero enforces a hard ceiling of 5 concurrent calls and 60 per minute per tenant. ml-connector batches requests and queues large syncs so they never exceed that limit. Cin7 webhooks are unsigned, so ml-connector validates every inbound payload by immediately querying Cin7 to confirm the record ID matches, preventing replay attacks.
How are Cin7 purchases mapped to Xero GL accounts?
Cin7 purchases include a product field and a supplier. ml-connector uses configured product-to-account mappings to determine which Xero GL account receives the purchase invoice. The Approach field (ORDER, INVOICE, RECEIVE) determines the stage; ml-connector only posts invoices once Approach is INVOICE to avoid duplicate GL entries.

Related integrations

Connect Xero and Cin7

Free to use. Add your credentials, ping your real systems, and see if we fit.

Get started