Xero

Create invoices, manage contacts, and track transactions in Xero.

Finance and paymentsOAuth22 actionsAll integrations

On this page
  1. Connect
  2. Call it from a workflow
  3. Actions (22)
  4. xero_create_contact
  5. xero_create_invoice
  6. custom_api_call
  7. xero_add_items_to_sales_invoice
  8. xero_allocate_credit_note_to_invoice
  9. xero_create_bank_transfer
  10. xero_create_bill
  11. xero_create_credit_note
  12. xero_create_inventory_item
  13. xero_create_payment
  14. xero_create_project
  15. xero_create_purchase_order
  16. xero_create_quote_draft
  17. xero_create_repeating_sales_invoice
  18. xero_find_contact
  19. xero_find_invoice
  20. xero_find_item
  21. xero_find_purchase_order
  22. xero_send_invoice_email
  23. xero_update_purchase_order
  24. xero_update_sales_invoice
  25. xero_upload_attachment
  26. 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.

Workflow
// 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);
});
Try it from your agent
{
  "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"
  }
}
From another backend (connector proxy)
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.

InputTypeDescription
tenant_idrequiredid (picked from your account)Organization
contact_idoptionaltextID of the contact to create invoice for.
namerequiredtextContact name, in full.
emailoptionaltextEmail address of the contact.

xero_create_invoice

Create or Update Invoice. Create Xero Invoice

Also accepted as create_invoice.

InputTypeDescription
tenant_idrequiredid (picked from your account)Organization
invoice_idoptionalid (picked from your account)Select an invoice
contact_idoptionalid (picked from your account)Select a contact
namerequiredtextContact name, in full.
emailoptionaltextEmail address of the contact.
line_itemrequiredobjectInvoice line items
dateoptionaltextDate the invoice was created. Format example: 2019-03-11
due_daterequiredtextDue date of the invoice. Format example: 2019-03-11
referenceoptionaltextReference number of the Invoice
statusrequiredone of "DRAFT" | "SUBMITTED" | "AUTHORISED" | "DELETED" | "VOIDED"Invoice Status

custom_api_call

Custom API Call. Make a custom API call to a specific endpoint

InputTypeDescription
urlrequiredobject (depends on other props)url
methodrequiredone of "GET" | "POST" | "PATCH" | "PUT" | "DELETE" | "HEAD"Method
headersrequiredobjectAuthorization headers are injected automatically from your connection.
queryParamsrequiredobjectQuery Parameters
body_typeoptionalone of "none" | "json" | "form_data" | "raw"Body Type
bodyoptionalobject (depends on other props)Body
response_is_binaryoptionalbooleanEnable for files like PDFs, images, etc.
failsafeoptionalbooleanNo Error on Failure
timeoutoptionalnumberTimeout (in seconds)
followRedirectsoptionalbooleanFollow redirects

xero_add_items_to_sales_invoice

Add Items to Existing Sales Invoice. Adds line items to an existing sales invoice (ACCREC).

InputTypeDescription
tenant_idrequiredid (picked from your account)Organization
invoice_idrequiredid (picked from your account)Select an invoice
allow_authorisedoptionalbooleanEnable adding items to AUTHORISED invoices (Xero allows limited updates for paid/part-paid ACCREC).
new_line_itemsrequiredarrayNew Line Items

xero_allocate_credit_note_to_invoice

Allocate Credit Note to Invoice. Allocates a credit note to a specific invoice.

InputTypeDescription
tenant_idrequiredid (picked from your account)Organization
credit_note_idrequiredid (picked from your account)Select a credit note to allocate from
invoice_idrequiredid (picked from your account)Select an invoice
amountrequirednumberThe amount of the credit to allocate.
dateoptionaltextDate of allocation. Format: YYYY-MM-DD. Optional.

xero_create_bank_transfer

Create Bank Transfer. Transfers money between two bank accounts in Xero.

