Xero
Create invoices, manage contacts, and track transactions in Xero.
On this page
- Connect
- Call it from a workflow
- Actions (22)
- xero_create_contact
- xero_create_invoice
- custom_api_call
- xero_add_items_to_sales_invoice
- xero_allocate_credit_note_to_invoice
- xero_create_bank_transfer
- xero_create_bill
- xero_create_credit_note
- xero_create_inventory_item
- xero_create_payment
- xero_create_project
- xero_create_purchase_order
- xero_create_quote_draft
- xero_create_repeating_sales_invoice
- xero_find_contact
- xero_find_invoice
- xero_find_item
- xero_find_purchase_order
- xero_send_invoice_email
- xero_update_purchase_order
- xero_update_sales_invoice
- xero_upload_attachment
- Details
Connect
Auth type: OAuth (oauth2). The connection holds the provider's OAuth tokens. They are sealed on the server and only opened when an action runs.
Scopes requested: openidaccounting.transactions
- From your agent: integrations {action: "connect", piece, credentials, env} stores the credentials for dev, prod or all. Answers name the fields, never the values.
- Or set the integration's project secrets with the secrets tool (SLACK_BOT_TOKEN, DISCORD_WEBHOOK_URL, TELEGRAM_BOT_TOKEN, TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN …): a call uses the connection, else those secrets. integrations {action: "catalog", piece} lists which ones work.
- Try one action now with integrations {action: "call", piece, piece_action, input}. It really sends.
Call it from a workflow
step.ctx.integrations.invoke("xero", action, input) resolves with the provider's answer and rejects when Xero isn't connected or refuses. Wrap it in step.run so a retry sends once. See step.ctx. Its actions run through the integration runner, which the server's operator turns on: integrations {action: "catalog", piece: "xero"} says whether yours can call it.
// workflows/notify.ts: call Xero when a booking is confirmed
import { on } from "@appbricx/workflows";
export const tellXero = on.transition("booking", "status", "confirmed", async (_event, step) => {
// Recorded once: a retry doesn't send it twice. Rejects when Xero isn't connected.
const output = await step.run("Xero", () =>
step.ctx.integrations.invoke("xero", "xero_create_contact", {
"tenant_id": "<tenant_id>",
"name": "<contact name>"
}),
);
step.ctx.log("Xero answered", output);
});{
"name": "integrations",
"arguments": {
"project_id": "<project-id>",
"action": "call",
"piece": "xero",
"piece_action": "xero_create_contact",
"input": {
"tenant_id": "<tenant_id>",
"name": "<contact name>"
},
"env": "dev"
}
}curl -X POST "$APP_ORIGIN/__appbricx/connector-proxy/xero/xero_create_contact" \
-H "Authorization: Bearer $APP_KEY" \
-H "content-type: application/json" \
-d '{"props":{"tenant_id":"<tenant_id>","name":"<contact name>"}}'Actions
xero_create_contact
Create or Update Contact. Create Xero Contact
Also accepted as create_contact.
| Input | Type | Description |
|---|---|---|
tenant_idrequired | id (picked from your account) | Organization |
contact_idoptional | text | ID of the contact to create invoice for. |
namerequired | text | Contact name, in full. |
emailoptional | text | Email address of the contact. |
xero_create_invoice
Create or Update Invoice. Create Xero Invoice
Also accepted as create_invoice.
| Input | Type | Description |
|---|---|---|
tenant_idrequired | id (picked from your account) | Organization |
invoice_idoptional | id (picked from your account) | Select an invoice |
contact_idoptional | id (picked from your account) | Select a contact |
namerequired | text | Contact name, in full. |
emailoptional | text | Email address of the contact. |
line_itemrequired | object | Invoice line items |
dateoptional | text | Date the invoice was created. Format example: 2019-03-11 |
due_daterequired | text | Due date of the invoice. Format example: 2019-03-11 |
referenceoptional | text | Reference number of the Invoice |
statusrequired | one of "DRAFT" | "SUBMITTED" | "AUTHORISED" | "DELETED" | "VOIDED" | Invoice Status |
custom_api_call
Custom API Call. Make a custom API call to a specific endpoint
| Input | Type | Description |
|---|---|---|
urlrequired | object (depends on other props) | url |
methodrequired | one of "GET" | "POST" | "PATCH" | "PUT" | "DELETE" | "HEAD" | Method |
headersrequired | object | Authorization headers are injected automatically from your connection. |
queryParamsrequired | object | Query Parameters |
body_typeoptional | one of "none" | "json" | "form_data" | "raw" | Body Type |
bodyoptional | object (depends on other props) | Body |
response_is_binaryoptional | boolean | Enable for files like PDFs, images, etc. |
failsafeoptional | boolean | No Error on Failure |
timeoutoptional | number | Timeout (in seconds) |
followRedirectsoptional | boolean | Follow redirects |
xero_add_items_to_sales_invoice
Add Items to Existing Sales Invoice. Adds line items to an existing sales invoice (ACCREC).
| Input | Type | Description |
|---|---|---|
tenant_idrequired | id (picked from your account) | Organization |
invoice_idrequired | id (picked from your account) | Select an invoice |
allow_authorisedoptional | boolean | Enable adding items to AUTHORISED invoices (Xero allows limited updates for paid/part-paid ACCREC). |
new_line_itemsrequired | array | New Line Items |
xero_allocate_credit_note_to_invoice
Allocate Credit Note to Invoice. Allocates a credit note to a specific invoice.
| Input | Type | Description |
|---|---|---|
tenant_idrequired | id (picked from your account) | Organization |
credit_note_idrequired | id (picked from your account) | Select a credit note to allocate from |
invoice_idrequired | id (picked from your account) | Select an invoice |
amountrequired | number | The amount of the credit to allocate. |
dateoptional | text | Date of allocation. Format: YYYY-MM-DD. Optional. |
xero_create_bank_transfer
Create Bank Transfer. Transfers money between two bank accounts in Xero.
| Input | Type | Description |
|---|---|---|
tenant_idrequired | id (picked from your account) | Organization |
from_bank_account_idrequired | id (picked from your account) | Select a bank account |
to_bank_account_idrequired | id (picked from your account) | Select a bank account |
amountrequired | number | Amount to transfer. Currencies must match between accounts. |
dateoptional | text | YYYY-MM-DD. Defaults to today if not provided. |
referenceoptional | text | Reference for the transfer. |
from_is_reconciledoptional | boolean | Mark source account transaction as reconciled. |
to_is_reconciledoptional | boolean | Mark destination account transaction as reconciled. |
xero_create_bill
Create Bill. Creates a new bill (Accounts Payable).
| Input | Type | Description |
|---|---|---|
tenant_idrequired | id (picked from your account) | Organization |
contact_idrequired | id (picked from your account) | Select a contact |
line_itemrequired | object | At minimum, provide a Description. |
dateoptional | text | Date the bill was issued (YYYY-MM-DD). Optional. |
due_dateoptional | text | Date the bill is due (YYYY-MM-DD). Optional. |
line_amount_typesoptional | one of "Exclusive" | "Inclusive" | "NoTax" | Line Amount Types |
invoice_numberoptional | text | Bill Number (Reference) |
statusoptional | one of "DRAFT" | "SUBMITTED" | "AUTHORISED" | Status |
xero_create_credit_note
Create Credit Note. Creates a new credit note for a contact.
| Input | Type | Description |
|---|---|---|
tenant_idrequired | id (picked from your account) | Organization |
typerequired | one of "ACCRECCREDIT" | "ACCPAYCREDIT" | Type |
contact_idrequired | id (picked from your account) | Select a contact |
dateoptional | text | YYYY-MM-DD. Defaults to today if not provided. |
statusoptional | one of "DRAFT" | "AUTHORISED" | Status |
line_amount_typesoptional | one of "Exclusive" | "Inclusive" | "NoTax" | Line Amount Types |
credit_note_numberoptional | text | Credit Note Number |
referenceoptional | text | Reference (ACCRECCREDIT only) |
currency_codeoptional | text | Currency Code |
branding_theme_idoptional | id (picked from your account) | Select a branding theme |
line_itemsoptional | array | Add one or more line items. At minimum, each line needs a Description. |
xero_create_inventory_item
Create Inventory Item. Creates a new inventory item in Xero.
| Input | Type | Description |
|---|---|---|
tenant_idrequired | id (picked from your account) | Organization |
coderequired | text | Item Code |
nameoptional | text | Name |
descriptionoptional | long text | Sales Description |
purchase_descriptionoptional | long text | Purchase Description |
is_soldoptional | boolean | Is Sold |
is_purchasedoptional | boolean | Is Purchased |
sales_detailsoptional | object | Sales Details |
sales_account_idoptional | id (picked from your account) | Select an account |
purchase_detailsoptional | object | Purchase Details |
purchase_account_idoptional | id (picked from your account) | Select an account |
cogs_account_idoptional | id (picked from your account) | Select an account |
inventory_asset_account_idoptional | id (picked from your account) | Select an account |
xero_create_payment
Create Payment. Applies a payment to an invoice.
| Input | Type | Description |
|---|---|---|
tenant_idrequired | id (picked from your account) | Organization |
invoice_idrequired | id (picked from your account) | Select an authorised invoice (sales or bill) to apply payment to. |
account_idrequired | id (picked from your account) | Select a bank account |
amountrequired | number | Payment amount (must be <= amount due). |
daterequired | text | YYYY-MM-DD. |
referenceoptional | text | Reference |
is_reconciledoptional | boolean | Mark payment as reconciled (optional). |
xero_create_project
Create Project. Creates a new project for a contact.
| Input | Type | Description |
|---|---|---|
tenant_idrequired | id (picked from your account) | Organization |
contact_idrequired | id (picked from your account) | Select a contact |
namerequired | text | Project Name |
deadline_utcoptional | text | Example: 2017-04-23T18:25:43.511Z |
estimate_amountoptional | number | Estimate Amount |
xero_create_purchase_order
Create Purchase Order. Creates a new purchase order for a contact.
| Input | Type | Description |
|---|---|---|
tenant_idrequired | id (picked from your account) | Organization |
contact_idrequired | id (picked from your account) | Select a contact |
line_itemrequired | object | At minimum, provide a Description. |
dateoptional | text | Date the purchase order was issued (YYYY-MM-DD). Optional. |
delivery_dateoptional | text | Date goods are to be delivered (YYYY-MM-DD). Optional. |
line_amount_typesoptional | one of "Exclusive" | "Inclusive" | "NoTax" | Line Amount Types |
purchase_order_numberoptional | text | Purchase Order Number |
referenceoptional | text | Reference |
branding_theme_idoptional | id (picked from your account) | Select a branding theme |
statusoptional | one of "DRAFT" | "SUBMITTED" | "AUTHORISED" | "BILLED" | "DELETED" | Status |
delivery_addressoptional | long text | Delivery Address |
attention_tooptional | text | Attention To |
telephoneoptional | text | Telephone |
delivery_instructionsoptional | long text | Delivery Instructions |
expected_arrival_dateoptional | text | YYYY-MM-DD. Optional. |
xero_create_quote_draft
Create New Quote Draft. Creates a new draft quote.
| Input | Type | Description |
|---|---|---|
tenant_idrequired | id (picked from your account) | Organization |
contact_idrequired | id (picked from your account) | Select a contact |
daterequired | text | Date the quote was issued (YYYY-MM-DD). |
expiry_dateoptional | text | Date the quote expires (YYYY-MM-DD). |
line_itemrequired | object | At minimum, provide a Description. |
line_amount_typesoptional | one of "Exclusive" | "Inclusive" | "NoTax" | Line Amount Types |
referenceoptional | text | Reference |
quote_numberoptional | text | Quote Number |
titleoptional | text | Title |
summaryoptional | long text | Summary |
termsoptional | long text | Terms |
statusoptional | one of "DRAFT" | Status |
xero_create_repeating_sales_invoice
Create Repeating Sales Invoice. Creates a repeating sales invoice (Accounts Receivable).
| Input | Type | Description |
|---|---|---|
tenant_idrequired | id (picked from your account) | Organization |
contact_idrequired | id (picked from your account) | Select a contact |
schedule_periodrequired | number | Integer period (e.g., 1 every week, 2 every month). |
schedule_unitrequired | one of "WEEKLY" | "MONTHLY" | Schedule Unit |
due_daterequired | number | Day number used with due date type (e.g., 20, 31). |
due_date_typerequired | id (picked from your account) | Due Date Type |
start_daterequired | text | Start Date (YYYY-MM-DD) |
end_dateoptional | text | End Date (YYYY-MM-DD) |
line_amount_typesrequired | one of "Exclusive" | "Inclusive" | "NoTax" | Line Amount Types |
currency_coderequired | id (picked from your account) | Select a currency code |
statusrequired | one of "DRAFT" | "AUTHORISED" | Status |
referenceoptional | text | Reference |
branding_theme_idoptional | id (picked from your account) | Select a branding theme |
approved_for_sendingoptional | boolean | Approved For Sending |
send_copyoptional | boolean | Send Copy |
mark_as_sentoptional | boolean | Mark As Sent |
include_pdfoptional | boolean | Include PDF |
line_itemsrequired | array | Line Items |
xero_find_contact
Find Contact. Finds a contact by name or account number (or SearchTerm).
| Input | Type | Description |
|---|---|---|
tenant_idrequired | id (picked from your account) | Organization |
search_byrequired | one of "NAME" | "ACCOUNT_NUMBER" | "SEARCH_TERM" | Search By |
valuerequired | text | Name, Account Number, or Search Term depending on Search By. |
include_archivedoptional | boolean | Include Archived |
summary_onlyoptional | boolean | Recommended for broad searches (Search Term). Excludes heavy fields. |
pageoptional | number | Pagination page (optional). |
xero_find_invoice
Find Invoice. Finds an invoice by number or reference.
| Input | Type | Description |
|---|---|---|
tenant_idrequired | id (picked from your account) | Organization |
search_byrequired | one of "INVOICE_NUMBER" | "REFERENCE" | "SEARCH_TERM" | Search By |
valuerequired | text | Invoice Number, Reference, or Search Term. |
type_filteroptional | one of "ACCREC" | "ACCPAY" | Type Filter |
summary_onlyoptional | boolean | Summary Only (faster, lighter) |
pageoptional | number | Page |
xero_find_item
Find Item. Finds an item by name or code.
| Input | Type | Description |
|---|---|---|
tenant_idrequired | id (picked from your account) | Organization |
search_byrequired | one of "CODE" | "NAME" | Search By |
valuerequired | text | Item Code or Name (exact match). |
orderoptional | text | e.g. Name or Name DESC |
xero_find_purchase_order
Find Purchase Order. Finds a purchase order by given parameters.
| Input | Type | Description |
|---|---|---|
tenant_idrequired | id (picked from your account) | Organization |
contact_idoptional | id (picked from your account) | Select a contact |
search_byrequired | one of "NUMBER" | "REFERENCE" | "ID" | Search By |
valuerequired | text | Number, Reference or ID depending on Search By. |
statusesoptional | list of | Statuses |
date_fromoptional | text | Date From (YYYY-MM-DD) |
date_tooptional | text | Date To (YYYY-MM-DD) |
orderoptional | text | Order (e.g., Date DESC) |
pageoptional | number | Page |
page_sizeoptional | number | Page Size (1-1000) |
xero_send_invoice_email
Send Sales Invoice by Email. Sends a sales invoice via email to a contact.
| Input | Type | Description |
|---|---|---|
tenant_idrequired | id (picked from your account) | Organization |
invoice_idrequired | id (picked from your account) | Select a sales invoice with a valid status for sending email (SUBMITTED, AUTHORISED, or PAID). |
xero_update_purchase_order
Update Purchase Order. Updates details of an existing purchase order.
| Input | Type | Description |
|---|---|---|
tenant_idrequired | id (picked from your account) | Organization |
purchase_order_idrequired | id (picked from your account) | Select a purchase order to update |
statusoptional | one of "DRAFT" | "SUBMITTED" | "AUTHORISED" | "BILLED" | "DELETED" | Status |
sent_to_contactoptional | boolean | Mark as Sent to Contact |
delivery_addressoptional | long text | Delivery Address |
attention_tooptional | text | Attention To |
telephoneoptional | text | Telephone |
delivery_instructionsoptional | long text | Delivery Instructions |
expected_arrival_dateoptional | text | Expected Arrival Date (YYYY-MM-DD) |
xero_update_sales_invoice
Update Sales Invoice. Updates details of an existing sales invoice (ACCREC).
| Input | Type | Description |
|---|---|---|
tenant_idrequired | id (picked from your account) | Organization |
allow_authorisedoptional | boolean | Enable updates for AUTHORISED invoices (Xero allows limited updates for paid/part-paid ACCREC). |
invoice_idrequired | id (picked from your account) | Select a sales invoice (ACCREC) with DRAFT or SUBMITTED status. |
referenceoptional | text | Reference |
due_dateoptional | text | Due Date (YYYY-MM-DD) |
invoice_numberoptional | text | Invoice Number |
branding_theme_idoptional | id (picked from your account) | Select a branding theme |
urloptional | text | Source URL |
contact_idoptional | id (picked from your account) | Select a contact |
statusoptional | one of "DRAFT" | "SUBMITTED" | "AUTHORISED" | "VOIDED" | "DELETED" | Status |
sent_to_contactoptional | boolean | Mark as Sent to Contact |
replace_all_line_itemsoptional | boolean | If enabled, only the provided line_items will remain. If disabled, we will merge with current lines by updating matching LineItemID and appending new items. |
line_itemsoptional | array | Line Items (updates/additions) |
xero_upload_attachment
Upload Attachment. Uploads an attachment to a specific Xero resource.
| Input | Type | Description |
|---|---|---|
tenant_idrequired | id (picked from your account) | Organization |
resource_typerequired | one of "Invoices" | "CreditNotes" | "PurchaseOrders" | "Quotes" | "BankTransfers" | "BankTransactions" | "Contacts" | "Accounts" | "ManualJournals" | "Receipts" | "RepeatingInvoices" | The Xero resource to attach the file to. |
resource_idrequired | id (picked from your account) | Select the specific resource to attach the file to. |
filerequired | file | The file to upload. Max 10MB per Xero limits. |
file_nameoptional | text | Optional file name to use in Xero. Avoid characters: < > : " / \ | ? * |
content_typeoptional | text | MIME type of the file (e.g., image/png). If not set, will be inferred or default to application/octet-stream. |
include_onlineoptional | boolean | Only applicable to ACCREC invoices and ACCREC credit notes. Adds IncludeOnline=true query parameter. |
Details
- Id
xero- Category
- Finance and payments
- Tags
- accounting, invoicing, finance, bookkeeping
- Package
@activepieces/piece-xero@0.6.4- Runs
- Through the integration runner