Xero Accounting API

Commercial

by Xero

Accounting API for the platform most SG SMEs and accountants run on: invoices, contacts, bank transactions, payroll and reports. Essential for any SG ERP or fintech that syncs books.

How to authenticate

  1. 1Create a free developer account at developer.xero.com and add an app.
  2. 2Configure the OAuth 2.0 redirect URI and copy client id/secret.
  3. 3Run the authorization code flow requesting scopes like accounting.transactions offline_access.
  4. 4Exchange the code for access + refresh tokens; access tokens last 30 minutes.
  5. 5Call the API with Authorization: Bearer and the xero-tenant-id header from the connections endpoint.

Example request

Request
curl -H 'Authorization: Bearer ACCESS_TOKEN' -H 'xero-tenant-id: TENANT_ID' -H 'Accept: application/json' 'https://api.xero.com/api.xro/2.0/Invoices?page=1'

Example response

Response (truncated)
{"Invoices":[{"InvoiceID":"...","Type":"ACCREC","Contact":{"Name":"ABC Pte Ltd"},"AmountDue":214.00,"Status":"AUTHORISED"}]}

Notes for AI agents

Forgetting the xero-tenant-id header is the classic 403 cause. Refresh tokens rotate on every use; persist the newest one atomically.

Machine-readable version: /api/apis/xero

Related APIs