createAccount
Creates a new chart of accounts
/Accounts
Usage and SDK Samples
await xero.setTokenSet(tokenSet);
const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const idempotencyKey = 'KEY_VALUE';
const account: Account = {
code: "123456",
name: "FooBar",
type: AccountType.EXPENSE,
description: "Hello World"
};
try {
const response = await xero.accountingApi.createAccount(xeroTenantId, account, idempotencyKey);
console.log(response.body || response.response.statusCode)
} catch (err) {
const error = JSON.stringify(err.response.body, null, 2)
console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
Scopes
accounting.settings | Grant read-write access to organisation and account settings |
Parameters
Name | Description |
---|---|
xero-tenant-id* |
String
Xero identifier for Tenant
Required
|
Idempotency-Key |
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
|
Name | Description |
---|---|
account * |
Account
Account object in body of request
Required
|