xero.accounts.create-account
Creates a new chart of accounts
Overview
| Property | Value |
|---|---|
| Workflow type | Atomic |
| Library | App-xero |
| Version | 1.0 |
Input Schema
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
base_url | string | Yes | — | Xero API root, e.g. https://<host>/api |
api_token | string | No | — | Bearer token; omit to use the workflow's token env var |
xero_tenant_id | string | Yes | — | Xero identifier for Tenant |
idempotency_key | string | No | — | This allows you to safely retry requests without the risk of duplicate processing. 128 character max. |
code | string | No | — | Customer defined alpha numeric account code e.g 200 or SALES (max length = 10) |
name | string | No | — | Name of account (max length = 150) |
accountid | string | No | — | The Xero identifier for an account – specified as a string following the endpoint name e.g. /297c2dc5-cc47-4afd-8ec8-74990b8761e9 |
type | string | No | — | See Account Types |
bankaccountnumber | string | No | — | For bank accounts only (Account Type BANK) |
status | string | No | — | Accounts with a status of ACTIVE can be updated to ARCHIVED. See Account Status Codes |
description | string | No | — | Description of the Account. Valid for all types of accounts except bank accounts (max length = 4000) |
bankaccounttype | string | No | — | For bank accounts only. See Bank Account types |
currencycode | string | No | — | 3 letter alpha code for the currency – see list of currency codes |
taxtype | string | No | — | The tax type from taxRates |
enablepaymentstoaccount | boolean | No | — | Boolean – describes whether account can have payments applied to it |
showinexpenseclaims | boolean | No | — | Boolean – describes whether account code is available for use with expense claims |
class_ | string | No | — | See Account Class Types |
systemaccount | string | No | — | 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. |
reportingcode | string | No | — | Shown if set |
reportingcodename | string | No | — | Shown if set |
hasattachments | boolean | No | — | boolean to indicate if an account has an attachment (read only) |
updateddateutc | string | No | — | Last modified date UTC format |
addtowatchlist | boolean | No | — | Boolean – describes whether the account is shown in the watchlist widget on the dashboard |
validationerrors | list | No | — | Displays array of validation error messages from the API |
Output Schema
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
base_url | string | Yes | — | Xero API root, e.g. https://<host>/api |
api_token | string | No | — | Bearer token; omit to use the workflow's token env var |
xero_tenant_id | string | Yes | — | Xero identifier for Tenant |
idempotency_key | string | No | — | This allows you to safely retry requests without the risk of duplicate processing. 128 character max. |
code | string | No | — | Customer defined alpha numeric account code e.g 200 or SALES (max length = 10) |
name | string | No | — | Name of account (max length = 150) |
accountid | string | No | — | The Xero identifier for an account – specified as a string following the endpoint name e.g. /297c2dc5-cc47-4afd-8ec8-74990b8761e9 |
type | string | No | — | See Account Types |
bankaccountnumber | string | No | — | For bank accounts only (Account Type BANK) |
status | string | No | — | Accounts with a status of ACTIVE can be updated to ARCHIVED. See Account Status Codes |
description | string | No | — | Description of the Account. Valid for all types of accounts except bank accounts (max length = 4000) |
bankaccounttype | string | No | — | For bank accounts only. See Bank Account types |
currencycode | string | No | — | 3 letter alpha code for the currency – see list of currency codes |
taxtype | string | No | — | The tax type from taxRates |
enablepaymentstoaccount | boolean | No | — | Boolean – describes whether account can have payments applied to it |
showinexpenseclaims | boolean | No | — | Boolean – describes whether account code is available for use with expense claims |
class_ | string | No | — | See Account Class Types |
systemaccount | string | No | — | 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. |
reportingcode | string | No | — | Shown if set |
reportingcodename | string | No | — | Shown if set |
hasattachments | boolean | No | — | boolean to indicate if an account has an attachment (read only) |
updateddateutc | string | No | — | Last modified date UTC format |
addtowatchlist | boolean | No | — | Boolean – describes whether the account is shown in the watchlist widget on the dashboard |
validationerrors | list | No | — | Displays array of validation error messages from the API |
status_code | integer | No | — | HTTP status code of the completed call |
response | json | No | — | Parsed JSON response body |
failure_reason | string | No | — | — |
failure_type | string | No | — | — |
failed_at | string | No | — | — |
failed_step | string | No | — | — |
failed_layer | string | No | — | — |
failed_at_state | string | No | — | — |
error | string | No | — | — |
error_type | string | No | — | — |
States
| State | Initial | Terminal | Success | Auto-advance | Description |
|---|---|---|---|---|---|
pending | Yes | No | — | execute | Waiting to call PUT /Accounts |
completed | No | Yes | Yes | — | HTTP call succeeded |
failed | No | Yes | No | — | HTTP call failed |
State Diagram
Transitions
| From | Action | To | Description |
|---|---|---|---|
pending | execute | completed | Perform PUT /Accounts |
* (any state) | fail | failed | Record the failure reason |
Outcomes
| Outcome | Type | Description | State Data Keys |
|---|---|---|---|
completed | SUCCESS | The provider accepted the request | status_code, response |
failed | FAILURE | The provider rejected the request or was unreachable | failure_reason, failure_type, status_code |
Business Errors
| Code | Message Template |
|---|---|
HTTP_AUTHENTICATION_FAILED | The provider rejected the credential (HTTP {status_code}) |
HTTP_AUTHORIZATION_FAILED | The credential is not permitted to perform this operation (HTTP {status_code}) |
HTTP_NOT_FOUND | The provider has no resource at {path} (HTTP 404) |
HTTP_RATE_LIMITED | The provider rate-limited this request (HTTP 429) |
HTTP_REQUEST_FAILED | The provider returned HTTP {status_code} for {method} |
HTTP_RESPONSE_SHAPE_UNEXPECTED | The provider response for {method} {path} could not be parsed as JSON |
API Usage
bash
POST /api/workflows/start
Content-Type: application/json
{
"workflow_type": "xero.accounts.create-account",
"initial_data": {
"base_url": "value",
"xero_tenant_id": "value"
}
}