Xero

Learn how to use Xero with Composio

Overview

SLUG: XERO

Description

Xero is a cloud-based accounting software for small businesses, providing invoicing, bank reconciliation, bookkeeping, and financial reporting in real time

Authentication Details

client_id
stringRequired
client_secret
stringRequired
full
stringDefaults to https://api.xero.com/connectionsRequired
oauth_redirect_uri
stringDefaults to https://backend.composio.dev/api/v1/auth-apps/add
scopes
stringDefaults to openid,profile,email,offline_access,accounting.reports.read,accounting.transactions.read,accounting.transactions,accounting.contacts.read,accounting.contacts,accounting.settings.read,accounting.settings,accounting.attachments,accounting.journals.read,projects.read,projects,files.read,files,accounting.budgets.read
bearer_token
string

Connecting to Xero

Create an auth config

Use the dashboard to create an auth config for the Xero toolkit. This allows you to connect multiple Xero accounts to Composio for agents to use.

1

Select App

Navigate to Xero.

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Xero Auth Config”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using OAuth2

1from composio import Composio
2
3# Replace these with your actual values
4xero_auth_config_id = "ac_YOUR_XERO_CONFIG_ID" # Auth config ID created above
5user_id = "0000-0000-0000" # UUID from database/application
6
7composio = Composio()
8
9
10def authenticate_toolkit(user_id: str, auth_config_id: str):
11 connection_request = composio.connected_accounts.initiate(
12 user_id=user_id,
13 auth_config_id=auth_config_id,
14 )
15
16 print(
17 f"Visit this URL to authenticate Xero: {connection_request.redirect_url}"
18 )
19
20 # This will wait for the auth flow to be completed
21 connection_request.wait_for_connection(timeout=15)
22 return connection_request.id
23
24
25connection_id = authenticate_toolkit(user_id, xero_auth_config_id)
26
27# You can also verify the connection status using:
28connected_account = composio.connected_accounts.get(connection_id)
29print(f"Connected account: {connected_account}")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the Xero toolkit’s playground

Python
1from composio import Composio
2from openai import OpenAI
3import json
4
5openai = OpenAI()
6composio = Composio()
7
8# User ID must be a valid UUID format
9user_id = "0000-0000-0000" # Replace with actual user UUID from your database
10
11tools = composio.tools.get(user_id=user_id, toolkits=["XERO"])
12
13print("[!] Tools:")
14print(json.dumps(tools))
15
16def invoke_llm(task = "What can you do?"):
17 completion = openai.chat.completions.create(
18 model="gpt-4o",
19 messages=[
20 {
21 "role": "user",
22 "content": task, # Your task here!
23 },
24 ],
25 tools=tools,
26 )
27
28 # Handle Result from tool call
29 result = composio.provider.handle_tool_calls(user_id=user_id, response=completion)
30 print(f"[!] Completion: {completion}")
31 print(f"[!] Tool call result: {result}")
32
33invoke_llm()

Tool List

Tool Name: Create Bank Transaction

Description

Create a bank transaction in Xero. Use SPEND for payments out or RECEIVE for money received.

Action Parameters

BankAccountCode
stringRequired
ContactID
stringRequired
CurrencyCode
string
Date
string
LineItems
arrayRequired
Reference
string
Status
string
Type
stringRequired
tenant_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Contact

Description

Create a new contact in Xero. Contacts can be customers, suppliers, or both.

Action Parameters

AccountNumber
string
BankAccountDetails
string
DefaultCurrency
string
EmailAddress
string
FirstName
string
IsCustomer
boolean
IsSupplier
boolean
LastName
string
Name
stringRequired
TaxNumber
string
Website
string
mobile_number
string
phone_number
string
tenant_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Invoice

Description

Create a new invoice in Xero. Supports both sales invoices (ACCREC) and bills (ACCPAY).

Action Parameters

ContactID
stringRequired
CurrencyCode
string
Date
string
DueDate
string
InvoiceNumber
string
LineItems
arrayRequired
Reference
string
Status
string
Type
stringRequired
tenant_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Item

Description

Create an inventory item in Xero. Items can be tracked for sales and/or purchases.

