Setu Recipes: reusable digital workers across every app.Browse templates

Integrations / Xero

Xero

Xero accounting: list connected organisations, invoices, contacts, accounts, bank transactions and payments; create invoices and contacts.

10 actions OAuth 2 8 read2 write Calls api.xero.com

Connect

TypeScript
const conn = await setu.connections.initiate({ userId: "user_1", toolkit: "xero" });
console.log(conn.connectUrl); // show this to your user
await conn.waitUntilActive();

Permissions requested

ScopeWhy it is requested
offline_accessStay connected without asking you to sign in again (refresh tokens)
openidIdentify which Xero user connected
profileRead the connected user's name
emailRead the connected user's email address to label the connection
accounting.invoicesRead and create invoices, credit notes and quotes
accounting.contactsRead and create contacts (customers and suppliers)
accounting.settings.readRead the organisation details and chart of accounts
accounting.banktransactions.readRead bank transactions
accounting.payments.readRead payments

Actions

Create contactwritexero.create_contactCreate a contact (customer or supplier) in Xero with a name and optional email and phone. The name must be unique in the organisation.

Needs scope: accounting.contacts

InputTypeDescription
tenant_idstringRequiredXero organisation (tenant) id from list_connections
namestringRequiredFull name or organisation name, unique
first_namestringOptionalFirst name
last_namestringOptionalLast name
emailstringOptionalEmail address
TypeScript
await setu.execute({
  userId: "user_1",
  action: "xero.create_contact",
  input: {
    "tenant_id": "<tenant_id>",
    "name": "<name>"
  },
});
Create invoicewritexero.create_invoiceCreate an invoice (ACCREC sales invoice or ACCPAY bill) in Xero for a contact, with line items. It is created as DRAFT unless status says otherwise.

Needs scope: accounting.invoices

InputTypeDescription
tenant_idstringRequiredXero organisation (tenant) id from list_connections
typestringRequiredACCREC is a sales invoice, ACCPAY a bill
contact_idstringRequiredContact id (GUID)
line_itemsarray of objectRequiredLines with Description, Quantity, UnitAmount and AccountCode
datestringOptionalInvoice date, YYYY-MM-DD
due_datestringOptionalDue date, YYYY-MM-DD
referencestringOptionalReference text
statusstringOptionalDefaults to DRAFT
TypeScript
await setu.execute({
  userId: "user_1",
  action: "xero.create_invoice",
  input: {
    "tenant_id": "<tenant_id>",
    "type": "<type>",
    "contact_id": "<contact_id>",
    "line_items": []
  },
});
Get invoicereadxero.get_invoiceGet one Xero invoice by its invoice id or invoice number, with status, contact, totals and amount due.

Needs scope: accounting.invoices

InputTypeDescription
tenant_idstringRequiredXero organisation (tenant) id from list_connections
invoice_idstringRequiredInvoice id (GUID) or invoice number
TypeScript
await setu.execute({
  userId: "user_1",
  action: "xero.get_invoice",
  input: {
    "tenant_id": "<tenant_id>",
    "invoice_id": "<invoice_id>"
  },
});
Get organisationreadxero.get_organisationGet the details of a Xero organisation: name, legal name, base currency, country, financial year end and organisation type.

Needs scope: accounting.settings.read

InputTypeDescription
tenant_idstringRequiredXero organisation (tenant) id from list_connections
TypeScript
await setu.execute({
  userId: "user_1",
  action: "xero.get_organisation",
  input: {
    "tenant_id": "<tenant_id>"
  },
});
List accountsreadxero.list_accountsList the chart of accounts of a Xero organisation: account codes, names, types and status. Needed to pick an AccountCode for invoice lines.

Needs scope: accounting.settings.read

InputTypeDescription
tenant_idstringRequiredXero organisation (tenant) id from list_connections
wherestringOptionalXero filter, e.g. Type=="REVENUE"
orderstringOptionalSort, e.g. Name
TypeScript
await setu.execute({
  userId: "user_1",
  action: "xero.list_accounts",
  input: {
    "tenant_id": "<tenant_id>"
  },
});
List bank transactionsreadxero.list_bank_transactionsList spend and receive money bank transactions in a Xero organisation, optionally filtered with a where expression. Returns 100 per page.

Needs scope: accounting.banktransactions.read

InputTypeDescription
tenant_idstringRequiredXero organisation (tenant) id from list_connections
wherestringOptionalXero filter, e.g. Status=="AUTHORISED"
orderstringOptionalSort, e.g. Date DESC
pageintegerOptionalPage number, starting at 1
TypeScript
await setu.execute({
  userId: "user_1",
  action: "xero.list_bank_transactions",
  input: {
    "tenant_id": "<tenant_id>"
  },
});
List connected organisationsreadxero.list_connectionsList the Xero organisations this connection can access, with their tenant ids. Call this first: every other Xero action needs a tenant_id from here.

No input.

TypeScript
await setu.execute({
  userId: "user_1",
  action: "xero.list_connections",
  input: {},
});
List contactsreadxero.list_contactsList or search contacts (customers and suppliers) in a Xero organisation by name, email or account number with search_term, or with a where expression.

Needs scope: accounting.contacts

InputTypeDescription
tenant_idstringRequiredXero organisation (tenant) id from list_connections
search_termstringOptionalMatches name, first or last name, email, account number
wherestringOptionalXero filter, e.g. ContactStatus=="ACTIVE"
pageintegerOptionalPage number, starting at 1
TypeScript
await setu.execute({
  userId: "user_1",
  action: "xero.list_contacts",
  input: {
    "tenant_id": "<tenant_id>"
  },
});
List invoicesreadxero.list_invoicesList invoices (sales and bills) in a Xero organisation. Filter by status or contact, or with a where expression like Type=="ACCREC"; returns 100 per page.

Needs scope: accounting.invoices

InputTypeDescription
tenant_idstringRequiredXero organisation (tenant) id from list_connections
wherestringOptionalXero filter, e.g. Type=="ACCREC" AND AmountDue>0
orderstringOptionalSort, e.g. Date DESC
statusesarray of stringOptionalDRAFT, SUBMITTED, AUTHORISED, PAID, VOIDED
contact_idsarray of stringOptionalOnly invoices for these contact ids
pageintegerOptionalPage number, starting at 1
TypeScript
await setu.execute({
  userId: "user_1",
  action: "xero.list_invoices",
  input: {
    "tenant_id": "<tenant_id>"
  },
});
List paymentsreadxero.list_paymentsList payments applied to invoices in a Xero organisation, optionally filtered with a where expression such as Status=="AUTHORISED".

Needs scope: accounting.payments.read

InputTypeDescription
tenant_idstringRequiredXero organisation (tenant) id from list_connections
wherestringOptionalXero filter, e.g. Date>=DateTime(2026,10,1)
orderstringOptionalSort, e.g. Date DESC
pageintegerOptionalPage number, starting at 1
TypeScript
await setu.execute({
  userId: "user_1",
  action: "xero.list_payments",
  input: {
    "tenant_id": "<tenant_id>"
  },
});