Xero Bank Feeds API – Push bank statement data into Xero for auto-reconciliation.
Base URL: https://api.xero.com/bankfeeds.xro/1.0/
Scope: bankfeeds
⚠️ Requires Xero Bank Feeds partner programme approval before use. Contact Xero to apply: https://developer.xero.com/documentation/bank-feeds-api/overview/
Workflow
- Create a feed connection for each bank account
- Push statement lines to the connection periodically
- Xero auto-matches and reconciles transactions
Statement Line Fields
| Field | Required | Description |
|---|---|---|
postedDate | ✅ | Transaction date (YYYY-MM-DD) |
description | ✅ | Transaction description |
amount | ✅ | Decimal amount (always positive) |
creditDebitIndicator | ✅ | "CREDIT" or "DEBIT" |
transactionId | — | Your unique ID (strongly recommended for idempotency) |
payeeName | — | Merchant or payee name |
reference | — | Your reference |
chequeNumber | — | Cheque number |
subType | — | Transaction sub-type (for categorisation) |
Examples
{:ok, conn} = Xero.BankFeeds.create_feed_connection(token, tenant_id, %{
"accountToken" => "my-unique-token",
"accountType" => "BANK",
"accountName" => "Business Cheque",
"accountNumber" => "123456789",
"currency" => "AUD"
})
{:ok, _} = Xero.BankFeeds.create_statements(token, tenant_id, %{
"feedConnectionId" => conn_id,
"startDate" => "2024-01-01",
"endDate" => "2024-01-31",
"startBalance" => %{"amount" => "1000.00", "creditDebitIndicator" => "CREDIT"},
"endBalance" => %{"amount" => "1500.00", "creditDebitIndicator" => "CREDIT"},
"statementLines" => [
%{
"postedDate" => "2024-01-15",
"description" => "Client Payment",
"amount" => "5000.00",
"creditDebitIndicator" => "CREDIT",
"transactionId" => "TXN-2024-001"
}
]
})
Summary
Functions
Creates one or more feed connections (pass a single map or a list).
Pushes one or more bank statements into Xero (pass a single map or a list).
Deletes feed connections by their IDs.
Uses the DeleteRequests endpoint (POST, not DELETE).
Deletes a statement by ID. Note: Only statements that have not yet been reconciled can be deleted.
Retrieves a single feed connection by ID.
Retrieves a single statement by ID.
Lists all feed connections. Options: :page, :page_size
Lists statements. Options: :feed_connection_id, :page, :page_size
Functions
@spec create_feed_connection(Xero.Auth.Token.t(), String.t(), map() | [map()]) :: {:ok, map()} | {:error, Xero.Error.t()}
Creates one or more feed connections (pass a single map or a list).
Required fields per connection
"accountToken"— Your unique identifier for this bank account (max 50 chars)"accountType"—"BANK"or"CREDITCARD""accountName"— Display name in Xero (max 30 chars)"accountNumber"— Bank account number (max 12 chars)"currency"— ISO 4217 currency code (e.g."AUD","GBP")
Region-specific required fields
- UK:
"sortCode"(format"12-34-56") - AU:
"bsb"(format"123456")
@spec create_statements(Xero.Auth.Token.t(), String.t(), map() | [map()]) :: {:ok, map()} | {:error, Xero.Error.t()}
Pushes one or more bank statements into Xero (pass a single map or a list).
Each statement represents one bank account period and must include:
"feedConnectionId"— UUID of the feed connection"startDate"/"endDate"— Statement period (YYYY-MM-DD)"startBalance"/"endBalance"— Balance maps withamountandcreditDebitIndicator"statementLines"— List of transaction maps
Use transactionId in each statement line for idempotency — Xero will reject
duplicate transactionId values for the same feed connection.
@spec delete_feed_connections(Xero.Auth.Token.t(), String.t(), [String.t()]) :: {:ok, map()} | {:error, Xero.Error.t()}
Deletes feed connections by their IDs.
Uses the DeleteRequests endpoint (POST, not DELETE).
@spec delete_statement(Xero.Auth.Token.t(), String.t(), String.t()) :: :ok | {:error, Xero.Error.t()}
Deletes a statement by ID. Note: Only statements that have not yet been reconciled can be deleted.
@spec get_feed_connection(Xero.Auth.Token.t(), String.t(), String.t()) :: {:ok, map()} | {:error, Xero.Error.t()}
Retrieves a single feed connection by ID.
@spec get_statement(Xero.Auth.Token.t(), String.t(), String.t()) :: {:ok, map()} | {:error, Xero.Error.t()}
Retrieves a single statement by ID.
@spec list_feed_connections(Xero.Auth.Token.t(), String.t(), keyword()) :: {:ok, map()} | {:error, Xero.Error.t()}
Lists all feed connections. Options: :page, :page_size
@spec list_statements(Xero.Auth.Token.t(), String.t(), keyword()) :: {:ok, map()} | {:error, Xero.Error.t()}
Lists statements. Options: :feed_connection_id, :page, :page_size