createAccount
Creates a new chart of accounts
/Accounts
Usage and SDK Samples
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
Configuration(
debug=false,
oauth2_token=OAuth2Token(
client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
),
),
pool_threads=1,
)
api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")
def accounting_create_account():
api_instance = AccountingApi(api_client)
xero_tenant_id = 'YOUR_XERO_TENANT_ID'
idempotency_key = 'KEY_VALUE'
account = Account(
code = "123456",
name = "FooBar",
type = AccountType.EXPENSE,
description = "Hello World")
try:
api_response = api_instance.create_account(xero_tenant_id, account, idempotency_key)
print(api_response)
except AccountingBadRequestException as e:
print("Exception when calling AccountingApi->createAccount: %s\n" % e)
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
|