finance
Xero CLI for Headless Automation
Use the Xero CLI for headless automation with headless JSON commands, schema discovery, credentials, and permission controls.
7 functions 6 read 1 write Manual OAuth token auth
Xero CLI for Headless Automation
Use KosmoKrator as a non-interactive integration runtime for local automations and wrappers.
Use headless automation when another tool needs a stable local command surface. The Xero CLI uses the same integration registry as the TUI, Lua runtime, and MCP gateway, but returns predictable command output for automation.
Command Shape
# Xero CLI for Headless Automation
kosmokrator integrations:configure xero --set access_token="$XERO_ACCESS_TOKEN" --enable --read allow --write ask --json
kosmo integrations:call xero.xero_create_invoice '{"contact_id":"example_contact_id","type":"example_type","date":"example_date","due_date":"example_due_date","reference":"example_reference","line_items":"example_line_items","status":"example_status"}' --json Discovery Before Execution
Agents and scripts can inspect Xero docs and schemas before choosing a function.
kosmo integrations:docs xero --json
kosmo integrations:docs xero.xero_create_invoice --json
kosmo integrations:schema xero.xero_create_invoice --json
kosmo integrations:search "Xero" --json
kosmo integrations:list --json Useful Xero CLI Functions
| Function | Type | Parameters | Description |
|---|---|---|---|
xero.xero_create_invoice | Write | contact_id, type, date, due_date, reference, line_items, status | Create a new invoice in Xero. Requires a contact_id and at least one line item with description and unit_amount. Returns the created invoice with its ID and number. |
xero.xero_get_contact | Read | contact_id | Retrieve a Xero contact by its ID. Returns the contact's ID, name, email, phone, addresses, and status. |
xero.xero_get_current_user | Read | none | Retrieve the currently authenticated Xero user. Returns the user's ID, name, and email. Useful for identifying which Xero organisation or token is in use. |
xero.xero_get_invoice | Read | invoice_id | Retrieve a Xero invoice by its ID. Returns the full invoice including line items, contact details, and totals. |
xero.xero_list_accounts | Read | where, order | List Xero chart of accounts. Returns account codes, names, types, tax types, and statuses. |
xero.xero_list_contacts | Read | page, where, order, include_archived | List Xero contacts with pagination. Returns contact IDs, names, emails, and types. Use page for pagination (1-indexed). |
xero.xero_list_invoices | Read | page, pageSize, statuses, where, order | List Xero invoices with pagination and filtering. Returns invoice IDs, numbers, amounts, status, and dates. Use page and pageSize for pagination. |
Automation Notes
- Use
--jsonfor machine-readable output. - Keep credentials out of argv by using environment variables or stored KosmoKrator configuration.
- Configure read/write policy before unattended runs; use
--forceonly for trusted automation. - Use the MCP gateway instead when the agent needs dynamic tool discovery inside a conversation.