ml-connector
XeroCleo

Xero and Cleo integration

Xero runs your accounting; Cleo orchestrates your supply chain documents. Connecting them automates the flow of invoices and purchase orders from Xero into EDI format via Cleo, so your trading partners receive structured documents without manual file export or re-keying. Xero webhooks trigger Cleo transformations, and supplier acknowledgments and receipts route back into Xero to keep your accounts reconciled with your supply chain activity.

How Xero works

Xero Accounting API is a REST service exposing invoices, purchase orders, payments, contacts, accounts, tracking categories, items, manual journals, and bank transactions. Authentication uses OAuth2 Authorization Code flow with access tokens that expire in 30 minutes and refresh tokens that expire in 60 days if offline_access scope is granted. Xero publishes webhook events for Contacts, Invoices, CreditNotes, Payments, ManualJournals, PurchaseOrders, and BankTransactions on CREATE and UPDATE; webhook payloads contain metadata only, requiring a follow-up GET to fetch the full record. Each API request requires the Xero-tenant-id header to target the specific organization. Rate limits are 5 concurrent calls and 60 per minute per tenant. Xero uses page-based pagination with a maximum of 100 records per page.

How Cleo works

Cleo Integration Cloud is a cloud-native B2B and EDI platform that handles integrations between trading partners, ERPs, transportation management systems, warehouse management systems, and marketplaces. It exposes Folders, Files, Connections, Users, Actions, Certificates, and Events through a REST API with OAuth2 password grant authentication; tokens are short-lived and tied to user account permissions within Cleo. Cleo is a pull-based polling system with no programmatic webhook subscription API; outbound webhooks are available via CIC Studio HTTP actions configured by the tenant administrator. Cleo is integration middleware, not a finance system, so invoices and purchase orders flow through as EDI transactions or file payloads, not as native REST objects. On-premise deployments use the same REST API with a custom host and port.

What moves between them

Xero invoices and purchase orders move outbound through Cleo into EDI 810 (invoices) and 850 (purchase orders) format for downstream trading partners. Xero webhooks on INVOICE_CREATE and PO_CREATE trigger ml-connector to push the document metadata into Cleo, where Actions format the record as EDI and route it to the appropriate partner folder. Inbound, supplier 997 functional acknowledgments and 856 advance shipping notices flow into Cleo, where ml-connector polls periodically and imports them into Xero as manual journal entries or bank transactions for reconciliation.

How ml-connector handles it

ml-connector stores Xero and Cleo OAuth2 credentials encrypted and refreshes Xero tokens before they expire at 30 minutes. Xero webhooks are registered once per customer organization and trigger immediately on invoice or purchase order creation; each webhook includes only the record ID, so ml-connector fetches the full record via GET from Xero's Accounting API. That record is transformed into EDI format (810 for invoice, 850 for PO) and posted to Cleo's Folders API, which queues it for the specified partner connection. ml-connector respects Xero's rate limit of 60 calls per minute per tenant by batching when multiple documents arrive in the same webhook burst. Inbound, ml-connector polls Cleo's Folders API every few minutes for new EDI acknowledgments and shipping notices, parses them, and routes the financial impact into Xero as manual journal entries so the GL remains in sync with supply chain activity. All transformations log to the audit trail and can be replayed if a downstream partner API times out.

A real-world example

A mid-sized B2B distributor runs Xero for accounting and uses Cleo to manage EDI with three major retail customers and five suppliers. Previously, accounting staff exported invoices and purchase orders from Xero weekly, formatted them manually in EDI syntax, and uploaded them to each partner's SFTP portal, then downloaded 997 acknowledgments and 856 shipments and re-entered key line-item totals into the GL. With Xero and Cleo connected, each invoice created in Xero triggers automatic EDI 810 formatting and delivery to the customer's Cleo folder within seconds, and supplier ship notices import automatically into manual journal entries, cutting reconciliation time at month-end from three days to one morning.

What you can do

  • Trigger Cleo document transformations automatically when invoices or purchase orders are created in Xero, without manual export or file upload.
  • Transform Xero invoices into EDI 810 format and purchase orders into EDI 850 for delivery to trading partners via Cleo.
  • Authenticate both systems securely with OAuth2, managing short-lived tokens and respecting rate limits on both sides.
  • Ingest supplier EDI 997 acknowledgments and 856 advance shipping notices from Cleo and post them into Xero's general ledger as manual journals for reconciliation.
  • Maintain a complete audit trail of every document movement and transformation, with the ability to replay failed transactions.

Questions

What document types flow between Xero and Cleo?
Outbound, Xero invoices and purchase orders flow into Cleo and are transformed into EDI 810 (invoices) and 850 (purchase orders) format for delivery to supply chain partners. Inbound, EDI 997 functional acknowledgments and 856 advance shipping notices from suppliers flow through Cleo into Xero as manual journal entries for GL reconciliation. Credit notes and payment records remain in Xero and do not route through Cleo.
How does the integration handle Xero's 30-minute access token expiry?
ml-connector tracks Xero's OAuth2 access token expiry and refreshes it before the 30-minute window closes, using the 60-day refresh token obtained during the initial Authorization Code flow. This ensures no integration downtime due to token expiry. If a refresh token expires, the user is prompted to re-authorize the Xero connection.
Does the integration respect Xero's rate limits?
Yes. Xero enforces a limit of 5 concurrent calls and 60 API requests per minute per tenant. ml-connector batches webhook-triggered fetches when multiple documents arrive in the same burst and spreads Cleo polling requests to stay well under the per-minute ceiling, ensuring no requests are rejected by Xero's rate limiter.

Related integrations

Connect Xero and Cleo

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

Get started