Xero: Updates a chart of accounts
Xero accounting.updateAccount: arguments, response, policy and SDK examples.
← Accounting operations · Get started
Operation xero.updateaccount
Provider route: POST /api.xro/2.0/Accounts/{AccountID}. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/xero with npm, or alter-sdk-xero with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { XeroIntegration } from "@alter-ai/xero";
async function execute(input: Parameters<XeroIntegration["accounting"]["updateAccount"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new XeroIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.accounting.updateAccount(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_xero import XeroIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = XeroIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.accounting.update_account(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
path | object | Required within parent | Additional keys: not allowed |
path.AccountID | string | Required within parent | Format: uuid |
headers | object | Required within parent | Additional keys: not allowed |
headers.xero-tenant-id | string | Required within parent | |
headers.Idempotency-Key | string | Optional | |
body | Model | Required within parent | Expand Updates a chart of accounts — request body — body |
Referenced models: Updates a chart of accounts — request body — body
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Deletes a chart of accounts — response body |
Referenced models: Deletes a chart of accounts — response body
Schemas
Section titled “Schemas”Updates a chart of accounts — request body — body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
Accounts | array | Optional | |
Accounts[] | Model | Each item | Expand Creates a new chart of accounts — request body — body |
Referenced models: Creates a new chart of accounts — request body — body
Deletes a chart of accounts — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
Accounts | array | Optional | |
Accounts[] | Model | Each item | Expand Deletes a chart of accounts — response body — Accounts item |
Referenced models: Deletes a chart of accounts — response body — Accounts item
Creates a new chart of accounts — request body — body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
AccountID | string | Optional | The Xero identifier for an account – specified as a string following the endpoint name e.g. /297c2dc5-cc47-4afd-8ec8-74990b8761e9 Format: uuid |
AddToWatchlist | boolean | Optional | Boolean – describes whether the account is shown in the watchlist widget on the dashboard |
BankAccountNumber | string | Optional | For bank accounts only (Account Type BANK) |
BankAccountType | string | Optional | For bank accounts only. See Bank Account types One of: BANK, CREDITCARD, PAYPAL, NONE, |
Class | string | Optional | See Account Class Types One of: ASSET, EQUITY, EXPENSE, LIABILITY, REVENUE Read only: true |
Code | string | Optional | Customer defined alpha numeric account code e.g 200 or SALES (max length = 10) |
CurrencyCode | Model | Optional | Expand Create a new currency for a Xero organisation — request body — body Code |
Description | string | Optional | Description of the Account. Valid for all types of accounts except bank accounts (max length = 4000) |
EnablePaymentsToAccount | boolean | Optional | Boolean – describes whether account can have payments applied to it |
HasAttachments | boolean | Optional | boolean to indicate if an account has an attachment (read only) Default: false Read only: true |
Name | string | Optional | Name of account (max length = 150) Maximum length: 150 |
ReportingCode | string | Optional | Shown if set |
ReportingCodeName | string | Optional | Shown if set Read only: true |
ShowInExpenseClaims | boolean | Optional | Boolean – describes whether account code is available for use with expense claims |
Status | string | Optional | Accounts with a status of ACTIVE can be updated to ARCHIVED. See Account Status Codes One of: ACTIVE, ARCHIVED, DELETED |
SystemAccount | string | Optional | If this is a system account then this element is returned. See System Account types. Note that non-system accounts may have this element set as either “” or null. One of: DEBTORS, CREDITORS, BANKCURRENCYGAIN, GST, GSTONIMPORTS, HISTORICAL, REALISEDCURRENCYGAIN, RETAINEDEARNINGS, ROUNDING, TRACKINGTRANSFERS, UNPAIDEXPCLM, UNREALISEDCURRENCYGAIN, WAGEPAYABLES, CISASSETS, CISASSET, CISLABOUR, CISLABOUREXPENSE, CISLABOURINCOME, CISLIABILITY, CISMATERIALS, Read only: true |
TaxType | string | Optional | The tax type from taxRates |
Type | string | Optional | See Account Types One of: BANK, CURRENT, CURRLIAB, DEPRECIATN, DIRECTCOSTS, EQUITY, EXPENSE, FIXED, INVENTORY, LIABILITY, NONCURRENT, OTHERINCOME, OVERHEADS, PREPAYMENT, REVENUE, SALES, TERMLIAB, PAYG |
UpdatedDateUTC | string | Optional | Last modified date UTC format Read only: true |
ValidationErrors | array | Optional | Displays array of validation error messages from the API |
ValidationErrors[] | Model | Each item | Expand Retrieves journals — response body — Warnings item |
Referenced models: Create a new currency for a Xero organisation — request body — body Code, Retrieves journals — response body — Warnings item
Deletes a chart of accounts — response body — Accounts item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
AccountID | string | Optional | The Xero identifier for an account – specified as a string following the endpoint name e.g. /297c2dc5-cc47-4afd-8ec8-74990b8761e9 Format: uuid |
AddToWatchlist | boolean | Optional | Boolean – describes whether the account is shown in the watchlist widget on the dashboard |
BankAccountNumber | string | Optional | For bank accounts only (Account Type BANK) |
BankAccountType | string | Optional | For bank accounts only. See Bank Account types Known values: BANK, CREDITCARD, PAYPAL, NONE, "" (empty string) |
Class | string | Optional | See Account Class Types Known values: ASSET, EQUITY, EXPENSE, LIABILITY, REVENUE Read only: true |
Code | string | Optional | Customer defined alpha numeric account code e.g 200 or SALES (max length = 10) |
CurrencyCode | Model | Optional | Expand Deletes an Allocation from a Prepayment — response body — Invoice Currency Code |
Description | string | Optional | Description of the Account. Valid for all types of accounts except bank accounts (max length = 4000) |
EnablePaymentsToAccount | boolean | Optional | Boolean – describes whether account can have payments applied to it |
HasAttachments | boolean | Optional | boolean to indicate if an account has an attachment (read only) Default: false Read only: true |
Name | string | Optional | Name of account (max length = 150) Maximum length: 150 |
ReportingCode | string | Optional | Shown if set |
ReportingCodeName | string | Optional | Shown if set Read only: true |
ShowInExpenseClaims | boolean | Optional | Boolean – describes whether account code is available for use with expense claims |
Status | string | Optional | Accounts with a status of ACTIVE can be updated to ARCHIVED. See Account Status Codes Known values: ACTIVE, ARCHIVED, DELETED |
SystemAccount | string | Optional | If this is a system account then this element is returned. See System Account types. Note that non-system accounts may have this element set as either “” or null. Known values: DEBTORS, CREDITORS, BANKCURRENCYGAIN, GST, GSTONIMPORTS, HISTORICAL, REALISEDCURRENCYGAIN, RETAINEDEARNINGS, ROUNDING, TRACKINGTRANSFERS, UNPAIDEXPCLM, UNREALISEDCURRENCYGAIN, WAGEPAYABLES, CISASSETS, CISASSET, CISLABOUR, CISLABOUREXPENSE, CISLABOURINCOME, CISLIABILITY, CISMATERIALS, "" (empty string)Read only: true |
TaxType | string | Optional | The tax type from taxRates |
Type | string | Optional | See Account Types Known values: BANK, CURRENT, CURRLIAB, DEPRECIATN, DIRECTCOSTS, EQUITY, EXPENSE, FIXED, INVENTORY, LIABILITY, NONCURRENT, OTHERINCOME, OVERHEADS, PREPAYMENT, REVENUE, SALES, TERMLIAB, PAYG |
UpdatedDateUTC | string | Optional | Last modified date UTC format Read only: true |
ValidationErrors | array | Optional | Displays array of validation error messages from the API |
ValidationErrors[] | Model | Each item | Expand Retrieves journals — response body — Warnings item |
Referenced models: Deletes an Allocation from a Prepayment — response body — Invoice Currency Code, Retrieves journals — response body — Warnings item
Create a new currency for a Xero organisation — request body — body Code
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | string | Root | 3 letter alpha code for the currency – see list of currency codes One of: AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BYR, BZD, CAD, CDF, CHF, CLF, CLP, CNY, COP, CRC, CUC, CUP, CVE, CZK, DJF, DKK, DOP, DZD, EEK, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JMD, JOD, JPY, KES, KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LTL, LVL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRO, MRU, MUR, MVR, MWK, MXN, MXV, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SKK, SLE, SLL, SOS, SRD, STD, STN, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VEF, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZMK, ZWD |
Retrieves journals — response body — Warnings item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
Message | string | Optional | Validation error message |
Deletes an Allocation from a Prepayment — response body — Invoice Currency Code
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | string | Root | 3 letter alpha code for the currency – see list of currency codes Known values: AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BYR, BZD, CAD, CDF, CHF, CLF, CLP, CNY, COP, CRC, CUC, CUP, CVE, CZK, DJF, DKK, DOP, DZD, EEK, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JMD, JOD, JPY, KES, KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LTL, LVL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRO, MRU, MUR, MVR, MWK, MXN, MXV, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SKK, SLE, SLL, SOS, SRD, STD, STN, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VEF, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZMK, ZWD |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: xero.updateaccount. Catalog operation: updateAccount. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.