• Xero

Export Xero to PostgreSQL in one file.

TradieBridge copies your Xero organisation through Xero’s official API, then hands you a .sql file that loads into any Postgres database. No API code, no paging, no rate limits.

To export Xero to PostgreSQL, connect Xero to TradieBridge and choose the Postgres export. You get one .sql file. Load it with psql -v ON_ERROR_STOP=1 -f your-export.sql your_database, and every Xero record lands in a xero_backup schema, ready to query.

Why Xero data is hard to get into Postgres

Xero’s own exports are reports, one at a time, each a snapshot of one day. The Xero API has all the data, but you must register an app, handle OAuth sign-in, page through each endpoint, stay under the rate limits and decide on a table for every resource. That is weeks of work before you write your first query.

How the export works

  1. Connect Xero to TradieBridge with a sign-in you approve. TradieBridge only reads.
  2. TradieBridge copies 43 Xero resources and keeps them current.
  3. Open the Xero connection, choose Postgres and press Email me the zip. The emailed link works for 7 days.
  4. Unzip it and load the .sql file with psql into your own database or Supabase.

TradieBridge reads every table from one snapshot, so the tables agree with each other. A payment never points at an invoice that the export missed.

What lands in your database

The file creates a xero_backup schema with one table for each resource, for example xero_invoices, xero_payments, xero_bank_transactions, xero_contacts, xero_journals and xero_payslips. Each row holds the Xero ID and the full record as jsonb, exactly as Xero sent it. Nothing is flattened away, so any field Xero returns is there to query.

Query it like any other table

Who owes you money, largest first:

SELECT data #>> '{Contact,Name}' AS customer,
       sum((data ->> 'AmountDue')::numeric) AS owing
FROM xero_backup.xero_invoices
WHERE data ->> 'Type' = 'ACCREC'
  AND data ->> 'Status' = 'AUTHORISED'
GROUP BY customer
ORDER BY owing DESC;

Other formats

The same copy also exports as CSV for spreadsheets and as JSON for developers. See Xero backup for what TradieBridge keeps and how deleted records stay in your copy. If you would rather ask than write SQL, connect Claude, ChatGPT or Copilot to the same data.

Docs Every Xero resource TradieBridge holds

Questions

Straight answers.

Can I export Xero to PostgreSQL?
Xero has no Postgres export of its own. TradieBridge copies your Xero organisation through Xero’s official API and exports it as one .sql file that psql loads into any Postgres database, Supabase included.
What does the Postgres export contain?
One table for each Xero resource TradieBridge holds, such as invoices, bills, payments, bank transactions, contacts, journals and payroll. Each row keeps the record exactly as Xero sent it, in a jsonb column called data.
Does loading the export change anything else in my database?
No. The file creates a schema called xero_backup and replaces only the tables inside it, in one transaction.
Do I need to write code against the Xero API?
No. TradieBridge handles the Xero sign-in, paging, rate limits and retries. You download a file and run one psql command.
Can I keep the database up to date?
TradieBridge keeps your Xero copy current. Export again whenever you want fresh data, and load the new file. It replaces the old tables.
Are attachments backed up?
Not yet. TradieBridge keeps each attachment’s details, such as its name and the record it belongs to, but not the file itself.

Back it up tonight. Ask it tomorrow.