InputTypeDescription
tenant_idrequiredid (picked from your account)Organization
from_bank_account_idrequiredid (picked from your account)Select a bank account
to_bank_account_idrequiredid (picked from your account)Select a bank account
amountrequirednumberAmount to transfer. Currencies must match between accounts.
dateoptionaltextYYYY-MM-DD. Defaults to today if not provided.
referenceoptionaltextReference for the transfer.
from_is_reconciledoptionalbooleanMark source account transaction as reconciled.
to_is_reconciledoptionalbooleanMark destination account transaction as reconciled.

xero_create_bill

Create Bill. Creates a new bill (Accounts Payable).

InputTypeDescription
tenant_idrequiredid (picked from your account)Organization
contact_idrequiredid (picked from your account)Select a contact
line_itemrequiredobjectAt minimum, provide a Description.
dateoptionaltextDate the bill was issued (YYYY-MM-DD). Optional.
due_dateoptionaltextDate the bill is due (YYYY-MM-DD). Optional.
line_amount_typesoptionalone of "Exclusive" | "Inclusive" | "NoTax"Line Amount Types
invoice_numberoptionaltextBill Number (Reference)
statusoptionalone of "DRAFT" | "SUBMITTED" | "AUTHORISED"Status

xero_create_credit_note

Create Credit Note. Creates a new credit note for a contact.

InputTypeDescription
tenant_idrequiredid (picked from your account)Organization
typerequiredone of "ACCRECCREDIT" | "ACCPAYCREDIT"Type
contact_idrequiredid (picked from your account)Select a contact
dateoptionaltextYYYY-MM-DD. Defaults to today if not provided.
statusoptionalone of "DRAFT" | "AUTHORISED"Status
line_amount_typesoptionalone of "Exclusive" | "Inclusive" | "NoTax"Line Amount Types
credit_note_numberoptionaltextCredit Note Number
referenceoptionaltextReference (ACCRECCREDIT only)
currency_codeoptionaltextCurrency Code
branding_theme_idoptionalid (picked from your account)Select a branding theme
line_itemsoptionalarrayAdd 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.

InputTypeDescription
tenant_idrequiredid (picked from your account)Organization
coderequiredtextItem Code
nameoptionaltextName
descriptionoptionallong textSales Description
purchase_descriptionoptionallong textPurchase Description
is_soldoptionalbooleanIs Sold
is_purchasedoptionalbooleanIs Purchased
sales_detailsoptionalobjectSales Details
sales_account_idoptionalid (picked from your account)Select an account
purchase_detailsoptionalobjectPurchase Details
purchase_account_idoptionalid (picked from your account)Select an account
cogs_account_idoptionalid (picked from your account)Select an account
inventory_asset_account_idoptionalid (picked from your account)Select an account

xero_create_payment

Create Payment. Applies a payment to an invoice.

InputTypeDescription
tenant_idrequiredid (picked from your account)Organization
invoice_idrequiredid (picked from your account)Select an authorised invoice (sales or bill) to apply payment to.
account_idrequiredid (picked from your account)Select a bank account
amountrequirednumberPayment amount (must be <= amount due).
daterequiredtextYYYY-MM-DD.
referenceoptionaltextReference
is_reconciledoptionalbooleanMark payment as reconciled (optional).

xero_create_project

Create Project. Creates a new project for a contact.

InputTypeDescription
tenant_idrequiredid (picked from your account)Organization
contact_idrequiredid (picked from your account)Select a contact
namerequiredtextProject Name
deadline_utcoptionaltextExample: 2017-04-23T18:25:43.511Z
estimate_amountoptionalnumberEstimate Amount

xero_create_purchase_order

Create Purchase Order. Creates a new purchase order for a contact.

InputTypeDescription
tenant_idrequiredid (picked from your account)Organization
contact_idrequiredid (picked from your account)Select a contact
line_itemrequiredobjectAt minimum, provide a Description.
dateoptionaltextDate the purchase order was issued (YYYY-MM-DD). Optional.
delivery_dateoptionaltextDate goods are to be delivered (YYYY-MM-DD). Optional.
line_amount_typesoptionalone of "Exclusive" | "Inclusive" | "NoTax"Line Amount Types
purchase_order_numberoptionaltextPurchase Order Number
referenceoptionaltextReference
branding_theme_idoptionalid (picked from your account)Select a branding theme
statusoptionalone of "DRAFT" | "SUBMITTED" | "AUTHORISED" | "BILLED" | "DELETED"Status
delivery_addressoptionallong textDelivery Address
attention_tooptionaltextAttention To
telephoneoptionaltextTelephone
delivery_instructionsoptionallong textDelivery Instructions
expected_arrival_dateoptionaltextYYYY-MM-DD. Optional.

xero_create_quote_draft

Create New Quote Draft. Creates a new draft quote.

InputTypeDescription
tenant_idrequiredid (picked from your account)Organization
contact_idrequiredid (picked from your account)Select a contact
daterequiredtextDate the quote was issued (YYYY-MM-DD).
expiry_dateoptionaltextDate the quote expires (YYYY-MM-DD).
line_itemrequiredobjectAt minimum, provide a Description.
line_amount_typesoptionalone of "Exclusive" | "Inclusive" | "NoTax"Line Amount Types
referenceoptionaltextReference
quote_numberoptionaltextQuote Number
titleoptionaltextTitle
summaryoptionallong textSummary
termsoptionallong textTerms
statusoptionalone of "DRAFT"Status

xero_create_repeating_sales_invoice

Create Repeating Sales Invoice. Creates a repeating sales invoice (Accounts Receivable).

InputTypeDescription
tenant_idrequiredid (picked from your account)Organization
contact_idrequiredid (picked from your account)Select a contact
schedule_periodrequirednumberInteger period (e.g., 1 every week, 2 every month).
schedule_unitrequiredone of "WEEKLY" | "MONTHLY"Schedule Unit
due_daterequirednumberDay number used with due date type (e.g., 20, 31).
due_date_typerequiredid (picked from your account)Due Date Type
start_daterequiredtextStart Date (YYYY-MM-DD)
end_dateoptionaltextEnd Date (YYYY-MM-DD)
line_amount_typesrequiredone of "Exclusive" | "Inclusive" | "NoTax"Line Amount Types
currency_coderequiredid (picked from your account)Select a currency code
statusrequiredone of "DRAFT" | "AUTHORISED"Status
referenceoptionaltextReference
branding_theme_idoptionalid (picked from your account)Select a branding theme
approved_for_sendingoptionalbooleanApproved For Sending
send_copyoptionalbooleanSend Copy
mark_as_sentoptionalbooleanMark As Sent
include_pdfoptionalbooleanInclude PDF
line_itemsrequiredarrayLine Items

xero_find_contact

Find Contact. Finds a contact by name or account number (or SearchTerm).

InputTypeDescription
tenant_idrequiredid (picked from your account)Organization
search_byrequiredone of "NAME" | "ACCOUNT_NUMBER" | "SEARCH_TERM"Search By
valuerequiredtextName, Account Number, or Search Term depending on Search By.
include_archivedoptionalbooleanInclude Archived
summary_onlyoptionalbooleanRecommended for broad searches (Search Term). Excludes heavy fields.
pageoptionalnumberPagination page (optional).

xero_find_invoice

Find Invoice. Finds an invoice by number or reference.

InputTypeDescription
tenant_idrequiredid (picked from your account)Organization
search_byrequiredone of "INVOICE_NUMBER" | "REFERENCE" | "SEARCH_TERM"Search By
valuerequiredtextInvoice Number, Reference, or Search Term.
type_filteroptionalone of "ACCREC" | "ACCPAY"Type Filter
summary_onlyoptionalbooleanSummary Only (faster, lighter)
pageoptionalnumberPage