Action Parameters

Code
stringRequired
IsPurchased
boolean
IsSold
boolean
Name
stringRequired
PurchaseDetails.AccountCode
string
PurchaseDetails.UnitPrice
number
SalesDetails.AccountCode
string
SalesDetails.UnitPrice
number
tenant_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Payment

Description

Create a payment in Xero to link an invoice with a bank account transaction.

Action Parameters

AccountID
stringRequired
Amount
numberRequired
CurrencyRate
number
Date
string
InvoiceID
stringRequired
Reference
string
tenant_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Purchase Order

Description

Create a purchase order in Xero to order goods/services from suppliers.

Action Parameters

ContactID
stringRequired
Date
string
DeliveryDate
string
LineItems
arrayRequired
Reference
string
Status
string
tenant_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Account

Description

Retrieve a specific account from the chart of accounts by ID. Returns account code, name, type, and settings.

Action Parameters

account_id
stringRequired
tenant_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Asset

Description

Retrieve a specific asset by ID from Xero. Returns depreciation details and book value.

Action Parameters

asset_id
stringRequired
tenant_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Balance Sheet Report

Description

Retrieve Balance Sheet report from Xero. Shows assets, liabilities, and equity at a specific date.

Action Parameters

date
string
paymentsOnly
boolean
periods
integer
standardLayout
boolean
tenant_id
string
timeframe
string
trackingOptionID
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Budget

Description

Retrieve a budget from Xero. Budgets track planned vs actual spending by account.

Action Parameters

DateFrom
string
DateTo
string
budget_id
stringRequired
tenant_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Connections

Description

Tool to list active Xero connections. Use when you need to retrieve all current tenant connections for the authenticated user.

Action Parameters

Action Response

data
arrayRequired
error
string
successful
booleanRequired

Tool Name: Get Contact

Description

Retrieve a specific contact by ID from Xero. Returns full contact details including addresses and phone numbers.

Action Parameters

contact_id
stringRequired
tenant_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Contacts

Description

Tool to retrieve a list of contacts. Use when you need up-to-date contact information with filtering, paging, or incremental updates.

Action Parameters

ContactID
string
IDs
array
If-Modified-Since
string
includeArchived
boolean
order
string
page
integer
pageSize
integer
searchTerm
string
summaryOnly
boolean
where
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Invoice

Description

Retrieve a specific invoice by ID from Xero. Returns full invoice details including line items and status.

Action Parameters

invoice_id
stringRequired
tenant_id
string
unitdp
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Item

Description

Retrieve a specific item by ID from Xero. Returns item code, name, pricing, and tax details.

Action Parameters

item_id
stringRequired
tenant_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Manual Journal

Description

Retrieve a specific manual journal by ID from Xero. Returns full details including journal lines.

Action Parameters

manual_journal_id
stringRequired
tenant_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Organisation

Description

Retrieve organisation details from Xero. Returns company info, base currency, timezone, financial year settings, etc.

Action Parameters

tenant_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Profit & Loss Report

Description

Retrieve Profit & Loss report from Xero. Shows income, expenses, and net profit for a specified period.

Action Parameters

fromDate
string
paymentsOnly
boolean
periods
integer
standardLayout
boolean
tenant_id
string
timeframe
string
toDate
string
trackingCategoryID
string
trackingCategoryID2
string
trackingOptionID
string
trackingOptionID2
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Project

Description

Retrieve a specific project by ID from Xero. Returns project details, deadlines, and status.

Action Parameters

project_id
stringRequired
tenant_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Purchase Order

Description

Retrieve a specific purchase order by ID from Xero. Returns full details including line items and status.

Action Parameters

purchase_order_id
stringRequired
tenant_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Quotes

Description

Tool to retrieve a list of quotes. Use when you need to list, filter, or page through sales quotes. Use after obtaining the tenant ID via connections.

Action Parameters

ContactID
string
DateFrom
string
DateTo
string
ExpiryDateFrom
string
ExpiryDateTo
string
If-Modified-Since
string
QuoteNumber
string
Status
string
order
string
page
integer
tenant_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Accounts

