Xero and SFTP / Flat Files integration
Xero handles your accounting, but legacy systems and EDI partners need data as flat files, not API calls. ml-connector bridges the gap by reading invoices, payments, and journals from Xero and writing them to your SFTP server in the file format your downstream systems expect. Whether you export to an ERP that accepts flat-file import, sync with an EDI partner, or archive accounting records to a file store, ml-connector handles the format mapping and the schedule.
What moves between them
Data moves from Xero to SFTP. ml-connector reads Xero invoices, payments (both customer and supplier), manual journals, and contact records, then formats each record as a line or block in a flat file (CSV, X12 EDI, or fixed-width text) and deposits the file to the outbound folder on your SFTP server on a schedule you define (typically hourly or daily). Xero webhook events (when enabled) trigger immediate processing of new records; otherwise ml-connector polls Xero periodically using the If-Modified-Since header to detect changes. There is no reverse sync from SFTP back to Xero; the integration is read-only on the Xero side.
How ml-connector handles it
ml-connector stores your Xero OAuth2 credentials and SFTP connection details (host, port, username or SSH private key) encrypted in its database. On each sync cycle, it refreshes the Xero access token if needed, reads invoices and payments from Xero's REST API (filtering by Xero-tenant-id to isolate your organization), and maps each record to the flat-file format you specify (CSV header row with invoice number, amount, date, and vendor; or X12 810 EDI format with segments and field separators). For SFTP delivery, ml-connector establishes an SSH connection using either SSH key authentication (presenting your private key) or username/password over the encrypted SSH channel, then writes the formatted file to your outbound folder using SFTP. Host key verification is required to prevent MITM attacks. If Xero rate limits a request (5 concurrent calls max per tenant), ml-connector backs off exponentially and retries. If SFTP connectivity fails, the file is queued and retried on the next sync window. Every record is logged with full audit trail: timestamp, Xero record ID, mapped file content, SFTP delivery status, and any errors. Failed records can be replayed or exported separately for manual investigation.
A real-world example
A mid-sized business uses Xero for accounting but runs a legacy ERP (such as SAP or Infor) that cannot consume the Xero API directly and instead requires invoices and payments as X12 810 and 820 EDI files. Before the integration, the accounting team manually exported invoices and payments from Xero each day, formatted them as X12 files in Excel or a custom script, and uploaded the files to their ERP's SFTP folder, a process prone to errors and formatting mismatches. With Xero and SFTP / Flat Files connected via ml-connector, each Xero invoice and payment is automatically formatted as the correct X12 EDI record and deposited to the ERP's SFTP inbound folder, eliminating manual export and format conversion steps and ensuring the ERP's records stay in sync with Xero.
What you can do
- Export Xero invoices and payments as flat files (CSV or X12 EDI 810/820) to SFTP on a schedule you control.
- Map Xero invoice and payment fields to X12 segments and CSV columns, with per-partner format customization.
- Authenticate Xero with OAuth2 and SFTP with SSH key or password, with encrypted credential storage and automatic token refresh.
- Generate X12 acknowledgments (997) and EDIFACT acknowledgments (CONTRL) for EDI workflows, deposited to the acks folder.
- Maintain a full audit trail of every Xero record read, its mapped file content, and SFTP delivery status, with retry and replay on failure.
Questions
- Can ml-connector push changes from Xero to SFTP in real-time?
- Xero webhook events can trigger immediate processing of new invoices and payments, but SFTP has no push mechanism, so ml-connector deposits the formatted file to your SFTP server on the next sync cycle (typically within minutes). If you need bulk historical export, ml-connector can perform a full delta sync using Xero's If-Modified-Since header to fetch all records modified since the last run.
- Which Xero records are supported and in what format?
- ml-connector reads invoices (both customer and supplier via the Type field), payments, manual journals, and contacts from Xero. Output formats include CSV (with configurable header row and field order), X12 EDI (810 for invoices, 820 for payments, 997 for acknowledgments), and fixed-width text. Format is configured per integration based on your downstream system's requirements.
- How does host key verification and SFTP security work?
- ml-connector requires host key verification in production to prevent man-in-the-middle attacks. SFTP authentication uses SSH key-based login (recommended, storing your private key encrypted) or username/password over the encrypted SSH channel. Each SFTP session is isolated and all credentials are stored encrypted in ml-connector's database with AES envelope encryption.
Related integrations
More Xero integrations
Other systems that connect to SFTP / Flat Files
Connect Xero and SFTP / Flat Files
Free to use. Add your credentials, ping your real systems, and see if we fit.
Get started