Xero: Sets the chart of accounts, the conversion date and conversion balances
Xero accounting.postSetup: arguments, response, policy and SDK examples.
← Accounting operations · Get started
Operation xero.postsetup
Provider route: POST /api.xro/2.0/Setup. 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"]["postSetup"]>[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.postSetup(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.post_setup(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
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 Sets the chart of accounts, the conversion date and conversion balances — request body — body |
Referenced models: Sets the chart of accounts, the conversion date and conversion balances — 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 Sets the chart of accounts, the conversion date and conversion balances — response body |
Referenced models: Sets the chart of accounts, the conversion date and conversion balances — response body
Schemas
Section titled “Schemas”3 more schemas are linked from the tables above, on the schema pages.
Sets the chart of accounts, the conversion date and conversion balances — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | JSON | Root | |
ImportSummary | Model | Optional | Expand Sets the chart of accounts, the conversion date and conversion balances — response body — Import Summary |
Referenced models: Sets the chart of accounts, the conversion date and conversion balances — response body — Import Summary
Sets the chart of accounts, the conversion date and conversion balances — request body — body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | JSON | Root | |
Accounts | array | Optional | |
Accounts[] | Model | Each item | Expand Creates a new chart of accounts — request body — body |
ConversionBalances | array | Optional | Balance supplied for each account that has a value as at the conversion date. |
ConversionBalances[] | Model | Each item | Expand Sets the chart of accounts, the conversion date and conversion balances — request body — body Conversion Balances item |
ConversionDate | Model | Optional | Expand Sets the chart of accounts, the conversion date and conversion balances — request body — body Conversion Date |
Referenced models: Creates a new chart of accounts — request body — body, Sets the chart of accounts, the conversion date and conversion balances — request body — body Conversion Balances item, Sets the chart of accounts, the conversion date and conversion balances — request body — body Conversion Date
Sets the chart of accounts, the conversion date and conversion balances — response body — Import Summary
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A summary of the import from setup endpoint |
Accounts | Model | Optional | Expand Sets the chart of accounts, the conversion date and conversion balances — response body — Import Summary Accounts |
Organisation | Model | Optional | Expand Sets the chart of accounts, the conversion date and conversion balances — response body — Import Summary Organisation |
Referenced models: Sets the chart of accounts, the conversion date and conversion balances — response body — Import Summary Organisation, Sets the chart of accounts, the conversion date and conversion balances — response body — Import Summary Accounts
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
Sets the chart of accounts, the conversion date and conversion balances — request body — body Conversion Balances item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Balance supplied for each account that has a value as at the conversion date. |
AccountCode | string | Optional | The account code for a account |
Balance | number | Optional | The opening balances of the account. Debits are positive, credits are negative values Format: double |
BalanceDetails | array | Optional | |
BalanceDetails[] | Model | Each item | Expand Sets the chart of accounts, the conversion date and conversion balances — request body — body Conversion Balances item Balance Details item |
Referenced models: Sets the chart of accounts, the conversion date and conversion balances — request body — body Conversion Balances item Balance Details item
Sets the chart of accounts, the conversion date and conversion balances — request body — body Conversion Date
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | The date when the organisation starts using Xero |
Month | integer | Optional | The month the organisation starts using Xero. Value is an integer between 1 and 12 |
Year | integer | Optional | The year the organisation starts using Xero. Value is an integer greater than 2006 |
Sets the chart of accounts, the conversion date and conversion balances — response body — Import Summary Organisation
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
Present | boolean | Optional |
Sets the chart of accounts, the conversion date and conversion balances — response body — Import Summary Accounts
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A summary of the accounts changes |
Deleted | JSON | Optional | |
Deleted (anyOf 1) | integer | Alternative | The number of accounts deleted Format: int32 |
Deleted (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Errored | JSON | Optional | |
Errored (anyOf 1) | integer | Alternative | The number of accounts that had an error Format: int32 |
Errored (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Locked | JSON | Optional | |
Locked (anyOf 1) | integer | Alternative | The number of locked accounts Format: int32 |
Locked (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
New | JSON | Optional | |
New (anyOf 1) | integer | Alternative | The number of new accounts created Format: int32 |
New (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
NewOrUpdated | JSON | Optional | |
NewOrUpdated (anyOf 1) | integer | Alternative | The number of new or updated accounts Format: int32 |
NewOrUpdated (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Present | boolean | Optional | |
System | JSON | Optional | |
System (anyOf 1) | integer | Alternative | The number of system accounts Format: int32 |
System (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Total | JSON | Optional | |
Total (anyOf 1) | integer | Alternative | The total number of accounts in the org Format: int32 |
Total (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Updated | JSON | Optional | |
Updated (anyOf 1) | integer | Alternative | The number of accounts updated Format: int32 |
Updated (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: xero.postsetup. Catalog operation: postSetup. 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.