Description

Retrieve chart of accounts from Xero. Returns all accounting codes used for categorizing transactions.

Action Parameters

order
string
tenant_id
string
where
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Assets

Description

Retrieve fixed assets from Xero. Assets track depreciation and book value of capital equipment.

Action Parameters

orderBy
string
page
integer
pageSize
integer
sortDirection
string
status
string
tenant_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Attachments

Description

List all attachments for a specific entity in Xero (invoice, contact, etc.).

Action Parameters

entity_id
stringRequired
entity_type
stringRequired
tenant_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Bank Transactions

Description

Retrieve bank transactions from Xero. Includes spend (payments) and receive (receipts) transactions.

Action Parameters

If-Modified-Since
string
order
string
page
integer
tenant_id
string
unitdp
integer
where
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Credit Notes

Description

Retrieve list of credit notes from Xero. Credit notes are issued to reduce amounts owed by customers.

Action Parameters

If-Modified-Since
string
order
string
page
integer
tenant_id
string
where
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Files

Description

Retrieve files from Xero Files. Lists documents stored in Xero's file management system.

Action Parameters

folderId
string
page
integer
pagesize
integer
sort
string
tenant_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Folders

Description

Retrieve folders from Xero Files. Lists document folders in Xero's file management system.

Action Parameters

sort
string
tenant_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Invoices

Description

Retrieve a list of invoices from Xero. Supports filtering by status, contact, date range, and pagination.

Action Parameters

ContactIDs
string
If-Modified-Since
string
InvoiceIDs
string
Statuses
string
createdByMyApp
boolean
includeArchived
boolean
order
string
page
integer
tenant_id
string
where
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Items

Description

Retrieve items (inventory/products) from Xero. Items can be tracked for sales and/or purchases.

Action Parameters

order
string
tenant_id
string
unitdp
integer
where
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Journals

Description

Retrieve journals from Xero. Journals show the accounting entries for all transactions.

Action Parameters

If-Modified-Since
string
offset
integer
paymentsOnly
boolean
tenant_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Manual Journals

Description

Retrieve manual journals from Xero. Manual journals are used for period-end adjustments and corrections.

Action Parameters

If-Modified-Since
string
order
string
page
integer
tenant_id
string
where
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Payments

Description

Retrieve list of payments from Xero. Payments link invoices to bank transactions.

Action Parameters

If-Modified-Since
string
order
string
page
integer
tenant_id
string
where
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Projects

Description

Retrieve projects from Xero. Projects track time and costs for client work.

Action Parameters

contactID
string
page
integer
pageSize
integer
projectIds
string
states
string
tenant_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Purchase Orders

Description

Retrieve list of purchase orders from Xero. Purchase orders track goods/services ordered from suppliers.

Action Parameters

DateFrom
string
DateTo
string
If-Modified-Since
string
Status
string
order
string
page
integer
tenant_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Tax Rates

Description

Retrieve tax rates from Xero. Shows available tax codes and rates for the organization.

Action Parameters

TaxType
string
order
string
tenant_id
string
where
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Tracking Categories

Description

Retrieve tracking categories from Xero. Tracking categories are used to segment data for reporting (e.g., departments, regions).

Action Parameters

includeArchived
boolean
order
string
tenant_id
string
where
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update Invoice

Description

Tool to update an existing invoice. Use when you need to modify the details of an invoice after it's been created.

Action Parameters

InvoiceID
string
InvoiceNumber
string
Invoices
arrayRequired
unitdp
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update Contact

Description

Update an existing contact in Xero. Only provided fields will be updated.

Action Parameters

AccountNumber
string
BankAccountDetails
string
DefaultCurrency
string
EmailAddress
string
FirstName
string
LastName
string
Name
string
TaxNumber
string
contact_id
stringRequired
mobile_number
string
phone_number
string
tenant_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Upload Attachment

Description

Upload a file attachment to a Xero entity (invoice, contact, etc.). Supports PDF, images, and documents.

Action Parameters

entity_id
stringRequired
entity_type
stringRequired
file_to_upload
objectRequired
filename
stringRequired
include_online
boolean
tenant_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired