createAccount
Creates a new chart of accounts
/Accounts
Usage and SDK Samples
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;
namespace Example
{
public class CreateAccountExample
{
public async Task Main()
{
var accessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new AccountingApi();
var xeroTenantId = "YOUR_XERO_TENANT_ID";
var idempotencyKey = "KEY_VALUE";
var account = new Account();
account.Code = "123456";
account.Name = "FooBar";
account.Type = AccountType.EXPENSE;
account.Description = "Hello World";
try {
var result = await apiInstance.CreateAccountAsync(accessToken, xeroTenantId, account, idempotencyKey);
Console.WriteLine(result);
}
catch (Exception e)
{
Console.WriteLine("Exception when calling apiInstance.CreateAccount: " + e.Message );
}
}
}
}
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
Required
|