> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Xero Accounting

> Read Xero accounting data and submit invoice and contact writes at a protected label.

Follow the [protected REST mount guide](https://docs.bijection.com/integrations/native-rest.md#protected-saas-mounts) for `xero.invoices.observations` or `xero.contacts.observations`.
Bind records and task answers to the installer’s `data` label.

Bind `providerEndpoint` to `https://api.xero.com` and `/api.xro/2.0/Invoices` or
`/api.xro/2.0/Contacts`. Use a sealed OAuth credential with the corresponding
accounting read scope. Set `selection` to the connected tenant UUID.
Initialize the matching `xero.invoices.observations` or
`xero.contacts.observations` profile.

The app requests Xero's `summaryOnly` records and keys them by
`InvoiceID` or `ContactID`. A short page ends the numbered walk and the
next walk starts at one. Each response admits 1–100 records and 36 KiB.
Rows that disappear stay published, and a returned archive or void status
is retained as observed. Xero can change content during a walk.

[Xero Accounting API pagination](https://developer.xero.com/documentation/api/accounting/requests-and-responses)

## Write contacts

Follow the [native write mount guide](https://docs.bijection.com/integrations/native-rest.md#native-provider-writes). Use mode `xero.contacts.create-update-delete` with `providerWriter`, endpoint `https://api.xero.com` and pass the writer in `receivers.writers` under that mode. Use `multiSecret` with two header bindings. Seal the OAuth access token as `Authorization` with prefix `Bearer ` and the selected tenant UUID as `xero-tenant-id`. Give the credential accounting contact write permission. Supply one Xero Contact object. Update sets `ContactID` from the command. Delete sets `ContactStatus: "ARCHIVED"`. HTTP 200 must return the contact ID without validation errors and, on archive, the archived state.

The receiver gets one dispatch attempt with `Idempotency-Key` because the credential and tenant seals can rotate independently. Commands take up to 24 KiB of JSON and carry no read cursor.

[Provider write API](https://github.com/XeroAPI/Xero-OpenAPI/blob/master/xero_accounting.yaml)

## Ledger resources and reports

Use a separate [protected REST mount](https://docs.bijection.com/integrations/native-rest.md#protected-saas-mounts)
for each resource. For inline resources, bind `providerEndpoint` to
`https://api.xero.com` and `/api.xro/2.0/<resource>`. Journals use the sealed
download binding below. For these modes, seal the OAuth bearer token
as `Authorization` and the tenant ID as `xero-tenant-id` through two
`multiSecret` header bindings. Use the resource's accounting scopes and
a tenant role allowed to read it. Reports and journals require reporting
permissions. Follow Xero's entitlement requirements for the Journals API.

| Mode | Resource and cursor | Fields |
| - | - | - |
| `xero.payments.observations` | `Payments`, numbered pages keyed by `PaymentID` | `PaymentID`, `Date`, `Amount`, `Reference`, `CurrencyRate`, `PaymentType`, `Status`, `IsReconciled`, `UpdatedDateUTC`, and nested references projected as `InvoiceID` and `AccountID`. |
| `xero.bank-transactions.observations` | `BankTransactions`, numbered pages keyed by `BankTransactionID` | `BankTransactionID`, `Type`, `Date`, `Reference`, `Status`, `CurrencyCode`, `CurrencyRate`, `SubTotal`, `TotalTax`, `Total`, `IsReconciled`, `UpdatedDateUTC` and nested references projected as `AccountID` and `ContactID`. |
| `xero.accounts.observations` | `Accounts`, single response keyed by `AccountID` | `AccountID`, `Code`, `Name`, `Type`, `Status`, `Description`, `TaxType`, `Class`, `CurrencyCode`, `BankAccountType`, `EnablePaymentsToAccount`, `ShowInExpenseClaims`, `ReportingCode`, `ReportingCodeName`, `UpdatedDateUTC`. |
| `xero.journals.observations` | `Journals`, fixed `limit: 100`, exclusive `JournalNumber` carried across polls and records keyed by `JournalID` | `JournalID`, `JournalNumber`, `JournalDate`, `CreatedDateUTC`, `Reference`, `SourceID`, `SourceType` and up to 100 `JournalLines` with `JournalLineID`, `AccountID`, `AccountCode`, `AccountType`, `AccountName`, `Description`, `NetAmount`, `GrossAmount`, `TaxAmount`, `TaxType`, `TaxName`. |
| `xero.report` | `Reports/ProfitAndLoss` or `Reports/BankSummary`, with `limit: 1` and YYYY-MM-DD `start` and `end`. Key by report ID and requested range. No cursor. | `ReportID`, `ReportName`, `ReportType`, `ReportTitles`, `ReportDate`, `UpdatedDateUTC` and the full nested `Rows` tree. |

Payments and bank transactions restart at page one after the reported
last page. Accounts must fit in one response. Inline answers must fit
in 36 KiB before projection. Missing records remain published and returned
statuses remain observations.

For the invoice and contact modes above, the installed projection is the
whole returned summary object, including its nested fields.

### Stage journal responses

Bind `xeroJournalDownload(auth, data)` as `receivers.xeroJournals` with the same
two sealed headers and protected `data` label. Initialize with
`{ profile: { mode: "provider", provider: "xero.journals.observations", limit: 100 } }`.
Xero exposes an exclusive `JournalNumber` offset and returns up to 100
journals per response. The receiver seals one complete response of up to
8 MiB in 512 KiB parts. The app lands up to eight indexed journals per
local transaction, with larger journals given their own transaction. A
projected journal is bounded to 512 KiB. The app commits the provider offset
with the final local page, retires the parts, and polls from that offset
until Xero returns an empty page. A fresh attempt can reread an interrupted
response from the last committed offset and land records by `JournalID`.

[Xero Journals API](https://developer.xero.com/documentation/api/accounting/journals)

## Write invoices

Use `providerWriter` with mode `xero.invoices.create-update`, the writer passed in `receivers.writers` under that mode and the same two sealed headers and key timing as
contact writes. Use an invoice write scope. Supply one invoice object up
to 24 KiB. PUT creates the invoice. POST updates the invoice UUID from
the command. The app acknowledges HTTP 200 only with one matching
`InvoiceID` and no returned validation errors. It retains the status and
ID. Writes have no read cursor and issue one keyed dispatch attempt.

[Xero Accounting API reference](https://github.com/XeroAPI/Xero-OpenAPI/blob/master/xero_accounting.yaml)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.