xero_find_item

Find Item. Finds an item by name or code.

InputTypeDescription
tenant_idrequiredid (picked from your account)Organization
search_byrequiredone of "CODE" | "NAME"Search By
valuerequiredtextItem Code or Name (exact match).
orderoptionaltexte.g. Name or Name DESC

xero_find_purchase_order

Find Purchase Order. Finds a purchase order by given parameters.

InputTypeDescription
tenant_idrequiredid (picked from your account)Organization
contact_idoptionalid (picked from your account)Select a contact
search_byrequiredone of "NUMBER" | "REFERENCE" | "ID"Search By
valuerequiredtextNumber, Reference or ID depending on Search By.
statusesoptionallist ofStatuses
date_fromoptionaltextDate From (YYYY-MM-DD)
date_tooptionaltextDate To (YYYY-MM-DD)
orderoptionaltextOrder (e.g., Date DESC)
pageoptionalnumberPage
page_sizeoptionalnumberPage Size (1-1000)

xero_send_invoice_email

Send Sales Invoice by Email. Sends a sales invoice via email to a contact.

InputTypeDescription
tenant_idrequiredid (picked from your account)Organization
invoice_idrequiredid (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.

InputTypeDescription
tenant_idrequiredid (picked from your account)Organization
purchase_order_idrequiredid (picked from your account)Select a purchase order to update
statusoptionalone of "DRAFT" | "SUBMITTED" | "AUTHORISED" | "BILLED" | "DELETED"Status
sent_to_contactoptionalbooleanMark as Sent to Contact
delivery_addressoptionallong textDelivery Address
attention_tooptionaltextAttention To
telephoneoptionaltextTelephone
delivery_instructionsoptionallong textDelivery Instructions
expected_arrival_dateoptionaltextExpected Arrival Date (YYYY-MM-DD)

xero_update_sales_invoice

Update Sales Invoice. Updates details of an existing sales invoice (ACCREC).

InputTypeDescription
tenant_idrequiredid (picked from your account)Organization
allow_authorisedoptionalbooleanEnable updates for AUTHORISED invoices (Xero allows limited updates for paid/part-paid ACCREC).
invoice_idrequiredid (picked from your account)Select a sales invoice (ACCREC) with DRAFT or SUBMITTED status.
referenceoptionaltextReference
due_dateoptionaltextDue Date (YYYY-MM-DD)
invoice_numberoptionaltextInvoice Number
branding_theme_idoptionalid (picked from your account)Select a branding theme
urloptionaltextSource URL
contact_idoptionalid (picked from your account)Select a contact
statusoptionalone of "DRAFT" | "SUBMITTED" | "AUTHORISED" | "VOIDED" | "DELETED"Status
sent_to_contactoptionalbooleanMark as Sent to Contact
replace_all_line_itemsoptionalbooleanIf 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_itemsoptionalarrayLine Items (updates/additions)

xero_upload_attachment

Upload Attachment. Uploads an attachment to a specific Xero resource.

InputTypeDescription
tenant_idrequiredid (picked from your account)Organization
resource_typerequiredone of "Invoices" | "CreditNotes" | "PurchaseOrders" | "Quotes" | "BankTransfers" | "BankTransactions" | "Contacts" | "Accounts" | "ManualJournals" | "Receipts" | "RepeatingInvoices"The Xero resource to attach the file to.
resource_idrequiredid (picked from your account)Select the specific resource to attach the file to.
filerequiredfileThe file to upload. Max 10MB per Xero limits.
file_nameoptionaltextOptional file name to use in Xero. Avoid characters: < > : " / \ | ? *
content_typeoptionaltextMIME type of the file (e.g., image/png). If not set, will be inferred or default to application/octet-stream.
include_onlineoptionalbooleanOnly 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