Xero Accounting API

Accounting

createAccount

Creates a new chart of accounts


/Accounts

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Accounts"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        Account account = new Account();
        account.setCode("123456");
        account.setName("FooBar");
        account.setType(com.xero.models.accounting.AccountType.EXPENSE);
        account.setDescription("Hello World");

        try {
            Accounts result = apiInstance.createAccount(accessToken, xeroTenantId, account);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createAccount");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Account account = { "Code":"123456", "Name":"Foobar", "Type":"EXPENSE", "Description":"Hello World" }; // Account | 
        try {
            Accounts result = apiInstance.createAccount(xeroTenantId, account);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createAccount");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Account *account = { "Code":"123456", "Name":"Foobar", "Type":"EXPENSE", "Description":"Hello World" }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a new chart of accounts
[apiInstance createAccountWith:xeroTenantId
    account:account
              completionHandler: ^(Accounts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const account: Account = { code: "123456", name: "Foobar", type: AccountType.EXPENSE, description: "Hello World" }

try {
  const response = await xero.accountingApi.createAccount(xeroTenantId, account);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createAccountExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var account = new Account(); // Account | 

            try
            {
                // Creates a new chart of accounts
                Accounts result = apiInstance.createAccount(xeroTenantId, account);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createAccount: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

$account = new XeroAPI\XeroPHP\Models\Accounting\Account;
$account->setCode('123456');
$account->setName('FooBar');
$account->setType(XeroAPI\XeroPHP\Models\Accounting\AccountType::EXPENSE);
$account->setDescription('Hello World');

try {
  $result = $apiInstance->createAccount($xeroTenantId, $account);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createAccount: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $account = ::Object::Account->new(); # Account | 

eval { 
    my $result = $api_instance->createAccount(xeroTenantId => $xeroTenantId, account => $account);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createAccount: $@\n";
}
# 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)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'

    account = Account(
        code = "123456",
        name = "FooBar",
        type = AccountType.EXPENSE,
        description = "Hello World")
    
    try:
        api_response = api_instance.create_account(xeroTenantId, account)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createAccount: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let account = { "Code":"123456", "Name":"Foobar", "Type":"EXPENSE", "Description":"Hello World" }; // Account

    let mut context = AccountingApi::Context::default();
    let result = client.createAccount(xeroTenantId, account, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
account *
Account
Account object in body of request
Required

createAccountAttachmentByFileName

Creates an attachment on a specific account


/Accounts/{AccountID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Accounts/{AccountID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID accountID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.createAccountAttachmentByFileName(accessToken, xeroTenantId, accountID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createAccountAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID accountID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Account object
        String fileName = xero-dev.jpg; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.createAccountAttachmentByFileName(xeroTenantId, accountID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createAccountAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *accountID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Account object (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates an attachment on a specific account
[apiInstance createAccountAttachmentByFileNameWith:xeroTenantId
    accountID:accountID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const accountID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for Account object
const fileName = "xero-dev.jpg";  // {String} Name of the attachment
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
import * as fs from "fs";
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createAccountAttachmentByFileName(xeroTenantId, accountID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createAccountAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var accountID = new UUID(); // UUID | Unique identifier for Account object (default to null)
            var fileName = xero-dev.jpg;  // String | Name of the attachment (default to null)
            var body = BYTE_ARRAY_DATA_HERE;  // byte[] | 

            try
            {
                // Creates an attachment on a specific account
                Attachments result = apiInstance.createAccountAttachmentByFileName(xeroTenantId, accountID, fileName, body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createAccountAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$accountID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->createAccountAttachmentByFileName($xeroTenantId, $accountID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createAccountAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $accountID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Account object
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->createAccountAttachmentByFileName(xeroTenantId => $xeroTenantId, accountID => $accountID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createAccountAttachmentByFileName: $@\n";
}
# 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_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    accountID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    
        // TODO: BINARY CREATE 
    try:
        api_response = api_instance.create_account_attachment_by_file_name(xeroTenantId, accountID, fileName, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createAccountAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let accountID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.createAccountAttachmentByFileName(xeroTenantId, accountID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
AccountID*
UUID (uuid)
Unique identifier for Account object
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

createBankTransactionAttachmentByFileName

Creates an attachment for a specific bank transaction by filename


/BankTransactions/{BankTransactionID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransactions/{BankTransactionID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID bankTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.createBankTransactionAttachmentByFileName(accessToken, xeroTenantId, bankTransactionID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createBankTransactionAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transaction
        String fileName = xero-dev.jpg; // String | The name of the file being attached
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.createBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createBankTransactionAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransactionID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transaction (default to null)
String *fileName = xero-dev.jpg; // The name of the file being attached (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates an attachment for a specific bank transaction by filename
[apiInstance createBankTransactionAttachmentByFileNameWith:xeroTenantId
    bankTransactionID:bankTransactionID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const bankTransactionID = "00000000-0000-0000-0000-000000000000";  // {UUID} Xero generated unique identifier for a bank transaction
const fileName = "xero-dev.jpg";  // {String} The name of the file being attached
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
import * as fs from "fs";
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createBankTransactionAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var bankTransactionID = new UUID(); // UUID | Xero generated unique identifier for a bank transaction (default to null)
            var fileName = xero-dev.jpg;  // String | The name of the file being attached (default to null)
            var body = BYTE_ARRAY_DATA_HERE;  // byte[] | 

            try
            {
                // Creates an attachment for a specific bank transaction by filename
                Attachments result = apiInstance.createBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createBankTransactionAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransactionID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->createBankTransactionAttachmentByFileName($xeroTenantId, $bankTransactionID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createBankTransactionAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transaction
my $fileName = xero-dev.jpg; # String | The name of the file being attached
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->createBankTransactionAttachmentByFileName(xeroTenantId => $xeroTenantId, bankTransactionID => $bankTransactionID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createBankTransactionAttachmentByFileName: $@\n";
}
# 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_bank_transaction_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    bankTransactionID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    
        // TODO: BINARY CREATE 
    try:
        api_response = api_instance.create_bank_transaction_attachment_by_file_name(xeroTenantId, bankTransactionID, fileName, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createBankTransactionAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.createBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
BankTransactionID*
UUID (uuid)
Xero generated unique identifier for a bank transaction
Required
FileName*
String
The name of the file being attached
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

createBankTransactionHistoryRecord

Creates a history record for a specific bank transactions


/BankTransactions/{BankTransactionID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransactions/{BankTransactionID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID bankTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createBankTransactionHistoryRecord(accessToken, xeroTenantId, bankTransactionID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createBankTransactionHistoryRecord");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transaction
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createBankTransactionHistoryRecord(xeroTenantId, bankTransactionID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createBankTransactionHistoryRecord");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransactionID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transaction (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a history record for a specific bank transactions
[apiInstance createBankTransactionHistoryRecordWith:xeroTenantId
    bankTransactionID:bankTransactionID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);
const historyRecords: HistoryRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] };  // {HistoryRecords} 
const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const bankTransactionID = "00000000-0000-0000-0000-000000000000";  // {UUID} Xero generated unique identifier for a bank transaction


try {
  const response = await xero.accountingApi.createBankTransactionHistoryRecord(xeroTenantId, bankTransactionID, historyRecords);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createBankTransactionHistoryRecordExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var bankTransactionID = new UUID(); // UUID | Xero generated unique identifier for a bank transaction (default to null)
            var historyRecords = new HistoryRecords(); // HistoryRecords | 

            try
            {
                // Creates a history record for a specific bank transactions
                HistoryRecords result = apiInstance.createBankTransactionHistoryRecord(xeroTenantId, bankTransactionID, historyRecords);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createBankTransactionHistoryRecord: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransactionID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createBankTransactionHistoryRecord($xeroTenantId, $bankTransactionID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createBankTransactionHistoryRecord: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transaction
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createBankTransactionHistoryRecord(xeroTenantId => $xeroTenantId, bankTransactionID => $bankTransactionID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createBankTransactionHistoryRecord: $@\n";
}
# 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_bank_transaction_history_record():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    bankTransactionID = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    history_records = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_bank_transaction_history_record(xeroTenantId, bankTransactionID, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createBankTransactionHistoryRecord: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createBankTransactionHistoryRecord(xeroTenantId, bankTransactionID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
BankTransactionID*
UUID (uuid)
Xero generated unique identifier for a bank transaction
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createBankTransactions

Creates one or more spent or received money transaction


/BankTransactions

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransactions?summarizeErrors=true&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        Boolean summarizeErrors = true;
        Integer unitdp = 4;
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        LineItem lineItem = new LineItem();
        lineItem.setDescription("Foobar");
        lineItem.setQuantity(1.0);
        lineItem.setUnitAmount(20.0);
        lineItem.setAccountCode("000");
        List<LineItems> lineItems = new ArrayList<LineItems>();
        lineItems.add(lineItem);
        Account bankAccount = new Account();
        bankAccount.setAccountID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        BankTransaction bankTransaction = new BankTransaction();
        bankTransaction.setType(com.xero.models.accounting.BankTransaction.TypeEnum.RECEIVE);
        bankTransaction.setContact(contact);
        bankTransaction.setBankAccount(bankAccount);
        bankTransaction.setLineItems(lineItems);
        BankTransactions bankTransactions = new BankTransactions();
        bankTransactions.addBankTransactionsItem(bankTransaction);

        try {
            BankTransactions result = apiInstance.createBankTransactions(accessToken, xeroTenantId, bankTransactions, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createBankTransactions");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        BankTransactions bankTransactions = { bankTransactions: [{ type: BankTransaction.TypeEnum.SPEND, contact: { contactID: "00000000-0000-0000-0000-000000000000" }, lineItems: [{ description: "Foobar", quantity: 1.0, unitAmount: 20.0, accountCode: "000" } ], bankAccount: { code: "000" }}]}; // BankTransactions | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            BankTransactions result = apiInstance.createBankTransactions(xeroTenantId, bankTransactions, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createBankTransactions");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
BankTransactions *bankTransactions = { bankTransactions: [{ type: BankTransaction.TypeEnum.SPEND, contact: { contactID: "00000000-0000-0000-0000-000000000000" }, lineItems: [{ description: "Foobar", quantity: 1.0, unitAmount: 20.0, accountCode: "000" } ], bankAccount: { code: "000" }}]}; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates one or more spent or received money transaction
[apiInstance createBankTransactionsWith:xeroTenantId
    bankTransactions:bankTransactions
    summarizeErrors:summarizeErrors
    unitdp:unitdp
              completionHandler: ^(BankTransactions output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant


const summarizeErrors = true;  // {Boolean} If false return 200 OK and mix of successfully created objects and any with validation errors

const unitdp = 4;  // {Integer} e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
const bankTransactions: BankTransactions = { bankTransactions: [{ type: BankTransaction.TypeEnum.SPEND, contact: { contactID: "00000000-0000-0000-0000-000000000000" }, lineItems: [{ description: "Foobar", quantity: 1.0, unitAmount: 20.0, accountCode: "000" } ], bankAccount: { code: "000" }}]}

try {
  const response = await xero.accountingApi.createBankTransactions(xeroTenantId, bankTransactions,  summarizeErrors, unitdp);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createBankTransactionsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var bankTransactions = new BankTransactions(); // BankTransactions | 
            var summarizeErrors = true;  // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors (optional)  (default to false)
            var unitdp = 4;  // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)  (default to null)

            try
            {
                // Creates one or more spent or received money transaction
                BankTransactions result = apiInstance.createBankTransactions(xeroTenantId, bankTransactions, summarizeErrors, unitdp);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createBankTransactions: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$unitdp = 4;

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
$lineItem->setDescription('Foobar');
$lineItem->setQuantity(1.0);
$lineItem->setUnitAmount(20.0);
$lineItem->setAccountCode('000');
$lineItems = [];
array_push($lineItems, $lineItem);

$bankAccount = new XeroAPI\XeroPHP\Models\Accounting\Account;
$bankAccount->setAccountID('00000000-0000-0000-0000-000000000000');

$bankTransaction = new XeroAPI\XeroPHP\Models\Accounting\BankTransaction;
$bankTransaction->setType(XeroAPI\XeroPHP\Models\Accounting\BankTransaction::TYPE_RECEIVE);
$bankTransaction->setContact($contact);
$bankTransaction->setBankAccount($bankAccount);
$bankTransaction->setLineItems($lineItems);

$bankTransactions = new XeroAPI\XeroPHP\Models\Accounting\BankTransactions;
$arr_bank_transactions = [];
array_push($arr_bank_transactions, $bankTransaction);
$bankTransactions->setBankTransactions($arr_bank_transactions);

try {
  $result = $apiInstance->createBankTransactions($xeroTenantId, $bankTransactions, $summarizeErrors, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createBankTransactions: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransactions = ::Object::BankTransactions->new(); # BankTransactions | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->createBankTransactions(xeroTenantId => $xeroTenantId, bankTransactions => $bankTransactions, summarizeErrors => $summarizeErrors, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createBankTransactions: $@\n";
}
# 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_bank_transactions():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    summarizeErrors = 'True'

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    line_item = LineItem(
        description = "Foobar",
        quantity = 1.0,
        unit_amount = 20.0,
        account_code = "000")
    
    line_items = []    
    line_items.append(line_item)

    bank_account = Account(
        account_id = "00000000-0000-0000-0000-000000000000")

    bank_transaction = BankTransaction(
        type = "RECEIVE",
        contact = contact,
        bank_account = bank_account)
        lineItems = lineItems,

    bankTransactions = BankTransactions( 
        bank_transactions = [bank_transaction])
    
    try:
        api_response = api_instance.create_bank_transactions(xeroTenantId, bankTransactions, summarizeErrors, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createBankTransactions: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransactions = { bankTransactions: [{ type: BankTransaction.TypeEnum.SPEND, contact: { contactID: "00000000-0000-0000-0000-000000000000" }, lineItems: [{ description: "Foobar", quantity: 1.0, unitAmount: 20.0, accountCode: "000" } ], bankAccount: { code: "000" }}]}; // BankTransactions
    let summarizeErrors = true; // Boolean
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.createBankTransactions(xeroTenantId, bankTransactions, summarizeErrors, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
bankTransactions *
BankTransactions
BankTransactions with an array of BankTransaction objects in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

createBankTransfer

Creates a bank transfer


/BankTransfers

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransfers"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        Account fromBankAccount = new Account();
        fromBankAccount.setAccountID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        Account toBankAccount = new Account();
        toBankAccount.setAccountID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        BankTransfer bankTransfer = new BankTransfer();
        bankTransfer.setFromBankAccount(fromBankAccount);
        bankTransfer.setToBankAccount(toBankAccount);
        bankTransfer.setAmount(1.0);
        BankTransfers bankTransfers = new BankTransfers();
        bankTransfers.addBankTransfersItem(bankTransfer);

        try {
            BankTransfers result = apiInstance.createBankTransfer(accessToken, xeroTenantId, bankTransfers);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createBankTransfer");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        BankTransfers bankTransfers = { "BankTransfers": [ { "FromBankAccount": { "Code": "090", "Name": "My Savings", "AccountID": "00000000-0000-0000-0000-000000000000", "Type": "BANK", "BankAccountNumber": "123455", "Status": "ACTIVE", "BankAccountType": "BANK", "CurrencyCode": "USD", "TaxType": "NONE", "EnablePaymentsToAccount": false, "ShowInExpenseClaims": false, "Class": "ASSET", "ReportingCode": "ASS", "ReportingCodeName": "Assets", "HasAttachments": false, "UpdatedDateUTC": "2016-10-17T13:45:33.993-07:00" }, "ToBankAccount": { "Code": "088", "Name": "Business Wells Fargo", "AccountID": "00000000-0000-0000-0000-000000000000", "Type": "BANK", "BankAccountNumber": "123455", "Status": "ACTIVE", "BankAccountType": "BANK", "CurrencyCode": "USD", "TaxType": "NONE", "EnablePaymentsToAccount": false, "ShowInExpenseClaims": false, "Class": "ASSET", "ReportingCode": "ASS", "ReportingCodeName": "Assets", "HasAttachments": false, "UpdatedDateUTC": "2016-06-03T08:31:14.517-07:00" }, "Amount": "50.00" } ] }; // BankTransfers | 
        try {
            BankTransfers result = apiInstance.createBankTransfer(xeroTenantId, bankTransfers);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createBankTransfer");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
BankTransfers *bankTransfers = { "BankTransfers": [ { "FromBankAccount": { "Code": "090", "Name": "My Savings", "AccountID": "00000000-0000-0000-0000-000000000000", "Type": "BANK", "BankAccountNumber": "123455", "Status": "ACTIVE", "BankAccountType": "BANK", "CurrencyCode": "USD", "TaxType": "NONE", "EnablePaymentsToAccount": false, "ShowInExpenseClaims": false, "Class": "ASSET", "ReportingCode": "ASS", "ReportingCodeName": "Assets", "HasAttachments": false, "UpdatedDateUTC": "2016-10-17T13:45:33.993-07:00" }, "ToBankAccount": { "Code": "088", "Name": "Business Wells Fargo", "AccountID": "00000000-0000-0000-0000-000000000000", "Type": "BANK", "BankAccountNumber": "123455", "Status": "ACTIVE", "BankAccountType": "BANK", "CurrencyCode": "USD", "TaxType": "NONE", "EnablePaymentsToAccount": false, "ShowInExpenseClaims": false, "Class": "ASSET", "ReportingCode": "ASS", "ReportingCodeName": "Assets", "HasAttachments": false, "UpdatedDateUTC": "2016-06-03T08:31:14.517-07:00" }, "Amount": "50.00" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a bank transfer
[apiInstance createBankTransferWith:xeroTenantId
    bankTransfers:bankTransfers
              completionHandler: ^(BankTransfers output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const bankTransfers: BankTransfers = { bankTransfers: [{ fromBankAccount: { code: "000", accountID: "00000000-0000-0000-0000-000000000000" }, toBankAccount: { code: "001", accountID: "00000000-0000-0000-0000-000000000000" }, amount: "50.00" }]}

try {
  const response = await xero.accountingApi.createBankTransfer(xeroTenantId, bankTransfers);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createBankTransferExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var bankTransfers = new BankTransfers(); // BankTransfers | 

            try
            {
                // Creates a bank transfer
                BankTransfers result = apiInstance.createBankTransfer(xeroTenantId, bankTransfers);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createBankTransfer: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

$fromBankAccount = new XeroAPI\XeroPHP\Models\Accounting\Account;
$fromBankAccount->setAccountID('00000000-0000-0000-0000-000000000000');

$toBankAccount = new XeroAPI\XeroPHP\Models\Accounting\Account;
$toBankAccount->setAccountID('00000000-0000-0000-0000-000000000000');

$bankTransfer = new XeroAPI\XeroPHP\Models\Accounting\BankTransfer;
$bankTransfer->setFromBankAccount($fromBankAccount);
$bankTransfer->setToBankAccount($toBankAccount);
$bankTransfer->setAmount(1.0);

$bankTransfers = new XeroAPI\XeroPHP\Models\Accounting\BankTransfers;
$arr_bank_transfers = [];
array_push($arr_bank_transfers, $bankTransfer);
$bankTransfers->setBankTransfers($arr_bank_transfers);

try {
  $result = $apiInstance->createBankTransfer($xeroTenantId, $bankTransfers);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createBankTransfer: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransfers = ::Object::BankTransfers->new(); # BankTransfers | 

eval { 
    my $result = $api_instance->createBankTransfer(xeroTenantId => $xeroTenantId, bankTransfers => $bankTransfers);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createBankTransfer: $@\n";
}
# 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_bank_transfer():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'

    fromBankAccount = Account(
        account_id = "00000000-0000-0000-0000-000000000000")

    toBankAccount = Account(
        account_id = "00000000-0000-0000-0000-000000000000")

    bank_transfer = BankTransfer(
        from_bank_account = fromBankAccount,
        to_bank_account = toBankAccount,
        amount = 1.0)

    bankTransfers = BankTransfers( 
        bank_transfers = [bank_transfer])
    
    try:
        api_response = api_instance.create_bank_transfer(xeroTenantId, bankTransfers)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createBankTransfer: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransfers = { "BankTransfers": [ { "FromBankAccount": { "Code": "090", "Name": "My Savings", "AccountID": "00000000-0000-0000-0000-000000000000", "Type": "BANK", "BankAccountNumber": "123455", "Status": "ACTIVE", "BankAccountType": "BANK", "CurrencyCode": "USD", "TaxType": "NONE", "EnablePaymentsToAccount": false, "ShowInExpenseClaims": false, "Class": "ASSET", "ReportingCode": "ASS", "ReportingCodeName": "Assets", "HasAttachments": false, "UpdatedDateUTC": "2016-10-17T13:45:33.993-07:00" }, "ToBankAccount": { "Code": "088", "Name": "Business Wells Fargo", "AccountID": "00000000-0000-0000-0000-000000000000", "Type": "BANK", "BankAccountNumber": "123455", "Status": "ACTIVE", "BankAccountType": "BANK", "CurrencyCode": "USD", "TaxType": "NONE", "EnablePaymentsToAccount": false, "ShowInExpenseClaims": false, "Class": "ASSET", "ReportingCode": "ASS", "ReportingCodeName": "Assets", "HasAttachments": false, "UpdatedDateUTC": "2016-06-03T08:31:14.517-07:00" }, "Amount": "50.00" } ] }; // BankTransfers

    let mut context = AccountingApi::Context::default();
    let result = client.createBankTransfer(xeroTenantId, bankTransfers, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
bankTransfers *
BankTransfers
BankTransfers with array of BankTransfer objects in request body
Required

createBankTransferAttachmentByFileName


/BankTransfers/{BankTransferID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransfers/{BankTransferID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID bankTransferID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.createBankTransferAttachmentByFileName(accessToken, xeroTenantId, bankTransferID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createBankTransferAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transfer
        String fileName = xero-dev.jpg; // String | The name of the file being attached to a Bank Transfer
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.createBankTransferAttachmentByFileName(xeroTenantId, bankTransferID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createBankTransferAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransferID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transfer (default to null)
String *fileName = xero-dev.jpg; // The name of the file being attached to a Bank Transfer (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// 
[apiInstance createBankTransferAttachmentByFileNameWith:xeroTenantId
    bankTransferID:bankTransferID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const bankTransferID = "00000000-0000-0000-0000-000000000000";  // {UUID} Xero generated unique identifier for a bank transfer
const fileName = "xero-dev.jpg";  // {String} The name of the file being attached to a Bank Transfer
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
import * as fs from "fs";
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createBankTransferAttachmentByFileName(xeroTenantId, bankTransferID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createBankTransferAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var bankTransferID = new UUID(); // UUID | Xero generated unique identifier for a bank transfer (default to null)
            var fileName = xero-dev.jpg;  // String | The name of the file being attached to a Bank Transfer (default to null)
            var body = BYTE_ARRAY_DATA_HERE;  // byte[] | 

            try
            {
                // 
                Attachments result = apiInstance.createBankTransferAttachmentByFileName(xeroTenantId, bankTransferID, fileName, body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createBankTransferAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransferID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->createBankTransferAttachmentByFileName($xeroTenantId, $bankTransferID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createBankTransferAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransferID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transfer
my $fileName = xero-dev.jpg; # String | The name of the file being attached to a Bank Transfer
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->createBankTransferAttachmentByFileName(xeroTenantId => $xeroTenantId, bankTransferID => $bankTransferID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createBankTransferAttachmentByFileName: $@\n";
}
# 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_bank_transfer_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    bankTransferID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    
        // TODO: BINARY CREATE 
    try:
        api_response = api_instance.create_bank_transfer_attachment_by_file_name(xeroTenantId, bankTransferID, fileName, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createBankTransferAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.createBankTransferAttachmentByFileName(xeroTenantId, bankTransferID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
BankTransferID*
UUID (uuid)
Xero generated unique identifier for a bank transfer
Required
FileName*
String
The name of the file being attached to a Bank Transfer
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

createBankTransferHistoryRecord

Creates a history record for a specific bank transfer


/BankTransfers/{BankTransferID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransfers/{BankTransferID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID bankTransferID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createBankTransferHistoryRecord(accessToken, xeroTenantId, bankTransferID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createBankTransferHistoryRecord");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transfer
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createBankTransferHistoryRecord(xeroTenantId, bankTransferID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createBankTransferHistoryRecord");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransferID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transfer (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a history record for a specific bank transfer
[apiInstance createBankTransferHistoryRecordWith:xeroTenantId
    bankTransferID:bankTransferID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);
const historyRecords: HistoryRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] };  // {HistoryRecords} 
const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const bankTransferID = "00000000-0000-0000-0000-000000000000";  // {UUID} Xero generated unique identifier for a bank transfer


try {
  const response = await xero.accountingApi.createBankTransferHistoryRecord(xeroTenantId, bankTransferID, historyRecords);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createBankTransferHistoryRecordExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var bankTransferID = new UUID(); // UUID | Xero generated unique identifier for a bank transfer (default to null)
            var historyRecords = new HistoryRecords(); // HistoryRecords | 

            try
            {
                // Creates a history record for a specific bank transfer
                HistoryRecords result = apiInstance.createBankTransferHistoryRecord(xeroTenantId, bankTransferID, historyRecords);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createBankTransferHistoryRecord: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransferID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createBankTransferHistoryRecord($xeroTenantId, $bankTransferID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createBankTransferHistoryRecord: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransferID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transfer
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createBankTransferHistoryRecord(xeroTenantId => $xeroTenantId, bankTransferID => $bankTransferID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createBankTransferHistoryRecord: $@\n";
}
# 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_bank_transfer_history_record():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    bankTransferID = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    history_records = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_bank_transfer_history_record(xeroTenantId, bankTransferID, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createBankTransferHistoryRecord: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createBankTransferHistoryRecord(xeroTenantId, bankTransferID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
BankTransferID*
UUID (uuid)
Xero generated unique identifier for a bank transfer
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createBatchPayment

Creates one or many batch payments for invoices


/BatchPayments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BatchPayments?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        Boolean summarizeErrors = true;
        LocalDate currDate = LocalDate.now();
        Account paymentAccount = new Account();
        paymentAccount.setAccountID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        Account bankAccount = new Account();
        bankAccount.setAccountID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        Invoice invoice = new Invoice();
        invoice.setInvoiceID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        Payment payment = new Payment();
        payment.setAccount(bankAccount);
        payment.setDate(currDate);
        payment.setAmount(1.0);
        payment.setInvoice(invoice);
        List<Payment> payments = new ArrayList<Payment>();
        payments.add(payment);
        BatchPayment batchPayment = new BatchPayment();
        batchPayment.setAccount(paymentAccount);
        batchPayment.setReference("hello foobar");
        batchPayment.setDate(currDate);
        batchPayment.setPayments(payments);
        BatchPayments batchPayments = new BatchPayments();
        batchPayments.addBatchPaymentsItem(batchPayment);

        try {
            BatchPayments result = apiInstance.createBatchPayment(accessToken, xeroTenantId, batchPayments, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createBatchPayment");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        BatchPayments batchPayments = { "BatchPayments": [ { "Account": { "AccountID": "00000000-0000-0000-0000-000000000000" }, "Reference": "ref", "Date": "2018-08-01", "Payments": [ { "Account": { "Code": "001" }, "Date": "2019-12-31", "Amount": 500, "Invoice": { "InvoiceID": "00000000-0000-0000-0000-000000000000", "LineItems": [], "Contact": {}, "Type": "ACCPAY" } } ] } ] }; // BatchPayments | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            BatchPayments result = apiInstance.createBatchPayment(xeroTenantId, batchPayments, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createBatchPayment");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
BatchPayments *batchPayments = { "BatchPayments": [ { "Account": { "AccountID": "00000000-0000-0000-0000-000000000000" }, "Reference": "ref", "Date": "2018-08-01", "Payments": [ { "Account": { "Code": "001" }, "Date": "2019-12-31", "Amount": 500, "Invoice": { "InvoiceID": "00000000-0000-0000-0000-000000000000", "LineItems": [], "Contact": {}, "Type": "ACCPAY" } } ] } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates one or many batch payments for invoices
[apiInstance createBatchPaymentWith:xeroTenantId
    batchPayments:batchPayments
    summarizeErrors:summarizeErrors
              completionHandler: ^(BatchPayments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant


const summarizeErrors = true;  // {Boolean} If false return 200 OK and mix of successfully created objects and any with validation errors
const batchPayments: BatchPayments = { batchPayments: [{ account: { accountId: "00000000-0000-0000-0000-000000000000" }, reference: "ref", date: "2018-08-01", payments: [{  account: { code: "001" }, date: "2019-12-31", amount: 500, invoice: { invoiceId: "00000000-0000-0000-0000-000000000000", lineItems: [], contact: {}, type: Invoice.TypeEnum.ACCPAY }}]}]}

try {
  const response = await xero.accountingApi.createBatchPayment(xeroTenantId, batchPayments,  summarizeErrors);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createBatchPaymentExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var batchPayments = new BatchPayments(); // BatchPayments | 
            var summarizeErrors = true;  // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors (optional)  (default to false)

            try
            {
                // Creates one or many batch payments for invoices
                BatchPayments result = apiInstance.createBatchPayment(xeroTenantId, batchPayments, summarizeErrors);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createBatchPayment: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$currDate = new DateTime('2020-12-10');

$paymentAccount = new XeroAPI\XeroPHP\Models\Accounting\Account;
$paymentAccount->setAccountID('00000000-0000-0000-0000-000000000000');

$bankAccount = new XeroAPI\XeroPHP\Models\Accounting\Account;
$bankAccount->setAccountID('00000000-0000-0000-0000-000000000000');

$invoice = new XeroAPI\XeroPHP\Models\Accounting\Invoice;
$invoice->setInvoiceID('00000000-0000-0000-0000-000000000000');

$payment = new XeroAPI\XeroPHP\Models\Accounting\Payment;
$payment->setAccount($bankAccount);
$payment->setDate($currDate);
$payment->setAmount(1.0);
$payment->setInvoice($invoice);
$payments = [];
array_push($payments, $payment);

$batchPayment = new XeroAPI\XeroPHP\Models\Accounting\BatchPayment;
$batchPayment->setAccount($paymentAccount);
$batchPayment->setReference('hello foobar');
$batchPayment->setDate($currDate);
$batchPayment->setPayments($payments);

$batchPayments = new XeroAPI\XeroPHP\Models\Accounting\BatchPayments;
$arr_batch_payments = [];
array_push($arr_batch_payments, $batchPayment);
$batchPayments->setBatchPayments($arr_batch_payments);

try {
  $result = $apiInstance->createBatchPayment($xeroTenantId, $batchPayments, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createBatchPayment: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $batchPayments = ::Object::BatchPayments->new(); # BatchPayments | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->createBatchPayment(xeroTenantId => $xeroTenantId, batchPayments => $batchPayments, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createBatchPayment: $@\n";
}
# 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_batch_payment():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    summarizeErrors = 'True'
    curr_date = dateutil.parser.parse('2020-12-03T00:00:00Z')

    payment_account = Account(
        account_id = "00000000-0000-0000-0000-000000000000")

    bank_account = Account(
        account_id = "00000000-0000-0000-0000-000000000000")

    invoice = Invoice(
        invoice_id = "00000000-0000-0000-0000-000000000000")

    payment = Payment(
        account = bank_account,
        date = curr_date,
        amount = 1.0,
        invoice = invoice)
    
    payments = []    
    payments.append(payment)

    batch_payment = BatchPayment(
        account = payment_account,
        reference = "hello foobar",
        date = curr_date,
        payments = payments)

    batchPayments = BatchPayments( 
        batch_payments = [batch_payment])
    
    try:
        api_response = api_instance.create_batch_payment(xeroTenantId, batchPayments, summarizeErrors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createBatchPayment: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let batchPayments = { "BatchPayments": [ { "Account": { "AccountID": "00000000-0000-0000-0000-000000000000" }, "Reference": "ref", "Date": "2018-08-01", "Payments": [ { "Account": { "Code": "001" }, "Date": "2019-12-31", "Amount": 500, "Invoice": { "InvoiceID": "00000000-0000-0000-0000-000000000000", "LineItems": [], "Contact": {}, "Type": "ACCPAY" } } ] } ] }; // BatchPayments
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.createBatchPayment(xeroTenantId, batchPayments, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
batchPayments *
BatchPayments
BatchPayments with an array of Payments in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

createBatchPaymentHistoryRecord

Creates a history record for a specific batch payment


/BatchPayments/{BatchPaymentID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BatchPayments/{BatchPaymentID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID batchPaymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createBatchPaymentHistoryRecord(accessToken, xeroTenantId, batchPaymentID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createBatchPaymentHistoryRecord");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID batchPaymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for BatchPayment
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createBatchPaymentHistoryRecord(xeroTenantId, batchPaymentID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createBatchPaymentHistoryRecord");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *batchPaymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for BatchPayment (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a history record for a specific batch payment
[apiInstance createBatchPaymentHistoryRecordWith:xeroTenantId
    batchPaymentID:batchPaymentID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);
const historyRecords: HistoryRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] };  // {HistoryRecords} 
const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const batchPaymentID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for BatchPayment


try {
  const response = await xero.accountingApi.createBatchPaymentHistoryRecord(xeroTenantId, batchPaymentID, historyRecords);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createBatchPaymentHistoryRecordExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var batchPaymentID = new UUID(); // UUID | Unique identifier for BatchPayment (default to null)
            var historyRecords = new HistoryRecords(); // HistoryRecords | 

            try
            {
                // Creates a history record for a specific batch payment
                HistoryRecords result = apiInstance.createBatchPaymentHistoryRecord(xeroTenantId, batchPaymentID, historyRecords);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createBatchPaymentHistoryRecord: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$batchPaymentID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createBatchPaymentHistoryRecord($xeroTenantId, $batchPaymentID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createBatchPaymentHistoryRecord: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $batchPaymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for BatchPayment
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createBatchPaymentHistoryRecord(xeroTenantId => $xeroTenantId, batchPaymentID => $batchPaymentID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createBatchPaymentHistoryRecord: $@\n";
}
# 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_batch_payment_history_record():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    batchPaymentID = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    history_records = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_batch_payment_history_record(xeroTenantId, batchPaymentID, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createBatchPaymentHistoryRecord: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let batchPaymentID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createBatchPaymentHistoryRecord(xeroTenantId, batchPaymentID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
BatchPaymentID*
UUID (uuid)
Unique identifier for BatchPayment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createBrandingThemePaymentServices

Creates a new custom payment service for a specific branding theme


/BrandingThemes/{BrandingThemeID}/PaymentServices

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BrandingThemes/{BrandingThemeID}/PaymentServices"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID brandingThemeID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        PaymentService paymentService = new PaymentService();
        paymentService.setPaymentServiceID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        paymentService.setPaymentServiceName("ACME Payments");
        paymentService.setPaymentServiceUrl("https://www.payupnow.com/");
        paymentService.setPayNowText("Pay Now");

        try {
            PaymentServices result = apiInstance.createBrandingThemePaymentServices(accessToken, xeroTenantId, brandingThemeID, paymentService);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createBrandingThemePaymentServices");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID brandingThemeID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Branding Theme
        PaymentService paymentService = { "PaymentServiceID": "00000000-0000-0000-0000-000000000000", "PaymentServiceName": "ACME Payments", "PaymentServiceUrl": "https://www.payupnow.com/", "PayNowText": "Pay Now" }; // PaymentService | 
        try {
            PaymentServices result = apiInstance.createBrandingThemePaymentServices(xeroTenantId, brandingThemeID, paymentService);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createBrandingThemePaymentServices");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *brandingThemeID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Branding Theme (default to null)
PaymentService *paymentService = { "PaymentServiceID": "00000000-0000-0000-0000-000000000000", "PaymentServiceName": "ACME Payments", "PaymentServiceUrl": "https://www.payupnow.com/", "PayNowText": "Pay Now" }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a new custom payment service for a specific branding theme
[apiInstance createBrandingThemePaymentServicesWith:xeroTenantId
    brandingThemeID:brandingThemeID
    paymentService:paymentService
              completionHandler: ^(PaymentServices output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const brandingThemeID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Branding Theme
const paymentService: PaymentService = { paymentServiceID: "00000000-0000-0000-0000-000000000000", paymentServiceName: "ACME Payments", paymentServiceUrl: "https://www.payupnow.com/", payNowText: "Pay Now" }

try {
  const response = await xero.accountingApi.createBrandingThemePaymentServices(xeroTenantId, brandingThemeID, paymentService);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createBrandingThemePaymentServicesExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var brandingThemeID = new UUID(); // UUID | Unique identifier for a Branding Theme (default to null)
            var paymentService = new PaymentService(); // PaymentService | 

            try
            {
                // Creates a new custom payment service for a specific branding theme
                PaymentServices result = apiInstance.createBrandingThemePaymentServices(xeroTenantId, brandingThemeID, paymentService);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createBrandingThemePaymentServices: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$brandingThemeID = "00000000-0000-0000-0000-000000000000";

$paymentService = new XeroAPI\XeroPHP\Models\Accounting\PaymentService;
$paymentService->setPaymentServiceID('00000000-0000-0000-0000-000000000000');
$paymentService->setPaymentServiceName('ACME Payments');
$paymentService->setPaymentServiceUrl('https://www.payupnow.com/');
$paymentService->setPayNowText('Pay Now');

try {
  $result = $apiInstance->createBrandingThemePaymentServices($xeroTenantId, $brandingThemeID, $paymentService);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createBrandingThemePaymentServices: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $brandingThemeID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Branding Theme
my $paymentService = ::Object::PaymentService->new(); # PaymentService | 

eval { 
    my $result = $api_instance->createBrandingThemePaymentServices(xeroTenantId => $xeroTenantId, brandingThemeID => $brandingThemeID, paymentService => $paymentService);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createBrandingThemePaymentServices: $@\n";
}
# 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_branding_theme_payment_services():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    brandingThemeID = '00000000-0000-0000-0000-000000000000'

    paymentService = PaymentService(
        paymentServiceID = "00000000-0000-0000-0000-000000000000",
        paymentServiceName = "ACME Payments",
        paymentServiceUrl = "https://www.payupnow.com/",
        payNowText = "Pay Now")
    
    try:
        api_response = api_instance.create_branding_theme_payment_services(xeroTenantId, brandingThemeID, paymentService)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createBrandingThemePaymentServices: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let brandingThemeID = 00000000-0000-0000-0000-000000000000; // UUID
    let paymentService = { "PaymentServiceID": "00000000-0000-0000-0000-000000000000", "PaymentServiceName": "ACME Payments", "PaymentServiceUrl": "https://www.payupnow.com/", "PayNowText": "Pay Now" }; // PaymentService

    let mut context = AccountingApi::Context::default();
    let result = client.createBrandingThemePaymentServices(xeroTenantId, brandingThemeID, paymentService, &context).wait();
    println!("{:?}", result);

}

Scopes

paymentservices Grant read-write access to payment services

Parameters

Path parameters
Name Description
BrandingThemeID*
UUID (uuid)
Unique identifier for a Branding Theme
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
paymentService *
PaymentService
PaymentService object in body of request
Required

createContactAttachmentByFileName


/Contacts/{ContactID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts/{ContactID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID contactID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.createContactAttachmentByFileName(accessToken, xeroTenantId, contactID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createContactAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact
        String fileName = xero-dev.jpg; // String | Name for the file you are attaching
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.createContactAttachmentByFileName(xeroTenantId, contactID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createContactAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact (default to null)
String *fileName = xero-dev.jpg; // Name for the file you are attaching (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// 
[apiInstance createContactAttachmentByFileNameWith:xeroTenantId
    contactID:contactID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const contactID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Contact
const fileName = "xero-dev.jpg";  // {String} Name for the file you are attaching
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
import * as fs from "fs";
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createContactAttachmentByFileName(xeroTenantId, contactID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createContactAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var contactID = new UUID(); // UUID | Unique identifier for a Contact (default to null)
            var fileName = xero-dev.jpg;  // String | Name for the file you are attaching (default to null)
            var body = BYTE_ARRAY_DATA_HERE;  // byte[] | 

            try
            {
                // 
                Attachments result = apiInstance.createContactAttachmentByFileName(xeroTenantId, contactID, fileName, body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createContactAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->createContactAttachmentByFileName($xeroTenantId, $contactID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createContactAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact
my $fileName = xero-dev.jpg; # String | Name for the file you are attaching
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->createContactAttachmentByFileName(xeroTenantId => $xeroTenantId, contactID => $contactID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createContactAttachmentByFileName: $@\n";
}
# 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_contact_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    contactID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    
        // TODO: BINARY CREATE 
    try:
        api_response = api_instance.create_contact_attachment_by_file_name(xeroTenantId, contactID, fileName, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createContactAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.createContactAttachmentByFileName(xeroTenantId, contactID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
ContactID*
UUID (uuid)
Unique identifier for a Contact
Required
FileName*
String
Name for the file you are attaching
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

createContactGroup

Creates a contact group


/ContactGroups

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ContactGroups"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        ContactGroup contactGroup = new ContactGroup();
        contactGroup.setName("VIPs");
        ContactGroups contactGroups = new ContactGroups();
        contactGroups.addContactGroupsItem(contactGroup);

        try {
            ContactGroups result = apiInstance.createContactGroup(accessToken, xeroTenantId, contactGroups);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createContactGroup");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        ContactGroups contactGroups = { "ContactGroups": [{ "Name": "VIPs" }]}; // ContactGroups | 
        try {
            ContactGroups result = apiInstance.createContactGroup(xeroTenantId, contactGroups);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createContactGroup");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
ContactGroups *contactGroups = { "ContactGroups": [{ "Name": "VIPs" }]}; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a contact group
[apiInstance createContactGroupWith:xeroTenantId
    contactGroups:contactGroups
              completionHandler: ^(ContactGroups output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const contactGroups: ContactGroups = { contactGroups: [{ name: "VIPs" }]}

try {
  const response = await xero.accountingApi.createContactGroup(xeroTenantId, contactGroups);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createContactGroupExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var contactGroups = new ContactGroups(); // ContactGroups | 

            try
            {
                // Creates a contact group
                ContactGroups result = apiInstance.createContactGroup(xeroTenantId, contactGroups);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createContactGroup: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

$contactGroup = new XeroAPI\XeroPHP\Models\Accounting\ContactGroup;
$contactGroup->setName('VIPs');

$contactGroups = new XeroAPI\XeroPHP\Models\Accounting\ContactGroups;
$arr_contact_groups = [];
array_push($arr_contact_groups, $contactGroup);
$contactGroups->setContactGroups($arr_contact_groups);

try {
  $result = $apiInstance->createContactGroup($xeroTenantId, $contactGroups);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createContactGroup: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactGroups = ::Object::ContactGroups->new(); # ContactGroups | 

eval { 
    my $result = $api_instance->createContactGroup(xeroTenantId => $xeroTenantId, contactGroups => $contactGroups);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createContactGroup: $@\n";
}
# 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_contact_group():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'

    contact_group = ContactGroup(
        name = "VIPs")

    contactGroups = ContactGroups( 
        contact_groups = [contact_group])
    
    try:
        api_response = api_instance.create_contact_group(xeroTenantId, contactGroups)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createContactGroup: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactGroups = { "ContactGroups": [{ "Name": "VIPs" }]}; // ContactGroups

    let mut context = AccountingApi::Context::default();
    let result = client.createContactGroup(xeroTenantId, contactGroups, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts Grant read-write access to contacts and contact groups

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
contactGroups *
ContactGroups
ContactGroups with an array of names in request body
Required

createContactGroupContacts

Creates contacts to a specific contact group


/ContactGroups/{ContactGroupID}/Contacts

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ContactGroups/{ContactGroupID}/Contacts"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID contactGroupID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        Contacts contacts = new Contacts();
        contacts.addContactsItem(contact);

        try {
            Contacts result = apiInstance.createContactGroupContacts(accessToken, xeroTenantId, contactGroupID, contacts);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createContactGroupContacts");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactGroupID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact Group
        Contacts contacts = { "Contacts": [ { "ContactID": "a3675fc4-f8dd-4f03-ba5b-f1870566bcd7" }, { "ContactID": "4e1753b9-018a-4775-b6aa-1bc7871cfee3" } ] }; // Contacts | 
        try {
            Contacts result = apiInstance.createContactGroupContacts(xeroTenantId, contactGroupID, contacts);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createContactGroupContacts");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactGroupID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact Group (default to null)
Contacts *contacts = { "Contacts": [ { "ContactID": "a3675fc4-f8dd-4f03-ba5b-f1870566bcd7" }, { "ContactID": "4e1753b9-018a-4775-b6aa-1bc7871cfee3" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates contacts to a specific contact group
[apiInstance createContactGroupContactsWith:xeroTenantId
    contactGroupID:contactGroupID
    contacts:contacts
              completionHandler: ^(Contacts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const contactGroupID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Contact Group
const contacts: Contacts = { contacts: [{ contactID: "a3675fc4-f8dd-4f03-ba5b-f1870566bcd7" }, { contactID: "4e1753b9-018a-4775-b6aa-1bc7871cfee3" }]}

try {
  const response = await xero.accountingApi.createContactGroupContacts(xeroTenantId, contactGroupID, contacts);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createContactGroupContactsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var contactGroupID = new UUID(); // UUID | Unique identifier for a Contact Group (default to null)
            var contacts = new Contacts(); // Contacts | 

            try
            {
                // Creates contacts to a specific contact group
                Contacts result = apiInstance.createContactGroupContacts(xeroTenantId, contactGroupID, contacts);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createContactGroupContacts: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactGroupID = "00000000-0000-0000-0000-000000000000";

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$contacts = new XeroAPI\XeroPHP\Models\Accounting\Contacts;
$arr_contacts = [];
array_push($arr_contacts, $contact);
$contacts->setContacts($arr_contacts);

try {
  $result = $apiInstance->createContactGroupContacts($xeroTenantId, $contactGroupID, $contacts);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createContactGroupContacts: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactGroupID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact Group
my $contacts = ::Object::Contacts->new(); # Contacts | 

eval { 
    my $result = $api_instance->createContactGroupContacts(xeroTenantId => $xeroTenantId, contactGroupID => $contactGroupID, contacts => $contacts);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createContactGroupContacts: $@\n";
}
# 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_contact_group_contacts():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    contactGroupID = '00000000-0000-0000-0000-000000000000'

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    contacts = Contacts( 
        contacts = [contact])
    
    try:
        api_response = api_instance.create_contact_group_contacts(xeroTenantId, contactGroupID, contacts)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createContactGroupContacts: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactGroupID = 00000000-0000-0000-0000-000000000000; // UUID
    let contacts = { "Contacts": [ { "ContactID": "a3675fc4-f8dd-4f03-ba5b-f1870566bcd7" }, { "ContactID": "4e1753b9-018a-4775-b6aa-1bc7871cfee3" } ] }; // Contacts

    let mut context = AccountingApi::Context::default();
    let result = client.createContactGroupContacts(xeroTenantId, contactGroupID, contacts, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts Grant read-write access to contacts and contact groups

Parameters

Path parameters
Name Description
ContactGroupID*
UUID (uuid)
Unique identifier for a Contact Group
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
contacts *
Contacts
Contacts with array of contacts specifying the ContactID to be added to ContactGroup in body of request
Required

createContactHistory

Creates a new history record for a specific contact


/Contacts/{ContactID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts/{ContactID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID contactID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createContactHistory(accessToken, xeroTenantId, contactID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createContactHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createContactHistory(xeroTenantId, contactID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createContactHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a new history record for a specific contact
[apiInstance createContactHistoryWith:xeroTenantId
    contactID:contactID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);
const historyRecords: HistoryRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] };  // {HistoryRecords} 
const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const contactID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Contact


try {
  const response = await xero.accountingApi.createContactHistory(xeroTenantId, contactID, historyRecords);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createContactHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var contactID = new UUID(); // UUID | Unique identifier for a Contact (default to null)
            var historyRecords = new HistoryRecords(); // HistoryRecords | 

            try
            {
                // Creates a new history record for a specific contact
                HistoryRecords result = apiInstance.createContactHistory(xeroTenantId, contactID, historyRecords);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createContactHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createContactHistory($xeroTenantId, $contactID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createContactHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createContactHistory(xeroTenantId => $xeroTenantId, contactID => $contactID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createContactHistory: $@\n";
}
# 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_contact_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    contactID = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    history_records = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_contact_history(xeroTenantId, contactID, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createContactHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createContactHistory(xeroTenantId, contactID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts Grant read-write access to contacts and contact groups

Parameters

Path parameters
Name Description
ContactID*
UUID (uuid)
Unique identifier for a Contact
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createContacts

Creates multiple contacts (bulk) in a Xero organisation


/Contacts

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        Boolean summarizeErrors = true;
        Phone phone = new Phone();
        phone.setPhoneNumber("555-1212");
        phone.setPhoneType(com.xero.models.accounting.Phone.PhoneTypeEnum.MOBILE);
        List<Phone> phones = new ArrayList<Phone>();
        phones.add(phone);
        Contact contact = new Contact();
        contact.setName("Bruce Banner");
        contact.setEmailAddress("hulk@avengers.com");
        contact.setPhones(phones);
        Contacts contacts = new Contacts();
        contacts.addContactsItem(contact);

        try {
            Contacts result = apiInstance.createContacts(accessToken, xeroTenantId, contacts, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createContacts");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Contacts contacts = { "Id": "e997d6d7-6dad-4458-beb8-d9c1bf7f2edf", "Status": "OK", "ProviderName": "Xero API Partner", "DateTimeUTC": "/Date(1551399321121)/", "Contacts": [ { "ContactID": "3ff6d40c-af9a-40a3-89ce-3c1556a25591", "ContactStatus": "ACTIVE", "Name": "Foo9987", "EmailAddress": "sid32476@blah.com", "BankAccountDetails": "", "Addresses": [ { "AddressType": "STREET", "City": "", "Region": "", "PostalCode": "", "Country": "" }, { "AddressType": "POBOX", "City": "", "Region": "", "PostalCode": "", "Country": "" } ], "Phones": [ { "PhoneType": "DEFAULT", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "DDI", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "FAX", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "MOBILE", "PhoneNumber": "555-1212", "PhoneAreaCode": "415", "PhoneCountryCode": "" } ], "UpdatedDateUTC": "/Date(1551399321043+0000)/", "ContactGroups": [], "IsSupplier": false, "IsCustomer": false, "SalesTrackingCategories": [], "PurchasesTrackingCategories": [], "PaymentTerms": { "Bills": { "Day": 15, "Type": "OFCURRENTMONTH" }, "Sales": { "Day": 10, "Type": "DAYSAFTERBILLMONTH" } }, "ContactPersons": [], "HasValidationErrors": false } ] }; // Contacts | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            Contacts result = apiInstance.createContacts(xeroTenantId, contacts, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createContacts");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Contacts *contacts = { "Id": "e997d6d7-6dad-4458-beb8-d9c1bf7f2edf", "Status": "OK", "ProviderName": "Xero API Partner", "DateTimeUTC": "/Date(1551399321121)/", "Contacts": [ { "ContactID": "3ff6d40c-af9a-40a3-89ce-3c1556a25591", "ContactStatus": "ACTIVE", "Name": "Foo9987", "EmailAddress": "sid32476@blah.com", "BankAccountDetails": "", "Addresses": [ { "AddressType": "STREET", "City": "", "Region": "", "PostalCode": "", "Country": "" }, { "AddressType": "POBOX", "City": "", "Region": "", "PostalCode": "", "Country": "" } ], "Phones": [ { "PhoneType": "DEFAULT", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "DDI", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "FAX", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "MOBILE", "PhoneNumber": "555-1212", "PhoneAreaCode": "415", "PhoneCountryCode": "" } ], "UpdatedDateUTC": "/Date(1551399321043+0000)/", "ContactGroups": [], "IsSupplier": false, "IsCustomer": false, "SalesTrackingCategories": [], "PurchasesTrackingCategories": [], "PaymentTerms": { "Bills": { "Day": 15, "Type": "OFCURRENTMONTH" }, "Sales": { "Day": 10, "Type": "DAYSAFTERBILLMONTH" } }, "ContactPersons": [], "HasValidationErrors": false } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates multiple contacts (bulk) in a Xero organisation
[apiInstance createContactsWith:xeroTenantId
    contacts:contacts
    summarizeErrors:summarizeErrors
              completionHandler: ^(Contacts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant


const summarizeErrors = true;  // {Boolean} If false return 200 OK and mix of successfully created objects and any with validation errors
const contacts: Contacts = { contacts: [{ name: "Bruce Banner", emailAddress: "hulk@avengers.com", phones: [{ phoneType: Phone.PhoneTypeEnum.MOBILE, phoneNumber: "555-1212", phoneAreaCode: "415" }], paymentTerms: { bills: { day: 15, type: PaymentTermType.OFCURRENTMONTH }, sales: { day: 10, type: PaymentTermType.DAYSAFTERBILLMONTH }}}]}

try {
  const response = await xero.accountingApi.createContacts(xeroTenantId, contacts,  summarizeErrors);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createContactsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var contacts = new Contacts(); // Contacts | 
            var summarizeErrors = true;  // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors (optional)  (default to false)

            try
            {
                // Creates multiple contacts (bulk) in a Xero organisation
                Contacts result = apiInstance.createContacts(xeroTenantId, contacts, summarizeErrors);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createContacts: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;

$phone = new XeroAPI\XeroPHP\Models\Accounting\Phone;
$phone->setPhoneNumber('555-1212');
$phone->setPhoneType(XeroAPI\XeroPHP\Models\Accounting\Phone::PHONE_TYPE_MOBILE);
$phones = [];
array_push($phones, $phone);

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setName('Bruce Banner');
$contact->setEmailAddress('hulk@avengers.com');
$contact->setPhones($phones);

$contacts = new XeroAPI\XeroPHP\Models\Accounting\Contacts;
$arr_contacts = [];
array_push($arr_contacts, $contact);
$contacts->setContacts($arr_contacts);

try {
  $result = $apiInstance->createContacts($xeroTenantId, $contacts, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createContacts: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contacts = ::Object::Contacts->new(); # Contacts | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->createContacts(xeroTenantId => $xeroTenantId, contacts => $contacts, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createContacts: $@\n";
}
# 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_contacts():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    summarizeErrors = 'True'

    phone = Phone(
        phone_number = "555-1212",
        phone_type = "MOBILE")
    
    phones = []    
    phones.append(phone)

    contact = Contact(
        name = "Bruce Banner",
        email_address = "hulk@avengers.com",
        phones = phones)

    contacts = Contacts( 
        contacts = [contact])
    
    try:
        api_response = api_instance.create_contacts(xeroTenantId, contacts, summarizeErrors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createContacts: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contacts = { "Id": "e997d6d7-6dad-4458-beb8-d9c1bf7f2edf", "Status": "OK", "ProviderName": "Xero API Partner", "DateTimeUTC": "/Date(1551399321121)/", "Contacts": [ { "ContactID": "3ff6d40c-af9a-40a3-89ce-3c1556a25591", "ContactStatus": "ACTIVE", "Name": "Foo9987", "EmailAddress": "sid32476@blah.com", "BankAccountDetails": "", "Addresses": [ { "AddressType": "STREET", "City": "", "Region": "", "PostalCode": "", "Country": "" }, { "AddressType": "POBOX", "City": "", "Region": "", "PostalCode": "", "Country": "" } ], "Phones": [ { "PhoneType": "DEFAULT", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "DDI", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "FAX", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "MOBILE", "PhoneNumber": "555-1212", "PhoneAreaCode": "415", "PhoneCountryCode": "" } ], "UpdatedDateUTC": "/Date(1551399321043+0000)/", "ContactGroups": [], "IsSupplier": false, "IsCustomer": false, "SalesTrackingCategories": [], "PurchasesTrackingCategories": [], "PaymentTerms": { "Bills": { "Day": 15, "Type": "OFCURRENTMONTH" }, "Sales": { "Day": 10, "Type": "DAYSAFTERBILLMONTH" } }, "ContactPersons": [], "HasValidationErrors": false } ] }; // Contacts
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.createContacts(xeroTenantId, contacts, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts Grant read-write access to contacts and contact groups

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
contacts *
Contacts
Contacts with an array of Contact objects to create in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

createCreditNoteAllocation

Creates allocation for a specific credit note


/CreditNotes/{CreditNoteID}/Allocations

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes/{CreditNoteID}/Allocations?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID creditNoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Boolean summarizeErrors = true;
        LocalDate currDate = LocalDate.now();
        Invoice invoice = new Invoice();
        invoice.setInvoiceID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        Allocation allocation = new Allocation();
        allocation.setAmount(1.0);
        allocation.setDate(currDate);
        allocation.setInvoice(invoice);
        Allocations allocations = new Allocations();
        allocations.addAllocationsItem(allocation);

        try {
            Allocations result = apiInstance.createCreditNoteAllocation(accessToken, xeroTenantId, creditNoteID, allocations, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createCreditNoteAllocation");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Credit Note
        Allocations allocations = { "Allocations": [ { "Invoice": { "LineItems": [], "InvoiceID": "c45720a1-ade3-4a38-a064-d15489be6841" }, "Amount": 1, "Date": "2019-03-05" } ] }; // Allocations | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            Allocations result = apiInstance.createCreditNoteAllocation(xeroTenantId, creditNoteID, allocations, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createCreditNoteAllocation");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *creditNoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Credit Note (default to null)
Allocations *allocations = { "Allocations": [ { "Invoice": { "LineItems": [], "InvoiceID": "c45720a1-ade3-4a38-a064-d15489be6841" }, "Amount": 1, "Date": "2019-03-05" } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates allocation for a specific credit note
[apiInstance createCreditNoteAllocationWith:xeroTenantId
    creditNoteID:creditNoteID
    allocations:allocations
    summarizeErrors:summarizeErrors
              completionHandler: ^(Allocations output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const creditNoteID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Credit Note


const summarizeErrors = true;  // {Boolean} If false return 200 OK and mix of successfully created objects and any with validation errors
const allocations: Allocations = { allocations: [{ amount: 1.0, date: "2019-03-05", invoice: { invoiceID: "c45720a1-ade3-4a38-a064-d15489be6841", lineItems: [], type: Invoice.TypeEnum.ACCPAY, contact: {} }}]}

try {
  const response = await xero.accountingApi.createCreditNoteAllocation(xeroTenantId, creditNoteID, allocations,  summarizeErrors);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createCreditNoteAllocationExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var creditNoteID = new UUID(); // UUID | Unique identifier for a Credit Note (default to null)
            var allocations = new Allocations(); // Allocations | 
            var summarizeErrors = true;  // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors (optional)  (default to false)

            try
            {
                // Creates allocation for a specific credit note
                Allocations result = apiInstance.createCreditNoteAllocation(xeroTenantId, creditNoteID, allocations, summarizeErrors);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createCreditNoteAllocation: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$creditNoteID = "00000000-0000-0000-0000-000000000000";
$summarizeErrors = true;
$currDate = new DateTime('2020-12-10');

$invoice = new XeroAPI\XeroPHP\Models\Accounting\Invoice;
$invoice->setInvoiceID('00000000-0000-0000-0000-000000000000');

$allocation = new XeroAPI\XeroPHP\Models\Accounting\Allocation;
$allocation->setAmount(1.0);
$allocation->setDate($currDate);
$allocation->setInvoice($invoice);

$allocations = new XeroAPI\XeroPHP\Models\Accounting\Allocations;
$arr_allocations = [];
array_push($arr_allocations, $allocation);
$allocations->setAllocations($arr_allocations);

try {
  $result = $apiInstance->createCreditNoteAllocation($xeroTenantId, $creditNoteID, $allocations, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createCreditNoteAllocation: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $creditNoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Credit Note
my $allocations = ::Object::Allocations->new(); # Allocations | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->createCreditNoteAllocation(xeroTenantId => $xeroTenantId, creditNoteID => $creditNoteID, allocations => $allocations, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createCreditNoteAllocation: $@\n";
}
# 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_credit_note_allocation():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    creditNoteID = '00000000-0000-0000-0000-000000000000'
    summarizeErrors = 'True'
    curr_date = dateutil.parser.parse('2020-12-03T00:00:00Z')

    invoice = Invoice(
        invoiceID = "00000000-0000-0000-0000-000000000000")

    allocation = Allocation(
        amount = 1.0,
        date = curr_date,
        invoice = invoice)

    allocations = Allocations( 
        allocations = [allocation])
    
    try:
        api_response = api_instance.create_credit_note_allocation(xeroTenantId, creditNoteID, allocations, summarizeErrors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createCreditNoteAllocation: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let allocations = { "Allocations": [ { "Invoice": { "LineItems": [], "InvoiceID": "c45720a1-ade3-4a38-a064-d15489be6841" }, "Amount": 1, "Date": "2019-03-05" } ] }; // Allocations
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.createCreditNoteAllocation(xeroTenantId, creditNoteID, allocations, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
CreditNoteID*
UUID (uuid)
Unique identifier for a Credit Note
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
allocations *
Allocations
Allocations with array of Allocation object in body of request.
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

createCreditNoteAttachmentByFileName

Creates an attachment for a specific credit note


/CreditNotes/{CreditNoteID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes/{CreditNoteID}/Attachments/{FileName}?IncludeOnline=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID creditNoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        Boolean includeOnline = true;
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.createCreditNoteAttachmentByFileName(accessToken, xeroTenantId, creditNoteID, fileName, body, includeOnline, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createCreditNoteAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Credit Note
        String fileName = xero-dev.jpg; // String | Name of the file you are attaching to Credit Note
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        Boolean includeOnline = true; // Boolean | Allows an attachment to be seen by the end customer within their online invoice
        try {
            Attachments result = apiInstance.createCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, fileName, body, includeOnline);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createCreditNoteAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *creditNoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Credit Note (default to null)
String *fileName = xero-dev.jpg; // Name of the file you are attaching to Credit Note (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 
Boolean *includeOnline = true; // Allows an attachment to be seen by the end customer within their online invoice (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates an attachment for a specific credit note
[apiInstance createCreditNoteAttachmentByFileNameWith:xeroTenantId
    creditNoteID:creditNoteID
    fileName:fileName
    body:body
    includeOnline:includeOnline
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const creditNoteID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Credit Note
const fileName = "xero-dev.jpg";  // {String} Name of the file you are attaching to Credit Note
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
import * as fs from "fs";
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

const includeOnline = true;  // {Boolean} Allows an attachment to be seen by the end customer within their online invoice


try {
  const response = await xero.accountingApi.createCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, fileName, body,  includeOnline, {
    headers: {
      "Content-Type": contentType,
    }
  });
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createCreditNoteAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var creditNoteID = new UUID(); // UUID | Unique identifier for a Credit Note (default to null)
            var fileName = xero-dev.jpg;  // String | Name of the file you are attaching to Credit Note (default to null)
            var body = BYTE_ARRAY_DATA_HERE;  // byte[] | 
            var includeOnline = true;  // Boolean | Allows an attachment to be seen by the end customer within their online invoice (optional)  (default to false)

            try
            {
                // Creates an attachment for a specific credit note
                Attachments result = apiInstance.createCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, fileName, body, includeOnline);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createCreditNoteAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$creditNoteID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";
$includeOnline = true;

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->createCreditNoteAttachmentByFileName($xeroTenantId, $creditNoteID, $fileName, $body, $includeOnline);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createCreditNoteAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $creditNoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Credit Note
my $fileName = xero-dev.jpg; # String | Name of the file you are attaching to Credit Note
my $body = ::Object::byte[]->new(); # byte[] | 
my $includeOnline = true; # Boolean | Allows an attachment to be seen by the end customer within their online invoice

eval { 
    my $result = $api_instance->createCreditNoteAttachmentByFileName(xeroTenantId => $xeroTenantId, creditNoteID => $creditNoteID, fileName => $fileName, body => $body, includeOnline => $includeOnline);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createCreditNoteAttachmentByFileName: $@\n";
}
# 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_credit_note_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    creditNoteID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    includeOnline = 'true'
    
        // TODO: BINARY CREATE 
    try:
        api_response = api_instance.create_credit_note_attachment_by_file_name(xeroTenantId, creditNoteID, fileName, body, includeOnline)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createCreditNoteAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]
    let includeOnline = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.createCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, fileName, body, includeOnline, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
CreditNoteID*
UUID (uuid)
Unique identifier for a Credit Note
Required
FileName*
String
Name of the file you are attaching to Credit Note
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required
Query parameters
Name Description
IncludeOnline
Boolean
Allows an attachment to be seen by the end customer within their online invoice

createCreditNoteHistory

Retrieves history records of a specific credit note


/CreditNotes/{CreditNoteID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes/{CreditNoteID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID creditNoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createCreditNoteHistory(accessToken, xeroTenantId, creditNoteID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createCreditNoteHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Credit Note
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createCreditNoteHistory(xeroTenantId, creditNoteID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createCreditNoteHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *creditNoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Credit Note (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history records of a specific credit note
[apiInstance createCreditNoteHistoryWith:xeroTenantId
    creditNoteID:creditNoteID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);
const historyRecords: HistoryRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] };  // {HistoryRecords} 
const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const creditNoteID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Credit Note


try {
  const response = await xero.accountingApi.createCreditNoteHistory(xeroTenantId, creditNoteID, historyRecords);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createCreditNoteHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var creditNoteID = new UUID(); // UUID | Unique identifier for a Credit Note (default to null)
            var historyRecords = new HistoryRecords(); // HistoryRecords | 

            try
            {
                // Retrieves history records of a specific credit note
                HistoryRecords result = apiInstance.createCreditNoteHistory(xeroTenantId, creditNoteID, historyRecords);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createCreditNoteHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$creditNoteID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createCreditNoteHistory($xeroTenantId, $creditNoteID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createCreditNoteHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $creditNoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Credit Note
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createCreditNoteHistory(xeroTenantId => $xeroTenantId, creditNoteID => $creditNoteID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createCreditNoteHistory: $@\n";
}
# 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_credit_note_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    creditNoteID = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    history_records = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_credit_note_history(xeroTenantId, creditNoteID, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createCreditNoteHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createCreditNoteHistory(xeroTenantId, creditNoteID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
CreditNoteID*
UUID (uuid)
Unique identifier for a Credit Note
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createCreditNotes

Creates a new credit note


/CreditNotes

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes?summarizeErrors=true&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        Boolean summarizeErrors = true;
        Integer unitdp = 4;
        LocalDate currDate = LocalDate.now();
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        LineItem lineItem = new LineItem();
        lineItem.setDescription("Foobar");
        lineItem.setQuantity(1.0);
        lineItem.setUnitAmount(20.0);
        lineItem.setAccountCode("000");
        List<LineItems> lineItems = new ArrayList<LineItems>();
        lineItems.add(lineItem);
        CreditNote creditNote = new CreditNote();
        creditNote.setType(com.xero.models.accounting.CreditNote.TypeEnum.ACCPAYCREDIT);
        creditNote.setContact(contact);
        creditNote.setDate(currDate);
        creditNote.setLineItems(lineItems);
        CreditNotes creditNotes = new CreditNotes();
        creditNotes.addCreditNotesItem(creditNote);

        try {
            CreditNotes result = apiInstance.createCreditNotes(accessToken, xeroTenantId, creditNotes, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createCreditNotes");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        CreditNotes creditNotes = { "CreditNotes":[ { "Type":"ACCPAYCREDIT", "Contact":{ "ContactID":"430fa14a-f945-44d3-9f97-5df5e28441b8" }, "Date":"2019-01-05", "LineItems":[ { "Description":"Foobar", "Quantity":2.0, "UnitAmount":20.0, "AccountCode":"400" } ] } ] }; // CreditNotes | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            CreditNotes result = apiInstance.createCreditNotes(xeroTenantId, creditNotes, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createCreditNotes");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
CreditNotes *creditNotes = { "CreditNotes":[ { "Type":"ACCPAYCREDIT", "Contact":{ "ContactID":"430fa14a-f945-44d3-9f97-5df5e28441b8" }, "Date":"2019-01-05", "LineItems":[ { "Description":"Foobar", "Quantity":2.0, "UnitAmount":20.0, "AccountCode":"400" } ] } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a new credit note
[apiInstance createCreditNotesWith:xeroTenantId
    creditNotes:creditNotes
    summarizeErrors:summarizeErrors
    unitdp:unitdp
              completionHandler: ^(CreditNotes output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant


const summarizeErrors = true;  // {Boolean} If false return 200 OK and mix of successfully created objects and any with validation errors

const unitdp = 4;  // {Integer} e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
const creditNotes: CreditNotes = { creditNotes: [{ type: CreditNote.TypeEnum.ACCPAYCREDIT, contact: { contactID: "430fa14a-f945-44d3-9f97-5df5e28441b8" }, date: "2019-01-05", lineItems: [{ description: "Foobar", quantity: 2.0, unitAmount: 20.0, accountCode: "400" }]}]}

try {
  const response = await xero.accountingApi.createCreditNotes(xeroTenantId, creditNotes,  summarizeErrors, unitdp);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createCreditNotesExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var creditNotes = new CreditNotes(); // CreditNotes | 
            var summarizeErrors = true;  // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors (optional)  (default to false)
            var unitdp = 4;  // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)  (default to null)

            try
            {
                // Creates a new credit note
                CreditNotes result = apiInstance.createCreditNotes(xeroTenantId, creditNotes, summarizeErrors, unitdp);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createCreditNotes: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$unitdp = 4;
$currDate = new DateTime('2020-12-10');

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
$lineItem->setDescription('Foobar');
$lineItem->setQuantity(1.0);
$lineItem->setUnitAmount(20.0);
$lineItem->setAccountCode('000');
$lineItems = [];
array_push($lineItems, $lineItem);

$creditNote = new XeroAPI\XeroPHP\Models\Accounting\CreditNote;
$creditNote->setType(XeroAPI\XeroPHP\Models\Accounting\CreditNote::TYPE_ACCPAYCREDIT);
$creditNote->setContact($contact);
$creditNote->setDate($currDate);
$creditNote->setLineItems($lineItems);

$creditNotes = new XeroAPI\XeroPHP\Models\Accounting\CreditNotes;
$arr_credit_notes = [];
array_push($arr_credit_notes, $creditNote);
$creditNotes->setCreditNotes($arr_credit_notes);

try {
  $result = $apiInstance->createCreditNotes($xeroTenantId, $creditNotes, $summarizeErrors, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createCreditNotes: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $creditNotes = ::Object::CreditNotes->new(); # CreditNotes | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->createCreditNotes(xeroTenantId => $xeroTenantId, creditNotes => $creditNotes, summarizeErrors => $summarizeErrors, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createCreditNotes: $@\n";
}
# 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_credit_notes():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    summarizeErrors = 'True'
    curr_date = dateutil.parser.parse('2020-12-03T00:00:00Z')

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    line_item = LineItem(
        description = "Foobar",
        quantity = 1.0,
        unit_amount = 20.0,
        account_code = "000")
    
    line_items = []    
    line_items.append(line_item)

    credit_note = CreditNote(
        type = "ACCPAYCREDIT",
        contact = contact,
        date = curr_date,
        line_items = line_items)

    creditNotes = CreditNotes( 
        credit_notes = [credit_note])
    
    try:
        api_response = api_instance.create_credit_notes(xeroTenantId, creditNotes, summarizeErrors, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createCreditNotes: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let creditNotes = { "CreditNotes":[ { "Type":"ACCPAYCREDIT", "Contact":{ "ContactID":"430fa14a-f945-44d3-9f97-5df5e28441b8" }, "Date":"2019-01-05", "LineItems":[ { "Description":"Foobar", "Quantity":2.0, "UnitAmount":20.0, "AccountCode":"400" } ] } ] }; // CreditNotes
    let summarizeErrors = true; // Boolean
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.createCreditNotes(xeroTenantId, creditNotes, summarizeErrors, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
creditNotes *
CreditNotes
Credit Notes with array of CreditNote object in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

createCurrency

Create a new currency for a Xero organisation


/Currencies

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Currencies"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        Currency currency = new Currency();
        currency.setCode(com.xero.models.accounting.CurrencyCode.USD);
        currency.setDescription("United States Dollar");

        try {
            Currencies result = apiInstance.createCurrency(accessToken, xeroTenantId, currency);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createCurrency");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Currency currency = { "Code": "USD", "Description": "United States Dollar" }; // Currency | 
        try {
            Currencies result = apiInstance.createCurrency(xeroTenantId, currency);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createCurrency");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Currency *currency = { "Code": "USD", "Description": "United States Dollar" }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Create a new currency for a Xero organisation
[apiInstance createCurrencyWith:xeroTenantId
    currency:currency
              completionHandler: ^(Currencies output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const currency: Currency = { code: CurrencyCode.USD, description: "United States Dollar" }

try {
  const response = await xero.accountingApi.createCurrency(xeroTenantId, currency);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createCurrencyExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var currency = new Currency(); // Currency | 

            try
            {
                // Create a new currency for a Xero organisation
                Currencies result = apiInstance.createCurrency(xeroTenantId, currency);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createCurrency: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

$currency = new XeroAPI\XeroPHP\Models\Accounting\Currency;
$currency->setCode(XeroAPI\XeroPHP\Models\Accounting\CurrencyCode::USD);
$currency->setDescription('United States Dollar');

try {
  $result = $apiInstance->createCurrency($xeroTenantId, $currency);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createCurrency: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $currency = ::Object::Currency->new(); # Currency | 

eval { 
    my $result = $api_instance->createCurrency(xeroTenantId => $xeroTenantId, currency => $currency);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createCurrency: $@\n";
}
# 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_currency():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'

    currency = Currency(
        code = CurrencyCode.USD,
        description = "United States Dollar")
    
    try:
        api_response = api_instance.create_currency(xeroTenantId, currency)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createCurrency: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let currency = { "Code": "USD", "Description": "United States Dollar" }; // Currency

    let mut context = AccountingApi::Context::default();
    let result = client.createCurrency(xeroTenantId, currency, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
currency *
Currency
Currency object in the body of request
Required

createEmployees

Creates new employees used in Xero payrun


/Employees

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Employees?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        Boolean summarizeErrors = true;
        Employee employee = new Employee();
        employee.setFirstName("Nick");
        employee.setLastName("Fury");
        Employees employees = new Employees();
        employees.addEmployeesItem(employee);

        try {
            Employees result = apiInstance.createEmployees(accessToken, xeroTenantId, employees, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createEmployees");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Employees employees = { "Employees": [ { "FirstName": "Nick", "LastName": "Fury", "ExternalLink": { "Url": "http://twitter.com/#!/search/Nick+Fury" } } ] }; // Employees | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            Employees result = apiInstance.createEmployees(xeroTenantId, employees, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createEmployees");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Employees *employees = { "Employees": [ { "FirstName": "Nick", "LastName": "Fury", "ExternalLink": { "Url": "http://twitter.com/#!/search/Nick+Fury" } } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates new employees used in Xero payrun
[apiInstance createEmployeesWith:xeroTenantId
    employees:employees
    summarizeErrors:summarizeErrors
              completionHandler: ^(Employees output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant


const summarizeErrors = true;  // {Boolean} If false return 200 OK and mix of successfully created objects and any with validation errors
const employees: Employees = { employees: [{ firstName: "Nick", lastName: "Fury", externalLink: { url: "http://twitter.com/#!/search/Nick+Fury" }}]}

try {
  const response = await xero.accountingApi.createEmployees(xeroTenantId, employees,  summarizeErrors);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createEmployeesExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var employees = new Employees(); // Employees | 
            var summarizeErrors = true;  // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors (optional)  (default to false)

            try
            {
                // Creates new employees used in Xero payrun
                Employees result = apiInstance.createEmployees(xeroTenantId, employees, summarizeErrors);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createEmployees: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;

$employee = new XeroAPI\XeroPHP\Models\Accounting\Employee;
$employee->setFirstName('Nick');
$employee->setLastName('Fury');

$employees = new XeroAPI\XeroPHP\Models\Accounting\Employees;
$arr_employees = [];
array_push($arr_employees, $employee);
$employees->setEmployees($arr_employees);

try {
  $result = $apiInstance->createEmployees($xeroTenantId, $employees, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createEmployees: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $employees = ::Object::Employees->new(); # Employees | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->createEmployees(xeroTenantId => $xeroTenantId, employees => $employees, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createEmployees: $@\n";
}
# 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_employees():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    summarizeErrors = 'True'

    employee = Employee(
        first_name = "Nick",
        last_name = "Fury")

    employees = Employees( 
        employees = [employee])
    
    try:
        api_response = api_instance.create_employees(xeroTenantId, employees, summarizeErrors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createEmployees: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let employees = { "Employees": [ { "FirstName": "Nick", "LastName": "Fury", "ExternalLink": { "Url": "http://twitter.com/#!/search/Nick+Fury" } } ] }; // Employees
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.createEmployees(xeroTenantId, employees, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
employees *
Employees
Employees with array of Employee object in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

createExpenseClaimHistory

Creates a history record for a specific expense claim


/ExpenseClaims/{ExpenseClaimID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ExpenseClaims/{ExpenseClaimID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID expenseClaimID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createExpenseClaimHistory(accessToken, xeroTenantId, expenseClaimID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createExpenseClaimHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID expenseClaimID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a ExpenseClaim
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createExpenseClaimHistory(xeroTenantId, expenseClaimID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createExpenseClaimHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *expenseClaimID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a ExpenseClaim (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a history record for a specific expense claim
[apiInstance createExpenseClaimHistoryWith:xeroTenantId
    expenseClaimID:expenseClaimID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);
const historyRecords: HistoryRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] };  // {HistoryRecords} 
const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const expenseClaimID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a ExpenseClaim


try {
  const response = await xero.accountingApi.createExpenseClaimHistory(xeroTenantId, expenseClaimID, historyRecords);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createExpenseClaimHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var expenseClaimID = new UUID(); // UUID | Unique identifier for a ExpenseClaim (default to null)
            var historyRecords = new HistoryRecords(); // HistoryRecords | 

            try
            {
                // Creates a history record for a specific expense claim
                HistoryRecords result = apiInstance.createExpenseClaimHistory(xeroTenantId, expenseClaimID, historyRecords);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createExpenseClaimHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$expenseClaimID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createExpenseClaimHistory($xeroTenantId, $expenseClaimID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createExpenseClaimHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $expenseClaimID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a ExpenseClaim
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createExpenseClaimHistory(xeroTenantId => $xeroTenantId, expenseClaimID => $expenseClaimID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createExpenseClaimHistory: $@\n";
}
# 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_expense_claim_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    expenseClaimID = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    history_records = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_expense_claim_history(xeroTenantId, expenseClaimID, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createExpenseClaimHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let expenseClaimID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createExpenseClaimHistory(xeroTenantId, expenseClaimID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
ExpenseClaimID*
UUID (uuid)
Unique identifier for a ExpenseClaim
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createExpenseClaims

Creates expense claims


/ExpenseClaims

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ExpenseClaims"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        LocalDate currDate = LocalDate.now();
        User user = new User();
        user.setUserID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        Receipt receipt = new Receipt();
        receipt.setReceiptID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        receipt.setDate(currDate);
        List<Receipt> receipts = new ArrayList<Receipt>();
        receipts.add(receipt);
        ExpenseClaim expenseClaim = new ExpenseClaim();
        expenseClaim.setStatus(com.xero.models.accounting.ExpenseClaim.StatusEnum.SUBMITTED);
        expenseClaim.setUser(user);
        expenseClaim.setReceipts(receipts);
        ExpenseClaims expenseClaims = new ExpenseClaims();
        expenseClaims.addExpenseClaimsItem(expenseClaim);

        try {
            ExpenseClaims result = apiInstance.createExpenseClaims(accessToken, xeroTenantId, expenseClaims);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createExpenseClaims");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        ExpenseClaims expenseClaims = { "ExpenseClaims": [ { "Status": "SUBMITTED", "User": { "UserID": "d1164823-0ac1-41ad-987b-b4e30fe0b273" }, "Receipts": [ { "Lineitems": [], "ReceiptID": "dc1c7f6d-0a4c-402f-acac-551d62ce5816" } ] } ] }; // ExpenseClaims | 
        try {
            ExpenseClaims result = apiInstance.createExpenseClaims(xeroTenantId, expenseClaims);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createExpenseClaims");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
ExpenseClaims *expenseClaims = { "ExpenseClaims": [ { "Status": "SUBMITTED", "User": { "UserID": "d1164823-0ac1-41ad-987b-b4e30fe0b273" }, "Receipts": [ { "Lineitems": [], "ReceiptID": "dc1c7f6d-0a4c-402f-acac-551d62ce5816" } ] } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates expense claims
[apiInstance createExpenseClaimsWith:xeroTenantId
    expenseClaims:expenseClaims
              completionHandler: ^(ExpenseClaims output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const expenseClaims: ExpenseClaims = { expenseClaims: [{ status: ExpenseClaim.StatusEnum.SUBMITTED, user: { userID: "d1164823-0ac1-41ad-987b-b4e30fe0b273" }, receipts: [{ receiptID: "dc1c7f6d-0a4c-402f-acac-551d62ce5816", lineItems: [], contact: {}, user: {}, date: "2018-01-01" }]}]}

try {
  const response = await xero.accountingApi.createExpenseClaims(xeroTenantId, expenseClaims);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createExpenseClaimsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var expenseClaims = new ExpenseClaims(); // ExpenseClaims | 

            try
            {
                // Creates expense claims
                ExpenseClaims result = apiInstance.createExpenseClaims(xeroTenantId, expenseClaims);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createExpenseClaims: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$currDate = new DateTime('2020-12-10');

$user = new XeroAPI\XeroPHP\Models\Accounting\User;
$user->setUserID('00000000-0000-0000-0000-000000000000');

$receipt = new XeroAPI\XeroPHP\Models\Accounting\Receipt;
$receipt->setReceiptID('00000000-0000-0000-0000-000000000000');
$receipt->setDate($currDate);
$receipts = [];
array_push($receipts, $receipt);

$expenseClaim = new XeroAPI\XeroPHP\Models\Accounting\ExpenseClaim;
$expenseClaim->setStatus(XeroAPI\XeroPHP\Models\Accounting\ExpenseClaim::STATUS_SUBMITTED);
$expenseClaim->setUser($user);
$expenseClaim->setReceipts($receipts);

$expenseClaims = new XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims;
$arr_expense_claims = [];
array_push($arr_expense_claims, $expenseClaim);
$expenseClaims->setExpenseClaims($arr_expense_claims);

try {
  $result = $apiInstance->createExpenseClaims($xeroTenantId, $expenseClaims);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createExpenseClaims: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $expenseClaims = ::Object::ExpenseClaims->new(); # ExpenseClaims | 

eval { 
    my $result = $api_instance->createExpenseClaims(xeroTenantId => $xeroTenantId, expenseClaims => $expenseClaims);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createExpenseClaims: $@\n";
}
# 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_expense_claims():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    curr_date = dateutil.parser.parse('2020-12-03T00:00:00Z')

    user = User(
        user_id = "00000000-0000-0000-0000-000000000000")

    receipt = Receipt(
        receipt_id = "00000000-0000-0000-0000-000000000000",
        date = curr_date)
    
    receipts = []    
    receipts.append(receipt)

    expense_claim = ExpenseClaim(
        status = "SUBMITTED",
        user = user,
        receipts = receipts)

    expenseClaims = ExpenseClaims( 
        expense_claims = [expense_claim])
    
    try:
        api_response = api_instance.create_expense_claims(xeroTenantId, expenseClaims)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createExpenseClaims: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let expenseClaims = { "ExpenseClaims": [ { "Status": "SUBMITTED", "User": { "UserID": "d1164823-0ac1-41ad-987b-b4e30fe0b273" }, "Receipts": [ { "Lineitems": [], "ReceiptID": "dc1c7f6d-0a4c-402f-acac-551d62ce5816" } ] } ] }; // ExpenseClaims

    let mut context = AccountingApi::Context::default();
    let result = client.createExpenseClaims(xeroTenantId, expenseClaims, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
expenseClaims *
ExpenseClaims
ExpenseClaims with array of ExpenseClaim object in body of request
Required

createInvoiceAttachmentByFileName

Creates an attachment for a specific invoice or purchase bill by filename


/Invoices/{InvoiceID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID}/Attachments/{FileName}?IncludeOnline=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID invoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        Boolean includeOnline = true;
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.createInvoiceAttachmentByFileName(accessToken, xeroTenantId, invoiceID, fileName, body, includeOnline, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createInvoiceAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID invoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Invoice
        String fileName = xero-dev.jpg; // String | Name of the file you are attaching
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        Boolean includeOnline = true; // Boolean | Allows an attachment to be seen by the end customer within their online invoice
        try {
            Attachments result = apiInstance.createInvoiceAttachmentByFileName(xeroTenantId, invoiceID, fileName, body, includeOnline);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createInvoiceAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *invoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Invoice (default to null)
String *fileName = xero-dev.jpg; // Name of the file you are attaching (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 
Boolean *includeOnline = true; // Allows an attachment to be seen by the end customer within their online invoice (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates an attachment for a specific invoice or purchase bill by filename
[apiInstance createInvoiceAttachmentByFileNameWith:xeroTenantId
    invoiceID:invoiceID
    fileName:fileName
    body:body
    includeOnline:includeOnline
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const invoiceID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for an Invoice
const fileName = "xero-dev.jpg";  // {String} Name of the file you are attaching
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
import * as fs from "fs";
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

const includeOnline = true;  // {Boolean} Allows an attachment to be seen by the end customer within their online invoice


try {
  const response = await xero.accountingApi.createInvoiceAttachmentByFileName(xeroTenantId, invoiceID, fileName, body,  includeOnline, {
    headers: {
      "Content-Type": contentType,
    }
  });
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createInvoiceAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var invoiceID = new UUID(); // UUID | Unique identifier for an Invoice (default to null)
            var fileName = xero-dev.jpg;  // String | Name of the file you are attaching (default to null)
            var body = BYTE_ARRAY_DATA_HERE;  // byte[] | 
            var includeOnline = true;  // Boolean | Allows an attachment to be seen by the end customer within their online invoice (optional)  (default to false)

            try
            {
                // Creates an attachment for a specific invoice or purchase bill by filename
                Attachments result = apiInstance.createInvoiceAttachmentByFileName(xeroTenantId, invoiceID, fileName, body, includeOnline);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createInvoiceAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$invoiceID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";
$includeOnline = true;

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->createInvoiceAttachmentByFileName($xeroTenantId, $invoiceID, $fileName, $body, $includeOnline);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createInvoiceAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Invoice
my $fileName = xero-dev.jpg; # String | Name of the file you are attaching
my $body = ::Object::byte[]->new(); # byte[] | 
my $includeOnline = true; # Boolean | Allows an attachment to be seen by the end customer within their online invoice

eval { 
    my $result = $api_instance->createInvoiceAttachmentByFileName(xeroTenantId => $xeroTenantId, invoiceID => $invoiceID, fileName => $fileName, body => $body, includeOnline => $includeOnline);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createInvoiceAttachmentByFileName: $@\n";
}
# 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_invoice_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    invoiceID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    includeOnline = 'true'
    
        // TODO: BINARY CREATE 
    try:
        api_response = api_instance.create_invoice_attachment_by_file_name(xeroTenantId, invoiceID, fileName, body, includeOnline)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createInvoiceAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoiceID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]
    let includeOnline = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.createInvoiceAttachmentByFileName(xeroTenantId, invoiceID, fileName, body, includeOnline, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
InvoiceID*
UUID (uuid)
Unique identifier for an Invoice
Required
FileName*
String
Name of the file you are attaching
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required
Query parameters
Name Description
IncludeOnline
Boolean
Allows an attachment to be seen by the end customer within their online invoice

createInvoiceHistory

Creates a history record for a specific invoice


/Invoices/{InvoiceID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID invoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createInvoiceHistory(accessToken, xeroTenantId, invoiceID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createInvoiceHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID invoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Invoice
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createInvoiceHistory(xeroTenantId, invoiceID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createInvoiceHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *invoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Invoice (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a history record for a specific invoice
[apiInstance createInvoiceHistoryWith:xeroTenantId
    invoiceID:invoiceID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);
const historyRecords: HistoryRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] };  // {HistoryRecords} 
const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const invoiceID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for an Invoice


try {
  const response = await xero.accountingApi.createInvoiceHistory(xeroTenantId, invoiceID, historyRecords);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createInvoiceHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var invoiceID = new UUID(); // UUID | Unique identifier for an Invoice (default to null)
            var historyRecords = new HistoryRecords(); // HistoryRecords | 

            try
            {
                // Creates a history record for a specific invoice
                HistoryRecords result = apiInstance.createInvoiceHistory(xeroTenantId, invoiceID, historyRecords);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createInvoiceHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$invoiceID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createInvoiceHistory($xeroTenantId, $invoiceID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createInvoiceHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Invoice
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createInvoiceHistory(xeroTenantId => $xeroTenantId, invoiceID => $invoiceID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createInvoiceHistory: $@\n";
}
# 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_invoice_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    invoiceID = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    history_records = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_invoice_history(xeroTenantId, invoiceID, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createInvoiceHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoiceID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createInvoiceHistory(xeroTenantId, invoiceID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
InvoiceID*
UUID (uuid)
Unique identifier for an Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createInvoices

Creates one or more sales invoices or purchase bills


/Invoices

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices?summarizeErrors=true&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        Boolean summarizeErrors = true;
        Integer unitdp = 4;
        LocalDate dateValue = LocalDate.of(2020, Month.OCTOBER, 10);
        LocalDate dueDateValue = LocalDate.of(2020, Month.OCTOBER, 28);
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        LineItemTracking lineItemTracking = new LineItemTracking();
        lineItemTracking.setTrackingCategoryID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        lineItemTracking.setTrackingOptionID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        List<LineItemTracking> lineItemTrackings = new ArrayList<LineItemTracking>();
        lineItemTrackings.add(lineItemTracking);
        LineItem lineItem = new LineItem();
        lineItem.setDescription("Foobar");
        lineItem.setQuantity(1.0);
        lineItem.setUnitAmount(20.0);
        lineItem.setAccountCode("000");
        lineItem.setTracking(lineItemTrackings);
        List<LineItems> lineItems = new ArrayList<LineItems>();
        lineItems.add(lineItem);
        Invoice invoice = new Invoice();
        invoice.setType(com.xero.models.accounting.Invoice.TypeEnum.ACCREC);
        invoice.setContact(contact);
        invoice.setDate(dateValue);
        invoice.setDueDate(dueDateValue);
        invoice.setLineItems(lineItems);
        invoice.setReference("Website Design");
        invoice.setStatus(com.xero.models.accounting.Invoice.StatusEnum.DRAFT);
        Invoices invoices = new Invoices();
        invoices.addInvoicesItem(invoice);

        try {
            Invoices result = apiInstance.createInvoices(accessToken, xeroTenantId, invoices, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createInvoices");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Invoices invoices = { "Invoices": [ { "Type": "ACCREC", "Contact": { "ContactID": "430fa14a-f945-44d3-9f97-5df5e28441b8" }, "LineItems": [ { "Description": "Acme Tires", "Quantity": 2, "UnitAmount": 20, "AccountCode": "200", "TaxType": "NONE", "LineAmount": 40 } ], "Date": "2019-03-11", "DueDate": "2018-12-10", "Reference": "Website Design", "Status": "AUTHORISED" } ] }; // Invoices | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Invoices result = apiInstance.createInvoices(xeroTenantId, invoices, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createInvoices");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Invoices *invoices = { "Invoices": [ { "Type": "ACCREC", "Contact": { "ContactID": "430fa14a-f945-44d3-9f97-5df5e28441b8" }, "LineItems": [ { "Description": "Acme Tires", "Quantity": 2, "UnitAmount": 20, "AccountCode": "200", "TaxType": "NONE", "LineAmount": 40 } ], "Date": "2019-03-11", "DueDate": "2018-12-10", "Reference": "Website Design", "Status": "AUTHORISED" } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates one or more sales invoices or purchase bills
[apiInstance createInvoicesWith:xeroTenantId
    invoices:invoices
    summarizeErrors:summarizeErrors
    unitdp:unitdp
              completionHandler: ^(Invoices output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant


const summarizeErrors = true;  // {Boolean} If false return 200 OK and mix of successfully created objects and any with validation errors

const unitdp = 4;  // {Integer} e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
const invoices: Invoices = { invoices: [{ type: Invoice.TypeEnum.ACCREC, contact: { contactID: "00000000-0000-0000-0000-000000000000" }, lineItems: [{ description: "Acme Tires", quantity: 2.0, unitAmount: 20.0, accountCode: "000", taxType: TaxType.NONE, lineAmount: 40.0 }], date: "2019-03-11", dueDate: "2018-12-10", reference: "Website Design", status: Invoice.StatusEnum.DRAFT }]}

try {
  const response = await xero.accountingApi.createInvoices(xeroTenantId, invoices,  summarizeErrors, unitdp);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createInvoicesExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var invoices = new Invoices(); // Invoices | 
            var summarizeErrors = true;  // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors (optional)  (default to false)
            var unitdp = 4;  // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)  (default to null)

            try
            {
                // Creates one or more sales invoices or purchase bills
                Invoices result = apiInstance.createInvoices(xeroTenantId, invoices, summarizeErrors, unitdp);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createInvoices: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$unitdp = 4;
$dateValue = new DateTime('2020-10-10');
$dueDateValue = new DateTime('2020-10-28');

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$lineItemTracking = new XeroAPI\XeroPHP\Models\Accounting\LineItemTracking;
$lineItemTracking->setTrackingCategoryID('00000000-0000-0000-0000-000000000000');
$lineItemTracking->setTrackingOptionID('00000000-0000-0000-0000-000000000000');
$lineItemTrackings = [];
array_push($lineItemTrackings, $lineItemTracking);

$lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
$lineItem->setDescription('Foobar');
$lineItem->setQuantity(1.0);
$lineItem->setUnitAmount(20.0);
$lineItem->setAccountCode('000');
$lineItem->setTracking(lineItemTrackings);
$lineItems = [];
array_push($lineItems, $lineItem);

$invoice = new XeroAPI\XeroPHP\Models\Accounting\Invoice;
$invoice->setType(XeroAPI\XeroPHP\Models\Accounting\Invoice::TYPE_ACCREC);
$invoice->setContact($contact);
$invoice->setDate($dateValue);
$invoice->setDueDate($dueDateValue);
$invoice->setLineItems($lineItems);
$invoice->setReference('Website Design');
$invoice->setStatus(XeroAPI\XeroPHP\Models\Accounting\Invoice::STATUS_DRAFT);

$invoices = new XeroAPI\XeroPHP\Models\Accounting\Invoices;
$arr_invoices = [];
array_push($arr_invoices, $invoice);
$invoices->setInvoices($arr_invoices);

try {
  $result = $apiInstance->createInvoices($xeroTenantId, $invoices, $summarizeErrors, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createInvoices: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoices = ::Object::Invoices->new(); # Invoices | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->createInvoices(xeroTenantId => $xeroTenantId, invoices => $invoices, summarizeErrors => $summarizeErrors, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createInvoices: $@\n";
}
# 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_invoices():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    summarizeErrors = 'True'
    date_value = dateutil.parser.parse('2020-10-10T00:00:00Z')
    due_date_value = dateutil.parser.parse('2020-10-28T00:00:00Z')

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    line_item_tracking = LineItemTracking(
        tracking_category_id = "00000000-0000-0000-0000-000000000000",
        tracking_option_id = "00000000-0000-0000-0000-000000000000")
    
    line_item_trackings = []    
    line_item_trackings.append(line_item_tracking)

    line_item = LineItem(
        description = "Foobar",
        quantity = 1.0,
        unit_amount = 20.0,
        account_code = "000",
        tracking = lineItemTrackings)
    
    line_items = []    
    line_items.append(line_item)

    invoice = Invoice(
        type = "ACCREC",
        contact = contact,
        date = date_value,
        due_date = due_date_value,
        line_items = line_items,
        reference = "Website Design",
        status = "DRAFT")

    invoices = Invoices( 
        invoices = [invoice])
    
    try:
        api_response = api_instance.create_invoices(xeroTenantId, invoices, summarizeErrors, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createInvoices: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoices = { "Invoices": [ { "Type": "ACCREC", "Contact": { "ContactID": "430fa14a-f945-44d3-9f97-5df5e28441b8" }, "LineItems": [ { "Description": "Acme Tires", "Quantity": 2, "UnitAmount": 20, "AccountCode": "200", "TaxType": "NONE", "LineAmount": 40 } ], "Date": "2019-03-11", "DueDate": "2018-12-10", "Reference": "Website Design", "Status": "AUTHORISED" } ] }; // Invoices
    let summarizeErrors = true; // Boolean
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.createInvoices(xeroTenantId, invoices, summarizeErrors, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
invoices *
Invoices
Invoices with an array of invoice objects in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

createItemHistory

Creates a history record for a specific item


/Items/{ItemID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Items/{ItemID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID itemID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createItemHistory(accessToken, xeroTenantId, itemID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createItemHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID itemID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Item
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createItemHistory(xeroTenantId, itemID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createItemHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *itemID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Item (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a history record for a specific item
[apiInstance createItemHistoryWith:xeroTenantId
    itemID:itemID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);
const historyRecords: HistoryRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] };  // {HistoryRecords} 
const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const itemID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for an Item


try {
  const response = await xero.accountingApi.createItemHistory(xeroTenantId, itemID, historyRecords);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createItemHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var itemID = new UUID(); // UUID | Unique identifier for an Item (default to null)
            var historyRecords = new HistoryRecords(); // HistoryRecords | 

            try
            {
                // Creates a history record for a specific item
                HistoryRecords result = apiInstance.createItemHistory(xeroTenantId, itemID, historyRecords);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createItemHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$itemID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createItemHistory($xeroTenantId, $itemID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createItemHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $itemID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Item
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createItemHistory(xeroTenantId => $xeroTenantId, itemID => $itemID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createItemHistory: $@\n";
}
# 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_item_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    itemID = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    history_records = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_item_history(xeroTenantId, itemID, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createItemHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let itemID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createItemHistory(xeroTenantId, itemID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Path parameters
Name Description
ItemID*
UUID (uuid)
Unique identifier for an Item
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createItems

Creates one or more items


/Items

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Items?summarizeErrors=true&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        Boolean summarizeErrors = true;
        Integer unitdp = 4;
        Purchase purchaseDetails = new Purchase();
        purchaseDetails.setCoGSAccountCode("500");
        Item item = new Item();
        item.setCode("abcXYZ123");
        item.setName("HelloWorld");
        item.setDescription("Foobar");
        item.setInventoryAssetAccountCode("140");
        item.setPurchaseDetails(purchaseDetails);
        Items items = new Items();
        items.addItemsItem(item);

        try {
            Items result = apiInstance.createItems(accessToken, xeroTenantId, items, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createItems");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Items items = { "Items": [ { "Code": "code123", "Name": "Item Name XYZ", "Description": "Foobar", "InventoryAssetAccountCode": "140", "PurchaseDetails": { "COGSAccountCode": "500" } } ] }; // Items | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Items result = apiInstance.createItems(xeroTenantId, items, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createItems");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Items *items = { "Items": [ { "Code": "code123", "Name": "Item Name XYZ", "Description": "Foobar", "InventoryAssetAccountCode": "140", "PurchaseDetails": { "COGSAccountCode": "500" } } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates one or more items
[apiInstance createItemsWith:xeroTenantId
    items:items
    summarizeErrors:summarizeErrors
    unitdp:unitdp
              completionHandler: ^(Items output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant


const summarizeErrors = true;  // {Boolean} If false return 200 OK and mix of successfully created objects and any with validation errors

const unitdp = 4;  // {Integer} e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
const items: Items = { items: [{ code: "abcXYZ123", name: "HelloWorld11", description: "Foobar", inventoryAssetAccountCode: "140", purchaseDetails: { cOGSAccountCode: "500" }}]}

try {
  const response = await xero.accountingApi.createItems(xeroTenantId, items,  summarizeErrors, unitdp);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createItemsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var items = new Items(); // Items | 
            var summarizeErrors = true;  // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors (optional)  (default to false)
            var unitdp = 4;  // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)  (default to null)

            try
            {
                // Creates one or more items
                Items result = apiInstance.createItems(xeroTenantId, items, summarizeErrors, unitdp);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createItems: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$unitdp = 4;

$purchaseDetails = new XeroAPI\XeroPHP\Models\Accounting\Purchase;
$purchaseDetails->setCoGSAccountCode('500');

$item = new XeroAPI\XeroPHP\Models\Accounting\Item;
$item->setCode('abcXYZ123');
$item->setName('HelloWorld');
$item->setDescription('Foobar');
$item->setInventoryAssetAccountCode('140');
$item->setPurchaseDetails($purchaseDetails);

$items = new XeroAPI\XeroPHP\Models\Accounting\Items;
$arr_items = [];
array_push($arr_items, $item);
$items->setItems($arr_items);

try {
  $result = $apiInstance->createItems($xeroTenantId, $items, $summarizeErrors, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createItems: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $items = ::Object::Items->new(); # Items | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->createItems(xeroTenantId => $xeroTenantId, items => $items, summarizeErrors => $summarizeErrors, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createItems: $@\n";
}
# 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_items():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    summarizeErrors = 'True'

    purchase_details = Purchase(
        cogs_account_code = "500")

    item = Item(
        code = "abcXYZ123",
        name = "HelloWorld",
        description = "Foobar",
        inventory_asset_account_code = "140",
        purchase_details = purchase_details)

    items = Items( 
        items = [item])
    
    try:
        api_response = api_instance.create_items(xeroTenantId, items, summarizeErrors, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createItems: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let items = { "Items": [ { "Code": "code123", "Name": "Item Name XYZ", "Description": "Foobar", "InventoryAssetAccountCode": "140", "PurchaseDetails": { "COGSAccountCode": "500" } } ] }; // Items
    let summarizeErrors = true; // Boolean
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.createItems(xeroTenantId, items, summarizeErrors, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
items *
Items
Items with an array of Item objects in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

createLinkedTransaction

Creates linked transactions (billable expenses)


/LinkedTransactions

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/LinkedTransactions"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        LinkedTransaction linkedTransaction = new LinkedTransaction();
        linkedTransaction.setSourceTransactionID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        linkedTransaction.setSourceLineItemID(UUID.fromString("00000000-0000-0000-0000-000000000000"));

        try {
            LinkedTransactions result = apiInstance.createLinkedTransaction(accessToken, xeroTenantId, linkedTransaction);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createLinkedTransaction");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        LinkedTransaction linkedTransaction = { "LinkedTransactions": [ { "SourceTransactionID": "a848644a-f20f-4630-98c3-386bd7505631", "SourceLineItemID": "b0df260d-3cc8-4ced-9bd6-41924f624ed3" } ] }; // LinkedTransaction | 
        try {
            LinkedTransactions result = apiInstance.createLinkedTransaction(xeroTenantId, linkedTransaction);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createLinkedTransaction");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
LinkedTransaction *linkedTransaction = { "LinkedTransactions": [ { "SourceTransactionID": "a848644a-f20f-4630-98c3-386bd7505631", "SourceLineItemID": "b0df260d-3cc8-4ced-9bd6-41924f624ed3" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates linked transactions (billable expenses)
[apiInstance createLinkedTransactionWith:xeroTenantId
    linkedTransaction:linkedTransaction
              completionHandler: ^(LinkedTransactions output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const linkedTransaction: LinkedTransaction = { sourceTransactionID: "00000000-0000-0000-0000-000000000000", sourceLineItemID: "00000000-0000-0000-0000-000000000000" }

try {
  const response = await xero.accountingApi.createLinkedTransaction(xeroTenantId, linkedTransaction);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createLinkedTransactionExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var linkedTransaction = new LinkedTransaction(); // LinkedTransaction | 

            try
            {
                // Creates linked transactions (billable expenses)
                LinkedTransactions result = apiInstance.createLinkedTransaction(xeroTenantId, linkedTransaction);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createLinkedTransaction: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

$linkedTransaction = new XeroAPI\XeroPHP\Models\Accounting\LinkedTransaction;
$linkedTransaction->setSourceTransactionID('00000000-0000-0000-0000-000000000000');
$linkedTransaction->setSourceLineItemID('00000000-0000-0000-0000-000000000000');

try {
  $result = $apiInstance->createLinkedTransaction($xeroTenantId, $linkedTransaction);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createLinkedTransaction: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $linkedTransaction = ::Object::LinkedTransaction->new(); # LinkedTransaction | 

eval { 
    my $result = $api_instance->createLinkedTransaction(xeroTenantId => $xeroTenantId, linkedTransaction => $linkedTransaction);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createLinkedTransaction: $@\n";
}
# 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_linked_transaction():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'

    linked_transaction = LinkedTransaction(
        source_transaction_id = "00000000-0000-0000-0000-000000000000",
        source_line_item_id = "00000000-0000-0000-0000-000000000000")
    
    try:
        api_response = api_instance.create_linked_transaction(xeroTenantId, linkedTransaction)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createLinkedTransaction: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let linkedTransaction = { "LinkedTransactions": [ { "SourceTransactionID": "a848644a-f20f-4630-98c3-386bd7505631", "SourceLineItemID": "b0df260d-3cc8-4ced-9bd6-41924f624ed3" } ] }; // LinkedTransaction

    let mut context = AccountingApi::Context::default();
    let result = client.createLinkedTransaction(xeroTenantId, linkedTransaction, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
linkedTransaction *
LinkedTransaction
LinkedTransaction object in body of request
Required

createManualJournalAttachmentByFileName

Creates a specific attachment for a specific manual journal by file name


/ManualJournals/{ManualJournalID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ManualJournals/{ManualJournalID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID manualJournalID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.createManualJournalAttachmentByFileName(accessToken, xeroTenantId, manualJournalID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createManualJournalAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a ManualJournal
        String fileName = xero-dev.jpg; // String | The name of the file being attached to a ManualJournal
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.createManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createManualJournalAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *manualJournalID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a ManualJournal (default to null)
String *fileName = xero-dev.jpg; // The name of the file being attached to a ManualJournal (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a specific attachment for a specific manual journal by file name
[apiInstance createManualJournalAttachmentByFileNameWith:xeroTenantId
    manualJournalID:manualJournalID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const manualJournalID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a ManualJournal
const fileName = "xero-dev.jpg";  // {String} The name of the file being attached to a ManualJournal
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
import * as fs from "fs";
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createManualJournalAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var manualJournalID = new UUID(); // UUID | Unique identifier for a ManualJournal (default to null)
            var fileName = xero-dev.jpg;  // String | The name of the file being attached to a ManualJournal (default to null)
            var body = BYTE_ARRAY_DATA_HERE;  // byte[] | 

            try
            {
                // Creates a specific attachment for a specific manual journal by file name
                Attachments result = apiInstance.createManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, fileName, body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createManualJournalAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$manualJournalID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->createManualJournalAttachmentByFileName($xeroTenantId, $manualJournalID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createManualJournalAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $manualJournalID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a ManualJournal
my $fileName = xero-dev.jpg; # String | The name of the file being attached to a ManualJournal
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->createManualJournalAttachmentByFileName(xeroTenantId => $xeroTenantId, manualJournalID => $manualJournalID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createManualJournalAttachmentByFileName: $@\n";
}
# 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_manual_journal_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    manualJournalID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    
        // TODO: BINARY CREATE 
    try:
        api_response = api_instance.create_manual_journal_attachment_by_file_name(xeroTenantId, manualJournalID, fileName, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createManualJournalAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.createManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
ManualJournalID*
UUID (uuid)
Unique identifier for a ManualJournal
Required
FileName*
String
The name of the file being attached to a ManualJournal
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

createManualJournalHistoryRecord

Creates a history record for a specific manual journal


/ManualJournals/{ManualJournalID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ManualJournals/{ManualJournalID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID manualJournalID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createManualJournalHistoryRecord(accessToken, xeroTenantId, manualJournalID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createManualJournalHistoryRecord");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a manual journal
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createManualJournalHistoryRecord(xeroTenantId, manualJournalID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createManualJournalHistoryRecord");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *manualJournalID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a manual journal (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a history record for a specific manual journal
[apiInstance createManualJournalHistoryRecordWith:xeroTenantId
    manualJournalID:manualJournalID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);
const historyRecords: HistoryRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] };  // {HistoryRecords} 
const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const manualJournalID = "00000000-0000-0000-0000-000000000000";  // {UUID} Xero generated unique identifier for a manual journal


try {
  const response = await xero.accountingApi.createManualJournalHistoryRecord(xeroTenantId, manualJournalID, historyRecords);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createManualJournalHistoryRecordExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var manualJournalID = new UUID(); // UUID | Xero generated unique identifier for a manual journal (default to null)
            var historyRecords = new HistoryRecords(); // HistoryRecords | 

            try
            {
                // Creates a history record for a specific manual journal
                HistoryRecords result = apiInstance.createManualJournalHistoryRecord(xeroTenantId, manualJournalID, historyRecords);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createManualJournalHistoryRecord: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$manualJournalID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createManualJournalHistoryRecord($xeroTenantId, $manualJournalID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createManualJournalHistoryRecord: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $manualJournalID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a manual journal
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createManualJournalHistoryRecord(xeroTenantId => $xeroTenantId, manualJournalID => $manualJournalID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createManualJournalHistoryRecord: $@\n";
}
# 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_manual_journal_history_record():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    manualJournalID = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    history_records = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_manual_journal_history_record(xeroTenantId, manualJournalID, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createManualJournalHistoryRecord: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createManualJournalHistoryRecord(xeroTenantId, manualJournalID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
ManualJournalID*
UUID (uuid)
Xero generated unique identifier for a manual journal
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createManualJournals

Creates one or more manual journals


/ManualJournals

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ManualJournals?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        Boolean summarizeErrors = true;
        LocalDate dateValue = LocalDate.of(2020, Month.OCTOBER, 10);
        List<ManualJournalLine> manualJournalLines = new ArrayList<ManualJournalLine>();
        ManualJournalLine credit = new ManualJournalLine();
        credit.setLineAmount(100.0);
        credit.setAccountCode("400");
        credit.setDescription("Hello there");
        manualJournalLines.add(credit);
        ManualJournalLine debit = new ManualJournalLine();
        debit.setLineAmount(-100.0);
        debit.setAccountCode("120");
        debit.setDescription("Hello there");
        manualJournalLines.add(debit);
        ManualJournal manualJournal = new ManualJournal();
        manualJournal.setNarration("Foobar");
        manualJournal.setDate(dateValue);
        manualJournal.setJournalLines(manualJournalLines);
        ManualJournals manualJournals = new ManualJournals();
        manualJournals.addManualJournalsItem(manualJournal);

        try {
            ManualJournals result = apiInstance.createManualJournals(accessToken, xeroTenantId, manualJournals, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createManualJournals");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        ManualJournals manualJournals = { "ManualJournals": [ { "Narration": "Journal Desc", "JournalLines": [ { "LineAmount": 100, "AccountCode": "400", "Description": "Money Movement" }, { "LineAmount": -100, "AccountCode": "400", "Description": "Prepayment of things", "Tracking": [ { "Name": "North", "Option": "Region" } ] } ], "Date": "2019-03-14" } ] }; // ManualJournals | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            ManualJournals result = apiInstance.createManualJournals(xeroTenantId, manualJournals, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createManualJournals");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
ManualJournals *manualJournals = { "ManualJournals": [ { "Narration": "Journal Desc", "JournalLines": [ { "LineAmount": 100, "AccountCode": "400", "Description": "Money Movement" }, { "LineAmount": -100, "AccountCode": "400", "Description": "Prepayment of things", "Tracking": [ { "Name": "North", "Option": "Region" } ] } ], "Date": "2019-03-14" } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates one or more manual journals
[apiInstance createManualJournalsWith:xeroTenantId
    manualJournals:manualJournals
    summarizeErrors:summarizeErrors
              completionHandler: ^(ManualJournals output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant


const summarizeErrors = true;  // {Boolean} If false return 200 OK and mix of successfully created objects and any with validation errors
const manualJournals: ManualJournals = { manualJournals: [{ narration: "Foo bar", date: "2019-03-14", journalLines: [{ lineAmount: 100.0, accountCode: "400", description: "Hello there" }, { lineAmount: -100.0, accountCode: "400", description: "Goodbye", tracking: [{ name: "Simpson", option: "Bart" }] }]}]}

try {
  const response = await xero.accountingApi.createManualJournals(xeroTenantId, manualJournals,  summarizeErrors);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createManualJournalsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var manualJournals = new ManualJournals(); // ManualJournals | 
            var summarizeErrors = true;  // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors (optional)  (default to false)

            try
            {
                // Creates one or more manual journals
                ManualJournals result = apiInstance.createManualJournals(xeroTenantId, manualJournals, summarizeErrors);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createManualJournals: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$dateValue = new DateTime('2019-10-10');
$manualJournalLines = [];

$credit = new XeroAPI\XeroPHP\Models\Accounting\ManualJournalLine;
$credit->setLineAmount(100.0);
$credit->setAccountCode('400');
$credit->setDescription('Hello there');
array_push($manualJournalLines, $credit);

$debit = new XeroAPI\XeroPHP\Models\Accounting\ManualJournalLine;
$debit->setLineAmount(-100.0);
$debit->setAccountCode('120');
$debit->setDescription('Hello there');
array_push($manualJournalLines, $debit);

$manualJournal = new XeroAPI\XeroPHP\Models\Accounting\ManualJournal;
$manualJournal->setNarration('Foobar');
$manualJournal->setDate($dateValue);
$manualJournal->setJournalLines($manualJournalLines);

$manualJournals = new XeroAPI\XeroPHP\Models\Accounting\ManualJournals;
$arr_manual_journals = [];
array_push($arr_manual_journals, $manualJournal);
$manualJournals->setManualJournals($arr_manual_journals);

try {
  $result = $apiInstance->createManualJournals($xeroTenantId, $manualJournals, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createManualJournals: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $manualJournals = ::Object::ManualJournals->new(); # ManualJournals | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->createManualJournals(xeroTenantId => $xeroTenantId, manualJournals => $manualJournals, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createManualJournals: $@\n";
}
# 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_manual_journals():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    summarizeErrors = 'True'
    date_value = dateutil.parser.parse('2020-12-03T00:00:00Z')
    
    manual_journal_lines = []

    credit = ManualJournalLine(
        line_amount = 100.0,
        account_code = "400",
        description = "Hello there")    
    manual_journal_lines.append(credit)

    debit = ManualJournalLine(
        line_amount = -100.0,
        account_code = "120",
        description = "Hello there")    
    manual_journal_lines.append(debit)

    manual_journal = ManualJournal(
        narration = "Foobar",
        date = date_value,
        journal_lines = manual_journal_lines)

    manualJournals = ManualJournals( 
        manual_journals = [manual_journal])
    
    try:
        api_response = api_instance.create_manual_journals(xeroTenantId, manualJournals, summarizeErrors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createManualJournals: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let manualJournals = { "ManualJournals": [ { "Narration": "Journal Desc", "JournalLines": [ { "LineAmount": 100, "AccountCode": "400", "Description": "Money Movement" }, { "LineAmount": -100, "AccountCode": "400", "Description": "Prepayment of things", "Tracking": [ { "Name": "North", "Option": "Region" } ] } ], "Date": "2019-03-14" } ] }; // ManualJournals
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.createManualJournals(xeroTenantId, manualJournals, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
manualJournals *
ManualJournals
ManualJournals array with ManualJournal object in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

createOverpaymentAllocations

Creates a single allocation for a specific overpayment


/Overpayments/{OverpaymentID}/Allocations

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Overpayments/{OverpaymentID}/Allocations?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID overpaymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Boolean summarizeErrors = true;
        LocalDate currDate = LocalDate.now();
        Invoice invoice = new Invoice();
        invoice.setInvoiceID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        Allocation allocation = new Allocation();
        allocation.setAmount(1.0);
        allocation.setDate(currDate);
        allocation.setInvoice(invoice);
        Allocations allocations = new Allocations();
        allocations.addAllocationsItem(allocation);

        try {
            Allocations result = apiInstance.createOverpaymentAllocations(accessToken, xeroTenantId, overpaymentID, allocations, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createOverpaymentAllocations");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID overpaymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Overpayment
        Allocations allocations = { "Allocations": [ { "Invoice": { "InvoiceID": "00000000-0000-0000-0000-000000000000", "LineItems": [], "Contact": {}, "Type": "ACCPAY" }, "Amount": 10.00, "Date": "2019-03-12" } ] }; // Allocations | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            Allocations result = apiInstance.createOverpaymentAllocations(xeroTenantId, overpaymentID, allocations, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createOverpaymentAllocations");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *overpaymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Overpayment (default to null)
Allocations *allocations = { "Allocations": [ { "Invoice": { "InvoiceID": "00000000-0000-0000-0000-000000000000", "LineItems": [], "Contact": {}, "Type": "ACCPAY" }, "Amount": 10.00, "Date": "2019-03-12" } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a single allocation for a specific overpayment
[apiInstance createOverpaymentAllocationsWith:xeroTenantId
    overpaymentID:overpaymentID
    allocations:allocations
    summarizeErrors:summarizeErrors
              completionHandler: ^(Allocations output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const overpaymentID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Overpayment


const summarizeErrors = true;  // {Boolean} If false return 200 OK and mix of successfully created objects and any with validation errors
const allocations: Allocations = { allocations: [{ invoice: { invoiceID: "00000000-0000-0000-0000-000000000000", lineItems: [], contact: {}, type: Invoice.TypeEnum.ACCPAY }, amount: 10.0, date: "2019-03-12" }]}

try {
  const response = await xero.accountingApi.createOverpaymentAllocations(xeroTenantId, overpaymentID, allocations,  summarizeErrors);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createOverpaymentAllocationsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var overpaymentID = new UUID(); // UUID | Unique identifier for a Overpayment (default to null)
            var allocations = new Allocations(); // Allocations | 
            var summarizeErrors = true;  // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors (optional)  (default to false)

            try
            {
                // Creates a single allocation for a specific overpayment
                Allocations result = apiInstance.createOverpaymentAllocations(xeroTenantId, overpaymentID, allocations, summarizeErrors);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createOverpaymentAllocations: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$overpaymentID = "00000000-0000-0000-0000-000000000000";
$summarizeErrors = true;
$currDate = new DateTime('2020-12-10');

$invoice = new XeroAPI\XeroPHP\Models\Accounting\Invoice;
$invoice->setInvoiceID('00000000-0000-0000-0000-000000000000');

$allocation = new XeroAPI\XeroPHP\Models\Accounting\Allocation;
$allocation->setAmount(1.0);
$allocation->setDate($currDate);
$allocation->setInvoice($invoice);

$allocations = new XeroAPI\XeroPHP\Models\Accounting\Allocations;
$arr_allocations = [];
array_push($arr_allocations, $allocation);
$allocations->setAllocations($arr_allocations);

try {
  $result = $apiInstance->createOverpaymentAllocations($xeroTenantId, $overpaymentID, $allocations, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createOverpaymentAllocations: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $overpaymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Overpayment
my $allocations = ::Object::Allocations->new(); # Allocations | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->createOverpaymentAllocations(xeroTenantId => $xeroTenantId, overpaymentID => $overpaymentID, allocations => $allocations, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createOverpaymentAllocations: $@\n";
}
# 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_overpayment_allocations():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    overpaymentID = '00000000-0000-0000-0000-000000000000'
    summarizeErrors = 'True'
    curr_date = dateutil.parser.parse('2020-12-03T00:00:00Z')

    invoice = Invoice(
        invoice_id = "00000000-0000-0000-0000-000000000000")

    allocation = Allocation(
        amount = 1.0,
        date = curr_date,
        invoice = invoice)

    allocations = Allocations( 
        allocations = [allocation])
    
    try:
        api_response = api_instance.create_overpayment_allocations(xeroTenantId, overpaymentID, allocations, summarizeErrors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createOverpaymentAllocations: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let overpaymentID = 00000000-0000-0000-0000-000000000000; // UUID
    let allocations = { "Allocations": [ { "Invoice": { "InvoiceID": "00000000-0000-0000-0000-000000000000", "LineItems": [], "Contact": {}, "Type": "ACCPAY" }, "Amount": 10.00, "Date": "2019-03-12" } ] }; // Allocations
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.createOverpaymentAllocations(xeroTenantId, overpaymentID, allocations, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
OverpaymentID*
UUID (uuid)
Unique identifier for a Overpayment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
allocations *
Allocations
Allocations array with Allocation object in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

createOverpaymentHistory

Creates a history record for a specific overpayment


/Overpayments/{OverpaymentID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Overpayments/{OverpaymentID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID overpaymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createOverpaymentHistory(accessToken, xeroTenantId, overpaymentID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createOverpaymentHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID overpaymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Overpayment
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createOverpaymentHistory(xeroTenantId, overpaymentID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createOverpaymentHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *overpaymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Overpayment (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a history record for a specific overpayment
[apiInstance createOverpaymentHistoryWith:xeroTenantId
    overpaymentID:overpaymentID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);
const historyRecords: HistoryRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] };  // {HistoryRecords} 
const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const overpaymentID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Overpayment


try {
  const response = await xero.accountingApi.createOverpaymentHistory(xeroTenantId, overpaymentID, historyRecords);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createOverpaymentHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var overpaymentID = new UUID(); // UUID | Unique identifier for a Overpayment (default to null)
            var historyRecords = new HistoryRecords(); // HistoryRecords | 

            try
            {
                // Creates a history record for a specific overpayment
                HistoryRecords result = apiInstance.createOverpaymentHistory(xeroTenantId, overpaymentID, historyRecords);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createOverpaymentHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$overpaymentID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createOverpaymentHistory($xeroTenantId, $overpaymentID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createOverpaymentHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $overpaymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Overpayment
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createOverpaymentHistory(xeroTenantId => $xeroTenantId, overpaymentID => $overpaymentID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createOverpaymentHistory: $@\n";
}
# 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_overpayment_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    overpaymentID = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    history_records = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_overpayment_history(xeroTenantId, overpaymentID, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createOverpaymentHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let overpaymentID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createOverpaymentHistory(xeroTenantId, overpaymentID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
OverpaymentID*
UUID (uuid)
Unique identifier for a Overpayment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createPayment

Creates a single payment for invoice or credit notes


/Payments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Payments"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        LocalDate dateValue = LocalDate.of(2020, Month.OCTOBER, 10);
        Invoice invoice = new Invoice();
        invoice.setInvoiceID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        Account account = new Account();
        account.setAccountID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        Payment payment = new Payment();
        payment.setInvoice(invoice);
        payment.setAccount(account);
        payment.setAmount(1.0);
        payment.setDate(dateValue);
        Payments payments = new Payments();
        payments.addPaymentsItem(payment);

        try {
            Payments result = apiInstance.createPayment(accessToken, xeroTenantId, payment);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createPayment");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Payment payment = { "Payments": [ { "Invoice": { "LineItems": [], "InvoiceID": "00000000-0000-0000-0000-000000000000" }, "Account": { "Code": "970" }, "Date": "2019-03-12", "Amount": 1 } ] }; // Payment | 
        try {
            Payments result = apiInstance.createPayment(xeroTenantId, payment);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createPayment");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Payment *payment = { "Payments": [ { "Invoice": { "LineItems": [], "InvoiceID": "00000000-0000-0000-0000-000000000000" }, "Account": { "Code": "970" }, "Date": "2019-03-12", "Amount": 1 } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a single payment for invoice or credit notes
[apiInstance createPaymentWith:xeroTenantId
    payment:payment
              completionHandler: ^(Payments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const payment: Payment = { invoice: { invoiceID: "00000000-0000-0000-0000-000000000000", lineItems: [], contact: {}, type: Invoice.TypeEnum.ACCPAY }, account: { code: "970" }, date: "2019-03-12", amount: 1.0 }

try {
  const response = await xero.accountingApi.createPayment(xeroTenantId, payment);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createPaymentExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var payment = new Payment(); // Payment | 

            try
            {
                // Creates a single payment for invoice or credit notes
                Payments result = apiInstance.createPayment(xeroTenantId, payment);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createPayment: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$dateValue = new DateTime('2020-10-10');

$invoice = new XeroAPI\XeroPHP\Models\Accounting\Invoice;
$invoice->setInvoiceID('00000000-0000-0000-0000-000000000000');

$account = new XeroAPI\XeroPHP\Models\Accounting\Account;
$account->setAccountID('00000000-0000-0000-0000-000000000000');

$payment = new XeroAPI\XeroPHP\Models\Accounting\Payment;
$payment->setInvoice($invoice);
$payment->setAccount($account);
$payment->setAmount(1.0);
$payment->setDate($dateValue);

$payments = new XeroAPI\XeroPHP\Models\Accounting\Payments;
$arr_payments = [];
array_push($arr_payments, $payment);
$payments->setPayments($arr_payments);

try {
  $result = $apiInstance->createPayment($xeroTenantId, $payment);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createPayment: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $payment = ::Object::Payment->new(); # Payment | 

eval { 
    my $result = $api_instance->createPayment(xeroTenantId => $xeroTenantId, payment => $payment);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createPayment: $@\n";
}
# 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_payment():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    date_value = dateutil.parser.parse('2020-10-10T00:00:00Z')

    invoice = Invoice(
        invoice_id = "00000000-0000-0000-0000-000000000000")

    account = Account(
        account_id = "00000000-0000-0000-0000-000000000000")

    payment = Payment(
        invoice = invoice,
        account = account,
        amount = 1.0,
        date = date_value)

    payments = Payments( 
        payments = [payment])
    
    try:
        api_response = api_instance.create_payment(xeroTenantId, payment)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPayment: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let payment = { "Payments": [ { "Invoice": { "LineItems": [], "InvoiceID": "00000000-0000-0000-0000-000000000000" }, "Account": { "Code": "970" }, "Date": "2019-03-12", "Amount": 1 } ] }; // Payment

    let mut context = AccountingApi::Context::default();
    let result = client.createPayment(xeroTenantId, payment, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
payment *
Payment
Request body with a single Payment object
Required

createPaymentHistory

Creates a history record for a specific payment


/Payments/{PaymentID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Payments/{PaymentID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID paymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createPaymentHistory(accessToken, xeroTenantId, paymentID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createPaymentHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID paymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Payment
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createPaymentHistory(xeroTenantId, paymentID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createPaymentHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *paymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Payment (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a history record for a specific payment
[apiInstance createPaymentHistoryWith:xeroTenantId
    paymentID:paymentID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);
const historyRecords: HistoryRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] };  // {HistoryRecords} 
const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const paymentID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Payment


try {
  const response = await xero.accountingApi.createPaymentHistory(xeroTenantId, paymentID, historyRecords);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createPaymentHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var paymentID = new UUID(); // UUID | Unique identifier for a Payment (default to null)
            var historyRecords = new HistoryRecords(); // HistoryRecords | 

            try
            {
                // Creates a history record for a specific payment
                HistoryRecords result = apiInstance.createPaymentHistory(xeroTenantId, paymentID, historyRecords);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createPaymentHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$paymentID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createPaymentHistory($xeroTenantId, $paymentID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createPaymentHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $paymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Payment
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createPaymentHistory(xeroTenantId => $xeroTenantId, paymentID => $paymentID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createPaymentHistory: $@\n";
}
# 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_payment_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    paymentID = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    history_records = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_payment_history(xeroTenantId, paymentID, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPaymentHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let paymentID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createPaymentHistory(xeroTenantId, paymentID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
PaymentID*
UUID (uuid)
Unique identifier for a Payment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createPaymentService

Creates a payment service


/PaymentServices

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PaymentServices"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        PaymentService paymentService = new PaymentService();
        paymentService.setPaymentServiceName("ACME Payments");
        paymentService.setPaymentServiceUrl("https://www.payupnow.com/");
        paymentService.setPayNowText("Pay Now");
        PaymentServices paymentServices = new PaymentServices();
        paymentServices.addPaymentServicesItem(paymentService);

        try {
            PaymentServices result = apiInstance.createPaymentService(accessToken, xeroTenantId, paymentServices);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createPaymentService");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        PaymentServices paymentServices = { "PaymentServices": [ { "PaymentServiceName": "PayUpNow", "PaymentServiceUrl": "https://www.payupnow.com/", "PayNowText": "Time To Pay" } ] }; // PaymentServices | 
        try {
            PaymentServices result = apiInstance.createPaymentService(xeroTenantId, paymentServices);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createPaymentService");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
PaymentServices *paymentServices = { "PaymentServices": [ { "PaymentServiceName": "PayUpNow", "PaymentServiceUrl": "https://www.payupnow.com/", "PayNowText": "Time To Pay" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a payment service
[apiInstance createPaymentServiceWith:xeroTenantId
    paymentServices:paymentServices
              completionHandler: ^(PaymentServices output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const paymentServices: PaymentServices = { paymentServices: [{ paymentServiceName: "PayUpNow", paymentServiceUrl: "https://www.payupnow.com/", payNowText: "Time To Pay" }]}

try {
  const response = await xero.accountingApi.createPaymentService(xeroTenantId, paymentServices);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createPaymentServiceExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var paymentServices = new PaymentServices(); // PaymentServices | 

            try
            {
                // Creates a payment service
                PaymentServices result = apiInstance.createPaymentService(xeroTenantId, paymentServices);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createPaymentService: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

$paymentService = new XeroAPI\XeroPHP\Models\Accounting\PaymentService;
$paymentService->setPaymentServiceName('ACME Payments');
$paymentService->setPaymentServiceUrl('https://www.payupnow.com/');
$paymentService->setPayNowText('Pay Now');

$paymentServices = new XeroAPI\XeroPHP\Models\Accounting\PaymentServices;
$arr_paymentServices = [];
array_push($arr_paymentServices, $paymentService);
$paymentServices->setPaymentServices($arr_paymentServices);

try {
  $result = $apiInstance->createPaymentService($xeroTenantId, $paymentServices);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createPaymentService: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $paymentServices = ::Object::PaymentServices->new(); # PaymentServices | 

eval { 
    my $result = $api_instance->createPaymentService(xeroTenantId => $xeroTenantId, paymentServices => $paymentServices);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createPaymentService: $@\n";
}
# 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_payment_service():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'

    payment_service = PaymentService(
        payment_service_name = "ACME Payments",
        payment_service_url = "https://www.payupnow.com/",
        pay_now_text = "Pay Now")

    paymentServices = PaymentServices( 
        paymentServices = [paymentService])
    
    try:
        api_response = api_instance.create_payment_service(xeroTenantId, paymentServices)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPaymentService: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let paymentServices = { "PaymentServices": [ { "PaymentServiceName": "PayUpNow", "PaymentServiceUrl": "https://www.payupnow.com/", "PayNowText": "Time To Pay" } ] }; // PaymentServices

    let mut context = AccountingApi::Context::default();
    let result = client.createPaymentService(xeroTenantId, paymentServices, &context).wait();
    println!("{:?}", result);

}

Scopes

paymentservices Grant read-write access to payment services

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
paymentServices *
PaymentServices
PaymentServices array with PaymentService object in body of request
Required

createPayments

Creates multiple payments for invoices or credit notes


/Payments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Payments?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        Boolean summarizeErrors = true;
        LocalDate dateValue = LocalDate.of(2020, Month.OCTOBER, 10);
        Invoice invoice = new Invoice();
        invoice.setInvoiceID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        Account account = new Account();
        account.setAccountID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        Payment payment = new Payment();
        payment.setInvoice(invoice);
        payment.setAccount(account);
        payment.setAmount(1.0);
        payment.setDate(dateValue);
        Payments payments = new Payments();
        payments.addPaymentsItem(payment);

        try {
            Payments result = apiInstance.createPayments(accessToken, xeroTenantId, payments, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createPayments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Payments payments = { "Payments": [ { "Invoice": { "LineItems": [], "InvoiceID": "00000000-0000-0000-0000-000000000000" }, "Account": { "Code": "970" }, "Date": "2019-03-12", "Amount": 1 } ] }; // Payments | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            Payments result = apiInstance.createPayments(xeroTenantId, payments, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createPayments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Payments *payments = { "Payments": [ { "Invoice": { "LineItems": [], "InvoiceID": "00000000-0000-0000-0000-000000000000" }, "Account": { "Code": "970" }, "Date": "2019-03-12", "Amount": 1 } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates multiple payments for invoices or credit notes
[apiInstance createPaymentsWith:xeroTenantId
    payments:payments
    summarizeErrors:summarizeErrors
              completionHandler: ^(Payments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant


const summarizeErrors = true;  // {Boolean} If false return 200 OK and mix of successfully created objects and any with validation errors
const payments: Payments = { payments: [{ invoice: { invoiceID: "00000000-0000-0000-0000-000000000000", lineItems: [], contact: {}, type: Invoice.TypeEnum.ACCPAY }, account: { code: "970" }, date: "2019-03-12", amount: 1.0 }]}

try {
  const response = await xero.accountingApi.createPayments(xeroTenantId, payments,  summarizeErrors);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createPaymentsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var payments = new Payments(); // Payments | 
            var summarizeErrors = true;  // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors (optional)  (default to false)

            try
            {
                // Creates multiple payments for invoices or credit notes
                Payments result = apiInstance.createPayments(xeroTenantId, payments, summarizeErrors);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createPayments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$dateValue = new DateTime('2020-10-10');

$invoice = new XeroAPI\XeroPHP\Models\Accounting\Invoice;
$invoice->setInvoiceID('00000000-0000-0000-0000-000000000000');

$account = new XeroAPI\XeroPHP\Models\Accounting\Account;
$account->setAccountID('00000000-0000-0000-0000-000000000000');

$payment = new XeroAPI\XeroPHP\Models\Accounting\Payment;
$payment->setInvoice($invoice);
$payment->setAccount($account);
$payment->setAmount(1.0);
$payment->setDate($dateValue);

$payments = new XeroAPI\XeroPHP\Models\Accounting\Payments;
$arr_payments = [];
array_push($arr_payments, $payment);
$payments->setPayments($arr_payments);

try {
  $result = $apiInstance->createPayments($xeroTenantId, $payments, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createPayments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $payments = ::Object::Payments->new(); # Payments | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->createPayments(xeroTenantId => $xeroTenantId, payments => $payments, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createPayments: $@\n";
}
# 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_payments():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    summarizeErrors = 'True'
    date_value = dateutil.parser.parse('2020-10-10T00:00:00Z')

    invoice = Invoice(
        invoice_id = "00000000-0000-0000-0000-000000000000")

    account = Account(
        account_id = "00000000-0000-0000-0000-000000000000")

    payment = Payment(
        invoice = invoice,
        account = account,
        amount = 1.0,
        date = date_value)

    payments = Payments( 
        payments = [payment])
    
    try:
        api_response = api_instance.create_payments(xeroTenantId, payments, summarizeErrors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPayments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let payments = { "Payments": [ { "Invoice": { "LineItems": [], "InvoiceID": "00000000-0000-0000-0000-000000000000" }, "Account": { "Code": "970" }, "Date": "2019-03-12", "Amount": 1 } ] }; // Payments
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.createPayments(xeroTenantId, payments, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
payments *
Payments
Payments array with Payment object in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

createPrepaymentAllocations

Allows you to create an Allocation for prepayments


/Prepayments/{PrepaymentID}/Allocations

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Prepayments/{PrepaymentID}/Allocations?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID prepaymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Boolean summarizeErrors = true;
        LocalDate currDate = LocalDate.now();
        Invoice invoice = new Invoice();
        invoice.setInvoiceID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        Allocation allocation = new Allocation();
        allocation.setInvoice(invoice);
        allocation.setAmount(1.0);
        allocation.setDate(currDate);
        Allocations allocations = new Allocations();
        allocations.addAllocationsItem(allocation);

        try {
            Allocations result = apiInstance.createPrepaymentAllocations(accessToken, xeroTenantId, prepaymentID, allocations, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createPrepaymentAllocations");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID prepaymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Prepayment
        Allocations allocations = { "Allocations": [ { "Invoice": { "LineItems": [], "InvoiceID": "00000000-0000-0000-0000-000000000000" }, "Amount": 1, "Date": "2019-01-10" } ] }; // Allocations | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            Allocations result = apiInstance.createPrepaymentAllocations(xeroTenantId, prepaymentID, allocations, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createPrepaymentAllocations");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *prepaymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Prepayment (default to null)
Allocations *allocations = { "Allocations": [ { "Invoice": { "LineItems": [], "InvoiceID": "00000000-0000-0000-0000-000000000000" }, "Amount": 1, "Date": "2019-01-10" } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Allows you to create an Allocation for prepayments
[apiInstance createPrepaymentAllocationsWith:xeroTenantId
    prepaymentID:prepaymentID
    allocations:allocations
    summarizeErrors:summarizeErrors
              completionHandler: ^(Allocations output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const prepaymentID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for Prepayment


const summarizeErrors = true;  // {Boolean} If false return 200 OK and mix of successfully created objects and any with validation errors
const allocations: Allocations = { allocations: [{ invoice: { invoiceID: "00000000-0000-0000-0000-000000000000", lineItems: [], contact: {}, type: null }, amount: 1.0, date: "2019-03-13" }]}

try {
  const response = await xero.accountingApi.createPrepaymentAllocations(xeroTenantId, prepaymentID, allocations,  summarizeErrors);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createPrepaymentAllocationsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var prepaymentID = new UUID(); // UUID | Unique identifier for Prepayment (default to null)
            var allocations = new Allocations(); // Allocations | 
            var summarizeErrors = true;  // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors (optional)  (default to false)

            try
            {
                // Allows you to create an Allocation for prepayments
                Allocations result = apiInstance.createPrepaymentAllocations(xeroTenantId, prepaymentID, allocations, summarizeErrors);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createPrepaymentAllocations: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$prepaymentID = "00000000-0000-0000-0000-000000000000";
$summarizeErrors = true;
$currDate = new DateTime('2020-12-10');

$invoice = new XeroAPI\XeroPHP\Models\Accounting\Invoice;
$invoice->setInvoiceID('00000000-0000-0000-0000-000000000000');

$allocation = new XeroAPI\XeroPHP\Models\Accounting\Allocation;
$allocation->setInvoice($invoice);
$allocation->setAmount(1.0);
$allocation->setDate($currDate);

$allocations = new XeroAPI\XeroPHP\Models\Accounting\Allocations;
$arr_allocations = [];
array_push($arr_allocations, $allocation);
$allocations->setAllocations($arr_allocations);

try {
  $result = $apiInstance->createPrepaymentAllocations($xeroTenantId, $prepaymentID, $allocations, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createPrepaymentAllocations: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $prepaymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Prepayment
my $allocations = ::Object::Allocations->new(); # Allocations | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->createPrepaymentAllocations(xeroTenantId => $xeroTenantId, prepaymentID => $prepaymentID, allocations => $allocations, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createPrepaymentAllocations: $@\n";
}
# 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_prepayment_allocations():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    prepaymentID = '00000000-0000-0000-0000-000000000000'
    summarizeErrors = 'True'
    curr_date = dateutil.parser.parse('2020-12-03T00:00:00Z')

    invoice = Invoice(
        invoice_id = "00000000-0000-0000-0000-000000000000")

    allocation = Allocation(
        invoice = invoice,
        amount = 1.0,
        date = curr_date)

    allocations = Allocations( 
        allocations = [allocation])
    
    try:
        api_response = api_instance.create_prepayment_allocations(xeroTenantId, prepaymentID, allocations, summarizeErrors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPrepaymentAllocations: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let prepaymentID = 00000000-0000-0000-0000-000000000000; // UUID
    let allocations = { "Allocations": [ { "Invoice": { "LineItems": [], "InvoiceID": "00000000-0000-0000-0000-000000000000" }, "Amount": 1, "Date": "2019-01-10" } ] }; // Allocations
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.createPrepaymentAllocations(xeroTenantId, prepaymentID, allocations, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
PrepaymentID*
UUID (uuid)
Unique identifier for Prepayment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
allocations *
Allocations
Allocations with an array of Allocation object in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

createPrepaymentHistory

Creates a history record for a specific prepayment


/Prepayments/{PrepaymentID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Prepayments/{PrepaymentID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID prepaymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createPrepaymentHistory(accessToken, xeroTenantId, prepaymentID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createPrepaymentHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID prepaymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a PrePayment
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createPrepaymentHistory(xeroTenantId, prepaymentID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createPrepaymentHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *prepaymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a PrePayment (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a history record for a specific prepayment
[apiInstance createPrepaymentHistoryWith:xeroTenantId
    prepaymentID:prepaymentID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);
const historyRecords: HistoryRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] };  // {HistoryRecords} 
const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const prepaymentID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a PrePayment


try {
  const response = await xero.accountingApi.createPrepaymentHistory(xeroTenantId, prepaymentID, historyRecords);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createPrepaymentHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var prepaymentID = new UUID(); // UUID | Unique identifier for a PrePayment (default to null)
            var historyRecords = new HistoryRecords(); // HistoryRecords | 

            try
            {
                // Creates a history record for a specific prepayment
                HistoryRecords result = apiInstance.createPrepaymentHistory(xeroTenantId, prepaymentID, historyRecords);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createPrepaymentHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$prepaymentID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createPrepaymentHistory($xeroTenantId, $prepaymentID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createPrepaymentHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $prepaymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a PrePayment
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createPrepaymentHistory(xeroTenantId => $xeroTenantId, prepaymentID => $prepaymentID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createPrepaymentHistory: $@\n";
}
# 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_prepayment_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    prepaymentID = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    history_records = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_prepayment_history(xeroTenantId, prepaymentID, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPrepaymentHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let prepaymentID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createPrepaymentHistory(xeroTenantId, prepaymentID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
PrepaymentID*
UUID (uuid)
Unique identifier for a PrePayment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createPurchaseOrderAttachmentByFileName

Creates attachment for a specific purchase order


/PurchaseOrders/{PurchaseOrderID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders/{PurchaseOrderID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID purchaseOrderID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.png";
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.createPurchaseOrderAttachmentByFileName(accessToken, xeroTenantId, purchaseOrderID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createPurchaseOrderAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Purchase Order object
        String fileName = xero-dev.png; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.createPurchaseOrderAttachmentByFileName(xeroTenantId, purchaseOrderID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createPurchaseOrderAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *purchaseOrderID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Purchase Order object (default to null)
String *fileName = xero-dev.png; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates attachment for a specific purchase order
[apiInstance createPurchaseOrderAttachmentByFileNameWith:xeroTenantId
    purchaseOrderID:purchaseOrderID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const purchaseOrderID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for Purchase Order object
const fileName = "xero-dev.png";  // {String} Name of the attachment
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
import * as fs from "fs";
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createPurchaseOrderAttachmentByFileName(xeroTenantId, purchaseOrderID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createPurchaseOrderAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var purchaseOrderID = new UUID(); // UUID | Unique identifier for Purchase Order object (default to null)
            var fileName = xero-dev.png;  // String | Name of the attachment (default to null)
            var body = BYTE_ARRAY_DATA_HERE;  // byte[] | 

            try
            {
                // Creates attachment for a specific purchase order
                Attachments result = apiInstance.createPurchaseOrderAttachmentByFileName(xeroTenantId, purchaseOrderID, fileName, body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createPurchaseOrderAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$purchaseOrderID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.png";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->createPurchaseOrderAttachmentByFileName($xeroTenantId, $purchaseOrderID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createPurchaseOrderAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $purchaseOrderID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Purchase Order object
my $fileName = xero-dev.png; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->createPurchaseOrderAttachmentByFileName(xeroTenantId => $xeroTenantId, purchaseOrderID => $purchaseOrderID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createPurchaseOrderAttachmentByFileName: $@\n";
}
# 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_purchase_order_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    purchaseOrderID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.png'
    
        // TODO: BINARY CREATE 
    try:
        api_response = api_instance.create_purchase_order_attachment_by_file_name(xeroTenantId, purchaseOrderID, fileName, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPurchaseOrderAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.png; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.createPurchaseOrderAttachmentByFileName(xeroTenantId, purchaseOrderID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
PurchaseOrderID*
UUID (uuid)
Unique identifier for Purchase Order object
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

createPurchaseOrderHistory

Creates a history record for a specific purchase orders


/PurchaseOrders/{PurchaseOrderID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders/{PurchaseOrderID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID purchaseOrderID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createPurchaseOrderHistory(accessToken, xeroTenantId, purchaseOrderID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createPurchaseOrderHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a PurchaseOrder
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createPurchaseOrderHistory(xeroTenantId, purchaseOrderID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createPurchaseOrderHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *purchaseOrderID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a PurchaseOrder (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a history record for a specific purchase orders
[apiInstance createPurchaseOrderHistoryWith:xeroTenantId
    purchaseOrderID:purchaseOrderID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);
const historyRecords: HistoryRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] };  // {HistoryRecords} 
const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const purchaseOrderID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a PurchaseOrder


try {
  const response = await xero.accountingApi.createPurchaseOrderHistory(xeroTenantId, purchaseOrderID, historyRecords);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createPurchaseOrderHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var purchaseOrderID = new UUID(); // UUID | Unique identifier for a PurchaseOrder (default to null)
            var historyRecords = new HistoryRecords(); // HistoryRecords | 

            try
            {
                // Creates a history record for a specific purchase orders
                HistoryRecords result = apiInstance.createPurchaseOrderHistory(xeroTenantId, purchaseOrderID, historyRecords);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createPurchaseOrderHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$purchaseOrderID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createPurchaseOrderHistory($xeroTenantId, $purchaseOrderID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createPurchaseOrderHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $purchaseOrderID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a PurchaseOrder
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createPurchaseOrderHistory(xeroTenantId => $xeroTenantId, purchaseOrderID => $purchaseOrderID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createPurchaseOrderHistory: $@\n";
}
# 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_purchase_order_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    purchaseOrderID = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    history_records = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_purchase_order_history(xeroTenantId, purchaseOrderID, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPurchaseOrderHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createPurchaseOrderHistory(xeroTenantId, purchaseOrderID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
PurchaseOrderID*
UUID (uuid)
Unique identifier for a PurchaseOrder
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createPurchaseOrders

Creates one or more purchase orders


/PurchaseOrders

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        Boolean summarizeErrors = true;
        LocalDate dateValue = LocalDate.of(2020, Month.OCTOBER, 10);
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        LineItem lineItem = new LineItem();
        lineItem.setDescription("Foobar");
        lineItem.setQuantity(1.0);
        lineItem.setUnitAmount(20.0);
        lineItem.setAccountCode("000");
        List<LineItems> lineItems = new ArrayList<LineItems>();
        lineItems.add(lineItem);
        PurchaseOrder purchaseOrder = new PurchaseOrder();
        purchaseOrder.setContact(contact);
        purchaseOrder.setLineItems(lineItems);
        purchaseOrder.setDate(dateValue);
        PurchaseOrders purchaseOrders = new PurchaseOrders();
        purchaseOrders.addPurchaseOrdersItem(purchaseOrder);

        try {
            PurchaseOrders result = apiInstance.createPurchaseOrders(accessToken, xeroTenantId, purchaseOrders, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createPurchaseOrders");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        PurchaseOrders purchaseOrders = { "PurchaseOrders": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "LineItems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "710" } ], "Date": "2019-03-13" } ] }; // PurchaseOrders | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            PurchaseOrders result = apiInstance.createPurchaseOrders(xeroTenantId, purchaseOrders, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createPurchaseOrders");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
PurchaseOrders *purchaseOrders = { "PurchaseOrders": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "LineItems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "710" } ], "Date": "2019-03-13" } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates one or more purchase orders
[apiInstance createPurchaseOrdersWith:xeroTenantId
    purchaseOrders:purchaseOrders
    summarizeErrors:summarizeErrors
              completionHandler: ^(PurchaseOrders output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant


const summarizeErrors = true;  // {Boolean} If false return 200 OK and mix of successfully created objects and any with validation errors
const purchaseOrders: PurchaseOrders = { purchaseOrders: [{ contact: { contactID: "00000000-0000-0000-0000-000000000000" }, lineItems: [{ description: "Foobar", quantity: 1.0, unitAmount: 20.0, accountCode: "710" }], date: "2019-03-13" }]}

try {
  const response = await xero.accountingApi.createPurchaseOrders(xeroTenantId, purchaseOrders,  summarizeErrors);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createPurchaseOrdersExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var purchaseOrders = new PurchaseOrders(); // PurchaseOrders | 
            var summarizeErrors = true;  // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors (optional)  (default to false)

            try
            {
                // Creates one or more purchase orders
                PurchaseOrders result = apiInstance.createPurchaseOrders(xeroTenantId, purchaseOrders, summarizeErrors);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createPurchaseOrders: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$dateValue = new DateTime('2020-12-10');

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
$lineItem->setDescription('Foobar');
$lineItem->setQuantity(1.0);
$lineItem->setUnitAmount(20.0);
$lineItem->setAccountCode('000');
$lineItems = [];
array_push($lineItems, $lineItem);

$purchaseOrder = new XeroAPI\XeroPHP\Models\Accounting\PurchaseOrder;
$purchaseOrder->setContact($contact);
$purchaseOrder->setLineItems($lineItems);
$purchaseOrder->setDate($dateValue);

$purchaseOrders = new XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders;
$arr_purchase_orders = [];
array_push($arr_purchase_orders, $purchaseOrder);
$purchaseOrders->setPurchaseOrders($arr_purchase_orders);

try {
  $result = $apiInstance->createPurchaseOrders($xeroTenantId, $purchaseOrders, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createPurchaseOrders: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $purchaseOrders = ::Object::PurchaseOrders->new(); # PurchaseOrders | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->createPurchaseOrders(xeroTenantId => $xeroTenantId, purchaseOrders => $purchaseOrders, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createPurchaseOrders: $@\n";
}
# 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_purchase_orders():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    summarizeErrors = 'True'
    date_value = dateutil.parser.parse('2020-12-03T00:00:00Z')

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    line_item = LineItem(
        description = "Foobar",
        quantity = 1.0,
        unit_amount = 20.0,
        account_code = "000")
    
    line_items = []    
    line_items.append(line_item)

    purchase_order = PurchaseOrder(
        contact = contact,
        line_items = line_items,
        date = date_value)

    purchaseOrders = PurchaseOrders( 
        purchase_orders = [purchase_order])
    
    try:
        api_response = api_instance.create_purchase_orders(xeroTenantId, purchaseOrders, summarizeErrors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPurchaseOrders: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let purchaseOrders = { "PurchaseOrders": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "LineItems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "710" } ], "Date": "2019-03-13" } ] }; // PurchaseOrders
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.createPurchaseOrders(xeroTenantId, purchaseOrders, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
purchaseOrders *
PurchaseOrders
PurchaseOrders with an array of PurchaseOrder object in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

createQuoteAttachmentByFileName

Creates attachment for a specific quote


/Quotes/{QuoteID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Quotes/{QuoteID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID quoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.createQuoteAttachmentByFileName(accessToken, xeroTenantId, quoteID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createQuoteAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID quoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Quote object
        String fileName = xero-dev.jpg; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.createQuoteAttachmentByFileName(xeroTenantId, quoteID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createQuoteAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *quoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Quote object (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates attachment for a specific quote
[apiInstance createQuoteAttachmentByFileNameWith:xeroTenantId
    quoteID:quoteID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const quoteID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for Quote object
const fileName = "xero-dev.jpg";  // {String} Name of the attachment
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
import * as fs from "fs";
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createQuoteAttachmentByFileName(xeroTenantId, quoteID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createQuoteAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var quoteID = new UUID(); // UUID | Unique identifier for Quote object (default to null)
            var fileName = xero-dev.jpg;  // String | Name of the attachment (default to null)
            var body = BYTE_ARRAY_DATA_HERE;  // byte[] | 

            try
            {
                // Creates attachment for a specific quote
                Attachments result = apiInstance.createQuoteAttachmentByFileName(xeroTenantId, quoteID, fileName, body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createQuoteAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$quoteID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->createQuoteAttachmentByFileName($xeroTenantId, $quoteID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createQuoteAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $quoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Quote object
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->createQuoteAttachmentByFileName(xeroTenantId => $xeroTenantId, quoteID => $quoteID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createQuoteAttachmentByFileName: $@\n";
}
# 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_quote_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    quoteID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    
        // TODO: BINARY CREATE 
    try:
        api_response = api_instance.create_quote_attachment_by_file_name(xeroTenantId, quoteID, fileName, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createQuoteAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let quoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.createQuoteAttachmentByFileName(xeroTenantId, quoteID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
QuoteID*
UUID (uuid)
Unique identifier for Quote object
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

createQuoteHistory

Creates a history record for a specific quote


/Quotes/{QuoteID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Quotes/{QuoteID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID quoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createQuoteHistory(accessToken, xeroTenantId, quoteID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createQuoteHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID quoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Quote
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createQuoteHistory(xeroTenantId, quoteID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createQuoteHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *quoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Quote (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a history record for a specific quote
[apiInstance createQuoteHistoryWith:xeroTenantId
    quoteID:quoteID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);
const historyRecords: HistoryRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] };  // {HistoryRecords} 
const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const quoteID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for an Quote


try {
  const response = await xero.accountingApi.createQuoteHistory(xeroTenantId, quoteID, historyRecords);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createQuoteHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var quoteID = new UUID(); // UUID | Unique identifier for an Quote (default to null)
            var historyRecords = new HistoryRecords(); // HistoryRecords | 

            try
            {
                // Creates a history record for a specific quote
                HistoryRecords result = apiInstance.createQuoteHistory(xeroTenantId, quoteID, historyRecords);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createQuoteHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$quoteID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createQuoteHistory($xeroTenantId, $quoteID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createQuoteHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $quoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Quote
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createQuoteHistory(xeroTenantId => $xeroTenantId, quoteID => $quoteID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createQuoteHistory: $@\n";
}
# 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_quote_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    quoteID = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    history_records = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_quote_history(xeroTenantId, quoteID, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createQuoteHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let quoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createQuoteHistory(xeroTenantId, quoteID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
QuoteID*
UUID (uuid)
Unique identifier for an Quote
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createQuotes

Create one or more quotes


/Quotes

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Quotes?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        Boolean summarizeErrors = true;
        LocalDate dateValue = LocalDate.of(2020, Month.OCTOBER, 10);
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        LineItem lineItem = new LineItem();
        lineItem.setDescription("Foobar");
        lineItem.setQuantity(1.0);
        lineItem.setUnitAmount(20.0);
        lineItem.setAccountCode("000");
        List<LineItems> lineItems = new ArrayList<LineItems>();
        lineItems.add(lineItem);
        Quote quote = new Quote();
        quote.setContact(contact);
        quote.setLineItems(lineItems);
        quote.setDate(dateValue);
        Quotes quotes = new Quotes();
        quotes.addQuotesItem(quote);

        try {
            Quotes result = apiInstance.createQuotes(accessToken, xeroTenantId, quotes, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createQuotes");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Quotes quotes = { "Quotes": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "LineItems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "12775" } ], "Date": "2020-02-01" } ] }; // Quotes | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            Quotes result = apiInstance.createQuotes(xeroTenantId, quotes, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createQuotes");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Quotes *quotes = { "Quotes": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "LineItems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "12775" } ], "Date": "2020-02-01" } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Create one or more quotes
[apiInstance createQuotesWith:xeroTenantId
    quotes:quotes
    summarizeErrors:summarizeErrors
              completionHandler: ^(Quotes output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant


const summarizeErrors = true;  // {Boolean} If false return 200 OK and mix of successfully created objects and any with validation errors
const quotes: Quotes = { quotes: [{ contact: { contactID: "00000000-0000-0000-0000-000000000000" }, lineItems: [{ description: "Foobar", quantity: 1.0, unitAmount: 20.0, accountCode: "12775" }], date: "2020-02-01" }]}

try {
  const response = await xero.accountingApi.createQuotes(xeroTenantId, quotes,  summarizeErrors);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createQuotesExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var quotes = new Quotes(); // Quotes | 
            var summarizeErrors = true;  // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors (optional)  (default to false)

            try
            {
                // Create one or more quotes
                Quotes result = apiInstance.createQuotes(xeroTenantId, quotes, summarizeErrors);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createQuotes: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$dateValue = new DateTime('2020-12-10');

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
$lineItem->setDescription('Foobar');
$lineItem->setQuantity(1.0);
$lineItem->setUnitAmount(20.0);
$lineItem->setAccountCode('000');
$lineItems = [];
array_push($lineItems, $lineItem);

$quote = new XeroAPI\XeroPHP\Models\Accounting\Quote;
$quote->setContact($contact);
$quote->setLineItems($lineItems);
$quote->setDate($dateValue);

$quotes = new XeroAPI\XeroPHP\Models\Accounting\Quotes;
$arr_quotes = [];
array_push($arr_quotes, $quote);
$quotes->setQuotes($arr_quotes);

try {
  $result = $apiInstance->createQuotes($xeroTenantId, $quotes, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createQuotes: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $quotes = ::Object::Quotes->new(); # Quotes | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->createQuotes(xeroTenantId => $xeroTenantId, quotes => $quotes, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createQuotes: $@\n";
}
# 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_quotes():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    summarizeErrors = 'True'
    date_value = dateutil.parser.parse('2020-12-03T00:00:00Z')

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    line_item = LineItem(
        description = "Foobar",
        quantity = 1.0,
        unit_amount = 20.0,
        account_code = "000")
    
    line_items = []    
    line_items.append(line_item)

    quote = Quote(
        contact = contact,
        line_items = line_items,
        date = date_value)

    quotes = Quotes( 
        quotes = [quote])
    
    try:
        api_response = api_instance.create_quotes(xeroTenantId, quotes, summarizeErrors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createQuotes: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let quotes = { "Quotes": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "LineItems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "12775" } ], "Date": "2020-02-01" } ] }; // Quotes
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.createQuotes(xeroTenantId, quotes, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
quotes *
Quotes
Quotes with an array of Quote object in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

createReceipt

Creates draft expense claim receipts for any user


/Receipts

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Receipts?unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        Integer unitdp = 4;
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        User user = new User();
        user.setUserID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        LineItem lineItem = new LineItem();
        lineItem.setDescription("Foobar");
        lineItem.setQuantity(1.0);
        lineItem.setUnitAmount(20.0);
        lineItem.setAccountCode("000");
        List<LineItems> lineItems = new ArrayList<LineItems>();
        lineItems.add(lineItem);
        Receipt receipt = new Receipt();
        receipt.setContact(contact);
        receipt.setUser(user);
        receipt.setLineItems(lineItems);
        receipt.setLineAmountTypes(com.xero.models.accounting.LineAmountTypes.INCLUSIVE);
        receipt.setStatus(com.xero.models.accounting.Receipt.StatusEnum.DRAFT);
        Receipts receipts = new Receipts();
        receipts.addReceiptsItem(receipt);

        try {
            Receipts result = apiInstance.createReceipt(accessToken, xeroTenantId, receipts, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createReceipt");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Receipts receipts = { "Receipts": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "Lineitems": [ { "Description": "Foobar", "Quantity": 2, "UnitAmount": 20, "AccountCode": "400", "TaxType": "NONE", "LineAmount": 40 } ], "User": { "UserID": "00000000-0000-0000-0000-000000000000" }, "LineAmountTypes": "NoTax", "Status": "DRAFT" } ] }; // Receipts | 
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Receipts result = apiInstance.createReceipt(xeroTenantId, receipts, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createReceipt");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Receipts *receipts = { "Receipts": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "Lineitems": [ { "Description": "Foobar", "Quantity": 2, "UnitAmount": 20, "AccountCode": "400", "TaxType": "NONE", "LineAmount": 40 } ], "User": { "UserID": "00000000-0000-0000-0000-000000000000" }, "LineAmountTypes": "NoTax", "Status": "DRAFT" } ] }; // 
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates draft expense claim receipts for any user
[apiInstance createReceiptWith:xeroTenantId
    receipts:receipts
    unitdp:unitdp
              completionHandler: ^(Receipts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant


const unitdp = 4;  // {Integer} e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
const receipts: Receipts = { receipts: [{ contact: { contactID: "00000000-0000-0000-0000-000000000000" }, lineItems: [{ description: "Foobar", quantity: 2.0, unitAmount: 20.0, accountCode: "400", taxType: TaxType.NONE, lineAmount: 40.0 }], user: { userID: "00000000-0000-0000-0000-000000000000" }, lineAmountTypes: LineAmountTypes.Inclusive, status: Receipt.StatusEnum.DRAFT, date: null} ] }

try {
  const response = await xero.accountingApi.createReceipt(xeroTenantId, receipts,  unitdp);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createReceiptExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var receipts = new Receipts(); // Receipts | 
            var unitdp = 4;  // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)  (default to null)

            try
            {
                // Creates draft expense claim receipts for any user
                Receipts result = apiInstance.createReceipt(xeroTenantId, receipts, unitdp);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createReceipt: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$unitdp = 4;

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$user = new XeroAPI\XeroPHP\Models\Accounting\User;
$user->setUserID('00000000-0000-0000-0000-000000000000');

$lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
$lineItem->setDescription('Foobar');
$lineItem->setQuantity(1.0);
$lineItem->setUnitAmount(20.0);
$lineItem->setAccountCode('000');
$lineItems = [];
array_push($lineItems, $lineItem);

$receipt = new XeroAPI\XeroPHP\Models\Accounting\Receipt;
$receipt->setContact($contact);
$receipt->setUser($user);
$receipt->setLineItems($lineItems);
$receipt->setLineAmountTypes(XeroAPI\XeroPHP\Models\Accounting\LineAmountTypes::INCLUSIVE);
$receipt->setStatus(XeroAPI\XeroPHP\Models\Accounting\Receipt::STATUS_DRAFT);

$receipts = new XeroAPI\XeroPHP\Models\Accounting\Receipts;
$arr_receipts = [];
array_push($arr_receipts, $receipt);
$receipts->setReceipts($arr_receipts);

try {
  $result = $apiInstance->createReceipt($xeroTenantId, $receipts, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createReceipt: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $receipts = ::Object::Receipts->new(); # Receipts | 
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->createReceipt(xeroTenantId => $xeroTenantId, receipts => $receipts, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createReceipt: $@\n";
}
# 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_receipt():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    user = User(
        user_id = "00000000-0000-0000-0000-000000000000")

    line_item = LineItem(
        description = "Foobar",
        quantity = 1.0,
        unit_amount = 20.0,
        account_code = "000")
    
    line_items = []    
    line_items.append(line_item)

    receipt = Receipt(
        contact = contact,
        user = user,
        line_items = line_items,
        line_amount_types = LineAmountTypes.INCLUSIVE,
        status = "DRAFT")

    receipts = Receipts( 
        receipts = [receipt])
    
    try:
        api_response = api_instance.create_receipt(xeroTenantId, receipts, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createReceipt: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let receipts = { "Receipts": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "Lineitems": [ { "Description": "Foobar", "Quantity": 2, "UnitAmount": 20, "AccountCode": "400", "TaxType": "NONE", "LineAmount": 40 } ], "User": { "UserID": "00000000-0000-0000-0000-000000000000" }, "LineAmountTypes": "NoTax", "Status": "DRAFT" } ] }; // Receipts
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.createReceipt(xeroTenantId, receipts, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
receipts *
Receipts
Receipts with an array of Receipt object in body of request
Required
Query parameters
Name Description
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

createReceiptAttachmentByFileName

Creates an attachment on a specific expense claim receipts by file name


/Receipts/{ReceiptID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Receipts/{ReceiptID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID receiptID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.createReceiptAttachmentByFileName(accessToken, xeroTenantId, receiptID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createReceiptAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID receiptID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Receipt
        String fileName = xero-dev.jpg; // String | The name of the file being attached to the Receipt
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.createReceiptAttachmentByFileName(xeroTenantId, receiptID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createReceiptAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *receiptID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Receipt (default to null)
String *fileName = xero-dev.jpg; // The name of the file being attached to the Receipt (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates an attachment on a specific expense claim receipts by file name
[apiInstance createReceiptAttachmentByFileNameWith:xeroTenantId
    receiptID:receiptID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const receiptID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Receipt
const fileName = "xero-dev.jpg";  // {String} The name of the file being attached to the Receipt
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
import * as fs from "fs";
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createReceiptAttachmentByFileName(xeroTenantId, receiptID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createReceiptAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var receiptID = new UUID(); // UUID | Unique identifier for a Receipt (default to null)
            var fileName = xero-dev.jpg;  // String | The name of the file being attached to the Receipt (default to null)
            var body = BYTE_ARRAY_DATA_HERE;  // byte[] | 

            try
            {
                // Creates an attachment on a specific expense claim receipts by file name
                Attachments result = apiInstance.createReceiptAttachmentByFileName(xeroTenantId, receiptID, fileName, body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createReceiptAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$receiptID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->createReceiptAttachmentByFileName($xeroTenantId, $receiptID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createReceiptAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $receiptID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Receipt
my $fileName = xero-dev.jpg; # String | The name of the file being attached to the Receipt
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->createReceiptAttachmentByFileName(xeroTenantId => $xeroTenantId, receiptID => $receiptID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createReceiptAttachmentByFileName: $@\n";
}
# 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_receipt_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    receiptID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    
        // TODO: BINARY CREATE 
    try:
        api_response = api_instance.create_receipt_attachment_by_file_name(xeroTenantId, receiptID, fileName, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createReceiptAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let receiptID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.createReceiptAttachmentByFileName(xeroTenantId, receiptID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
ReceiptID*
UUID (uuid)
Unique identifier for a Receipt
Required
FileName*
String
The name of the file being attached to the Receipt
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

createReceiptHistory

Creates a history record for a specific receipt


/Receipts/{ReceiptID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Receipts/{ReceiptID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID receiptID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createReceiptHistory(accessToken, xeroTenantId, receiptID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createReceiptHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID receiptID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Receipt
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createReceiptHistory(xeroTenantId, receiptID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createReceiptHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *receiptID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Receipt (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a history record for a specific receipt
[apiInstance createReceiptHistoryWith:xeroTenantId
    receiptID:receiptID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);
const historyRecords: HistoryRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] };  // {HistoryRecords} 
const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const receiptID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Receipt


try {
  const response = await xero.accountingApi.createReceiptHistory(xeroTenantId, receiptID, historyRecords);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createReceiptHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var receiptID = new UUID(); // UUID | Unique identifier for a Receipt (default to null)
            var historyRecords = new HistoryRecords(); // HistoryRecords | 

            try
            {
                // Creates a history record for a specific receipt
                HistoryRecords result = apiInstance.createReceiptHistory(xeroTenantId, receiptID, historyRecords);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createReceiptHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$receiptID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createReceiptHistory($xeroTenantId, $receiptID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createReceiptHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $receiptID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Receipt
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createReceiptHistory(xeroTenantId => $xeroTenantId, receiptID => $receiptID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createReceiptHistory: $@\n";
}
# 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_receipt_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    receiptID = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    history_records = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_receipt_history(xeroTenantId, receiptID, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createReceiptHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let receiptID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createReceiptHistory(xeroTenantId, receiptID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
ReceiptID*
UUID (uuid)
Unique identifier for a Receipt
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createRepeatingInvoiceAttachmentByFileName

Creates an attachment from a specific repeating invoices by file name


/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID repeatingInvoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.createRepeatingInvoiceAttachmentByFileName(accessToken, xeroTenantId, repeatingInvoiceID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createRepeatingInvoiceAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Repeating Invoice
        String fileName = xero-dev.jpg; // String | The name of the file being attached to a Repeating Invoice
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.createRepeatingInvoiceAttachmentByFileName(xeroTenantId, repeatingInvoiceID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createRepeatingInvoiceAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Repeating Invoice (default to null)
String *fileName = xero-dev.jpg; // The name of the file being attached to a Repeating Invoice (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates an attachment from a specific repeating invoices by file name
[apiInstance createRepeatingInvoiceAttachmentByFileNameWith:xeroTenantId
    repeatingInvoiceID:repeatingInvoiceID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const repeatingInvoiceID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Repeating Invoice
const fileName = "xero-dev.jpg";  // {String} The name of the file being attached to a Repeating Invoice
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
import * as fs from "fs";
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createRepeatingInvoiceAttachmentByFileName(xeroTenantId, repeatingInvoiceID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createRepeatingInvoiceAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var repeatingInvoiceID = new UUID(); // UUID | Unique identifier for a Repeating Invoice (default to null)
            var fileName = xero-dev.jpg;  // String | The name of the file being attached to a Repeating Invoice (default to null)
            var body = BYTE_ARRAY_DATA_HERE;  // byte[] | 

            try
            {
                // Creates an attachment from a specific repeating invoices by file name
                Attachments result = apiInstance.createRepeatingInvoiceAttachmentByFileName(xeroTenantId, repeatingInvoiceID, fileName, body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createRepeatingInvoiceAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$repeatingInvoiceID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->createRepeatingInvoiceAttachmentByFileName($xeroTenantId, $repeatingInvoiceID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createRepeatingInvoiceAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Repeating Invoice
my $fileName = xero-dev.jpg; # String | The name of the file being attached to a Repeating Invoice
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->createRepeatingInvoiceAttachmentByFileName(xeroTenantId => $xeroTenantId, repeatingInvoiceID => $repeatingInvoiceID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createRepeatingInvoiceAttachmentByFileName: $@\n";
}
# 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_repeating_invoice_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    repeatingInvoiceID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    
        // TODO: BINARY CREATE 
    try:
        api_response = api_instance.create_repeating_invoice_attachment_by_file_name(xeroTenantId, repeatingInvoiceID, fileName, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createRepeatingInvoiceAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.createRepeatingInvoiceAttachmentByFileName(xeroTenantId, repeatingInvoiceID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
RepeatingInvoiceID*
UUID (uuid)
Unique identifier for a Repeating Invoice
Required
FileName*
String
The name of the file being attached to a Repeating Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

createRepeatingInvoiceHistory

Creates a history record for a specific repeating invoice


/RepeatingInvoices/{RepeatingInvoiceID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/RepeatingInvoices/{RepeatingInvoiceID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID repeatingInvoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createRepeatingInvoiceHistory(accessToken, xeroTenantId, repeatingInvoiceID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createRepeatingInvoiceHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Repeating Invoice
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createRepeatingInvoiceHistory(xeroTenantId, repeatingInvoiceID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createRepeatingInvoiceHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Repeating Invoice (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a  history record for a specific repeating invoice
[apiInstance createRepeatingInvoiceHistoryWith:xeroTenantId
    repeatingInvoiceID:repeatingInvoiceID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);
const historyRecords: HistoryRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] };  // {HistoryRecords} 
const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const repeatingInvoiceID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Repeating Invoice


try {
  const response = await xero.accountingApi.createRepeatingInvoiceHistory(xeroTenantId, repeatingInvoiceID, historyRecords);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createRepeatingInvoiceHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var repeatingInvoiceID = new UUID(); // UUID | Unique identifier for a Repeating Invoice (default to null)
            var historyRecords = new HistoryRecords(); // HistoryRecords | 

            try
            {
                // Creates a  history record for a specific repeating invoice
                HistoryRecords result = apiInstance.createRepeatingInvoiceHistory(xeroTenantId, repeatingInvoiceID, historyRecords);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createRepeatingInvoiceHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$repeatingInvoiceID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createRepeatingInvoiceHistory($xeroTenantId, $repeatingInvoiceID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createRepeatingInvoiceHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Repeating Invoice
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createRepeatingInvoiceHistory(xeroTenantId => $xeroTenantId, repeatingInvoiceID => $repeatingInvoiceID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createRepeatingInvoiceHistory: $@\n";
}
# 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_repeating_invoice_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    repeatingInvoiceID = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    history_records = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_repeating_invoice_history(xeroTenantId, repeatingInvoiceID, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createRepeatingInvoiceHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createRepeatingInvoiceHistory(xeroTenantId, repeatingInvoiceID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
RepeatingInvoiceID*
UUID (uuid)
Unique identifier for a Repeating Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createTaxRates

Creates one or more tax rates


/TaxRates

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/TaxRates"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        TaxComponent taxComponent = new TaxComponent();
        taxComponent.setName("State Tax");
        taxComponent.setRate(2.25);
        List<TaxComponent> taxComponent = new ArrayList<TaxComponent>();
        taxComponents.add(taxComponent);
        TaxRate taxRate = new TaxRate();
        taxRate.setName("CA State Tax");
        taxRate.setTaxComponents(taxComponents);
        TaxRates taxRates = new TaxRates();
        taxRates.addTaxRatesItem(taxRate);

        try {
            TaxRates result = apiInstance.createTaxRates(accessToken, xeroTenantId, taxRates);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createTaxRates");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        TaxRates taxRates = { "TaxRates": [ { "Name": "CA State Tax", "TaxComponents": [ { "Name": "State Tax", "Rate": 2.25 } ] } ] }; // TaxRates | 
        try {
            TaxRates result = apiInstance.createTaxRates(xeroTenantId, taxRates);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createTaxRates");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
TaxRates *taxRates = { "TaxRates": [ { "Name": "CA State Tax", "TaxComponents": [ { "Name": "State Tax", "Rate": 2.25 } ] } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates one or more tax rates
[apiInstance createTaxRatesWith:xeroTenantId
    taxRates:taxRates
              completionHandler: ^(TaxRates output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const taxRates: TaxRates = { taxRates: [{ name: "CA State Tax", taxComponents: [{ name: "State Tax", rate: 2.25 }]}]}

try {
  const response = await xero.accountingApi.createTaxRates(xeroTenantId, taxRates);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createTaxRatesExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var taxRates = new TaxRates(); // TaxRates | 

            try
            {
                // Creates one or more tax rates
                TaxRates result = apiInstance.createTaxRates(xeroTenantId, taxRates);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createTaxRates: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

$taxComponent = new XeroAPI\XeroPHP\Models\Accounting\TaxComponent;
$taxComponent->setName('State Tax');
$taxComponent->setRate(2.25);
$taxComponent = [];
array_push($taxComponents, $taxComponent);

$taxRate = new XeroAPI\XeroPHP\Models\Accounting\TaxRate;
$taxRate->setName('CA State Tax');
$taxRate->setTaxComponents($taxComponents);

$taxRates = new XeroAPI\XeroPHP\Models\Accounting\TaxRates;
$arr_tax_rates = [];
array_push($arr_tax_rates, $taxRate);
$taxRates->setTaxRates($arr_tax_rates);

try {
  $result = $apiInstance->createTaxRates($xeroTenantId, $taxRates);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createTaxRates: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $taxRates = ::Object::TaxRates->new(); # TaxRates | 

eval { 
    my $result = $api_instance->createTaxRates(xeroTenantId => $xeroTenantId, taxRates => $taxRates);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createTaxRates: $@\n";
}
# 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_tax_rates():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'

    tax_component = TaxComponent(
        name = "State Tax",
        rate = 2.25)
    
    taxComponent = []    
    tax_components.append(tax_component)

    tax_rate = TaxRate(
        name = "CA State Tax",
        taxComponents = taxComponents,

    taxRates = TaxRates( 
        tax_rates = [tax_rate])
    
    try:
        api_response = api_instance.create_tax_rates(xeroTenantId, taxRates)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createTaxRates: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let taxRates = { "TaxRates": [ { "Name": "CA State Tax", "TaxComponents": [ { "Name": "State Tax", "Rate": 2.25 } ] } ] }; // TaxRates

    let mut context = AccountingApi::Context::default();
    let result = client.createTaxRates(xeroTenantId, taxRates, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
taxRates *
TaxRates
TaxRates array with TaxRate object in body of request
Required

createTrackingCategory

Create tracking categories


/TrackingCategories

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/TrackingCategories"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        TrackingCategory trackingCategory = new TrackingCategory();
        trackingCategory.setName("Foobar");

        try {
            TrackingCategories result = apiInstance.createTrackingCategory(accessToken, xeroTenantId, trackingCategory);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createTrackingCategory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        TrackingCategory trackingCategory = { name: "FooBar" }; // TrackingCategory | 
        try {
            TrackingCategories result = apiInstance.createTrackingCategory(xeroTenantId, trackingCategory);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createTrackingCategory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
TrackingCategory *trackingCategory = { name: "FooBar" }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Create tracking categories
[apiInstance createTrackingCategoryWith:xeroTenantId
    trackingCategory:trackingCategory
              completionHandler: ^(TrackingCategories output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);
const trackingCategory: TrackingCategory = { name: "FooBar" };  // {TrackingCategory} 
const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant


try {
  const response = await xero.accountingApi.createTrackingCategory(xeroTenantId, trackingCategory);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createTrackingCategoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var trackingCategory = new TrackingCategory(); // TrackingCategory | 

            try
            {
                // Create tracking categories
                TrackingCategories result = apiInstance.createTrackingCategory(xeroTenantId, trackingCategory);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createTrackingCategory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

$trackingCategory = new XeroAPI\XeroPHP\Models\Accounting\TrackingCategory;
$trackingCategory->setName('Foobar');

try {
  $result = $apiInstance->createTrackingCategory($xeroTenantId, $trackingCategory);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createTrackingCategory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $trackingCategory = ::Object::TrackingCategory->new(); # TrackingCategory | 

eval { 
    my $result = $api_instance->createTrackingCategory(xeroTenantId => $xeroTenantId, trackingCategory => $trackingCategory);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createTrackingCategory: $@\n";
}
# 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_tracking_category():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'

    trackingCategory = TrackingCategory(
        name = "Foobar")
    
    try:
        api_response = api_instance.create_tracking_category(xeroTenantId, trackingCategory)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createTrackingCategory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let trackingCategory = { name: "FooBar" }; // TrackingCategory

    let mut context = AccountingApi::Context::default();
    let result = client.createTrackingCategory(xeroTenantId, trackingCategory, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
trackingCategory *
TrackingCategory
TrackingCategory object in body of request
Required

createTrackingOptions

Creates options for a specific tracking category


/TrackingCategories/{TrackingCategoryID}/Options

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/TrackingCategories/{TrackingCategoryID}/Options"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID trackingCategoryID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        TrackingOption trackingOption = new TrackingOption();
        trackingOption.setName("Foobar");

        try {
            TrackingOptions result = apiInstance.createTrackingOptions(accessToken, xeroTenantId, trackingCategoryID, trackingOption);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createTrackingOptions");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID trackingCategoryID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a TrackingCategory
        TrackingOption trackingOption = { name: " Bar" }; // TrackingOption | 
        try {
            TrackingOptions result = apiInstance.createTrackingOptions(xeroTenantId, trackingCategoryID, trackingOption);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createTrackingOptions");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *trackingCategoryID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a TrackingCategory (default to null)
TrackingOption *trackingOption = { name: " Bar" }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates options for a specific tracking category
[apiInstance createTrackingOptionsWith:xeroTenantId
    trackingCategoryID:trackingCategoryID
    trackingOption:trackingOption
              completionHandler: ^(TrackingOptions output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);
const trackingOption: TrackingOption = { name: " Bar" };  // {TrackingOption} 
const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const trackingCategoryID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a TrackingCategory


try {
  const response = await xero.accountingApi.createTrackingOptions(xeroTenantId, trackingCategoryID, trackingOption);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class createTrackingOptionsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var trackingCategoryID = new UUID(); // UUID | Unique identifier for a TrackingCategory (default to null)
            var trackingOption = new TrackingOption(); // TrackingOption | 

            try
            {
                // Creates options for a specific tracking category
                TrackingOptions result = apiInstance.createTrackingOptions(xeroTenantId, trackingCategoryID, trackingOption);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.createTrackingOptions: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$trackingCategoryID = "00000000-0000-0000-0000-000000000000";

$trackingOption = new XeroAPI\XeroPHP\Models\Accounting\TrackingOption;
$trackingOption->setName('Foobar');

try {
  $result = $apiInstance->createTrackingOptions($xeroTenantId, $trackingCategoryID, $trackingOption);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createTrackingOptions: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $trackingCategoryID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a TrackingCategory
my $trackingOption = ::Object::TrackingOption->new(); # TrackingOption | 

eval { 
    my $result = $api_instance->createTrackingOptions(xeroTenantId => $xeroTenantId, trackingCategoryID => $trackingCategoryID, trackingOption => $trackingOption);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createTrackingOptions: $@\n";
}
# 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_tracking_options():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    trackingCategoryID = '00000000-0000-0000-0000-000000000000'

    trackingOption = TrackingOption(
        name = "Foobar")
    
    try:
        api_response = api_instance.create_tracking_options(xeroTenantId, trackingCategoryID, trackingOption)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createTrackingOptions: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let trackingCategoryID = 00000000-0000-0000-0000-000000000000; // UUID
    let trackingOption = { name: " Bar" }; // TrackingOption

    let mut context = AccountingApi::Context::default();
    let result = client.createTrackingOptions(xeroTenantId, trackingCategoryID, trackingOption, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Path parameters
Name Description
TrackingCategoryID*
UUID (uuid)
Unique identifier for a TrackingCategory
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
trackingOption *
TrackingOption
TrackingOption object in body of request
Required

deleteAccount

Deletes a chart of accounts


/Accounts/{AccountID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Accounts/{AccountID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID accountID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Accounts result = apiInstance.deleteAccount(accessToken, xeroTenantId, accountID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#deleteAccount");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID accountID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for retrieving single object
        try {
            Accounts result = apiInstance.deleteAccount(xeroTenantId, accountID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#deleteAccount");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *accountID = 00000000-0000-0000-0000-000000000000; // Unique identifier for retrieving single object (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Deletes a chart of accounts
[apiInstance deleteAccountWith:xeroTenantId
    accountID:accountID
              completionHandler: ^(Accounts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const accountID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for retrieving single object

try {
  const response = await xero.accountingApi.deleteAccount(xeroTenantId, accountID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class deleteAccountExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var accountID = new UUID(); // UUID | Unique identifier for retrieving single object (default to null)

            try
            {
                // Deletes a chart of accounts
                Accounts result = apiInstance.deleteAccount(xeroTenantId, accountID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.deleteAccount: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$accountID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->deleteAccount($xeroTenantId, $accountID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->deleteAccount: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $accountID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for retrieving single object

eval { 
    my $result = $api_instance->deleteAccount(xeroTenantId => $xeroTenantId, accountID => $accountID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->deleteAccount: $@\n";
}
# 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_delete_account():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    accountID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.delete_account(xeroTenantId, accountID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deleteAccount: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let accountID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.deleteAccount(xeroTenantId, accountID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Path parameters
Name Description
AccountID*
UUID (uuid)
Unique identifier for retrieving single object
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

deleteContactGroupContact

Deletes a specific contact from a contact group using a unique contact Id


/ContactGroups/{ContactGroupID}/Contacts/{ContactID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ContactGroups/{ContactGroupID}/Contacts/{ContactID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID contactGroupID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID contactID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
             result = apiInstance.deleteContactGroupContact(accessToken, xeroTenantId, contactGroupID, contactID);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#deleteContactGroupContact");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactGroupID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact Group
        UUID contactID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact
        try {
            apiInstance.deleteContactGroupContact(xeroTenantId, contactGroupID, contactID);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#deleteContactGroupContact");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactGroupID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact Group (default to null)
UUID *contactID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Deletes a specific contact from a contact group using a unique contact Id
[apiInstance deleteContactGroupContactWith:xeroTenantId
    contactGroupID:contactGroupID
    contactID:contactID
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const contactGroupID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Contact Group
const contactID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Contact

try {
  const response = await xero.accountingApi.deleteContactGroupContact(xeroTenantId, contactGroupID, contactID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class deleteContactGroupContactExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var contactGroupID = new UUID(); // UUID | Unique identifier for a Contact Group (default to null)
            var contactID = new UUID(); // UUID | Unique identifier for a Contact (default to null)

            try
            {
                // Deletes a specific contact from a contact group using a unique contact Id
                apiInstance.deleteContactGroupContact(xeroTenantId, contactGroupID, contactID);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.deleteContactGroupContact: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactGroupID = "00000000-0000-0000-0000-000000000000";
$contactID = "00000000-0000-0000-0000-000000000000";

try {
  $apiInstance->deleteContactGroupContact($xeroTenantId, $contactGroupID, $contactID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->deleteContactGroupContact: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactGroupID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact Group
my $contactID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact

eval { 
    $api_instance->deleteContactGroupContact(xeroTenantId => $xeroTenantId, contactGroupID => $contactGroupID, contactID => $contactID);
};
if ($@) {
    warn "Exception when calling AccountingApi->deleteContactGroupContact: $@\n";
}
# 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_delete_contact_group_contact():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    contactGroupID = '00000000-0000-0000-0000-000000000000'
    contactID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_instance.delete_contact_group_contact(xeroTenantId, contactGroupID, contactID)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deleteContactGroupContact: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactGroupID = 00000000-0000-0000-0000-000000000000; // UUID
    let contactID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.deleteContactGroupContact(xeroTenantId, contactGroupID, contactID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts Grant read-write access to contacts and contact groups

Parameters

Path parameters
Name Description
ContactGroupID*
UUID (uuid)
Unique identifier for a Contact Group
Required
ContactID*
UUID (uuid)
Unique identifier for a Contact
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

deleteContactGroupContacts

Deletes all contacts from a specific contact group


/ContactGroups/{ContactGroupID}/Contacts

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ContactGroups/{ContactGroupID}/Contacts"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID contactGroupID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
             result = apiInstance.deleteContactGroupContacts(accessToken, xeroTenantId, contactGroupID);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#deleteContactGroupContacts");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactGroupID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact Group
        try {
            apiInstance.deleteContactGroupContacts(xeroTenantId, contactGroupID);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#deleteContactGroupContacts");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactGroupID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact Group (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Deletes all contacts from a specific contact group
[apiInstance deleteContactGroupContactsWith:xeroTenantId
    contactGroupID:contactGroupID
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const contactGroupID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Contact Group

try {
  const response = await xero.accountingApi.deleteContactGroupContacts(xeroTenantId, contactGroupID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class deleteContactGroupContactsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var contactGroupID = new UUID(); // UUID | Unique identifier for a Contact Group (default to null)

            try
            {
                // Deletes all contacts from a specific contact group
                apiInstance.deleteContactGroupContacts(xeroTenantId, contactGroupID);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.deleteContactGroupContacts: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactGroupID = "00000000-0000-0000-0000-000000000000";

try {
  $apiInstance->deleteContactGroupContacts($xeroTenantId, $contactGroupID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->deleteContactGroupContacts: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactGroupID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact Group

eval { 
    $api_instance->deleteContactGroupContacts(xeroTenantId => $xeroTenantId, contactGroupID => $contactGroupID);
};
if ($@) {
    warn "Exception when calling AccountingApi->deleteContactGroupContacts: $@\n";
}
# 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_delete_contact_group_contacts():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    contactGroupID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_instance.delete_contact_group_contacts(xeroTenantId, contactGroupID)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deleteContactGroupContacts: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactGroupID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.deleteContactGroupContacts(xeroTenantId, contactGroupID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts Grant read-write access to contacts and contact groups

Parameters

Path parameters
Name Description
ContactGroupID*
UUID (uuid)
Unique identifier for a Contact Group
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

deleteItem

Deletes a specific item


/Items/{ItemID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Items/{ItemID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID itemID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
             result = apiInstance.deleteItem(accessToken, xeroTenantId, itemID);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#deleteItem");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID itemID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Item
        try {
            apiInstance.deleteItem(xeroTenantId, itemID);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#deleteItem");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *itemID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Item (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Deletes a specific item
[apiInstance deleteItemWith:xeroTenantId
    itemID:itemID
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const itemID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for an Item

try {
  const response = await xero.accountingApi.deleteItem(xeroTenantId, itemID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class deleteItemExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var itemID = new UUID(); // UUID | Unique identifier for an Item (default to null)

            try
            {
                // Deletes a specific item
                apiInstance.deleteItem(xeroTenantId, itemID);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.deleteItem: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$itemID = "00000000-0000-0000-0000-000000000000";

try {
  $apiInstance->deleteItem($xeroTenantId, $itemID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->deleteItem: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $itemID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Item

eval { 
    $api_instance->deleteItem(xeroTenantId => $xeroTenantId, itemID => $itemID);
};
if ($@) {
    warn "Exception when calling AccountingApi->deleteItem: $@\n";
}
# 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_delete_item():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    itemID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_instance.delete_item(xeroTenantId, itemID)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deleteItem: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let itemID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.deleteItem(xeroTenantId, itemID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Path parameters
Name Description
ItemID*
UUID (uuid)
Unique identifier for an Item
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

deleteLinkedTransaction

Deletes a specific linked transactions (billable expenses)


/LinkedTransactions/{LinkedTransactionID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/LinkedTransactions/{LinkedTransactionID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID linkedTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
             result = apiInstance.deleteLinkedTransaction(accessToken, xeroTenantId, linkedTransactionID);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#deleteLinkedTransaction");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID linkedTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a LinkedTransaction
        try {
            apiInstance.deleteLinkedTransaction(xeroTenantId, linkedTransactionID);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#deleteLinkedTransaction");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *linkedTransactionID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a LinkedTransaction (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Deletes a specific linked transactions (billable expenses)
[apiInstance deleteLinkedTransactionWith:xeroTenantId
    linkedTransactionID:linkedTransactionID
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const linkedTransactionID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a LinkedTransaction

try {
  const response = await xero.accountingApi.deleteLinkedTransaction(xeroTenantId, linkedTransactionID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class deleteLinkedTransactionExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var linkedTransactionID = new UUID(); // UUID | Unique identifier for a LinkedTransaction (default to null)

            try
            {
                // Deletes a specific linked transactions (billable expenses)
                apiInstance.deleteLinkedTransaction(xeroTenantId, linkedTransactionID);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.deleteLinkedTransaction: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$linkedTransactionID = "00000000-0000-0000-0000-000000000000";

try {
  $apiInstance->deleteLinkedTransaction($xeroTenantId, $linkedTransactionID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->deleteLinkedTransaction: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $linkedTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a LinkedTransaction

eval { 
    $api_instance->deleteLinkedTransaction(xeroTenantId => $xeroTenantId, linkedTransactionID => $linkedTransactionID);
};
if ($@) {
    warn "Exception when calling AccountingApi->deleteLinkedTransaction: $@\n";
}
# 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_delete_linked_transaction():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    linkedTransactionID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_instance.delete_linked_transaction(xeroTenantId, linkedTransactionID)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deleteLinkedTransaction: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let linkedTransactionID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.deleteLinkedTransaction(xeroTenantId, linkedTransactionID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
LinkedTransactionID*
UUID (uuid)
Unique identifier for a LinkedTransaction
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

deletePayment

Updates a specific payment for invoices and credit notes


/Payments/{PaymentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Payments/{PaymentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID paymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        PaymentDelete paymentDelete = new PaymentDelete();
        paymentDelete.setStatus("DELETED");

        try {
            Payments result = apiInstance.deletePayment(accessToken, xeroTenantId, paymentID, paymentDelete);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#deletePayment");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID paymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Payment
        PaymentDelete paymentDelete = { "Payments":[ { "Status":"DELETED" } ] }; // PaymentDelete | 
        try {
            Payments result = apiInstance.deletePayment(xeroTenantId, paymentID, paymentDelete);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#deletePayment");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *paymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Payment (default to null)
PaymentDelete *paymentDelete = { "Payments":[ { "Status":"DELETED" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific payment for invoices and credit notes
[apiInstance deletePaymentWith:xeroTenantId
    paymentID:paymentID
    paymentDelete:paymentDelete
              completionHandler: ^(Payments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const paymentID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Payment
const paymentDelete: PaymentDelete = { status: "DELETED" }

try {
  const response = await xero.accountingApi.deletePayment(xeroTenantId, paymentID, paymentDelete);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class deletePaymentExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var paymentID = new UUID(); // UUID | Unique identifier for a Payment (default to null)
            var paymentDelete = new PaymentDelete(); // PaymentDelete | 

            try
            {
                // Updates a specific payment for invoices and credit notes
                Payments result = apiInstance.deletePayment(xeroTenantId, paymentID, paymentDelete);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.deletePayment: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$paymentID = "00000000-0000-0000-0000-000000000000";

$paymentDelete = new XeroAPI\XeroPHP\Models\Accounting\PaymentDelete;
$paymentDelete->setStatus('DELETED');

try {
  $result = $apiInstance->deletePayment($xeroTenantId, $paymentID, $paymentDelete);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->deletePayment: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $paymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Payment
my $paymentDelete = ::Object::PaymentDelete->new(); # PaymentDelete | 

eval { 
    my $result = $api_instance->deletePayment(xeroTenantId => $xeroTenantId, paymentID => $paymentID, paymentDelete => $paymentDelete);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->deletePayment: $@\n";
}
# 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_delete_payment():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    paymentID = '00000000-0000-0000-0000-000000000000'

    paymentDelete = PaymentDelete(
        status = "DELETED")
    
    try:
        api_response = api_instance.delete_payment(xeroTenantId, paymentID, paymentDelete)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deletePayment: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let paymentID = 00000000-0000-0000-0000-000000000000; // UUID
    let paymentDelete = { "Payments":[ { "Status":"DELETED" } ] }; // PaymentDelete

    let mut context = AccountingApi::Context::default();
    let result = client.deletePayment(xeroTenantId, paymentID, paymentDelete, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
PaymentID*
UUID (uuid)
Unique identifier for a Payment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
paymentDelete *
PaymentDelete
Required

deleteTrackingCategory

Deletes a specific tracking category


/TrackingCategories/{TrackingCategoryID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/TrackingCategories/{TrackingCategoryID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID trackingCategoryID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            TrackingCategories result = apiInstance.deleteTrackingCategory(accessToken, xeroTenantId, trackingCategoryID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#deleteTrackingCategory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID trackingCategoryID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a TrackingCategory
        try {
            TrackingCategories result = apiInstance.deleteTrackingCategory(xeroTenantId, trackingCategoryID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#deleteTrackingCategory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *trackingCategoryID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a TrackingCategory (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Deletes a specific tracking category
[apiInstance deleteTrackingCategoryWith:xeroTenantId
    trackingCategoryID:trackingCategoryID
              completionHandler: ^(TrackingCategories output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const trackingCategoryID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a TrackingCategory

try {
  const response = await xero.accountingApi.deleteTrackingCategory(xeroTenantId, trackingCategoryID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class deleteTrackingCategoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var trackingCategoryID = new UUID(); // UUID | Unique identifier for a TrackingCategory (default to null)

            try
            {
                // Deletes a specific tracking category
                TrackingCategories result = apiInstance.deleteTrackingCategory(xeroTenantId, trackingCategoryID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.deleteTrackingCategory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$trackingCategoryID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->deleteTrackingCategory($xeroTenantId, $trackingCategoryID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->deleteTrackingCategory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $trackingCategoryID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a TrackingCategory

eval { 
    my $result = $api_instance->deleteTrackingCategory(xeroTenantId => $xeroTenantId, trackingCategoryID => $trackingCategoryID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->deleteTrackingCategory: $@\n";
}
# 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_delete_tracking_category():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    trackingCategoryID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.delete_tracking_category(xeroTenantId, trackingCategoryID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deleteTrackingCategory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let trackingCategoryID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.deleteTrackingCategory(xeroTenantId, trackingCategoryID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Path parameters
Name Description
TrackingCategoryID*
UUID (uuid)
Unique identifier for a TrackingCategory
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

deleteTrackingOptions

Deletes a specific option for a specific tracking category


/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID trackingCategoryID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID trackingOptionID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            TrackingOptions result = apiInstance.deleteTrackingOptions(accessToken, xeroTenantId, trackingCategoryID, trackingOptionID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#deleteTrackingOptions");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID trackingCategoryID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a TrackingCategory
        UUID trackingOptionID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Tracking Option
        try {
            TrackingOptions result = apiInstance.deleteTrackingOptions(xeroTenantId, trackingCategoryID, trackingOptionID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#deleteTrackingOptions");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *trackingCategoryID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a TrackingCategory (default to null)
UUID *trackingOptionID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Tracking Option (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Deletes a specific option for a specific tracking category
[apiInstance deleteTrackingOptionsWith:xeroTenantId
    trackingCategoryID:trackingCategoryID
    trackingOptionID:trackingOptionID
              completionHandler: ^(TrackingOptions output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const trackingCategoryID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a TrackingCategory
const trackingOptionID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Tracking Option

try {
  const response = await xero.accountingApi.deleteTrackingOptions(xeroTenantId, trackingCategoryID, trackingOptionID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class deleteTrackingOptionsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var trackingCategoryID = new UUID(); // UUID | Unique identifier for a TrackingCategory (default to null)
            var trackingOptionID = new UUID(); // UUID | Unique identifier for a Tracking Option (default to null)

            try
            {
                // Deletes a specific option for a specific tracking category
                TrackingOptions result = apiInstance.deleteTrackingOptions(xeroTenantId, trackingCategoryID, trackingOptionID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.deleteTrackingOptions: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$trackingCategoryID = "00000000-0000-0000-0000-000000000000";
$trackingOptionID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->deleteTrackingOptions($xeroTenantId, $trackingCategoryID, $trackingOptionID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->deleteTrackingOptions: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $trackingCategoryID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a TrackingCategory
my $trackingOptionID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Tracking Option

eval { 
    my $result = $api_instance->deleteTrackingOptions(xeroTenantId => $xeroTenantId, trackingCategoryID => $trackingCategoryID, trackingOptionID => $trackingOptionID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->deleteTrackingOptions: $@\n";
}
# 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_delete_tracking_options():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    trackingCategoryID = '00000000-0000-0000-0000-000000000000'
    trackingOptionID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.delete_tracking_options(xeroTenantId, trackingCategoryID, trackingOptionID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deleteTrackingOptions: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let trackingCategoryID = 00000000-0000-0000-0000-000000000000; // UUID
    let trackingOptionID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.deleteTrackingOptions(xeroTenantId, trackingCategoryID, trackingOptionID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Path parameters
Name Description
TrackingCategoryID*
UUID (uuid)
Unique identifier for a TrackingCategory
Required
TrackingOptionID*
UUID (uuid)
Unique identifier for a Tracking Option
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

emailInvoice

Sends a copy of a specific invoice to related contact via email


/Invoices/{InvoiceID}/Email

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID}/Email"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID invoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        RequestEmpty requestEmpty = new RequestEmpty();

        try {
             result = apiInstance.emailInvoice(accessToken, xeroTenantId, invoiceID, requestEmpty);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#emailInvoice");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID invoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Invoice
        RequestEmpty requestEmpty = {}; // RequestEmpty | 
        try {
            apiInstance.emailInvoice(xeroTenantId, invoiceID, requestEmpty);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#emailInvoice");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *invoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Invoice (default to null)
RequestEmpty *requestEmpty = {}; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Sends a copy of a specific invoice to related contact via email
[apiInstance emailInvoiceWith:xeroTenantId
    invoiceID:invoiceID
    requestEmpty:requestEmpty
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);
const requestEmpty: RequestEmpty = {};  // {RequestEmpty} 
const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const invoiceID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for an Invoice


try {
  const response = await xero.accountingApi.emailInvoice(xeroTenantId, invoiceID, requestEmpty);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class emailInvoiceExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var invoiceID = new UUID(); // UUID | Unique identifier for an Invoice (default to null)
            var requestEmpty = new RequestEmpty(); // RequestEmpty | 

            try
            {
                // Sends a copy of a specific invoice to related contact via email
                apiInstance.emailInvoice(xeroTenantId, invoiceID, requestEmpty);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.emailInvoice: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$invoiceID = "00000000-0000-0000-0000-000000000000";

$requestEmpty = new XeroAPI\XeroPHP\Models\Accounting\RequestEmpty;

try {
  $apiInstance->emailInvoice($xeroTenantId, $invoiceID, $requestEmpty);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->emailInvoice: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Invoice
my $requestEmpty = ::Object::RequestEmpty->new(); # RequestEmpty | 

eval { 
    $api_instance->emailInvoice(xeroTenantId => $xeroTenantId, invoiceID => $invoiceID, requestEmpty => $requestEmpty);
};
if ($@) {
    warn "Exception when calling AccountingApi->emailInvoice: $@\n";
}
# 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_email_invoice():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    invoiceID = '00000000-0000-0000-0000-000000000000'

    requestEmpty = RequestEmpty()
    
    try:
        api_instance.email_invoice(xeroTenantId, invoiceID, requestEmpty)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->emailInvoice: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoiceID = 00000000-0000-0000-0000-000000000000; // UUID
    let requestEmpty = {}; // RequestEmpty

    let mut context = AccountingApi::Context::default();
    let result = client.emailInvoice(xeroTenantId, invoiceID, requestEmpty, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
InvoiceID*
UUID (uuid)
Unique identifier for an Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
requestEmpty *
RequestEmpty
Required

getAccount

Retrieves a single chart of accounts by using a unique account Id


/Accounts/{AccountID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Accounts/{AccountID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID accountID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Accounts result = apiInstance.getAccount(accessToken, xeroTenantId, accountID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getAccount");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID accountID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for retrieving single object
        try {
            Accounts result = apiInstance.getAccount(xeroTenantId, accountID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getAccount");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *accountID = 00000000-0000-0000-0000-000000000000; // Unique identifier for retrieving single object (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a single chart of accounts by using a unique account Id
[apiInstance getAccountWith:xeroTenantId
    accountID:accountID
              completionHandler: ^(Accounts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const accountID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for retrieving single object

try {
  const response = await xero.accountingApi.getAccount(xeroTenantId, accountID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getAccountExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var accountID = new UUID(); // UUID | Unique identifier for retrieving single object (default to null)

            try
            {
                // Retrieves a single chart of accounts by using a unique account Id
                Accounts result = apiInstance.getAccount(xeroTenantId, accountID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getAccount: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$accountID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getAccount($xeroTenantId, $accountID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getAccount: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $accountID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for retrieving single object

eval { 
    my $result = $api_instance->getAccount(xeroTenantId => $xeroTenantId, accountID => $accountID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getAccount: $@\n";
}
# 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_get_account():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    accountID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_account(xeroTenantId, accountID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getAccount: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let accountID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getAccount(xeroTenantId, accountID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Path parameters
Name Description
AccountID*
UUID (uuid)
Unique identifier for retrieving single object
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getAccountAttachmentByFileName

Retrieves an attachment for a specific account by filename


/Accounts/{AccountID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Accounts/{AccountID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID accountID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        String contentType = "image/jpg";

        try {
            ByteArrayInputStream result = apiInstance.getAccountAttachmentByFileName(accessToken, xeroTenantId, accountID, fileName, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getAccountAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID accountID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Account object
        String fileName = xero-dev.jpg; // String | Name of the attachment
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getAccountAttachmentByFileName(xeroTenantId, accountID, fileName, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getAccountAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *accountID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Account object (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves an attachment for a specific account by filename
[apiInstance getAccountAttachmentByFileNameWith:xeroTenantId
    accountID:accountID
    fileName:fileName
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const accountID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for Account object
const fileName = "xero-dev.jpg";  // {String} Name of the attachment
const contentType = "image/jpg";  // {String} The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

try {
  const response = await xero.accountingApi.getAccountAttachmentByFileName(xeroTenantId, accountID, fileName, contentType);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getAccountAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var accountID = new UUID(); // UUID | Unique identifier for Account object (default to null)
            var fileName = xero-dev.jpg;  // String | Name of the attachment (default to null)
            var contentType = image/jpg;  // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

            try
            {
                // Retrieves an attachment for a specific account by filename
                File result = apiInstance.getAccountAttachmentByFileName(xeroTenantId, accountID, fileName, contentType);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getAccountAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$accountID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getAccountAttachmentByFileName($xeroTenantId, $accountID, $fileName, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getAccountAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $accountID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Account object
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getAccountAttachmentByFileName(xeroTenantId => $xeroTenantId, accountID => $accountID, fileName => $fileName, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getAccountAttachmentByFileName: $@\n";
}
# 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_get_account_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    accountID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    contentType = 'image/jpg'
    
    try:
        api_response = api_instance.get_account_attachment_by_file_name(xeroTenantId, accountID, fileName, contentType)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getAccountAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let accountID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getAccountAttachmentByFileName(xeroTenantId, accountID, fileName, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
AccountID*
UUID (uuid)
Unique identifier for Account object
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getAccountAttachmentById

Retrieves a specific attachment from a specific account using a unique attachment Id


/Accounts/{AccountID}/Attachments/{AttachmentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Accounts/{AccountID}/Attachments/{AttachmentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID accountID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID attachmentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String contentType = "image/jpg";

        try {
            ByteArrayInputStream result = apiInstance.getAccountAttachmentById(accessToken, xeroTenantId, accountID, attachmentID, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getAccountAttachmentById");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID accountID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Account object
        UUID attachmentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Attachment object
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getAccountAttachmentById(xeroTenantId, accountID, attachmentID, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getAccountAttachmentById");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *accountID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Account object (default to null)
UUID *attachmentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Attachment object (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment from a specific account using a unique attachment Id
[apiInstance getAccountAttachmentByIdWith:xeroTenantId
    accountID:accountID
    attachmentID:attachmentID
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const accountID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for Account object
const attachmentID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for Attachment object
const contentType = "image/jpg";  // {String} The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

try {
  const response = await xero.accountingApi.getAccountAttachmentById(xeroTenantId, accountID, attachmentID, contentType);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getAccountAttachmentByIdExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var accountID = new UUID(); // UUID | Unique identifier for Account object (default to null)
            var attachmentID = new UUID(); // UUID | Unique identifier for Attachment object (default to null)
            var contentType = image/jpg;  // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

            try
            {
                // Retrieves a specific attachment from a specific account using a unique attachment Id
                File result = apiInstance.getAccountAttachmentById(xeroTenantId, accountID, attachmentID, contentType);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getAccountAttachmentById: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$accountID = "00000000-0000-0000-0000-000000000000";
$attachmentID = "00000000-0000-0000-0000-000000000000";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getAccountAttachmentById($xeroTenantId, $accountID, $attachmentID, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getAccountAttachmentById: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $accountID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Account object
my $attachmentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Attachment object
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getAccountAttachmentById(xeroTenantId => $xeroTenantId, accountID => $accountID, attachmentID => $attachmentID, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getAccountAttachmentById: $@\n";
}
# 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_get_account_attachment_by_id():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    accountID = '00000000-0000-0000-0000-000000000000'
    attachmentID = '00000000-0000-0000-0000-000000000000'
    contentType = 'image/jpg'
    
    try:
        api_response = api_instance.get_account_attachment_by_id(xeroTenantId, accountID, attachmentID, contentType)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getAccountAttachmentById: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let accountID = 00000000-0000-0000-0000-000000000000; // UUID
    let attachmentID = 00000000-0000-0000-0000-000000000000; // UUID
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getAccountAttachmentById(xeroTenantId, accountID, attachmentID, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
AccountID*
UUID (uuid)
Unique identifier for Account object
Required
AttachmentID*
UUID (uuid)
Unique identifier for Attachment object
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getAccountAttachments

Retrieves attachments for a specific accounts by using a unique account Id


/Accounts/{AccountID}/Attachments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Accounts/{AccountID}/Attachments"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID accountID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Attachments result = apiInstance.getAccountAttachments(accessToken, xeroTenantId, accountID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getAccountAttachments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID accountID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Account object
        try {
            Attachments result = apiInstance.getAccountAttachments(xeroTenantId, accountID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getAccountAttachments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *accountID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Account object (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves attachments for a specific accounts by using a unique account Id
[apiInstance getAccountAttachmentsWith:xeroTenantId
    accountID:accountID
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const accountID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for Account object

try {
  const response = await xero.accountingApi.getAccountAttachments(xeroTenantId, accountID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getAccountAttachmentsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var accountID = new UUID(); // UUID | Unique identifier for Account object (default to null)

            try
            {
                // Retrieves attachments for a specific accounts by using a unique account Id
                Attachments result = apiInstance.getAccountAttachments(xeroTenantId, accountID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getAccountAttachments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$accountID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getAccountAttachments($xeroTenantId, $accountID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getAccountAttachments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $accountID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Account object

eval { 
    my $result = $api_instance->getAccountAttachments(xeroTenantId => $xeroTenantId, accountID => $accountID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getAccountAttachments: $@\n";
}
# 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_get_account_attachments():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    accountID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_account_attachments(xeroTenantId, accountID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getAccountAttachments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let accountID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getAccountAttachments(xeroTenantId, accountID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
AccountID*
UUID (uuid)
Unique identifier for Account object
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getAccounts

Retrieves the full chart of accounts


/Accounts

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Accounts?where=Status=="ACTIVE" AND Type=="BANK"&order=Name ASC"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = "Status=="ACTIVE" AND Type=="BANK"";
        String order = "Name ASC";

        try {
            Accounts result = apiInstance.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, order);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getAccounts");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = Status=="ACTIVE" AND Type=="BANK"; // String | Filter by an any element
        String order = Name ASC; // String | Order by an any element
        try {
            Accounts result = apiInstance.getAccounts(xeroTenantId, ifModifiedSince, where, order);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getAccounts");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = Status=="ACTIVE" AND Type=="BANK"; // Filter by an any element (optional) (default to null)
String *order = Name ASC; // Order by an any element (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves the full chart of accounts
[apiInstance getAccountsWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
              completionHandler: ^(Accounts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="ACTIVE" AND Type=="BANK"';  // {String} Filter by an any element

const order = 'Name ASC';  // {String} Order by an any element


try {
  const response = await xero.accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getAccountsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var ifModifiedSince = 2020-02-06T12:17:43.202-08:00;  // Date | Only records created or modified since this timestamp will be returned (optional)  (default to null)
            var where = Status=="ACTIVE" AND Type=="BANK";  // String | Filter by an any element (optional)  (default to null)
            var order = Name ASC;  // String | Order by an any element (optional)  (default to null)

            try
            {
                // Retrieves the full chart of accounts
                Accounts result = apiInstance.getAccounts(xeroTenantId, ifModifiedSince, where, order);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getAccounts: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\Account::STATUS_ACTIVE . '"";
$order = "Name ASC";

try {
  $result = $apiInstance->getAccounts($xeroTenantId, $ifModifiedSince, $where, $order);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getAccounts: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = Status=="ACTIVE" AND Type=="BANK"; # String | Filter by an any element
my $order = Name ASC; # String | Order by an any element

eval { 
    my $result = $api_instance->getAccounts(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getAccounts: $@\n";
}
# 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_get_accounts():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    ifModifiedSince = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'Status=="ACTIVE" AND Type=="BANK"'
    order = 'Name ASC'
    
    try:
        api_response = api_instance.get_accounts(xeroTenantId, ifModifiedSince, where, order)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getAccounts: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = Status=="ACTIVE" AND Type=="BANK"; // String
    let order = Name ASC; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getAccounts(xeroTenantId, ifModifiedSince, where, order, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element

getBankTransaction

Retrieves a single spent or received money transaction by using a unique bank transaction Id


/BankTransactions/{BankTransactionID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransactions/{BankTransactionID}?unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID bankTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Integer unitdp = 4;

        try {
            BankTransactions result = apiInstance.getBankTransaction(accessToken, xeroTenantId, bankTransactionID, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransaction");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transaction
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            BankTransactions result = apiInstance.getBankTransaction(xeroTenantId, bankTransactionID, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransaction");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransactionID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transaction (default to null)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a single spent or received money transaction by using a unique bank transaction Id
[apiInstance getBankTransactionWith:xeroTenantId
    bankTransactionID:bankTransactionID
    unitdp:unitdp
              completionHandler: ^(BankTransactions output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const bankTransactionID = "00000000-0000-0000-0000-000000000000";  // {UUID} Xero generated unique identifier for a bank transaction

const unitdp = 4;  // {Integer} e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts


try {
  const response = await xero.accountingApi.getBankTransaction(xeroTenantId, bankTransactionID,  unitdp);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getBankTransactionExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var bankTransactionID = new UUID(); // UUID | Xero generated unique identifier for a bank transaction (default to null)
            var unitdp = 4;  // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)  (default to null)

            try
            {
                // Retrieves a single spent or received money transaction by using a unique bank transaction Id
                BankTransactions result = apiInstance.getBankTransaction(xeroTenantId, bankTransactionID, unitdp);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getBankTransaction: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransactionID = "00000000-0000-0000-0000-000000000000";
$unitdp = 4;

try {
  $result = $apiInstance->getBankTransaction($xeroTenantId, $bankTransactionID, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBankTransaction: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transaction
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->getBankTransaction(xeroTenantId => $xeroTenantId, bankTransactionID => $bankTransactionID, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBankTransaction: $@\n";
}
# 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_get_bank_transaction():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    bankTransactionID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_bank_transaction(xeroTenantId, bankTransactionID, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransaction: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getBankTransaction(xeroTenantId, bankTransactionID, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
BankTransactionID*
UUID (uuid)
Xero generated unique identifier for a bank transaction
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

getBankTransactionAttachmentByFileName

Retrieves a specific attachment from a specific bank transaction by filename


/BankTransactions/{BankTransactionID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransactions/{BankTransactionID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID bankTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        String contentType = "image/jpg";

        try {
            ByteArrayInputStream result = apiInstance.getBankTransactionAttachmentByFileName(accessToken, xeroTenantId, bankTransactionID, fileName, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransactionAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transaction
        String fileName = xero-dev.jpg; // String | The name of the file being attached
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransactionAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransactionID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transaction (default to null)
String *fileName = xero-dev.jpg; // The name of the file being attached (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment from a specific bank transaction by filename
[apiInstance getBankTransactionAttachmentByFileNameWith:xeroTenantId
    bankTransactionID:bankTransactionID
    fileName:fileName
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const bankTransactionID = "00000000-0000-0000-0000-000000000000";  // {UUID} Xero generated unique identifier for a bank transaction
const fileName = "xero-dev.jpg";  // {String} The name of the file being attached
const contentType = "image/jpg";  // {String} The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

try {
  const response = await xero.accountingApi.getBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, contentType);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getBankTransactionAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var bankTransactionID = new UUID(); // UUID | Xero generated unique identifier for a bank transaction (default to null)
            var fileName = xero-dev.jpg;  // String | The name of the file being attached (default to null)
            var contentType = image/jpg;  // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

            try
            {
                // Retrieves a specific attachment from a specific bank transaction by filename
                File result = apiInstance.getBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, contentType);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getBankTransactionAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransactionID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getBankTransactionAttachmentByFileName($xeroTenantId, $bankTransactionID, $fileName, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBankTransactionAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transaction
my $fileName = xero-dev.jpg; # String | The name of the file being attached
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getBankTransactionAttachmentByFileName(xeroTenantId => $xeroTenantId, bankTransactionID => $bankTransactionID, fileName => $fileName, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBankTransactionAttachmentByFileName: $@\n";
}
# 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_get_bank_transaction_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    bankTransactionID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    contentType = 'image/jpg'
    
    try:
        api_response = api_instance.get_bank_transaction_attachment_by_file_name(xeroTenantId, bankTransactionID, fileName, contentType)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransactionAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
BankTransactionID*
UUID (uuid)
Xero generated unique identifier for a bank transaction
Required
FileName*
String
The name of the file being attached
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getBankTransactionAttachmentById

Retrieves specific attachments from a specific BankTransaction using a unique attachment Id


/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID bankTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID attachmentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String contentType = "image/jpg";

        try {
            ByteArrayInputStream result = apiInstance.getBankTransactionAttachmentById(accessToken, xeroTenantId, bankTransactionID, attachmentID, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransactionAttachmentById");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transaction
        UUID attachmentID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for an attachment
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getBankTransactionAttachmentById(xeroTenantId, bankTransactionID, attachmentID, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransactionAttachmentById");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransactionID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transaction (default to null)
UUID *attachmentID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for an attachment (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves specific attachments from a specific BankTransaction using a unique attachment Id
[apiInstance getBankTransactionAttachmentByIdWith:xeroTenantId
    bankTransactionID:bankTransactionID
    attachmentID:attachmentID
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const bankTransactionID = "00000000-0000-0000-0000-000000000000";  // {UUID} Xero generated unique identifier for a bank transaction
const attachmentID = "00000000-0000-0000-0000-000000000000";  // {UUID} Xero generated unique identifier for an attachment
const contentType = "image/jpg";  // {String} The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

try {
  const response = await xero.accountingApi.getBankTransactionAttachmentById(xeroTenantId, bankTransactionID, attachmentID, contentType);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getBankTransactionAttachmentByIdExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var bankTransactionID = new UUID(); // UUID | Xero generated unique identifier for a bank transaction (default to null)
            var attachmentID = new UUID(); // UUID | Xero generated unique identifier for an attachment (default to null)
            var contentType = image/jpg;  // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

            try
            {
                // Retrieves specific attachments from a specific BankTransaction using a unique attachment Id
                File result = apiInstance.getBankTransactionAttachmentById(xeroTenantId, bankTransactionID, attachmentID, contentType);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getBankTransactionAttachmentById: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransactionID = "00000000-0000-0000-0000-000000000000";
$attachmentID = "00000000-0000-0000-0000-000000000000";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getBankTransactionAttachmentById($xeroTenantId, $bankTransactionID, $attachmentID, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBankTransactionAttachmentById: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transaction
my $attachmentID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for an attachment
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getBankTransactionAttachmentById(xeroTenantId => $xeroTenantId, bankTransactionID => $bankTransactionID, attachmentID => $attachmentID, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBankTransactionAttachmentById: $@\n";
}
# 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_get_bank_transaction_attachment_by_id():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    bankTransactionID = '00000000-0000-0000-0000-000000000000'
    attachmentID = '00000000-0000-0000-0000-000000000000'
    contentType = 'image/jpg'
    
    try:
        api_response = api_instance.get_bank_transaction_attachment_by_id(xeroTenantId, bankTransactionID, attachmentID, contentType)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransactionAttachmentById: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID
    let attachmentID = 00000000-0000-0000-0000-000000000000; // UUID
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getBankTransactionAttachmentById(xeroTenantId, bankTransactionID, attachmentID, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
BankTransactionID*
UUID (uuid)
Xero generated unique identifier for a bank transaction
Required
AttachmentID*
UUID (uuid)
Xero generated unique identifier for an attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getBankTransactionAttachments

Retrieves any attachments from a specific bank transactions


/BankTransactions/{BankTransactionID}/Attachments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransactions/{BankTransactionID}/Attachments"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID bankTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Attachments result = apiInstance.getBankTransactionAttachments(accessToken, xeroTenantId, bankTransactionID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransactionAttachments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transaction
        try {
            Attachments result = apiInstance.getBankTransactionAttachments(xeroTenantId, bankTransactionID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransactionAttachments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransactionID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transaction (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves any attachments from a specific bank transactions
[apiInstance getBankTransactionAttachmentsWith:xeroTenantId
    bankTransactionID:bankTransactionID
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const bankTransactionID = "00000000-0000-0000-0000-000000000000";  // {UUID} Xero generated unique identifier for a bank transaction

try {
  const response = await xero.accountingApi.getBankTransactionAttachments(xeroTenantId, bankTransactionID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getBankTransactionAttachmentsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var bankTransactionID = new UUID(); // UUID | Xero generated unique identifier for a bank transaction (default to null)

            try
            {
                // Retrieves any attachments from a specific bank transactions
                Attachments result = apiInstance.getBankTransactionAttachments(xeroTenantId, bankTransactionID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getBankTransactionAttachments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransactionID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getBankTransactionAttachments($xeroTenantId, $bankTransactionID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBankTransactionAttachments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transaction

eval { 
    my $result = $api_instance->getBankTransactionAttachments(xeroTenantId => $xeroTenantId, bankTransactionID => $bankTransactionID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBankTransactionAttachments: $@\n";
}
# 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_get_bank_transaction_attachments():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    bankTransactionID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_bank_transaction_attachments(xeroTenantId, bankTransactionID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransactionAttachments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getBankTransactionAttachments(xeroTenantId, bankTransactionID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
BankTransactionID*
UUID (uuid)
Xero generated unique identifier for a bank transaction
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getBankTransactions

Retrieves any spent or received money transactions


/BankTransactions

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransactions?where=Status=="AUTHORISED"&order=Type ASC&page=1&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = "Status=="AUTHORISED"";
        String order = "Type ASC";
        Integer page = 1;
        Integer unitdp = 4;

        try {
            BankTransactions result = apiInstance.getBankTransactions(accessToken, xeroTenantId, ifModifiedSince, where, order, page, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransactions");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = Status=="AUTHORISED"; // String | Filter by an any element
        String order = Type ASC; // String | Order by an any element
        Integer page = 1; // Integer | Up to 100 bank transactions will be returned in a single API call with line items details
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            BankTransactions result = apiInstance.getBankTransactions(xeroTenantId, ifModifiedSince, where, order, page, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransactions");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = Status=="AUTHORISED"; // Filter by an any element (optional) (default to null)
String *order = Type ASC; // Order by an any element (optional) (default to null)
Integer *page = 1; // Up to 100 bank transactions will be returned in a single API call with line items details (optional) (default to null)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves any spent or received money transactions
[apiInstance getBankTransactionsWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
    page:page
    unitdp:unitdp
              completionHandler: ^(BankTransactions output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="AUTHORISED"';  // {String} Filter by an any element

const order = 'Type ASC';  // {String} Order by an any element

const page = 1;  // {Integer} Up to 100 bank transactions will be returned in a single API call with line items details

const unitdp = 4;  // {Integer} e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts


try {
  const response = await xero.accountingApi.getBankTransactions(xeroTenantId, ifModifiedSince, where, order, page, unitdp);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getBankTransactionsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var ifModifiedSince = 2020-02-06T12:17:43.202-08:00;  // Date | Only records created or modified since this timestamp will be returned (optional)  (default to null)
            var where = Status=="AUTHORISED";  // String | Filter by an any element (optional)  (default to null)
            var order = Type ASC;  // String | Order by an any element (optional)  (default to null)
            var page = 1;  // Integer | Up to 100 bank transactions will be returned in a single API call with line items details (optional)  (default to null)
            var unitdp = 4;  // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)  (default to null)

            try
            {
                // Retrieves any spent or received money transactions
                BankTransactions result = apiInstance.getBankTransactions(xeroTenantId, ifModifiedSince, where, order, page, unitdp);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getBankTransactions: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "Status=="' . XeroAPI\XeroPHP\Models\Accounting\BankTransaction::STATUS_AUTHORISED . '"";
$order = "Type ASC";
$page = 1;
$unitdp = 4;

try {
  $result = $apiInstance->getBankTransactions($xeroTenantId, $ifModifiedSince, $where, $order, $page, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBankTransactions: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = Status=="AUTHORISED"; # String | Filter by an any element
my $order = Type ASC; # String | Order by an any element
my $page = 1; # Integer | Up to 100 bank transactions will be returned in a single API call with line items details
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->getBankTransactions(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order, page => $page, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBankTransactions: $@\n";
}
# 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_get_bank_transactions():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    ifModifiedSince = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'Status=="AUTHORISED"'
    order = 'Type ASC'
    
    try:
        api_response = api_instance.get_bank_transactions(xeroTenantId, ifModifiedSince, where, order, page, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransactions: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = Status=="AUTHORISED"; // String
    let order = Type ASC; // String
    let page = 1; // Integer
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getBankTransactions(xeroTenantId, ifModifiedSince, where, order, page, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element
page
Integer
Up to 100 bank transactions will be returned in a single API call with line items details
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

getBankTransactionsHistory

Retrieves history from a specific bank transaction using a unique bank transaction Id


/BankTransactions/{BankTransactionID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransactions/{BankTransactionID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID bankTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getBankTransactionsHistory(accessToken, xeroTenantId, bankTransactionID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransactionsHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transaction
        try {
            HistoryRecords result = apiInstance.getBankTransactionsHistory(xeroTenantId, bankTransactionID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransactionsHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransactionID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transaction (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history from a specific bank transaction using a unique bank transaction Id
[apiInstance getBankTransactionsHistoryWith:xeroTenantId
    bankTransactionID:bankTransactionID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const bankTransactionID = "00000000-0000-0000-0000-000000000000";  // {UUID} Xero generated unique identifier for a bank transaction

try {
  const response = await xero.accountingApi.getBankTransactionsHistory(xeroTenantId, bankTransactionID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getBankTransactionsHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var bankTransactionID = new UUID(); // UUID | Xero generated unique identifier for a bank transaction (default to null)

            try
            {
                // Retrieves history from a specific bank transaction using a unique bank transaction Id
                HistoryRecords result = apiInstance.getBankTransactionsHistory(xeroTenantId, bankTransactionID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getBankTransactionsHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransactionID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getBankTransactionsHistory($xeroTenantId, $bankTransactionID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBankTransactionsHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transaction

eval { 
    my $result = $api_instance->getBankTransactionsHistory(xeroTenantId => $xeroTenantId, bankTransactionID => $bankTransactionID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBankTransactionsHistory: $@\n";
}
# 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_get_bank_transactions_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    bankTransactionID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_bank_transactions_history(xeroTenantId, bankTransactionID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransactionsHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getBankTransactionsHistory(xeroTenantId, bankTransactionID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
BankTransactionID*
UUID (uuid)
Xero generated unique identifier for a bank transaction
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getBankTransfer

Retrieves specific bank transfers by using a unique bank transfer Id


/BankTransfers/{BankTransferID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransfers/{BankTransferID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID bankTransferID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            BankTransfers result = apiInstance.getBankTransfer(accessToken, xeroTenantId, bankTransferID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransfer");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transfer
        try {
            BankTransfers result = apiInstance.getBankTransfer(xeroTenantId, bankTransferID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransfer");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransferID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transfer (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves specific bank transfers by using a unique bank transfer Id
[apiInstance getBankTransferWith:xeroTenantId
    bankTransferID:bankTransferID
              completionHandler: ^(BankTransfers output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const bankTransferID = "00000000-0000-0000-0000-000000000000";  // {UUID} Xero generated unique identifier for a bank transfer

try {
  const response = await xero.accountingApi.getBankTransfer(xeroTenantId, bankTransferID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getBankTransferExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var bankTransferID = new UUID(); // UUID | Xero generated unique identifier for a bank transfer (default to null)

            try
            {
                // Retrieves specific bank transfers by using a unique bank transfer Id
                BankTransfers result = apiInstance.getBankTransfer(xeroTenantId, bankTransferID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getBankTransfer: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransferID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getBankTransfer($xeroTenantId, $bankTransferID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBankTransfer: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransferID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transfer

eval { 
    my $result = $api_instance->getBankTransfer(xeroTenantId => $xeroTenantId, bankTransferID => $bankTransferID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBankTransfer: $@\n";
}
# 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_get_bank_transfer():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    bankTransferID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_bank_transfer(xeroTenantId, bankTransferID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransfer: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getBankTransfer(xeroTenantId, bankTransferID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
BankTransferID*
UUID (uuid)
Xero generated unique identifier for a bank transfer
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getBankTransferAttachmentByFileName

Retrieves a specific attachment on a specific bank transfer by file name


/BankTransfers/{BankTransferID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransfers/{BankTransferID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID bankTransferID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        String contentType = "image/jpg";

        try {
            ByteArrayInputStream result = apiInstance.getBankTransferAttachmentByFileName(accessToken, xeroTenantId, bankTransferID, fileName, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransferAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transfer
        String fileName = xero-dev.jpg; // String | The name of the file being attached to a Bank Transfer
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getBankTransferAttachmentByFileName(xeroTenantId, bankTransferID, fileName, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransferAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransferID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transfer (default to null)
String *fileName = xero-dev.jpg; // The name of the file being attached to a Bank Transfer (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment on a specific bank transfer by file name
[apiInstance getBankTransferAttachmentByFileNameWith:xeroTenantId
    bankTransferID:bankTransferID
    fileName:fileName
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const bankTransferID = "00000000-0000-0000-0000-000000000000";  // {UUID} Xero generated unique identifier for a bank transfer
const fileName = "xero-dev.jpg";  // {String} The name of the file being attached to a Bank Transfer
const contentType = "image/jpg";  // {String} The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

try {
  const response = await xero.accountingApi.getBankTransferAttachmentByFileName(xeroTenantId, bankTransferID, fileName, contentType);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getBankTransferAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var bankTransferID = new UUID(); // UUID | Xero generated unique identifier for a bank transfer (default to null)
            var fileName = xero-dev.jpg;  // String | The name of the file being attached to a Bank Transfer (default to null)
            var contentType = image/jpg;  // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

            try
            {
                // Retrieves a specific attachment on a specific bank transfer by file name
                File result = apiInstance.getBankTransferAttachmentByFileName(xeroTenantId, bankTransferID, fileName, contentType);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getBankTransferAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransferID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getBankTransferAttachmentByFileName($xeroTenantId, $bankTransferID, $fileName, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBankTransferAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransferID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transfer
my $fileName = xero-dev.jpg; # String | The name of the file being attached to a Bank Transfer
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getBankTransferAttachmentByFileName(xeroTenantId => $xeroTenantId, bankTransferID => $bankTransferID, fileName => $fileName, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBankTransferAttachmentByFileName: $@\n";
}
# 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_get_bank_transfer_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    bankTransferID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    contentType = 'image/jpg'
    
    try:
        api_response = api_instance.get_bank_transfer_attachment_by_file_name(xeroTenantId, bankTransferID, fileName, contentType)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransferAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getBankTransferAttachmentByFileName(xeroTenantId, bankTransferID, fileName, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
BankTransferID*
UUID (uuid)
Xero generated unique identifier for a bank transfer
Required
FileName*
String
The name of the file being attached to a Bank Transfer
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getBankTransferAttachmentById

Retrieves a specific attachment from a specific bank transfer using a unique attachment ID


/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID bankTransferID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID attachmentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String contentType = "image/jpg";

        try {
            ByteArrayInputStream result = apiInstance.getBankTransferAttachmentById(accessToken, xeroTenantId, bankTransferID, attachmentID, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransferAttachmentById");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transfer
        UUID attachmentID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for an Attachment to a bank transfer
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getBankTransferAttachmentById(xeroTenantId, bankTransferID, attachmentID, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransferAttachmentById");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransferID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transfer (default to null)
UUID *attachmentID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for an Attachment to a bank transfer (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment from a specific bank transfer using a unique attachment ID
[apiInstance getBankTransferAttachmentByIdWith:xeroTenantId
    bankTransferID:bankTransferID
    attachmentID:attachmentID
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const bankTransferID = "00000000-0000-0000-0000-000000000000";  // {UUID} Xero generated unique identifier for a bank transfer
const attachmentID = "00000000-0000-0000-0000-000000000000";  // {UUID} Xero generated unique identifier for an Attachment to a bank transfer
const contentType = "image/jpg";  // {String} The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

try {
  const response = await xero.accountingApi.getBankTransferAttachmentById(xeroTenantId, bankTransferID, attachmentID, contentType);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getBankTransferAttachmentByIdExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var bankTransferID = new UUID(); // UUID | Xero generated unique identifier for a bank transfer (default to null)
            var attachmentID = new UUID(); // UUID | Xero generated unique identifier for an Attachment to a bank transfer (default to null)
            var contentType = image/jpg;  // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

            try
            {
                // Retrieves a specific attachment from a specific bank transfer using a unique attachment ID
                File result = apiInstance.getBankTransferAttachmentById(xeroTenantId, bankTransferID, attachmentID, contentType);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getBankTransferAttachmentById: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransferID = "00000000-0000-0000-0000-000000000000";
$attachmentID = "00000000-0000-0000-0000-000000000000";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getBankTransferAttachmentById($xeroTenantId, $bankTransferID, $attachmentID, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBankTransferAttachmentById: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransferID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transfer
my $attachmentID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for an Attachment to a bank transfer
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getBankTransferAttachmentById(xeroTenantId => $xeroTenantId, bankTransferID => $bankTransferID, attachmentID => $attachmentID, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBankTransferAttachmentById: $@\n";
}
# 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_get_bank_transfer_attachment_by_id():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    bankTransferID = '00000000-0000-0000-0000-000000000000'
    attachmentID = '00000000-0000-0000-0000-000000000000'
    contentType = 'image/jpg'
    
    try:
        api_response = api_instance.get_bank_transfer_attachment_by_id(xeroTenantId, bankTransferID, attachmentID, contentType)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransferAttachmentById: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID
    let attachmentID = 00000000-0000-0000-0000-000000000000; // UUID
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getBankTransferAttachmentById(xeroTenantId, bankTransferID, attachmentID, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
BankTransferID*
UUID (uuid)
Xero generated unique identifier for a bank transfer
Required
AttachmentID*
UUID (uuid)
Xero generated unique identifier for an Attachment to a bank transfer
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getBankTransferAttachments

Retrieves attachments from a specific bank transfer


/BankTransfers/{BankTransferID}/Attachments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransfers/{BankTransferID}/Attachments"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID bankTransferID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Attachments result = apiInstance.getBankTransferAttachments(accessToken, xeroTenantId, bankTransferID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransferAttachments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transfer
        try {
            Attachments result = apiInstance.getBankTransferAttachments(xeroTenantId, bankTransferID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransferAttachments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransferID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transfer (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves attachments from a specific bank transfer
[apiInstance getBankTransferAttachmentsWith:xeroTenantId
    bankTransferID:bankTransferID
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const bankTransferID = "00000000-0000-0000-0000-000000000000";  // {UUID} Xero generated unique identifier for a bank transfer

try {
  const response = await xero.accountingApi.getBankTransferAttachments(xeroTenantId, bankTransferID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getBankTransferAttachmentsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var bankTransferID = new UUID(); // UUID | Xero generated unique identifier for a bank transfer (default to null)

            try
            {
                // Retrieves attachments from a specific bank transfer
                Attachments result = apiInstance.getBankTransferAttachments(xeroTenantId, bankTransferID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getBankTransferAttachments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransferID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getBankTransferAttachments($xeroTenantId, $bankTransferID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBankTransferAttachments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransferID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transfer

eval { 
    my $result = $api_instance->getBankTransferAttachments(xeroTenantId => $xeroTenantId, bankTransferID => $bankTransferID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBankTransferAttachments: $@\n";
}
# 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_get_bank_transfer_attachments():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    bankTransferID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_bank_transfer_attachments(xeroTenantId, bankTransferID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransferAttachments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getBankTransferAttachments(xeroTenantId, bankTransferID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
BankTransferID*
UUID (uuid)
Xero generated unique identifier for a bank transfer
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getBankTransferHistory

Retrieves history from a specific bank transfer using a unique bank transfer Id


/BankTransfers/{BankTransferID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransfers/{BankTransferID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID bankTransferID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getBankTransferHistory(accessToken, xeroTenantId, bankTransferID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransferHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transfer
        try {
            HistoryRecords result = apiInstance.getBankTransferHistory(xeroTenantId, bankTransferID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransferHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransferID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transfer (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history from a specific bank transfer using a unique bank transfer Id
[apiInstance getBankTransferHistoryWith:xeroTenantId
    bankTransferID:bankTransferID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const bankTransferID = "00000000-0000-0000-0000-000000000000";  // {UUID} Xero generated unique identifier for a bank transfer

try {
  const response = await xero.accountingApi.getBankTransferHistory(xeroTenantId, bankTransferID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getBankTransferHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var bankTransferID = new UUID(); // UUID | Xero generated unique identifier for a bank transfer (default to null)

            try
            {
                // Retrieves history from a specific bank transfer using a unique bank transfer Id
                HistoryRecords result = apiInstance.getBankTransferHistory(xeroTenantId, bankTransferID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getBankTransferHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransferID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getBankTransferHistory($xeroTenantId, $bankTransferID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBankTransferHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransferID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transfer

eval { 
    my $result = $api_instance->getBankTransferHistory(xeroTenantId => $xeroTenantId, bankTransferID => $bankTransferID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBankTransferHistory: $@\n";
}
# 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_get_bank_transfer_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    bankTransferID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_bank_transfer_history(xeroTenantId, bankTransferID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransferHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getBankTransferHistory(xeroTenantId, bankTransferID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
BankTransferID*
UUID (uuid)
Xero generated unique identifier for a bank transfer
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getBankTransfers

Retrieves all bank transfers


/BankTransfers

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransfers?where=HasAttachments==true&order=Amount ASC"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = "HasAttachments==true";
        String order = "Amount ASC";

        try {
            BankTransfers result = apiInstance.getBankTransfers(accessToken, xeroTenantId, ifModifiedSince, where, order);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransfers");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = HasAttachments==true; // String | Filter by an any element
        String order = Amount ASC; // String | Order by an any element
        try {
            BankTransfers result = apiInstance.getBankTransfers(xeroTenantId, ifModifiedSince, where, order);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransfers");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = HasAttachments==true; // Filter by an any element (optional) (default to null)
String *order = Amount ASC; // Order by an any element (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves all bank transfers
[apiInstance getBankTransfersWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
              completionHandler: ^(BankTransfers output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'HasAttachments==true';  // {String} Filter by an any element

const order = 'Amount ASC';  // {String} Order by an any element


try {
  const response = await xero.accountingApi.getBankTransfers(xeroTenantId, ifModifiedSince, where, order);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getBankTransfersExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var ifModifiedSince = 2020-02-06T12:17:43.202-08:00;  // Date | Only records created or modified since this timestamp will be returned (optional)  (default to null)
            var where = HasAttachments==true;  // String | Filter by an any element (optional)  (default to null)
            var order = Amount ASC;  // String | Order by an any element (optional)  (default to null)

            try
            {
                // Retrieves all bank transfers
                BankTransfers result = apiInstance.getBankTransfers(xeroTenantId, ifModifiedSince, where, order);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getBankTransfers: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "HasAttachments==true";
$order = "Amount ASC";

try {
  $result = $apiInstance->getBankTransfers($xeroTenantId, $ifModifiedSince, $where, $order);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBankTransfers: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = HasAttachments==true; # String | Filter by an any element
my $order = Amount ASC; # String | Order by an any element

eval { 
    my $result = $api_instance->getBankTransfers(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBankTransfers: $@\n";
}
# 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_get_bank_transfers():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    ifModifiedSince = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'HasAttachments==true'
    order = 'Amount ASC'
    
    try:
        api_response = api_instance.get_bank_transfers(xeroTenantId, ifModifiedSince, where, order)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransfers: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = HasAttachments==true; // String
    let order = Amount ASC; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getBankTransfers(xeroTenantId, ifModifiedSince, where, order, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element

getBatchPaymentHistory

Retrieves history from a specific batch payment


/BatchPayments/{BatchPaymentID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BatchPayments/{BatchPaymentID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID batchPaymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getBatchPaymentHistory(accessToken, xeroTenantId, batchPaymentID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBatchPaymentHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID batchPaymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for BatchPayment
        try {
            HistoryRecords result = apiInstance.getBatchPaymentHistory(xeroTenantId, batchPaymentID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBatchPaymentHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *batchPaymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for BatchPayment (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history from a specific batch payment
[apiInstance getBatchPaymentHistoryWith:xeroTenantId
    batchPaymentID:batchPaymentID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const batchPaymentID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for BatchPayment

try {
  const response = await xero.accountingApi.getBatchPaymentHistory(xeroTenantId, batchPaymentID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getBatchPaymentHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var batchPaymentID = new UUID(); // UUID | Unique identifier for BatchPayment (default to null)

            try
            {
                // Retrieves history from a specific batch payment
                HistoryRecords result = apiInstance.getBatchPaymentHistory(xeroTenantId, batchPaymentID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getBatchPaymentHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$batchPaymentID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getBatchPaymentHistory($xeroTenantId, $batchPaymentID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBatchPaymentHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $batchPaymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for BatchPayment

eval { 
    my $result = $api_instance->getBatchPaymentHistory(xeroTenantId => $xeroTenantId, batchPaymentID => $batchPaymentID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBatchPaymentHistory: $@\n";
}
# 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_get_batch_payment_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    batchPaymentID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_batch_payment_history(xeroTenantId, batchPaymentID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBatchPaymentHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let batchPaymentID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getBatchPaymentHistory(xeroTenantId, batchPaymentID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
BatchPaymentID*
UUID (uuid)
Unique identifier for BatchPayment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getBatchPayments

Retrieves either one or many batch payments for invoices


/BatchPayments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BatchPayments?where=Status=="AUTHORISED"&order=Date ASC"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = "Status=="AUTHORISED"";
        String order = "Date ASC";

        try {
            BatchPayments result = apiInstance.getBatchPayments(accessToken, xeroTenantId, ifModifiedSince, where, order);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBatchPayments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = Status=="AUTHORISED"; // String | Filter by an any element
        String order = Date ASC; // String | Order by an any element
        try {
            BatchPayments result = apiInstance.getBatchPayments(xeroTenantId, ifModifiedSince, where, order);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBatchPayments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = Status=="AUTHORISED"; // Filter by an any element (optional) (default to null)
String *order = Date ASC; // Order by an any element (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves either one or many batch payments for invoices
[apiInstance getBatchPaymentsWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
              completionHandler: ^(BatchPayments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="AUTHORISED"';  // {String} Filter by an any element

const order = 'Date ASC';  // {String} Order by an any element


try {
  const response = await xero.accountingApi.getBatchPayments(xeroTenantId, ifModifiedSince, where, order);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getBatchPaymentsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var ifModifiedSince = 2020-02-06T12:17:43.202-08:00;  // Date | Only records created or modified since this timestamp will be returned (optional)  (default to null)
            var where = Status=="AUTHORISED";  // String | Filter by an any element (optional)  (default to null)
            var order = Date ASC;  // String | Order by an any element (optional)  (default to null)

            try
            {
                // Retrieves either one or many batch payments for invoices
                BatchPayments result = apiInstance.getBatchPayments(xeroTenantId, ifModifiedSince, where, order);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getBatchPayments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "Status=="' . XeroAPI\XeroPHP\Models\Accounting\BatchPayment::STATUS_AUTHORISED . '"";
$order = "Date ASC";

try {
  $result = $apiInstance->getBatchPayments($xeroTenantId, $ifModifiedSince, $where, $order);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBatchPayments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = Status=="AUTHORISED"; # String | Filter by an any element
my $order = Date ASC; # String | Order by an any element

eval { 
    my $result = $api_instance->getBatchPayments(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBatchPayments: $@\n";
}
# 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_get_batch_payments():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    ifModifiedSince = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'Status=="AUTHORISED"'
    order = 'Date ASC'
    
    try:
        api_response = api_instance.get_batch_payments(xeroTenantId, ifModifiedSince, where, order)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBatchPayments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = Status=="AUTHORISED"; // String
    let order = Date ASC; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getBatchPayments(xeroTenantId, ifModifiedSince, where, order, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element

getBrandingTheme

Retrieves a specific branding theme using a unique branding theme Id


/BrandingThemes/{BrandingThemeID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BrandingThemes/{BrandingThemeID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID brandingThemeID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            BrandingThemes result = apiInstance.getBrandingTheme(accessToken, xeroTenantId, brandingThemeID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBrandingTheme");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID brandingThemeID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Branding Theme
        try {
            BrandingThemes result = apiInstance.getBrandingTheme(xeroTenantId, brandingThemeID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBrandingTheme");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *brandingThemeID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Branding Theme (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific branding theme using a unique branding theme Id
[apiInstance getBrandingThemeWith:xeroTenantId
    brandingThemeID:brandingThemeID
              completionHandler: ^(BrandingThemes output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const brandingThemeID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Branding Theme

try {
  const response = await xero.accountingApi.getBrandingTheme(xeroTenantId, brandingThemeID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getBrandingThemeExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var brandingThemeID = new UUID(); // UUID | Unique identifier for a Branding Theme (default to null)

            try
            {
                // Retrieves a specific branding theme using a unique branding theme Id
                BrandingThemes result = apiInstance.getBrandingTheme(xeroTenantId, brandingThemeID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getBrandingTheme: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$brandingThemeID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getBrandingTheme($xeroTenantId, $brandingThemeID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBrandingTheme: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $brandingThemeID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Branding Theme

eval { 
    my $result = $api_instance->getBrandingTheme(xeroTenantId => $xeroTenantId, brandingThemeID => $brandingThemeID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBrandingTheme: $@\n";
}
# 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_get_branding_theme():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    brandingThemeID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_branding_theme(xeroTenantId, brandingThemeID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBrandingTheme: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let brandingThemeID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getBrandingTheme(xeroTenantId, brandingThemeID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Path parameters
Name Description
BrandingThemeID*
UUID (uuid)
Unique identifier for a Branding Theme
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getBrandingThemePaymentServices

Retrieves the payment services for a specific branding theme


/BrandingThemes/{BrandingThemeID}/PaymentServices

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BrandingThemes/{BrandingThemeID}/PaymentServices"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID brandingThemeID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            PaymentServices result = apiInstance.getBrandingThemePaymentServices(accessToken, xeroTenantId, brandingThemeID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBrandingThemePaymentServices");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID brandingThemeID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Branding Theme
        try {
            PaymentServices result = apiInstance.getBrandingThemePaymentServices(xeroTenantId, brandingThemeID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBrandingThemePaymentServices");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *brandingThemeID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Branding Theme (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves the payment services for a specific branding theme
[apiInstance getBrandingThemePaymentServicesWith:xeroTenantId
    brandingThemeID:brandingThemeID
              completionHandler: ^(PaymentServices output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const brandingThemeID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Branding Theme

try {
  const response = await xero.accountingApi.getBrandingThemePaymentServices(xeroTenantId, brandingThemeID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getBrandingThemePaymentServicesExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var brandingThemeID = new UUID(); // UUID | Unique identifier for a Branding Theme (default to null)

            try
            {
                // Retrieves the payment services for a specific branding theme
                PaymentServices result = apiInstance.getBrandingThemePaymentServices(xeroTenantId, brandingThemeID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getBrandingThemePaymentServices: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$brandingThemeID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getBrandingThemePaymentServices($xeroTenantId, $brandingThemeID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBrandingThemePaymentServices: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $brandingThemeID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Branding Theme

eval { 
    my $result = $api_instance->getBrandingThemePaymentServices(xeroTenantId => $xeroTenantId, brandingThemeID => $brandingThemeID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBrandingThemePaymentServices: $@\n";
}
# 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_get_branding_theme_payment_services():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    brandingThemeID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_branding_theme_payment_services(xeroTenantId, brandingThemeID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBrandingThemePaymentServices: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let brandingThemeID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getBrandingThemePaymentServices(xeroTenantId, brandingThemeID, &context).wait();
    println!("{:?}", result);

}

Scopes

paymentservices Grant read-write access to payment services

Parameters

Path parameters
Name Description
BrandingThemeID*
UUID (uuid)
Unique identifier for a Branding Theme
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getBrandingThemes

Retrieves all the branding themes


/BrandingThemes

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BrandingThemes"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";

        try {
            BrandingThemes result = apiInstance.getBrandingThemes(accessToken, xeroTenantId);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBrandingThemes");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        try {
            BrandingThemes result = apiInstance.getBrandingThemes(xeroTenantId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBrandingThemes");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves all the branding themes
[apiInstance getBrandingThemesWith:xeroTenantId
              completionHandler: ^(BrandingThemes output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

try {
  const response = await xero.accountingApi.getBrandingThemes(xeroTenantId);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getBrandingThemesExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)

            try
            {
                // Retrieves all the branding themes
                BrandingThemes result = apiInstance.getBrandingThemes(xeroTenantId);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getBrandingThemes: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

try {
  $result = $apiInstance->getBrandingThemes($xeroTenantId);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBrandingThemes: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant

eval { 
    my $result = $api_instance->getBrandingThemes(xeroTenantId => $xeroTenantId);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBrandingThemes: $@\n";
}
# 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_get_branding_themes():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    
    try:
        api_response = api_instance.get_branding_themes(xeroTenantId)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBrandingThemes: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getBrandingThemes(xeroTenantId, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getContact

Retrieves a specific contacts in a Xero organisation using a unique contact Id


/Contacts/{ContactID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts/{ContactID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID contactID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Contacts result = apiInstance.getContact(accessToken, xeroTenantId, contactID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getContact");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact
        try {
            Contacts result = apiInstance.getContact(xeroTenantId, contactID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getContact");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific contacts in a Xero organisation using a unique contact Id
[apiInstance getContactWith:xeroTenantId
    contactID:contactID
              completionHandler: ^(Contacts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const contactID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Contact

try {
  const response = await xero.accountingApi.getContact(xeroTenantId, contactID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getContactExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var contactID = new UUID(); // UUID | Unique identifier for a Contact (default to null)

            try
            {
                // Retrieves a specific contacts in a Xero organisation using a unique contact Id
                Contacts result = apiInstance.getContact(xeroTenantId, contactID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getContact: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getContact($xeroTenantId, $contactID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getContact: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact

eval { 
    my $result = $api_instance->getContact(xeroTenantId => $xeroTenantId, contactID => $contactID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getContact: $@\n";
}
# 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_get_contact():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    contactID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_contact(xeroTenantId, contactID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getContact: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getContact(xeroTenantId, contactID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts.read Grant read-only access to contacts and contact groups

Parameters

Path parameters
Name Description
ContactID*
UUID (uuid)
Unique identifier for a Contact
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getContactAttachmentByFileName

Retrieves a specific attachment from a specific contact by file name


/Contacts/{ContactID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts/{ContactID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID contactID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        String contentType = "image/jpg";

        try {
            ByteArrayInputStream result = apiInstance.getContactAttachmentByFileName(accessToken, xeroTenantId, contactID, fileName, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getContactAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact
        String fileName = xero-dev.jpg; // String | Name for the file you are attaching
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getContactAttachmentByFileName(xeroTenantId, contactID, fileName, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getContactAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact (default to null)
String *fileName = xero-dev.jpg; // Name for the file you are attaching (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment from a specific contact by file name
[apiInstance getContactAttachmentByFileNameWith:xeroTenantId
    contactID:contactID
    fileName:fileName
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const contactID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Contact
const fileName = "xero-dev.jpg";  // {String} Name for the file you are attaching
const contentType = "image/jpg";  // {String} The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

try {
  const response = await xero.accountingApi.getContactAttachmentByFileName(xeroTenantId, contactID, fileName, contentType);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getContactAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var contactID = new UUID(); // UUID | Unique identifier for a Contact (default to null)
            var fileName = xero-dev.jpg;  // String | Name for the file you are attaching (default to null)
            var contentType = image/jpg;  // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

            try
            {
                // Retrieves a specific attachment from a specific contact by file name
                File result = apiInstance.getContactAttachmentByFileName(xeroTenantId, contactID, fileName, contentType);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getContactAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getContactAttachmentByFileName($xeroTenantId, $contactID, $fileName, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getContactAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact
my $fileName = xero-dev.jpg; # String | Name for the file you are attaching
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getContactAttachmentByFileName(xeroTenantId => $xeroTenantId, contactID => $contactID, fileName => $fileName, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getContactAttachmentByFileName: $@\n";
}
# 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_get_contact_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    contactID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    contentType = 'image/jpg'
    
    try:
        api_response = api_instance.get_contact_attachment_by_file_name(xeroTenantId, contactID, fileName, contentType)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getContactAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getContactAttachmentByFileName(xeroTenantId, contactID, fileName, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
ContactID*
UUID (uuid)
Unique identifier for a Contact
Required
FileName*
String
Name for the file you are attaching
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getContactAttachmentById

Retrieves a specific attachment from a specific contact using a unique attachment Id


/Contacts/{ContactID}/Attachments/{AttachmentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts/{ContactID}/Attachments/{AttachmentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID contactID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID attachmentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String contentType = "image/jpg";

        try {
            ByteArrayInputStream result = apiInstance.getContactAttachmentById(accessToken, xeroTenantId, contactID, attachmentID, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getContactAttachmentById");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact
        UUID attachmentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Attachment
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getContactAttachmentById(xeroTenantId, contactID, attachmentID, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getContactAttachmentById");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact (default to null)
UUID *attachmentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Attachment (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment from a specific contact using a unique attachment Id
[apiInstance getContactAttachmentByIdWith:xeroTenantId
    contactID:contactID
    attachmentID:attachmentID
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const contactID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Contact
const attachmentID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Attachment
const contentType = "image/jpg";  // {String} The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

try {
  const response = await xero.accountingApi.getContactAttachmentById(xeroTenantId, contactID, attachmentID, contentType);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getContactAttachmentByIdExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var contactID = new UUID(); // UUID | Unique identifier for a Contact (default to null)
            var attachmentID = new UUID(); // UUID | Unique identifier for a Attachment (default to null)
            var contentType = image/jpg;  // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

            try
            {
                // Retrieves a specific attachment from a specific contact using a unique attachment Id
                File result = apiInstance.getContactAttachmentById(xeroTenantId, contactID, attachmentID, contentType);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getContactAttachmentById: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactID = "00000000-0000-0000-0000-000000000000";
$attachmentID = "00000000-0000-0000-0000-000000000000";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getContactAttachmentById($xeroTenantId, $contactID, $attachmentID, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getContactAttachmentById: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact
my $attachmentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Attachment
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getContactAttachmentById(xeroTenantId => $xeroTenantId, contactID => $contactID, attachmentID => $attachmentID, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getContactAttachmentById: $@\n";
}
# 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_get_contact_attachment_by_id():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    contactID = '00000000-0000-0000-0000-000000000000'
    attachmentID = '00000000-0000-0000-0000-000000000000'
    contentType = 'image/jpg'
    
    try:
        api_response = api_instance.get_contact_attachment_by_id(xeroTenantId, contactID, attachmentID, contentType)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getContactAttachmentById: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactID = 00000000-0000-0000-0000-000000000000; // UUID
    let attachmentID = 00000000-0000-0000-0000-000000000000; // UUID
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getContactAttachmentById(xeroTenantId, contactID, attachmentID, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
ContactID*
UUID (uuid)
Unique identifier for a Contact
Required
AttachmentID*
UUID (uuid)
Unique identifier for a Attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getContactAttachments

Retrieves attachments for a specific contact in a Xero organisation


/Contacts/{ContactID}/Attachments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts/{ContactID}/Attachments"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID contactID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Attachments result = apiInstance.getContactAttachments(accessToken, xeroTenantId, contactID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getContactAttachments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact
        try {
            Attachments result = apiInstance.getContactAttachments(xeroTenantId, contactID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getContactAttachments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves attachments for a specific contact in a Xero organisation
[apiInstance getContactAttachmentsWith:xeroTenantId
    contactID:contactID
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const contactID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Contact

try {
  const response = await xero.accountingApi.getContactAttachments(xeroTenantId, contactID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getContactAttachmentsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var contactID = new UUID(); // UUID | Unique identifier for a Contact (default to null)

            try
            {
                // Retrieves attachments for a specific contact in a Xero organisation
                Attachments result = apiInstance.getContactAttachments(xeroTenantId, contactID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getContactAttachments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getContactAttachments($xeroTenantId, $contactID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getContactAttachments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact

eval { 
    my $result = $api_instance->getContactAttachments(xeroTenantId => $xeroTenantId, contactID => $contactID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getContactAttachments: $@\n";
}
# 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_get_contact_attachments():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    contactID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_contact_attachments(xeroTenantId, contactID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getContactAttachments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getContactAttachments(xeroTenantId, contactID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
ContactID*
UUID (uuid)
Unique identifier for a Contact
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getContactByContactNumber

Retrieves a specific contact by contact number in a Xero organisation


/Contacts/{ContactNumber}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts/{ContactNumber}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        String contactNumber = "SB2";

        try {
            Contacts result = apiInstance.getContactByContactNumber(accessToken, xeroTenantId, contactNumber);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getContactByContactNumber");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        String contactNumber = SB2; // String | This field is read only on the Xero contact screen, used to identify contacts in external systems (max length = 50).
        try {
            Contacts result = apiInstance.getContactByContactNumber(xeroTenantId, contactNumber);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getContactByContactNumber");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
String *contactNumber = SB2; // This field is read only on the Xero contact screen, used to identify contacts in external systems (max length = 50). (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific contact by contact number in a Xero organisation
[apiInstance getContactByContactNumberWith:xeroTenantId
    contactNumber:contactNumber
              completionHandler: ^(Contacts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const contactNumber = "SB2";  // {String} This field is read only on the Xero contact screen, used to identify contacts in external systems (max length = 50).

try {
  const response = await xero.accountingApi.getContactByContactNumber(xeroTenantId, contactNumber);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getContactByContactNumberExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var contactNumber = SB2;  // String | This field is read only on the Xero contact screen, used to identify contacts in external systems (max length = 50). (default to null)

            try
            {
                // Retrieves a specific contact by contact number in a Xero organisation
                Contacts result = apiInstance.getContactByContactNumber(xeroTenantId, contactNumber);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getContactByContactNumber: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactNumber = "SB2";

try {
  $result = $apiInstance->getContactByContactNumber($xeroTenantId, $contactNumber);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getContactByContactNumber: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactNumber = SB2; # String | This field is read only on the Xero contact screen, used to identify contacts in external systems (max length = 50).

eval { 
    my $result = $api_instance->getContactByContactNumber(xeroTenantId => $xeroTenantId, contactNumber => $contactNumber);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getContactByContactNumber: $@\n";
}
# 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_get_contact_by_contact_number():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    contactNumber = 'SB2'
    
    try:
        api_response = api_instance.get_contact_by_contact_number(xeroTenantId, contactNumber)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getContactByContactNumber: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactNumber = SB2; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getContactByContactNumber(xeroTenantId, contactNumber, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts.read Grant read-only access to contacts and contact groups

Parameters

Path parameters
Name Description
ContactNumber*
String
This field is read only on the Xero contact screen, used to identify contacts in external systems (max length = 50).
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getContactCISSettings

Retrieves CIS settings for a specific contact in a Xero organisation


/Contacts/{ContactID}/CISSettings

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts/{ContactID}/CISSettings"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID contactID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            CISSettings result = apiInstance.getContactCISSettings(accessToken, xeroTenantId, contactID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getContactCISSettings");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact
        try {
            CISSettings result = apiInstance.getContactCISSettings(xeroTenantId, contactID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getContactCISSettings");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves CIS settings for a specific contact in a Xero organisation
[apiInstance getContactCISSettingsWith:xeroTenantId
    contactID:contactID
              completionHandler: ^(CISSettings output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const contactID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Contact

try {
  const response = await xero.accountingApi.getContactCISSettings(xeroTenantId, contactID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getContactCISSettingsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var contactID = new UUID(); // UUID | Unique identifier for a Contact (default to null)

            try
            {
                // Retrieves CIS settings for a specific contact in a Xero organisation
                CISSettings result = apiInstance.getContactCISSettings(xeroTenantId, contactID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getContactCISSettings: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getContactCISSettings($xeroTenantId, $contactID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getContactCISSettings: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact

eval { 
    my $result = $api_instance->getContactCISSettings(xeroTenantId => $xeroTenantId, contactID => $contactID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getContactCISSettings: $@\n";
}
# 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_get_contact_cis_settings():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    contactID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_contact_cis_settings(xeroTenantId, contactID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getContactCISSettings: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getContactCISSettings(xeroTenantId, contactID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts.read Grant read-only access to contacts and contact groups

Parameters

Path parameters
Name Description
ContactID*
UUID (uuid)
Unique identifier for a Contact
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getContactGroup

Retrieves a specific contact group by using a unique contact group Id


/ContactGroups/{ContactGroupID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ContactGroups/{ContactGroupID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID contactGroupID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            ContactGroups result = apiInstance.getContactGroup(accessToken, xeroTenantId, contactGroupID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getContactGroup");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactGroupID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact Group
        try {
            ContactGroups result = apiInstance.getContactGroup(xeroTenantId, contactGroupID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getContactGroup");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactGroupID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact Group (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific contact group by using a unique contact group Id
[apiInstance getContactGroupWith:xeroTenantId
    contactGroupID:contactGroupID
              completionHandler: ^(ContactGroups output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const contactGroupID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Contact Group

try {
  const response = await xero.accountingApi.getContactGroup(xeroTenantId, contactGroupID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getContactGroupExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var contactGroupID = new UUID(); // UUID | Unique identifier for a Contact Group (default to null)

            try
            {
                // Retrieves a specific contact group by using a unique contact group Id
                ContactGroups result = apiInstance.getContactGroup(xeroTenantId, contactGroupID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getContactGroup: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactGroupID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getContactGroup($xeroTenantId, $contactGroupID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getContactGroup: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactGroupID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact Group

eval { 
    my $result = $api_instance->getContactGroup(xeroTenantId => $xeroTenantId, contactGroupID => $contactGroupID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getContactGroup: $@\n";
}
# 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_get_contact_group():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    contactGroupID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_contact_group(xeroTenantId, contactGroupID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getContactGroup: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactGroupID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getContactGroup(xeroTenantId, contactGroupID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts.read Grant read-only access to contacts and contact groups

Parameters

Path parameters
Name Description
ContactGroupID*
UUID (uuid)
Unique identifier for a Contact Group
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getContactGroups

Retrieves the contact Id and name of all the contacts in a contact group


/ContactGroups

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ContactGroups?where=Status=="ACTIVE"&order=Name ASC"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        String where = "Status=="ACTIVE"";
        String order = "Name ASC";

        try {
            ContactGroups result = apiInstance.getContactGroups(accessToken, xeroTenantId, where, order);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getContactGroups");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        String where = Status=="ACTIVE"; // String | Filter by an any element
        String order = Name ASC; // String | Order by an any element
        try {
            ContactGroups result = apiInstance.getContactGroups(xeroTenantId, where, order);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getContactGroups");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
String *where = Status=="ACTIVE"; // Filter by an any element (optional) (default to null)
String *order = Name ASC; // Order by an any element (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves the contact Id and name of all the contacts in a contact group
[apiInstance getContactGroupsWith:xeroTenantId
    where:where
    order:order
              completionHandler: ^(ContactGroups output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const where = 'Status=="ACTIVE"';  // {String} Filter by an any element

const order = 'Name ASC';  // {String} Order by an any element


try {
  const response = await xero.accountingApi.getContactGroups(xeroTenantId,  where, order);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getContactGroupsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var where = Status=="ACTIVE";  // String | Filter by an any element (optional)  (default to null)
            var order = Name ASC;  // String | Order by an any element (optional)  (default to null)

            try
            {
                // Retrieves the contact Id and name of all the contacts in a contact group
                ContactGroups result = apiInstance.getContactGroups(xeroTenantId, where, order);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getContactGroups: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\ContactGroup::STATUS_ACTIVE . '"";
$order = "Name ASC";

try {
  $result = $apiInstance->getContactGroups($xeroTenantId, $where, $order);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getContactGroups: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $where = Status=="ACTIVE"; # String | Filter by an any element
my $order = Name ASC; # String | Order by an any element

eval { 
    my $result = $api_instance->getContactGroups(xeroTenantId => $xeroTenantId, where => $where, order => $order);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getContactGroups: $@\n";
}
# 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_get_contact_groups():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    where = 'Status=="ACTIVE"'
    order = 'Name ASC'
    
    try:
        api_response = api_instance.get_contact_groups(xeroTenantId, where, order)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getContactGroups: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let where = Status=="ACTIVE"; // String
    let order = Name ASC; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getContactGroups(xeroTenantId, where, order, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts.read Grant read-only access to contacts and contact groups

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element

getContactHistory

Retrieves history records for a specific contact


/Contacts/{ContactID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts/{ContactID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID contactID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getContactHistory(accessToken, xeroTenantId, contactID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getContactHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact
        try {
            HistoryRecords result = apiInstance.getContactHistory(xeroTenantId, contactID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getContactHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history records for a specific contact
[apiInstance getContactHistoryWith:xeroTenantId
    contactID:contactID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const contactID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Contact

try {
  const response = await xero.accountingApi.getContactHistory(xeroTenantId, contactID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getContactHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var contactID = new UUID(); // UUID | Unique identifier for a Contact (default to null)

            try
            {
                // Retrieves history records for a specific contact
                HistoryRecords result = apiInstance.getContactHistory(xeroTenantId, contactID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getContactHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getContactHistory($xeroTenantId, $contactID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getContactHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact

eval { 
    my $result = $api_instance->getContactHistory(xeroTenantId => $xeroTenantId, contactID => $contactID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getContactHistory: $@\n";
}
# 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_get_contact_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    contactID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_contact_history(xeroTenantId, contactID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getContactHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getContactHistory(xeroTenantId, contactID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts.read Grant read-only access to contacts and contact groups

Parameters

Path parameters
Name Description
ContactID*
UUID (uuid)
Unique identifier for a Contact
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getContacts

Retrieves all contacts in a Xero organisation


/Contacts

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts?where=ContactStatus=="ACTIVE"&order=Name ASC&IDs="00000000-0000-0000-0000-000000000000"&page=1&includeArchived=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = "ContactStatus=="ACTIVE"";
        String order = "Name ASC";
        array[UUID] iDs = "00000000-0000-0000-0000-000000000000";
        Integer page = 1;
        Boolean includeArchived = true;

        try {
            Contacts result = apiInstance.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, iDs, page, includeArchived);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getContacts");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = ContactStatus=="ACTIVE"; // String | Filter by an any element
        String order = Name ASC; // String | Order by an any element
        array[UUID] iDs = "00000000-0000-0000-0000-000000000000"; // array[UUID] | Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call.
        Integer page = 1; // Integer | e.g. page=1 - Up to 100 contacts will be returned in a single API call.
        Boolean includeArchived = true; // Boolean | e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response
        try {
            Contacts result = apiInstance.getContacts(xeroTenantId, ifModifiedSince, where, order, iDs, page, includeArchived);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getContacts");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = ContactStatus=="ACTIVE"; // Filter by an any element (optional) (default to null)
String *order = Name ASC; // Order by an any element (optional) (default to null)
array[UUID] *iDs = "00000000-0000-0000-0000-000000000000"; // Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call. (optional) (default to null)
Integer *page = 1; // e.g. page=1 - Up to 100 contacts will be returned in a single API call. (optional) (default to null)
Boolean *includeArchived = true; // e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves all contacts in a Xero organisation
[apiInstance getContactsWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
    iDs:iDs
    page:page
    includeArchived:includeArchived
              completionHandler: ^(Contacts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'ContactStatus=="ACTIVE"';  // {String} Filter by an any element

const order = 'Name ASC';  // {String} Order by an any element

const iDs = ['"00000000-0000-0000-0000-000000000000"'];  // {array[UUID]} Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call.

const page = 1;  // {Integer} e.g. page=1 - Up to 100 contacts will be returned in a single API call.

const includeArchived = true;  // {Boolean} e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response


try {
  const response = await xero.accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, iDs, page, includeArchived);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getContactsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var ifModifiedSince = 2020-02-06T12:17:43.202-08:00;  // Date | Only records created or modified since this timestamp will be returned (optional)  (default to null)
            var where = ContactStatus=="ACTIVE";  // String | Filter by an any element (optional)  (default to null)
            var order = Name ASC;  // String | Order by an any element (optional)  (default to null)
            var iDs = new array[UUID](); // array[UUID] | Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call. (optional)  (default to null)
            var page = 1;  // Integer | e.g. page=1 - Up to 100 contacts will be returned in a single API call. (optional)  (default to null)
            var includeArchived = true;  // Boolean | e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response (optional)  (default to null)

            try
            {
                // Retrieves all contacts in a Xero organisation
                Contacts result = apiInstance.getContacts(xeroTenantId, ifModifiedSince, where, order, iDs, page, includeArchived);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getContacts: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "ContactStatus=="' . \XeroAPI\XeroPHP\Models\Accounting\Contact::CONTACT_STATUS_ACTIVE . '"";
$order = "Name ASC";
$iDs = array("00000000-0000-0000-0000-000000000000")
$page = 1;
$includeArchived = true;

try {
  $result = $apiInstance->getContacts($xeroTenantId, $ifModifiedSince, $where, $order, $iDs, $page, $includeArchived);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getContacts: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = ContactStatus=="ACTIVE"; # String | Filter by an any element
my $order = Name ASC; # String | Order by an any element
my $iDs = ["00000000-0000-0000-0000-000000000000"]; # array[UUID] | Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call.
my $page = 1; # Integer | e.g. page=1 - Up to 100 contacts will be returned in a single API call.
my $includeArchived = true; # Boolean | e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response

eval { 
    my $result = $api_instance->getContacts(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order, iDs => $iDs, page => $page, includeArchived => $includeArchived);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getContacts: $@\n";
}
# 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_get_contacts():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    ifModifiedSince = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'ContactStatus=="ACTIVE"'
    order = 'Name ASC'
    iDs = ["00000000-0000-0000-0000-000000000000"]
    includeArchived = 'true'
    
    try:
        api_response = api_instance.get_contacts(xeroTenantId, ifModifiedSince, where, order, iDs, page, includeArchived)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getContacts: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = ContactStatus=="ACTIVE"; // String
    let order = Name ASC; // String
    let iDs = "00000000-0000-0000-0000-000000000000"; // array[UUID]
    let page = 1; // Integer
    let includeArchived = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.getContacts(xeroTenantId, ifModifiedSince, where, order, iDs, page, includeArchived, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts.read Grant read-only access to contacts and contact groups

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element
IDs
array[UUID] (uuid)
Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call.
page
Integer
e.g. page=1 - Up to 100 contacts will be returned in a single API call.
includeArchived
Boolean
e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response

getCreditNote

Retrieves a specific credit note using a unique credit note Id


/CreditNotes/{CreditNoteID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes/{CreditNoteID}?unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID creditNoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Integer unitdp = 4;

        try {
            CreditNotes result = apiInstance.getCreditNote(accessToken, xeroTenantId, creditNoteID, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNote");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Credit Note
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            CreditNotes result = apiInstance.getCreditNote(xeroTenantId, creditNoteID, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNote");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *creditNoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Credit Note (default to null)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific credit note using a unique credit note Id
[apiInstance getCreditNoteWith:xeroTenantId
    creditNoteID:creditNoteID
    unitdp:unitdp
              completionHandler: ^(CreditNotes output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const creditNoteID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Credit Note

const unitdp = 4;  // {Integer} e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts


try {
  const response = await xero.accountingApi.getCreditNote(xeroTenantId, creditNoteID,  unitdp);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getCreditNoteExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var creditNoteID = new UUID(); // UUID | Unique identifier for a Credit Note (default to null)
            var unitdp = 4;  // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)  (default to null)

            try
            {
                // Retrieves a specific credit note using a unique credit note Id
                CreditNotes result = apiInstance.getCreditNote(xeroTenantId, creditNoteID, unitdp);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getCreditNote: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$creditNoteID = "00000000-0000-0000-0000-000000000000";
$unitdp = 4;

try {
  $result = $apiInstance->getCreditNote($xeroTenantId, $creditNoteID, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getCreditNote: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $creditNoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Credit Note
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->getCreditNote(xeroTenantId => $xeroTenantId, creditNoteID => $creditNoteID, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getCreditNote: $@\n";
}
# 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_get_credit_note():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    creditNoteID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_credit_note(xeroTenantId, creditNoteID, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getCreditNote: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getCreditNote(xeroTenantId, creditNoteID, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
CreditNoteID*
UUID (uuid)
Unique identifier for a Credit Note
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

getCreditNoteAsPdf

Retrieves credit notes as PDF files


/CreditNotes/{CreditNoteID}/pdf

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes/{CreditNoteID}/pdf"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID creditNoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            ByteArrayInputStream result = apiInstance.getCreditNoteAsPdf(accessToken, xeroTenantId, creditNoteID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNoteAsPdf");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Credit Note
        try {
            File result = apiInstance.getCreditNoteAsPdf(xeroTenantId, creditNoteID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNoteAsPdf");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *creditNoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Credit Note (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves credit notes as PDF files
[apiInstance getCreditNoteAsPdfWith:xeroTenantId
    creditNoteID:creditNoteID
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const creditNoteID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Credit Note

try {
  const response = await xero.accountingApi.getCreditNoteAsPdf(xeroTenantId, creditNoteID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getCreditNoteAsPdfExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var creditNoteID = new UUID(); // UUID | Unique identifier for a Credit Note (default to null)

            try
            {
                // Retrieves credit notes as PDF files
                File result = apiInstance.getCreditNoteAsPdf(xeroTenantId, creditNoteID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getCreditNoteAsPdf: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$creditNoteID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getCreditNoteAsPdf($xeroTenantId, $creditNoteID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getCreditNoteAsPdf: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $creditNoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Credit Note

eval { 
    my $result = $api_instance->getCreditNoteAsPdf(xeroTenantId => $xeroTenantId, creditNoteID => $creditNoteID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getCreditNoteAsPdf: $@\n";
}
# 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_get_credit_note_as_pdf():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    creditNoteID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_credit_note_as_pdf(xeroTenantId, creditNoteID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getCreditNoteAsPdf: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getCreditNoteAsPdf(xeroTenantId, creditNoteID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
CreditNoteID*
UUID (uuid)
Unique identifier for a Credit Note
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getCreditNoteAttachmentByFileName

Retrieves a specific attachment on a specific credit note by file name


/CreditNotes/{CreditNoteID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes/{CreditNoteID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID creditNoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        String contentType = "image/jpg";

        try {
            ByteArrayInputStream result = apiInstance.getCreditNoteAttachmentByFileName(accessToken, xeroTenantId, creditNoteID, fileName, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNoteAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Credit Note
        String fileName = xero-dev.jpg; // String | Name of the file you are attaching to Credit Note
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, fileName, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNoteAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *creditNoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Credit Note (default to null)
String *fileName = xero-dev.jpg; // Name of the file you are attaching to Credit Note (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment on a specific credit note by file name
[apiInstance getCreditNoteAttachmentByFileNameWith:xeroTenantId
    creditNoteID:creditNoteID
    fileName:fileName
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const creditNoteID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Credit Note
const fileName = "xero-dev.jpg";  // {String} Name of the file you are attaching to Credit Note
const contentType = "image/jpg";  // {String} The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

try {
  const response = await xero.accountingApi.getCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, fileName, contentType);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getCreditNoteAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var creditNoteID = new UUID(); // UUID | Unique identifier for a Credit Note (default to null)
            var fileName = xero-dev.jpg;  // String | Name of the file you are attaching to Credit Note (default to null)
            var contentType = image/jpg;  // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

            try
            {
                // Retrieves a specific attachment on a specific credit note by file name
                File result = apiInstance.getCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, fileName, contentType);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getCreditNoteAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$creditNoteID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getCreditNoteAttachmentByFileName($xeroTenantId, $creditNoteID, $fileName, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getCreditNoteAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $creditNoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Credit Note
my $fileName = xero-dev.jpg; # String | Name of the file you are attaching to Credit Note
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getCreditNoteAttachmentByFileName(xeroTenantId => $xeroTenantId, creditNoteID => $creditNoteID, fileName => $fileName, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getCreditNoteAttachmentByFileName: $@\n";
}
# 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_get_credit_note_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    creditNoteID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    contentType = 'image/jpg'
    
    try:
        api_response = api_instance.get_credit_note_attachment_by_file_name(xeroTenantId, creditNoteID, fileName, contentType)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getCreditNoteAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, fileName, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
CreditNoteID*
UUID (uuid)
Unique identifier for a Credit Note
Required
FileName*
String
Name of the file you are attaching to Credit Note
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getCreditNoteAttachmentById

Retrieves a specific attachment from a specific credit note using a unique attachment Id


/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID creditNoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID attachmentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String contentType = "image/jpg";

        try {
            ByteArrayInputStream result = apiInstance.getCreditNoteAttachmentById(accessToken, xeroTenantId, creditNoteID, attachmentID, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNoteAttachmentById");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Credit Note
        UUID attachmentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Attachment
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getCreditNoteAttachmentById(xeroTenantId, creditNoteID, attachmentID, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNoteAttachmentById");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *creditNoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Credit Note (default to null)
UUID *attachmentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Attachment (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment from a specific credit note using a unique attachment Id
[apiInstance getCreditNoteAttachmentByIdWith:xeroTenantId
    creditNoteID:creditNoteID
    attachmentID:attachmentID
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const creditNoteID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Credit Note
const attachmentID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Attachment
const contentType = "image/jpg";  // {String} The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

try {
  const response = await xero.accountingApi.getCreditNoteAttachmentById(xeroTenantId, creditNoteID, attachmentID, contentType);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getCreditNoteAttachmentByIdExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var creditNoteID = new UUID(); // UUID | Unique identifier for a Credit Note (default to null)
            var attachmentID = new UUID(); // UUID | Unique identifier for a Attachment (default to null)
            var contentType = image/jpg;  // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

            try
            {
                // Retrieves a specific attachment from a specific credit note using a unique attachment Id
                File result = apiInstance.getCreditNoteAttachmentById(xeroTenantId, creditNoteID, attachmentID, contentType);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getCreditNoteAttachmentById: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$creditNoteID = "00000000-0000-0000-0000-000000000000";
$attachmentID = "00000000-0000-0000-0000-000000000000";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getCreditNoteAttachmentById($xeroTenantId, $creditNoteID, $attachmentID, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getCreditNoteAttachmentById: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $creditNoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Credit Note
my $attachmentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Attachment
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getCreditNoteAttachmentById(xeroTenantId => $xeroTenantId, creditNoteID => $creditNoteID, attachmentID => $attachmentID, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getCreditNoteAttachmentById: $@\n";
}
# 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_get_credit_note_attachment_by_id():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    creditNoteID = '00000000-0000-0000-0000-000000000000'
    attachmentID = '00000000-0000-0000-0000-000000000000'
    contentType = 'image/jpg'
    
    try:
        api_response = api_instance.get_credit_note_attachment_by_id(xeroTenantId, creditNoteID, attachmentID, contentType)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getCreditNoteAttachmentById: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let attachmentID = 00000000-0000-0000-0000-000000000000; // UUID
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getCreditNoteAttachmentById(xeroTenantId, creditNoteID, attachmentID, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
CreditNoteID*
UUID (uuid)
Unique identifier for a Credit Note
Required
AttachmentID*
UUID (uuid)
Unique identifier for a Attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getCreditNoteAttachments

Retrieves attachments for a specific credit notes


/CreditNotes/{CreditNoteID}/Attachments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes/{CreditNoteID}/Attachments"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID creditNoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Attachments result = apiInstance.getCreditNoteAttachments(accessToken, xeroTenantId, creditNoteID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNoteAttachments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Credit Note
        try {
            Attachments result = apiInstance.getCreditNoteAttachments(xeroTenantId, creditNoteID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNoteAttachments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *creditNoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Credit Note (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves attachments for a specific credit notes
[apiInstance getCreditNoteAttachmentsWith:xeroTenantId
    creditNoteID:creditNoteID
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const creditNoteID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Credit Note

try {
  const response = await xero.accountingApi.getCreditNoteAttachments(xeroTenantId, creditNoteID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getCreditNoteAttachmentsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var creditNoteID = new UUID(); // UUID | Unique identifier for a Credit Note (default to null)

            try
            {
                // Retrieves attachments for a specific credit notes
                Attachments result = apiInstance.getCreditNoteAttachments(xeroTenantId, creditNoteID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getCreditNoteAttachments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$creditNoteID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getCreditNoteAttachments($xeroTenantId, $creditNoteID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getCreditNoteAttachments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $creditNoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Credit Note

eval { 
    my $result = $api_instance->getCreditNoteAttachments(xeroTenantId => $xeroTenantId, creditNoteID => $creditNoteID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getCreditNoteAttachments: $@\n";
}
# 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_get_credit_note_attachments():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    creditNoteID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_credit_note_attachments(xeroTenantId, creditNoteID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getCreditNoteAttachments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getCreditNoteAttachments(xeroTenantId, creditNoteID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
CreditNoteID*
UUID (uuid)
Unique identifier for a Credit Note
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getCreditNoteHistory

Retrieves history records of a specific credit note


/CreditNotes/{CreditNoteID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes/{CreditNoteID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID creditNoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getCreditNoteHistory(accessToken, xeroTenantId, creditNoteID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNoteHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Credit Note
        try {
            HistoryRecords result = apiInstance.getCreditNoteHistory(xeroTenantId, creditNoteID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNoteHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *creditNoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Credit Note (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history records of a specific credit note
[apiInstance getCreditNoteHistoryWith:xeroTenantId
    creditNoteID:creditNoteID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const creditNoteID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Credit Note

try {
  const response = await xero.accountingApi.getCreditNoteHistory(xeroTenantId, creditNoteID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getCreditNoteHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var creditNoteID = new UUID(); // UUID | Unique identifier for a Credit Note (default to null)

            try
            {
                // Retrieves history records of a specific credit note
                HistoryRecords result = apiInstance.getCreditNoteHistory(xeroTenantId, creditNoteID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getCreditNoteHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$creditNoteID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getCreditNoteHistory($xeroTenantId, $creditNoteID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getCreditNoteHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $creditNoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Credit Note

eval { 
    my $result = $api_instance->getCreditNoteHistory(xeroTenantId => $xeroTenantId, creditNoteID => $creditNoteID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getCreditNoteHistory: $@\n";
}
# 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_get_credit_note_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    creditNoteID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_credit_note_history(xeroTenantId, creditNoteID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getCreditNoteHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getCreditNoteHistory(xeroTenantId, creditNoteID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
CreditNoteID*
UUID (uuid)
Unique identifier for a Credit Note
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getCreditNotes

Retrieves any credit notes


/CreditNotes

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes?where=Status=="DRAFT"&order=CreditNoteNumber ASC&page=1&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = "Status=="DRAFT"";
        String order = "CreditNoteNumber ASC";
        Integer page = 1;
        Integer unitdp = 4;

        try {
            CreditNotes result = apiInstance.getCreditNotes(accessToken, xeroTenantId, ifModifiedSince, where, order, page, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNotes");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = Status=="DRAFT"; // String | Filter by an any element
        String order = CreditNoteNumber ASC; // String | Order by an any element
        Integer page = 1; // Integer | e.g. page=1 – Up to 100 credit notes will be returned in a single API call with line items shown for each credit note
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            CreditNotes result = apiInstance.getCreditNotes(xeroTenantId, ifModifiedSince, where, order, page, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNotes");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = Status=="DRAFT"; // Filter by an any element (optional) (default to null)
String *order = CreditNoteNumber ASC; // Order by an any element (optional) (default to null)
Integer *page = 1; // e.g. page=1 – Up to 100 credit notes will be returned in a single API call with line items shown for each credit note (optional) (default to null)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves any credit notes
[apiInstance getCreditNotesWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
    page:page
    unitdp:unitdp
              completionHandler: ^(CreditNotes output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="DRAFT"';  // {String} Filter by an any element

const order = 'CreditNoteNumber ASC';  // {String} Order by an any element

const page = 1;  // {Integer} e.g. page=1 – Up to 100 credit notes will be returned in a single API call with line items shown for each credit note

const unitdp = 4;  // {Integer} e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts


try {
  const response = await xero.accountingApi.getCreditNotes(xeroTenantId, ifModifiedSince, where, order, page, unitdp);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getCreditNotesExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var ifModifiedSince = 2020-02-06T12:17:43.202-08:00;  // Date | Only records created or modified since this timestamp will be returned (optional)  (default to null)
            var where = Status=="DRAFT";  // String | Filter by an any element (optional)  (default to null)
            var order = CreditNoteNumber ASC;  // String | Order by an any element (optional)  (default to null)
            var page = 1;  // Integer | e.g. page=1 – Up to 100 credit notes will be returned in a single API call with line items shown for each credit note (optional)  (default to null)
            var unitdp = 4;  // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)  (default to null)

            try
            {
                // Retrieves any credit notes
                CreditNotes result = apiInstance.getCreditNotes(xeroTenantId, ifModifiedSince, where, order, page, unitdp);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getCreditNotes: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\CreditNote::STATUS_DRAFT . '"";
$order = "CreditNoteNumber ASC";
$page = 1;
$unitdp = 4;

try {
  $result = $apiInstance->getCreditNotes($xeroTenantId, $ifModifiedSince, $where, $order, $page, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getCreditNotes: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = Status=="DRAFT"; # String | Filter by an any element
my $order = CreditNoteNumber ASC; # String | Order by an any element
my $page = 1; # Integer | e.g. page=1 – Up to 100 credit notes will be returned in a single API call with line items shown for each credit note
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->getCreditNotes(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order, page => $page, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getCreditNotes: $@\n";
}
# 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_get_credit_notes():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    ifModifiedSince = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'Status=="DRAFT"'
    order = 'CreditNoteNumber ASC'
    
    try:
        api_response = api_instance.get_credit_notes(xeroTenantId, ifModifiedSince, where, order, page, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getCreditNotes: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = Status=="DRAFT"; // String
    let order = CreditNoteNumber ASC; // String
    let page = 1; // Integer
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getCreditNotes(xeroTenantId, ifModifiedSince, where, order, page, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element
page
Integer
e.g. page=1 – Up to 100 credit notes will be returned in a single API call with line items shown for each credit note
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

getCurrencies

Retrieves currencies for your Xero organisation


/Currencies

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Currencies?where=Code=="USD"&order=Code ASC"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        String where = "Code=="USD"";
        String order = "Code ASC";

        try {
            Currencies result = apiInstance.getCurrencies(accessToken, xeroTenantId, where, order);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getCurrencies");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        String where = Code=="USD"; // String | Filter by an any element
        String order = Code ASC; // String | Order by an any element
        try {
            Currencies result = apiInstance.getCurrencies(xeroTenantId, where, order);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getCurrencies");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
String *where = Code=="USD"; // Filter by an any element (optional) (default to null)
String *order = Code ASC; // Order by an any element (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves currencies for your Xero organisation
[apiInstance getCurrenciesWith:xeroTenantId
    where:where
    order:order
              completionHandler: ^(Currencies output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const where = 'Code=="USD"';  // {String} Filter by an any element

const order = 'Code ASC';  // {String} Order by an any element


try {
  const response = await xero.accountingApi.getCurrencies(xeroTenantId,  where, order);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getCurrenciesExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var where = Code=="USD";  // String | Filter by an any element (optional)  (default to null)
            var order = Code ASC;  // String | Order by an any element (optional)  (default to null)

            try
            {
                // Retrieves currencies for your Xero organisation
                Currencies result = apiInstance.getCurrencies(xeroTenantId, where, order);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getCurrencies: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$where = "Code=="' . \XeroAPI\XeroPHP\Models\Accounting\CurrencyCode::USD . '"";
$order = "Code ASC";

try {
  $result = $apiInstance->getCurrencies($xeroTenantId, $where, $order);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getCurrencies: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $where = Code=="USD"; # String | Filter by an any element
my $order = Code ASC; # String | Order by an any element

eval { 
    my $result = $api_instance->getCurrencies(xeroTenantId => $xeroTenantId, where => $where, order => $order);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getCurrencies: $@\n";
}
# 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_get_currencies():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    where = 'Code=="USD"'
    order = 'Code ASC'
    
    try:
        api_response = api_instance.get_currencies(xeroTenantId, where, order)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getCurrencies: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let where = Code=="USD"; // String
    let order = Code ASC; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getCurrencies(xeroTenantId, where, order, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element

getEmployee

Retrieves a specific employee used in Xero payrun using a unique employee Id


/Employees/{EmployeeID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Employees/{EmployeeID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID employeeID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Employees result = apiInstance.getEmployee(accessToken, xeroTenantId, employeeID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getEmployee");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID employeeID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Employee
        try {
            Employees result = apiInstance.getEmployee(xeroTenantId, employeeID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getEmployee");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *employeeID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Employee (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific employee used in Xero payrun using a unique employee Id
[apiInstance getEmployeeWith:xeroTenantId
    employeeID:employeeID
              completionHandler: ^(Employees output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const employeeID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Employee

try {
  const response = await xero.accountingApi.getEmployee(xeroTenantId, employeeID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getEmployeeExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var employeeID = new UUID(); // UUID | Unique identifier for a Employee (default to null)

            try
            {
                // Retrieves a specific employee used in Xero payrun using a unique employee Id
                Employees result = apiInstance.getEmployee(xeroTenantId, employeeID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getEmployee: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$employeeID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getEmployee($xeroTenantId, $employeeID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getEmployee: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $employeeID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Employee

eval { 
    my $result = $api_instance->getEmployee(xeroTenantId => $xeroTenantId, employeeID => $employeeID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getEmployee: $@\n";
}
# 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_get_employee():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    employeeID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_employee(xeroTenantId, employeeID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getEmployee: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let employeeID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getEmployee(xeroTenantId, employeeID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Unique identifier for a Employee
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getEmployees

Retrieves employees used in Xero payrun


/Employees

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Employees?where=Status=="ACTIVE"&order=LastName ASC"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = "Status=="ACTIVE"";
        String order = "LastName ASC";

        try {
            Employees result = apiInstance.getEmployees(accessToken, xeroTenantId, ifModifiedSince, where, order);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getEmployees");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = Status=="ACTIVE"; // String | Filter by an any element
        String order = LastName ASC; // String | Order by an any element
        try {
            Employees result = apiInstance.getEmployees(xeroTenantId, ifModifiedSince, where, order);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getEmployees");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = Status=="ACTIVE"; // Filter by an any element (optional) (default to null)
String *order = LastName ASC; // Order by an any element (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves employees used in Xero payrun
[apiInstance getEmployeesWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
              completionHandler: ^(Employees output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="ACTIVE"';  // {String} Filter by an any element

const order = 'LastName ASC';  // {String} Order by an any element


try {
  const response = await xero.accountingApi.getEmployees(xeroTenantId, ifModifiedSince, where, order);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getEmployeesExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var ifModifiedSince = 2020-02-06T12:17:43.202-08:00;  // Date | Only records created or modified since this timestamp will be returned (optional)  (default to null)
            var where = Status=="ACTIVE";  // String | Filter by an any element (optional)  (default to null)
            var order = LastName ASC;  // String | Order by an any element (optional)  (default to null)

            try
            {
                // Retrieves employees used in Xero payrun
                Employees result = apiInstance.getEmployees(xeroTenantId, ifModifiedSince, where, order);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getEmployees: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\Employee::STATUS_ACTIVE . '"";
$order = "LastName ASC";

try {
  $result = $apiInstance->getEmployees($xeroTenantId, $ifModifiedSince, $where, $order);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getEmployees: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = Status=="ACTIVE"; # String | Filter by an any element
my $order = LastName ASC; # String | Order by an any element

eval { 
    my $result = $api_instance->getEmployees(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getEmployees: $@\n";
}
# 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_get_employees():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    ifModifiedSince = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'Status=="ACTIVE"'
    order = 'LastName ASC'
    
    try:
        api_response = api_instance.get_employees(xeroTenantId, ifModifiedSince, where, order)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getEmployees: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = Status=="ACTIVE"; // String
    let order = LastName ASC; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getEmployees(xeroTenantId, ifModifiedSince, where, order, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element

getExpenseClaim

Retrieves a specific expense claim using a unique expense claim Id


/ExpenseClaims/{ExpenseClaimID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ExpenseClaims/{ExpenseClaimID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID expenseClaimID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            ExpenseClaims result = apiInstance.getExpenseClaim(accessToken, xeroTenantId, expenseClaimID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getExpenseClaim");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID expenseClaimID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a ExpenseClaim
        try {
            ExpenseClaims result = apiInstance.getExpenseClaim(xeroTenantId, expenseClaimID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getExpenseClaim");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *expenseClaimID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a ExpenseClaim (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific expense claim using a unique expense claim Id
[apiInstance getExpenseClaimWith:xeroTenantId
    expenseClaimID:expenseClaimID
              completionHandler: ^(ExpenseClaims output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const expenseClaimID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a ExpenseClaim

try {
  const response = await xero.accountingApi.getExpenseClaim(xeroTenantId, expenseClaimID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getExpenseClaimExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var expenseClaimID = new UUID(); // UUID | Unique identifier for a ExpenseClaim (default to null)

            try
            {
                // Retrieves a specific expense claim using a unique expense claim Id
                ExpenseClaims result = apiInstance.getExpenseClaim(xeroTenantId, expenseClaimID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getExpenseClaim: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$expenseClaimID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getExpenseClaim($xeroTenantId, $expenseClaimID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getExpenseClaim: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $expenseClaimID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a ExpenseClaim

eval { 
    my $result = $api_instance->getExpenseClaim(xeroTenantId => $xeroTenantId, expenseClaimID => $expenseClaimID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getExpenseClaim: $@\n";
}
# 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_get_expense_claim():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    expenseClaimID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_expense_claim(xeroTenantId, expenseClaimID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getExpenseClaim: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let expenseClaimID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getExpenseClaim(xeroTenantId, expenseClaimID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
ExpenseClaimID*
UUID (uuid)
Unique identifier for a ExpenseClaim
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getExpenseClaimHistory

Retrieves history records of a specific expense claim


/ExpenseClaims/{ExpenseClaimID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ExpenseClaims/{ExpenseClaimID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID expenseClaimID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getExpenseClaimHistory(accessToken, xeroTenantId, expenseClaimID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getExpenseClaimHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID expenseClaimID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a ExpenseClaim
        try {
            HistoryRecords result = apiInstance.getExpenseClaimHistory(xeroTenantId, expenseClaimID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getExpenseClaimHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *expenseClaimID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a ExpenseClaim (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history records of a specific expense claim
[apiInstance getExpenseClaimHistoryWith:xeroTenantId
    expenseClaimID:expenseClaimID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const expenseClaimID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a ExpenseClaim

try {
  const response = await xero.accountingApi.getExpenseClaimHistory(xeroTenantId, expenseClaimID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getExpenseClaimHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var expenseClaimID = new UUID(); // UUID | Unique identifier for a ExpenseClaim (default to null)

            try
            {
                // Retrieves history records of a specific expense claim
                HistoryRecords result = apiInstance.getExpenseClaimHistory(xeroTenantId, expenseClaimID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getExpenseClaimHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$expenseClaimID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getExpenseClaimHistory($xeroTenantId, $expenseClaimID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getExpenseClaimHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $expenseClaimID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a ExpenseClaim

eval { 
    my $result = $api_instance->getExpenseClaimHistory(xeroTenantId => $xeroTenantId, expenseClaimID => $expenseClaimID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getExpenseClaimHistory: $@\n";
}
# 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_get_expense_claim_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    expenseClaimID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_expense_claim_history(xeroTenantId, expenseClaimID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getExpenseClaimHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let expenseClaimID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getExpenseClaimHistory(xeroTenantId, expenseClaimID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
ExpenseClaimID*
UUID (uuid)
Unique identifier for a ExpenseClaim
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getExpenseClaims

Retrieves expense claims


/ExpenseClaims

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ExpenseClaims?where=Status=="SUBMITTED"&order=Status ASC"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = "Status=="SUBMITTED"";
        String order = "Status ASC";

        try {
            ExpenseClaims result = apiInstance.getExpenseClaims(accessToken, xeroTenantId, ifModifiedSince, where, order);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getExpenseClaims");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = Status=="SUBMITTED"; // String | Filter by an any element
        String order = Status ASC; // String | Order by an any element
        try {
            ExpenseClaims result = apiInstance.getExpenseClaims(xeroTenantId, ifModifiedSince, where, order);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getExpenseClaims");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = Status=="SUBMITTED"; // Filter by an any element (optional) (default to null)
String *order = Status ASC; // Order by an any element (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves expense claims
[apiInstance getExpenseClaimsWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
              completionHandler: ^(ExpenseClaims output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="SUBMITTED"';  // {String} Filter by an any element

const order = 'Status ASC';  // {String} Order by an any element


try {
  const response = await xero.accountingApi.getExpenseClaims(xeroTenantId, ifModifiedSince, where, order);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getExpenseClaimsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var ifModifiedSince = 2020-02-06T12:17:43.202-08:00;  // Date | Only records created or modified since this timestamp will be returned (optional)  (default to null)
            var where = Status=="SUBMITTED";  // String | Filter by an any element (optional)  (default to null)
            var order = Status ASC;  // String | Order by an any element (optional)  (default to null)

            try
            {
                // Retrieves expense claims
                ExpenseClaims result = apiInstance.getExpenseClaims(xeroTenantId, ifModifiedSince, where, order);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getExpenseClaims: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\ExpenseClaim::STATUS_SUBMITTED . '"";
$order = "Status ASC";

try {
  $result = $apiInstance->getExpenseClaims($xeroTenantId, $ifModifiedSince, $where, $order);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getExpenseClaims: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = Status=="SUBMITTED"; # String | Filter by an any element
my $order = Status ASC; # String | Order by an any element

eval { 
    my $result = $api_instance->getExpenseClaims(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getExpenseClaims: $@\n";
}
# 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_get_expense_claims():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    ifModifiedSince = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'Status=="SUBMITTED"'
    order = 'Status ASC'
    
    try:
        api_response = api_instance.get_expense_claims(xeroTenantId, ifModifiedSince, where, order)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getExpenseClaims: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = Status=="SUBMITTED"; // String
    let order = Status ASC; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getExpenseClaims(xeroTenantId, ifModifiedSince, where, order, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element

getInvoice

Retrieves a specific sales invoice or purchase bill using a unique invoice Id


/Invoices/{InvoiceID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID}?unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID invoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Integer unitdp = 4;

        try {
            Invoices result = apiInstance.getInvoice(accessToken, xeroTenantId, invoiceID, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getInvoice");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID invoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Invoice
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Invoices result = apiInstance.getInvoice(xeroTenantId, invoiceID, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getInvoice");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *invoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Invoice (default to null)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific sales invoice or purchase bill using a unique invoice Id
[apiInstance getInvoiceWith:xeroTenantId
    invoiceID:invoiceID
    unitdp:unitdp
              completionHandler: ^(Invoices output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const invoiceID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for an Invoice

const unitdp = 4;  // {Integer} e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts


try {
  const response = await xero.accountingApi.getInvoice(xeroTenantId, invoiceID,  unitdp);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getInvoiceExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var invoiceID = new UUID(); // UUID | Unique identifier for an Invoice (default to null)
            var unitdp = 4;  // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)  (default to null)

            try
            {
                // Retrieves a specific sales invoice or purchase bill using a unique invoice Id
                Invoices result = apiInstance.getInvoice(xeroTenantId, invoiceID, unitdp);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getInvoice: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$invoiceID = "00000000-0000-0000-0000-000000000000";
$unitdp = 4;

try {
  $result = $apiInstance->getInvoice($xeroTenantId, $invoiceID, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getInvoice: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Invoice
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->getInvoice(xeroTenantId => $xeroTenantId, invoiceID => $invoiceID, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getInvoice: $@\n";
}
# 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_get_invoice():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    invoiceID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_invoice(xeroTenantId, invoiceID, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getInvoice: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoiceID = 00000000-0000-0000-0000-000000000000; // UUID
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getInvoice(xeroTenantId, invoiceID, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
InvoiceID*
UUID (uuid)
Unique identifier for an Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

getInvoiceAsPdf

Retrieves invoices or purchase bills as PDF files


/Invoices/{InvoiceID}/pdf

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID}/pdf"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID invoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            ByteArrayInputStream result = apiInstance.getInvoiceAsPdf(accessToken, xeroTenantId, invoiceID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getInvoiceAsPdf");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID invoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Invoice
        try {
            File result = apiInstance.getInvoiceAsPdf(xeroTenantId, invoiceID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getInvoiceAsPdf");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *invoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Invoice (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves invoices or purchase bills as PDF files
[apiInstance getInvoiceAsPdfWith:xeroTenantId
    invoiceID:invoiceID
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const invoiceID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for an Invoice

try {
  const response = await xero.accountingApi.getInvoiceAsPdf(xeroTenantId, invoiceID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getInvoiceAsPdfExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var invoiceID = new UUID(); // UUID | Unique identifier for an Invoice (default to null)

            try
            {
                // Retrieves invoices or purchase bills as PDF files
                File result = apiInstance.getInvoiceAsPdf(xeroTenantId, invoiceID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getInvoiceAsPdf: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$invoiceID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getInvoiceAsPdf($xeroTenantId, $invoiceID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getInvoiceAsPdf: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Invoice

eval { 
    my $result = $api_instance->getInvoiceAsPdf(xeroTenantId => $xeroTenantId, invoiceID => $invoiceID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getInvoiceAsPdf: $@\n";
}
# 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_get_invoice_as_pdf():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    invoiceID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_invoice_as_pdf(xeroTenantId, invoiceID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getInvoiceAsPdf: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoiceID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getInvoiceAsPdf(xeroTenantId, invoiceID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
InvoiceID*
UUID (uuid)
Unique identifier for an Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getInvoiceAttachmentByFileName

Retrieves an attachment from a specific invoice or purchase bill by filename


/Invoices/{InvoiceID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID invoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        String contentType = "image/jpg";

        try {
            ByteArrayInputStream result = apiInstance.getInvoiceAttachmentByFileName(accessToken, xeroTenantId, invoiceID, fileName, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getInvoiceAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID invoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Invoice
        String fileName = xero-dev.jpg; // String | Name of the file you are attaching
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getInvoiceAttachmentByFileName(xeroTenantId, invoiceID, fileName, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getInvoiceAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *invoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Invoice (default to null)
String *fileName = xero-dev.jpg; // Name of the file you are attaching (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves an attachment from a specific invoice or purchase bill by filename
[apiInstance getInvoiceAttachmentByFileNameWith:xeroTenantId
    invoiceID:invoiceID
    fileName:fileName
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const invoiceID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for an Invoice
const fileName = "xero-dev.jpg";  // {String} Name of the file you are attaching
const contentType = "image/jpg";  // {String} The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

try {
  const response = await xero.accountingApi.getInvoiceAttachmentByFileName(xeroTenantId, invoiceID, fileName, contentType);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getInvoiceAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var invoiceID = new UUID(); // UUID | Unique identifier for an Invoice (default to null)
            var fileName = xero-dev.jpg;  // String | Name of the file you are attaching (default to null)
            var contentType = image/jpg;  // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

            try
            {
                // Retrieves an attachment from a specific invoice or purchase bill by filename
                File result = apiInstance.getInvoiceAttachmentByFileName(xeroTenantId, invoiceID, fileName, contentType);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getInvoiceAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$invoiceID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getInvoiceAttachmentByFileName($xeroTenantId, $invoiceID, $fileName, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getInvoiceAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Invoice
my $fileName = xero-dev.jpg; # String | Name of the file you are attaching
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getInvoiceAttachmentByFileName(xeroTenantId => $xeroTenantId, invoiceID => $invoiceID, fileName => $fileName, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getInvoiceAttachmentByFileName: $@\n";
}
# 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_get_invoice_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    invoiceID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    contentType = 'image/jpg'
    
    try:
        api_response = api_instance.get_invoice_attachment_by_file_name(xeroTenantId, invoiceID, fileName, contentType)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getInvoiceAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoiceID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getInvoiceAttachmentByFileName(xeroTenantId, invoiceID, fileName, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
InvoiceID*
UUID (uuid)
Unique identifier for an Invoice
Required
FileName*
String
Name of the file you are attaching
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getInvoiceAttachmentById

Retrieves a specific attachment from a specific invoices or purchase bills by using a unique attachment Id


/Invoices/{InvoiceID}/Attachments/{AttachmentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID}/Attachments/{AttachmentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID invoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID attachmentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String contentType = "image/jpg";

        try {
            ByteArrayInputStream result = apiInstance.getInvoiceAttachmentById(accessToken, xeroTenantId, invoiceID, attachmentID, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getInvoiceAttachmentById");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID invoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Invoice
        UUID attachmentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Attachment
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getInvoiceAttachmentById(xeroTenantId, invoiceID, attachmentID, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getInvoiceAttachmentById");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *invoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Invoice (default to null)
UUID *attachmentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Attachment (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment from a specific invoices or purchase bills by using a unique attachment Id
[apiInstance getInvoiceAttachmentByIdWith:xeroTenantId
    invoiceID:invoiceID
    attachmentID:attachmentID
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const invoiceID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for an Invoice
const attachmentID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for an Attachment
const contentType = "image/jpg";  // {String} The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

try {
  const response = await xero.accountingApi.getInvoiceAttachmentById(xeroTenantId, invoiceID, attachmentID, contentType);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getInvoiceAttachmentByIdExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var invoiceID = new UUID(); // UUID | Unique identifier for an Invoice (default to null)
            var attachmentID = new UUID(); // UUID | Unique identifier for an Attachment (default to null)
            var contentType = image/jpg;  // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

            try
            {
                // Retrieves a specific attachment from a specific invoices or purchase bills by using a unique attachment Id
                File result = apiInstance.getInvoiceAttachmentById(xeroTenantId, invoiceID, attachmentID, contentType);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getInvoiceAttachmentById: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$invoiceID = "00000000-0000-0000-0000-000000000000";
$attachmentID = "00000000-0000-0000-0000-000000000000";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getInvoiceAttachmentById($xeroTenantId, $invoiceID, $attachmentID, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getInvoiceAttachmentById: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Invoice
my $attachmentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Attachment
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getInvoiceAttachmentById(xeroTenantId => $xeroTenantId, invoiceID => $invoiceID, attachmentID => $attachmentID, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getInvoiceAttachmentById: $@\n";
}
# 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_get_invoice_attachment_by_id():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    invoiceID = '00000000-0000-0000-0000-000000000000'
    attachmentID = '00000000-0000-0000-0000-000000000000'
    contentType = 'image/jpg'
    
    try:
        api_response = api_instance.get_invoice_attachment_by_id(xeroTenantId, invoiceID, attachmentID, contentType)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getInvoiceAttachmentById: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoiceID = 00000000-0000-0000-0000-000000000000; // UUID
    let attachmentID = 00000000-0000-0000-0000-000000000000; // UUID
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getInvoiceAttachmentById(xeroTenantId, invoiceID, attachmentID, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
InvoiceID*
UUID (uuid)
Unique identifier for an Invoice
Required
AttachmentID*
UUID (uuid)
Unique identifier for an Attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getInvoiceAttachments

Retrieves attachments for a specific invoice or purchase bill


/Invoices/{InvoiceID}/Attachments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID}/Attachments"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID invoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Attachments result = apiInstance.getInvoiceAttachments(accessToken, xeroTenantId, invoiceID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getInvoiceAttachments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID invoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Invoice
        try {
            Attachments result = apiInstance.getInvoiceAttachments(xeroTenantId, invoiceID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getInvoiceAttachments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *invoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Invoice (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves attachments for a specific invoice or purchase bill
[apiInstance getInvoiceAttachmentsWith:xeroTenantId
    invoiceID:invoiceID
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const invoiceID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for an Invoice

try {
  const response = await xero.accountingApi.getInvoiceAttachments(xeroTenantId, invoiceID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getInvoiceAttachmentsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var invoiceID = new UUID(); // UUID | Unique identifier for an Invoice (default to null)

            try
            {
                // Retrieves attachments for a specific invoice or purchase bill
                Attachments result = apiInstance.getInvoiceAttachments(xeroTenantId, invoiceID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getInvoiceAttachments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$invoiceID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getInvoiceAttachments($xeroTenantId, $invoiceID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getInvoiceAttachments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Invoice

eval { 
    my $result = $api_instance->getInvoiceAttachments(xeroTenantId => $xeroTenantId, invoiceID => $invoiceID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getInvoiceAttachments: $@\n";
}
# 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_get_invoice_attachments():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    invoiceID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_invoice_attachments(xeroTenantId, invoiceID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getInvoiceAttachments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoiceID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getInvoiceAttachments(xeroTenantId, invoiceID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
InvoiceID*
UUID (uuid)
Unique identifier for an Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getInvoiceHistory

Retrieves history records for a specific invoice


/Invoices/{InvoiceID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID invoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getInvoiceHistory(accessToken, xeroTenantId, invoiceID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getInvoiceHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID invoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Invoice
        try {
            HistoryRecords result = apiInstance.getInvoiceHistory(xeroTenantId, invoiceID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getInvoiceHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *invoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Invoice (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history records for a specific invoice
[apiInstance getInvoiceHistoryWith:xeroTenantId
    invoiceID:invoiceID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const invoiceID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for an Invoice

try {
  const response = await xero.accountingApi.getInvoiceHistory(xeroTenantId, invoiceID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getInvoiceHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var invoiceID = new UUID(); // UUID | Unique identifier for an Invoice (default to null)

            try
            {
                // Retrieves history records for a specific invoice
                HistoryRecords result = apiInstance.getInvoiceHistory(xeroTenantId, invoiceID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getInvoiceHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$invoiceID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getInvoiceHistory($xeroTenantId, $invoiceID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getInvoiceHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Invoice

eval { 
    my $result = $api_instance->getInvoiceHistory(xeroTenantId => $xeroTenantId, invoiceID => $invoiceID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getInvoiceHistory: $@\n";
}
# 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_get_invoice_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    invoiceID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_invoice_history(xeroTenantId, invoiceID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getInvoiceHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoiceID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getInvoiceHistory(xeroTenantId, invoiceID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
InvoiceID*
UUID (uuid)
Unique identifier for an Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getInvoiceReminders

Retrieves invoice reminder settings


/InvoiceReminders/Settings

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/InvoiceReminders/Settings"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";

        try {
            InvoiceReminders result = apiInstance.getInvoiceReminders(accessToken, xeroTenantId);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getInvoiceReminders");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        try {
            InvoiceReminders result = apiInstance.getInvoiceReminders(xeroTenantId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getInvoiceReminders");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves invoice reminder settings
[apiInstance getInvoiceRemindersWith:xeroTenantId
              completionHandler: ^(InvoiceReminders output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

try {
  const response = await xero.accountingApi.getInvoiceReminders(xeroTenantId);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getInvoiceRemindersExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)

            try
            {
                // Retrieves invoice reminder settings
                InvoiceReminders result = apiInstance.getInvoiceReminders(xeroTenantId);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getInvoiceReminders: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

try {
  $result = $apiInstance->getInvoiceReminders($xeroTenantId);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getInvoiceReminders: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant

eval { 
    my $result = $api_instance->getInvoiceReminders(xeroTenantId => $xeroTenantId);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getInvoiceReminders: $@\n";
}
# 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_get_invoice_reminders():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    
    try:
        api_response = api_instance.get_invoice_reminders(xeroTenantId)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getInvoiceReminders: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getInvoiceReminders(xeroTenantId, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getInvoices

Retrieves sales invoices or purchase bills


/Invoices

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices?where=Status=="DRAFT"&order=InvoiceNumber ASC&IDs="00000000-0000-0000-0000-000000000000"&InvoiceNumbers="INV-001", "INV-002"&ContactIDs="00000000-0000-0000-0000-000000000000"&Statuses="DRAFT", "SUBMITTED"&page=1&includeArchived=true&createdByMyApp=false&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = "Status=="DRAFT"";
        String order = "InvoiceNumber ASC";
        array[UUID] iDs = "00000000-0000-0000-0000-000000000000";
        array[String] invoiceNumbers = "INV-001", "INV-002";
        array[UUID] contactIDs = "00000000-0000-0000-0000-000000000000";
        array[String] statuses = "DRAFT", "SUBMITTED";
        Integer page = 1;
        Boolean includeArchived = true;
        Boolean createdByMyApp = false;
        Integer unitdp = 4;

        try {
            Invoices result = apiInstance.getInvoices(accessToken, xeroTenantId, ifModifiedSince, where, order, iDs, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getInvoices");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = Status=="DRAFT"; // String | Filter by an any element
        String order = InvoiceNumber ASC; // String | Order by an any element
        array[UUID] iDs = "00000000-0000-0000-0000-000000000000"; // array[UUID] | Filter by a comma-separated list of InvoicesIDs.
        array[String] invoiceNumbers = "INV-001", "INV-002"; // array[String] | Filter by a comma-separated list of InvoiceNumbers.
        array[UUID] contactIDs = "00000000-0000-0000-0000-000000000000"; // array[UUID] | Filter by a comma-separated list of ContactIDs.
        array[String] statuses = "DRAFT", "SUBMITTED"; // array[String] | Filter by a comma-separated list Statuses. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter.
        Integer page = 1; // Integer | e.g. page=1 – Up to 100 invoices will be returned in a single API call with line items shown for each invoice
        Boolean includeArchived = true; // Boolean | e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response
        Boolean createdByMyApp = false; // Boolean | When set to true you'll only retrieve Invoices created by your app
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Invoices result = apiInstance.getInvoices(xeroTenantId, ifModifiedSince, where, order, iDs, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getInvoices");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = Status=="DRAFT"; // Filter by an any element (optional) (default to null)
String *order = InvoiceNumber ASC; // Order by an any element (optional) (default to null)
array[UUID] *iDs = "00000000-0000-0000-0000-000000000000"; // Filter by a comma-separated list of InvoicesIDs. (optional) (default to null)
array[String] *invoiceNumbers = "INV-001", "INV-002"; // Filter by a comma-separated list of InvoiceNumbers. (optional) (default to null)
array[UUID] *contactIDs = "00000000-0000-0000-0000-000000000000"; // Filter by a comma-separated list of ContactIDs. (optional) (default to null)
array[String] *statuses = "DRAFT", "SUBMITTED"; // Filter by a comma-separated list Statuses. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. (optional) (default to null)
Integer *page = 1; // e.g. page=1 – Up to 100 invoices will be returned in a single API call with line items shown for each invoice (optional) (default to null)
Boolean *includeArchived = true; // e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response (optional) (default to null)
Boolean *createdByMyApp = false; // When set to true you'll only retrieve Invoices created by your app (optional) (default to null)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves sales invoices or purchase bills
[apiInstance getInvoicesWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
    iDs:iDs
    invoiceNumbers:invoiceNumbers
    contactIDs:contactIDs
    statuses:statuses
    page:page
    includeArchived:includeArchived
    createdByMyApp:createdByMyApp
    unitdp:unitdp
              completionHandler: ^(Invoices output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="DRAFT"';  // {String} Filter by an any element

const order = 'InvoiceNumber ASC';  // {String} Order by an any element

const iDs = ['"00000000-0000-0000-0000-000000000000"'];  // {array[UUID]} Filter by a comma-separated list of InvoicesIDs.

const invoiceNumbers = ['"INV-001", "INV-002"'];  // {array[String]} Filter by a comma-separated list of InvoiceNumbers.

const contactIDs = ['"00000000-0000-0000-0000-000000000000"'];  // {array[UUID]} Filter by a comma-separated list of ContactIDs.

const statuses = ['"DRAFT", "SUBMITTED"'];  // {array[String]} Filter by a comma-separated list Statuses. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter.

const page = 1;  // {Integer} e.g. page=1 – Up to 100 invoices will be returned in a single API call with line items shown for each invoice

const includeArchived = true;  // {Boolean} e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response

const createdByMyApp = false;  // {Boolean} When set to true you'll only retrieve Invoices created by your app

const unitdp = 4;  // {Integer} e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts


try {
  const response = await xero.accountingApi.getInvoices(xeroTenantId, ifModifiedSince, where, order, iDs, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getInvoicesExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var ifModifiedSince = 2020-02-06T12:17:43.202-08:00;  // Date | Only records created or modified since this timestamp will be returned (optional)  (default to null)
            var where = Status=="DRAFT";  // String | Filter by an any element (optional)  (default to null)
            var order = InvoiceNumber ASC;  // String | Order by an any element (optional)  (default to null)
            var iDs = new array[UUID](); // array[UUID] | Filter by a comma-separated list of InvoicesIDs. (optional)  (default to null)
            var invoiceNumbers = new array[String](); // array[String] | Filter by a comma-separated list of InvoiceNumbers. (optional)  (default to null)
            var contactIDs = new array[UUID](); // array[UUID] | Filter by a comma-separated list of ContactIDs. (optional)  (default to null)
            var statuses = new array[String](); // array[String] | Filter by a comma-separated list Statuses. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. (optional)  (default to null)
            var page = 1;  // Integer | e.g. page=1 – Up to 100 invoices will be returned in a single API call with line items shown for each invoice (optional)  (default to null)
            var includeArchived = true;  // Boolean | e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response (optional)  (default to null)
            var createdByMyApp = false;  // Boolean | When set to true you'll only retrieve Invoices created by your app (optional)  (default to null)
            var unitdp = 4;  // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)  (default to null)

            try
            {
                // Retrieves sales invoices or purchase bills
                Invoices result = apiInstance.getInvoices(xeroTenantId, ifModifiedSince, where, order, iDs, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getInvoices: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\Invoice::STATUS_DRAFT . '"";
$order = "InvoiceNumber ASC";
$iDs = array("00000000-0000-0000-0000-000000000000")
$invoiceNumbers = array("INV-001", "INV-002")
$contactIDs = array("00000000-0000-0000-0000-000000000000")
$statuses = array("DRAFT", "SUBMITTED")
$page = 1;
$includeArchived = true;
$createdByMyApp = false;
$unitdp = 4;

try {
  $result = $apiInstance->getInvoices($xeroTenantId, $ifModifiedSince, $where, $order, $iDs, $invoiceNumbers, $contactIDs, $statuses, $page, $includeArchived, $createdByMyApp, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getInvoices: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = Status=="DRAFT"; # String | Filter by an any element
my $order = InvoiceNumber ASC; # String | Order by an any element
my $iDs = ["00000000-0000-0000-0000-000000000000"]; # array[UUID] | Filter by a comma-separated list of InvoicesIDs.
my $invoiceNumbers = ["INV-001", "INV-002"]; # array[String] | Filter by a comma-separated list of InvoiceNumbers.
my $contactIDs = ["00000000-0000-0000-0000-000000000000"]; # array[UUID] | Filter by a comma-separated list of ContactIDs.
my $statuses = ["DRAFT", "SUBMITTED"]; # array[String] | Filter by a comma-separated list Statuses. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter.
my $page = 1; # Integer | e.g. page=1 – Up to 100 invoices will be returned in a single API call with line items shown for each invoice
my $includeArchived = true; # Boolean | e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response
my $createdByMyApp = false; # Boolean | When set to true you'll only retrieve Invoices created by your app
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->getInvoices(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order, iDs => $iDs, invoiceNumbers => $invoiceNumbers, contactIDs => $contactIDs, statuses => $statuses, page => $page, includeArchived => $includeArchived, createdByMyApp => $createdByMyApp, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getInvoices: $@\n";
}
# 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_get_invoices():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    ifModifiedSince = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'Status=="DRAFT"'
    order = 'InvoiceNumber ASC'
    iDs = ["00000000-0000-0000-0000-000000000000"]
    invoiceNumbers = ["INV-001", "INV-002"]
    contactIDs = ["00000000-0000-0000-0000-000000000000"]
    statuses = ["DRAFT", "SUBMITTED"]
    includeArchived = 'true'
    createdByMyApp = 'false'
    
    try:
        api_response = api_instance.get_invoices(xeroTenantId, ifModifiedSince, where, order, iDs, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getInvoices: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = Status=="DRAFT"; // String
    let order = InvoiceNumber ASC; // String
    let iDs = "00000000-0000-0000-0000-000000000000"; // array[UUID]
    let invoiceNumbers = "INV-001", "INV-002"; // array[String]
    let contactIDs = "00000000-0000-0000-0000-000000000000"; // array[UUID]
    let statuses = "DRAFT", "SUBMITTED"; // array[String]
    let page = 1; // Integer
    let includeArchived = true; // Boolean
    let createdByMyApp = false; // Boolean
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getInvoices(xeroTenantId, ifModifiedSince, where, order, iDs, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element
IDs
array[UUID] (uuid)
Filter by a comma-separated list of InvoicesIDs.
InvoiceNumbers
array[String]
Filter by a comma-separated list of InvoiceNumbers.
ContactIDs
array[UUID] (uuid)
Filter by a comma-separated list of ContactIDs.
Statuses
array[String]
Filter by a comma-separated list Statuses. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter.
page
Integer
e.g. page=1 – Up to 100 invoices will be returned in a single API call with line items shown for each invoice
includeArchived
Boolean
e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response
createdByMyApp
Boolean
When set to true you'll only retrieve Invoices created by your app
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

getItem

Retrieves a specific item using a unique item Id


/Items/{ItemID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Items/{ItemID}?unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID itemID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Integer unitdp = 4;

        try {
            Items result = apiInstance.getItem(accessToken, xeroTenantId, itemID, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getItem");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID itemID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Item
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Items result = apiInstance.getItem(xeroTenantId, itemID, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getItem");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *itemID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Item (default to null)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific item using a unique item Id
[apiInstance getItemWith:xeroTenantId
    itemID:itemID
    unitdp:unitdp
              completionHandler: ^(Items output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const itemID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for an Item

const unitdp = 4;  // {Integer} e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts


try {
  const response = await xero.accountingApi.getItem(xeroTenantId, itemID,  unitdp);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getItemExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var itemID = new UUID(); // UUID | Unique identifier for an Item (default to null)
            var unitdp = 4;  // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)  (default to null)

            try
            {
                // Retrieves a specific item using a unique item Id
                Items result = apiInstance.getItem(xeroTenantId, itemID, unitdp);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getItem: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$itemID = "00000000-0000-0000-0000-000000000000";
$unitdp = 4;

try {
  $result = $apiInstance->getItem($xeroTenantId, $itemID, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getItem: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $itemID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Item
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->getItem(xeroTenantId => $xeroTenantId, itemID => $itemID, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getItem: $@\n";
}
# 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_get_item():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    itemID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_item(xeroTenantId, itemID, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getItem: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let itemID = 00000000-0000-0000-0000-000000000000; // UUID
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getItem(xeroTenantId, itemID, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Path parameters
Name Description
ItemID*
UUID (uuid)
Unique identifier for an Item
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

getItemHistory

Retrieves history for a specific item


/Items/{ItemID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Items/{ItemID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID itemID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getItemHistory(accessToken, xeroTenantId, itemID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getItemHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID itemID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Item
        try {
            HistoryRecords result = apiInstance.getItemHistory(xeroTenantId, itemID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getItemHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *itemID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Item (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history for a specific item
[apiInstance getItemHistoryWith:xeroTenantId
    itemID:itemID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const itemID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for an Item

try {
  const response = await xero.accountingApi.getItemHistory(xeroTenantId, itemID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getItemHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var itemID = new UUID(); // UUID | Unique identifier for an Item (default to null)

            try
            {
                // Retrieves history for a specific item
                HistoryRecords result = apiInstance.getItemHistory(xeroTenantId, itemID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getItemHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$itemID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getItemHistory($xeroTenantId, $itemID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getItemHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $itemID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Item

eval { 
    my $result = $api_instance->getItemHistory(xeroTenantId => $xeroTenantId, itemID => $itemID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getItemHistory: $@\n";
}
# 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_get_item_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    itemID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_item_history(xeroTenantId, itemID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getItemHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let itemID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getItemHistory(xeroTenantId, itemID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Path parameters
Name Description
ItemID*
UUID (uuid)
Unique identifier for an Item
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getItems

Retrieves items


/Items

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Items?where=IsSold==true&order=Code ASC&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = "IsSold==true";
        String order = "Code ASC";
        Integer unitdp = 4;

        try {
            Items result = apiInstance.getItems(accessToken, xeroTenantId, ifModifiedSince, where, order, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getItems");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = IsSold==true; // String | Filter by an any element
        String order = Code ASC; // String | Order by an any element
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Items result = apiInstance.getItems(xeroTenantId, ifModifiedSince, where, order, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getItems");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = IsSold==true; // Filter by an any element (optional) (default to null)
String *order = Code ASC; // Order by an any element (optional) (default to null)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves items
[apiInstance getItemsWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
    unitdp:unitdp
              completionHandler: ^(Items output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'IsSold==true';  // {String} Filter by an any element

const order = 'Code ASC';  // {String} Order by an any element

const unitdp = 4;  // {Integer} e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts


try {
  const response = await xero.accountingApi.getItems(xeroTenantId, ifModifiedSince, where, order, unitdp);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getItemsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var ifModifiedSince = 2020-02-06T12:17:43.202-08:00;  // Date | Only records created or modified since this timestamp will be returned (optional)  (default to null)
            var where = IsSold==true;  // String | Filter by an any element (optional)  (default to null)
            var order = Code ASC;  // String | Order by an any element (optional)  (default to null)
            var unitdp = 4;  // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)  (default to null)

            try
            {
                // Retrieves items
                Items result = apiInstance.getItems(xeroTenantId, ifModifiedSince, where, order, unitdp);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getItems: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "IsSold==true";
$order = "Code ASC";
$unitdp = 4;

try {
  $result = $apiInstance->getItems($xeroTenantId, $ifModifiedSince, $where, $order, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getItems: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = IsSold==true; # String | Filter by an any element
my $order = Code ASC; # String | Order by an any element
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->getItems(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getItems: $@\n";
}
# 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_get_items():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    ifModifiedSince = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'IsSold==true'
    order = 'Code ASC'
    
    try:
        api_response = api_instance.get_items(xeroTenantId, ifModifiedSince, where, order, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getItems: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = IsSold==true; // String
    let order = Code ASC; // String
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getItems(xeroTenantId, ifModifiedSince, where, order, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

getJournal

Retrieves a specific journal using a unique journal Id.


/Journals/{JournalID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Journals/{JournalID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID journalID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Journals result = apiInstance.getJournal(accessToken, xeroTenantId, journalID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getJournal");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID journalID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Journal
        try {
            Journals result = apiInstance.getJournal(xeroTenantId, journalID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getJournal");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *journalID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Journal (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific journal using a unique journal Id.
[apiInstance getJournalWith:xeroTenantId
    journalID:journalID
              completionHandler: ^(Journals output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const journalID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Journal

try {
  const response = await xero.accountingApi.getJournal(xeroTenantId, journalID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getJournalExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var journalID = new UUID(); // UUID | Unique identifier for a Journal (default to null)

            try
            {
                // Retrieves a specific journal using a unique journal Id.
                Journals result = apiInstance.getJournal(xeroTenantId, journalID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getJournal: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$journalID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getJournal($xeroTenantId, $journalID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getJournal: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $journalID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Journal

eval { 
    my $result = $api_instance->getJournal(xeroTenantId => $xeroTenantId, journalID => $journalID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getJournal: $@\n";
}
# 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_get_journal():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    journalID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_journal(xeroTenantId, journalID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getJournal: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let journalID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getJournal(xeroTenantId, journalID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.journals.read Grant read-only access to journals

Parameters

Path parameters
Name Description
JournalID*
UUID (uuid)
Unique identifier for a Journal
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getJournals

Retrieves journals


/Journals

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Journals?offset=10&paymentsOnly=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        Integer offset = 10;
        Boolean paymentsOnly = true;

        try {
            Journals result = apiInstance.getJournals(accessToken, xeroTenantId, ifModifiedSince, offset, paymentsOnly);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getJournals");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        Integer offset = 10; // Integer | Offset by a specified journal number. e.g. journals with a JournalNumber greater than the offset will be returned
        Boolean paymentsOnly = true; // Boolean | Filter to retrieve journals on a cash basis. Journals are returned on an accrual basis by default.
        try {
            Journals result = apiInstance.getJournals(xeroTenantId, ifModifiedSince, offset, paymentsOnly);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getJournals");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
Integer *offset = 10; // Offset by a specified journal number. e.g. journals with a JournalNumber greater than the offset will be returned (optional) (default to null)
Boolean *paymentsOnly = true; // Filter to retrieve journals on a cash basis. Journals are returned on an accrual basis by default. (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves journals
[apiInstance getJournalsWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    offset:offset
    paymentsOnly:paymentsOnly
              completionHandler: ^(Journals output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const offset = 10;  // {Integer} Offset by a specified journal number. e.g. journals with a JournalNumber greater than the offset will be returned

const paymentsOnly = true;  // {Boolean} Filter to retrieve journals on a cash basis. Journals are returned on an accrual basis by default.


try {
  const response = await xero.accountingApi.getJournals(xeroTenantId, ifModifiedSince, offset, paymentsOnly);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getJournalsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var ifModifiedSince = 2020-02-06T12:17:43.202-08:00;  // Date | Only records created or modified since this timestamp will be returned (optional)  (default to null)
            var offset = 10;  // Integer | Offset by a specified journal number. e.g. journals with a JournalNumber greater than the offset will be returned (optional)  (default to null)
            var paymentsOnly = true;  // Boolean | Filter to retrieve journals on a cash basis. Journals are returned on an accrual basis by default. (optional)  (default to null)

            try
            {
                // Retrieves journals
                Journals result = apiInstance.getJournals(xeroTenantId, ifModifiedSince, offset, paymentsOnly);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getJournals: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$offset = 10;
$paymentsOnly = true;

try {
  $result = $apiInstance->getJournals($xeroTenantId, $ifModifiedSince, $offset, $paymentsOnly);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getJournals: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $offset = 10; # Integer | Offset by a specified journal number. e.g. journals with a JournalNumber greater than the offset will be returned
my $paymentsOnly = true; # Boolean | Filter to retrieve journals on a cash basis. Journals are returned on an accrual basis by default.

eval { 
    my $result = $api_instance->getJournals(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, offset => $offset, paymentsOnly => $paymentsOnly);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getJournals: $@\n";
}
# 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_get_journals():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    ifModifiedSince = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    paymentsOnly = 'true'
    
    try:
        api_response = api_instance.get_journals(xeroTenantId, ifModifiedSince, offset, paymentsOnly)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getJournals: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let offset = 10; // Integer
    let paymentsOnly = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.getJournals(xeroTenantId, ifModifiedSince, offset, paymentsOnly, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.journals.read Grant read-only access to journals

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
offset
Integer
Offset by a specified journal number. e.g. journals with a JournalNumber greater than the offset will be returned
paymentsOnly
Boolean
Filter to retrieve journals on a cash basis. Journals are returned on an accrual basis by default.

getLinkedTransaction

Retrieves a specific linked transaction (billable expenses) using a unique linked transaction Id


/LinkedTransactions/{LinkedTransactionID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/LinkedTransactions/{LinkedTransactionID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID linkedTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            LinkedTransactions result = apiInstance.getLinkedTransaction(accessToken, xeroTenantId, linkedTransactionID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getLinkedTransaction");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID linkedTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a LinkedTransaction
        try {
            LinkedTransactions result = apiInstance.getLinkedTransaction(xeroTenantId, linkedTransactionID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getLinkedTransaction");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *linkedTransactionID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a LinkedTransaction (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific linked transaction (billable expenses) using a unique linked transaction Id
[apiInstance getLinkedTransactionWith:xeroTenantId
    linkedTransactionID:linkedTransactionID
              completionHandler: ^(LinkedTransactions output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const linkedTransactionID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a LinkedTransaction

try {
  const response = await xero.accountingApi.getLinkedTransaction(xeroTenantId, linkedTransactionID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getLinkedTransactionExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var linkedTransactionID = new UUID(); // UUID | Unique identifier for a LinkedTransaction (default to null)

            try
            {
                // Retrieves a specific linked transaction (billable expenses) using a unique linked transaction Id
                LinkedTransactions result = apiInstance.getLinkedTransaction(xeroTenantId, linkedTransactionID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getLinkedTransaction: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$linkedTransactionID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getLinkedTransaction($xeroTenantId, $linkedTransactionID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getLinkedTransaction: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $linkedTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a LinkedTransaction

eval { 
    my $result = $api_instance->getLinkedTransaction(xeroTenantId => $xeroTenantId, linkedTransactionID => $linkedTransactionID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getLinkedTransaction: $@\n";
}
# 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_get_linked_transaction():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    linkedTransactionID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_linked_transaction(xeroTenantId, linkedTransactionID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getLinkedTransaction: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let linkedTransactionID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getLinkedTransaction(xeroTenantId, linkedTransactionID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
LinkedTransactionID*
UUID (uuid)
Unique identifier for a LinkedTransaction
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getLinkedTransactions

Retrieves linked transactions (billable expenses)


/LinkedTransactions

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/LinkedTransactions?page=1&LinkedTransactionID=00000000-0000-0000-0000-000000000000&SourceTransactionID=00000000-0000-0000-0000-000000000000&ContactID=00000000-0000-0000-0000-000000000000&Status=APPROVED&TargetTransactionID=00000000-0000-0000-0000-000000000000"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        Integer page = 1;
        UUID linkedTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID sourceTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID contactID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String status = "APPROVED";
        UUID targetTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            LinkedTransactions result = apiInstance.getLinkedTransactions(accessToken, xeroTenantId, page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getLinkedTransactions");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Integer page = 1; // Integer | Up to 100 linked transactions will be returned in a single API call. Use the page parameter to specify the page to be returned e.g. page=1.
        UUID linkedTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | The Xero identifier for an Linked Transaction
        UUID sourceTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Filter by the SourceTransactionID. Get the linked transactions created from a particular ACCPAY invoice
        UUID contactID = 00000000-0000-0000-0000-000000000000; // UUID | Filter by the ContactID. Get all the linked transactions that have been assigned to a particular customer.
        String status = APPROVED; // String | Filter by the combination of ContactID and Status. Get  the linked transactions associated to a  customer and with a status
        UUID targetTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Filter by the TargetTransactionID. Get all the linked transactions allocated to a particular ACCREC invoice
        try {
            LinkedTransactions result = apiInstance.getLinkedTransactions(xeroTenantId, page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getLinkedTransactions");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Integer *page = 1; // Up to 100 linked transactions will be returned in a single API call. Use the page parameter to specify the page to be returned e.g. page=1. (optional) (default to null)
UUID *linkedTransactionID = 00000000-0000-0000-0000-000000000000; // The Xero identifier for an Linked Transaction (optional) (default to null)
UUID *sourceTransactionID = 00000000-0000-0000-0000-000000000000; // Filter by the SourceTransactionID. Get the linked transactions created from a particular ACCPAY invoice (optional) (default to null)
UUID *contactID = 00000000-0000-0000-0000-000000000000; // Filter by the ContactID. Get all the linked transactions that have been assigned to a particular customer. (optional) (default to null)
String *status = APPROVED; // Filter by the combination of ContactID and Status. Get  the linked transactions associated to a  customer and with a status (optional) (default to null)
UUID *targetTransactionID = 00000000-0000-0000-0000-000000000000; // Filter by the TargetTransactionID. Get all the linked transactions allocated to a particular ACCREC invoice (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves linked transactions (billable expenses)
[apiInstance getLinkedTransactionsWith:xeroTenantId
    page:page
    linkedTransactionID:linkedTransactionID
    sourceTransactionID:sourceTransactionID
    contactID:contactID
    status:status
    targetTransactionID:targetTransactionID
              completionHandler: ^(LinkedTransactions output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const page = 1;  // {Integer} Up to 100 linked transactions will be returned in a single API call. Use the page parameter to specify the page to be returned e.g. page=1.

const linkedTransactionID = '00000000-0000-0000-0000-000000000000';  // {UUID} The Xero identifier for an Linked Transaction

const sourceTransactionID = '00000000-0000-0000-0000-000000000000';  // {UUID} Filter by the SourceTransactionID. Get the linked transactions created from a particular ACCPAY invoice

const contactID = '00000000-0000-0000-0000-000000000000';  // {UUID} Filter by the ContactID. Get all the linked transactions that have been assigned to a particular customer.

const status = 'APPROVED';  // {String} Filter by the combination of ContactID and Status. Get  the linked transactions associated to a  customer and with a status

const targetTransactionID = '00000000-0000-0000-0000-000000000000';  // {UUID} Filter by the TargetTransactionID. Get all the linked transactions allocated to a particular ACCREC invoice


try {
  const response = await xero.accountingApi.getLinkedTransactions(xeroTenantId,  page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getLinkedTransactionsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var page = 1;  // Integer | Up to 100 linked transactions will be returned in a single API call. Use the page parameter to specify the page to be returned e.g. page=1. (optional)  (default to null)
            var linkedTransactionID = new UUID(); // UUID | The Xero identifier for an Linked Transaction (optional)  (default to null)
            var sourceTransactionID = new UUID(); // UUID | Filter by the SourceTransactionID. Get the linked transactions created from a particular ACCPAY invoice (optional)  (default to null)
            var contactID = new UUID(); // UUID | Filter by the ContactID. Get all the linked transactions that have been assigned to a particular customer. (optional)  (default to null)
            var status = APPROVED;  // String | Filter by the combination of ContactID and Status. Get  the linked transactions associated to a  customer and with a status (optional)  (default to null)
            var targetTransactionID = new UUID(); // UUID | Filter by the TargetTransactionID. Get all the linked transactions allocated to a particular ACCREC invoice (optional)  (default to null)

            try
            {
                // Retrieves linked transactions (billable expenses)
                LinkedTransactions result = apiInstance.getLinkedTransactions(xeroTenantId, page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getLinkedTransactions: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$page = 1;
$linkedTransactionID = "00000000-0000-0000-0000-000000000000";
$sourceTransactionID = "00000000-0000-0000-0000-000000000000";
$contactID = "00000000-0000-0000-0000-000000000000";
$status = "APPROVED";
$targetTransactionID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getLinkedTransactions($xeroTenantId, $page, $linkedTransactionID, $sourceTransactionID, $contactID, $status, $targetTransactionID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getLinkedTransactions: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $page = 1; # Integer | Up to 100 linked transactions will be returned in a single API call. Use the page parameter to specify the page to be returned e.g. page=1.
my $linkedTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | The Xero identifier for an Linked Transaction
my $sourceTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Filter by the SourceTransactionID. Get the linked transactions created from a particular ACCPAY invoice
my $contactID = 00000000-0000-0000-0000-000000000000; # UUID | Filter by the ContactID. Get all the linked transactions that have been assigned to a particular customer.
my $status = APPROVED; # String | Filter by the combination of ContactID and Status. Get  the linked transactions associated to a  customer and with a status
my $targetTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Filter by the TargetTransactionID. Get all the linked transactions allocated to a particular ACCREC invoice

eval { 
    my $result = $api_instance->getLinkedTransactions(xeroTenantId => $xeroTenantId, page => $page, linkedTransactionID => $linkedTransactionID, sourceTransactionID => $sourceTransactionID, contactID => $contactID, status => $status, targetTransactionID => $targetTransactionID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getLinkedTransactions: $@\n";
}
# 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_get_linked_transactions():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    linkedTransactionID = '00000000-0000-0000-0000-000000000000'
    sourceTransactionID = '00000000-0000-0000-0000-000000000000'
    contactID = '00000000-0000-0000-0000-000000000000'
    status = 'APPROVED'
    targetTransactionID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_linked_transactions(xeroTenantId, page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getLinkedTransactions: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let page = 1; // Integer
    let linkedTransactionID = 00000000-0000-0000-0000-000000000000; // UUID
    let sourceTransactionID = 00000000-0000-0000-0000-000000000000; // UUID
    let contactID = 00000000-0000-0000-0000-000000000000; // UUID
    let status = APPROVED; // String
    let targetTransactionID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getLinkedTransactions(xeroTenantId, page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
page
Integer
Up to 100 linked transactions will be returned in a single API call. Use the page parameter to specify the page to be returned e.g. page=1.
LinkedTransactionID
UUID (uuid)
The Xero identifier for an Linked Transaction
SourceTransactionID
UUID (uuid)
Filter by the SourceTransactionID. Get the linked transactions created from a particular ACCPAY invoice
ContactID
UUID (uuid)
Filter by the ContactID. Get all the linked transactions that have been assigned to a particular customer.
Status
String
Filter by the combination of ContactID and Status. Get the linked transactions associated to a customer and with a status
TargetTransactionID
UUID (uuid)
Filter by the TargetTransactionID. Get all the linked transactions allocated to a particular ACCREC invoice

getManualJournal

Retrieves a specific manual journal


/ManualJournals/{ManualJournalID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ManualJournals/{ManualJournalID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID manualJournalID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            ManualJournals result = apiInstance.getManualJournal(accessToken, xeroTenantId, manualJournalID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getManualJournal");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a ManualJournal
        try {
            ManualJournals result = apiInstance.getManualJournal(xeroTenantId, manualJournalID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getManualJournal");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *manualJournalID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a ManualJournal (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific manual journal
[apiInstance getManualJournalWith:xeroTenantId
    manualJournalID:manualJournalID
              completionHandler: ^(ManualJournals output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const manualJournalID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a ManualJournal

try {
  const response = await xero.accountingApi.getManualJournal(xeroTenantId, manualJournalID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getManualJournalExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var manualJournalID = new UUID(); // UUID | Unique identifier for a ManualJournal (default to null)

            try
            {
                // Retrieves a specific manual journal
                ManualJournals result = apiInstance.getManualJournal(xeroTenantId, manualJournalID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getManualJournal: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$manualJournalID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getManualJournal($xeroTenantId, $manualJournalID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getManualJournal: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $manualJournalID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a ManualJournal

eval { 
    my $result = $api_instance->getManualJournal(xeroTenantId => $xeroTenantId, manualJournalID => $manualJournalID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getManualJournal: $@\n";
}
# 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_get_manual_journal():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    manualJournalID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_manual_journal(xeroTenantId, manualJournalID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getManualJournal: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getManualJournal(xeroTenantId, manualJournalID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
ManualJournalID*
UUID (uuid)
Unique identifier for a ManualJournal
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getManualJournalAttachmentByFileName

Retrieves a specific attachment from a specific manual journal by file name


/ManualJournals/{ManualJournalID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ManualJournals/{ManualJournalID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID manualJournalID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        String contentType = "image/jpg";

        try {
            ByteArrayInputStream result = apiInstance.getManualJournalAttachmentByFileName(accessToken, xeroTenantId, manualJournalID, fileName, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getManualJournalAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a ManualJournal
        String fileName = xero-dev.jpg; // String | The name of the file being attached to a ManualJournal
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, fileName, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getManualJournalAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *manualJournalID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a ManualJournal (default to null)
String *fileName = xero-dev.jpg; // The name of the file being attached to a ManualJournal (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment from a specific manual journal by file name
[apiInstance getManualJournalAttachmentByFileNameWith:xeroTenantId
    manualJournalID:manualJournalID
    fileName:fileName
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const manualJournalID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a ManualJournal
const fileName = "xero-dev.jpg";  // {String} The name of the file being attached to a ManualJournal
const contentType = "image/jpg";  // {String} The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

try {
  const response = await xero.accountingApi.getManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, fileName, contentType);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getManualJournalAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var manualJournalID = new UUID(); // UUID | Unique identifier for a ManualJournal (default to null)
            var fileName = xero-dev.jpg;  // String | The name of the file being attached to a ManualJournal (default to null)
            var contentType = image/jpg;  // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

            try
            {
                // Retrieves a specific attachment from a specific manual journal by file name
                File result = apiInstance.getManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, fileName, contentType);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getManualJournalAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$manualJournalID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getManualJournalAttachmentByFileName($xeroTenantId, $manualJournalID, $fileName, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getManualJournalAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $manualJournalID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a ManualJournal
my $fileName = xero-dev.jpg; # String | The name of the file being attached to a ManualJournal
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getManualJournalAttachmentByFileName(xeroTenantId => $xeroTenantId, manualJournalID => $manualJournalID, fileName => $fileName, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getManualJournalAttachmentByFileName: $@\n";
}
# 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_get_manual_journal_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    manualJournalID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    contentType = 'image/jpg'
    
    try:
        api_response = api_instance.get_manual_journal_attachment_by_file_name(xeroTenantId, manualJournalID, fileName, contentType)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getManualJournalAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, fileName, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
ManualJournalID*
UUID (uuid)
Unique identifier for a ManualJournal
Required
FileName*
String
The name of the file being attached to a ManualJournal
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getManualJournalAttachmentById

Allows you to retrieve a specific attachment from a specific manual journal using a unique attachment Id


/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID manualJournalID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID attachmentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String contentType = "image/jpg";

        try {
            ByteArrayInputStream result = apiInstance.getManualJournalAttachmentById(accessToken, xeroTenantId, manualJournalID, attachmentID, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getManualJournalAttachmentById");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a ManualJournal
        UUID attachmentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Attachment
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getManualJournalAttachmentById(xeroTenantId, manualJournalID, attachmentID, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getManualJournalAttachmentById");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *manualJournalID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a ManualJournal (default to null)
UUID *attachmentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Attachment (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Allows you to retrieve a specific attachment from a specific manual journal using a unique attachment Id
[apiInstance getManualJournalAttachmentByIdWith:xeroTenantId
    manualJournalID:manualJournalID
    attachmentID:attachmentID
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const manualJournalID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a ManualJournal
const attachmentID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Attachment
const contentType = "image/jpg";  // {String} The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

try {
  const response = await xero.accountingApi.getManualJournalAttachmentById(xeroTenantId, manualJournalID, attachmentID, contentType);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getManualJournalAttachmentByIdExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var manualJournalID = new UUID(); // UUID | Unique identifier for a ManualJournal (default to null)
            var attachmentID = new UUID(); // UUID | Unique identifier for a Attachment (default to null)
            var contentType = image/jpg;  // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

            try
            {
                // Allows you to retrieve a specific attachment from a specific manual journal using a unique attachment Id
                File result = apiInstance.getManualJournalAttachmentById(xeroTenantId, manualJournalID, attachmentID, contentType);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getManualJournalAttachmentById: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$manualJournalID = "00000000-0000-0000-0000-000000000000";
$attachmentID = "00000000-0000-0000-0000-000000000000";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getManualJournalAttachmentById($xeroTenantId, $manualJournalID, $attachmentID, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getManualJournalAttachmentById: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $manualJournalID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a ManualJournal
my $attachmentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Attachment
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getManualJournalAttachmentById(xeroTenantId => $xeroTenantId, manualJournalID => $manualJournalID, attachmentID => $attachmentID, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getManualJournalAttachmentById: $@\n";
}
# 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_get_manual_journal_attachment_by_id():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    manualJournalID = '00000000-0000-0000-0000-000000000000'
    attachmentID = '00000000-0000-0000-0000-000000000000'
    contentType = 'image/jpg'
    
    try:
        api_response = api_instance.get_manual_journal_attachment_by_id(xeroTenantId, manualJournalID, attachmentID, contentType)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getManualJournalAttachmentById: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID
    let attachmentID = 00000000-0000-0000-0000-000000000000; // UUID
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getManualJournalAttachmentById(xeroTenantId, manualJournalID, attachmentID, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
ManualJournalID*
UUID (uuid)
Unique identifier for a ManualJournal
Required
AttachmentID*
UUID (uuid)
Unique identifier for a Attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getManualJournalAttachments

Retrieves attachment for a specific manual journal


/ManualJournals/{ManualJournalID}/Attachments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ManualJournals/{ManualJournalID}/Attachments"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID manualJournalID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Attachments result = apiInstance.getManualJournalAttachments(accessToken, xeroTenantId, manualJournalID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getManualJournalAttachments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a ManualJournal
        try {
            Attachments result = apiInstance.getManualJournalAttachments(xeroTenantId, manualJournalID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getManualJournalAttachments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *manualJournalID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a ManualJournal (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves attachment for a specific manual journal
[apiInstance getManualJournalAttachmentsWith:xeroTenantId
    manualJournalID:manualJournalID
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const manualJournalID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a ManualJournal

try {
  const response = await xero.accountingApi.getManualJournalAttachments(xeroTenantId, manualJournalID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getManualJournalAttachmentsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var manualJournalID = new UUID(); // UUID | Unique identifier for a ManualJournal (default to null)

            try
            {
                // Retrieves attachment for a specific manual journal
                Attachments result = apiInstance.getManualJournalAttachments(xeroTenantId, manualJournalID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getManualJournalAttachments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$manualJournalID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getManualJournalAttachments($xeroTenantId, $manualJournalID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getManualJournalAttachments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $manualJournalID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a ManualJournal

eval { 
    my $result = $api_instance->getManualJournalAttachments(xeroTenantId => $xeroTenantId, manualJournalID => $manualJournalID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getManualJournalAttachments: $@\n";
}
# 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_get_manual_journal_attachments():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    manualJournalID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_manual_journal_attachments(xeroTenantId, manualJournalID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getManualJournalAttachments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getManualJournalAttachments(xeroTenantId, manualJournalID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
ManualJournalID*
UUID (uuid)
Unique identifier for a ManualJournal
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getManualJournals

Retrieves manual journals


/ManualJournals

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ManualJournals?where=Status=="DRAFT"&order=Date ASC&page=1"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = "Status=="DRAFT"";
        String order = "Date ASC";
        Integer page = 1;

        try {
            ManualJournals result = apiInstance.getManualJournals(accessToken, xeroTenantId, ifModifiedSince, where, order, page);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getManualJournals");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = Status=="DRAFT"; // String | Filter by an any element
        String order = Date ASC; // String | Order by an any element
        Integer page = 1; // Integer | e.g. page=1 – Up to 100 manual journals will be returned in a single API call with line items shown for each overpayment
        try {
            ManualJournals result = apiInstance.getManualJournals(xeroTenantId, ifModifiedSince, where, order, page);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getManualJournals");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = Status=="DRAFT"; // Filter by an any element (optional) (default to null)
String *order = Date ASC; // Order by an any element (optional) (default to null)
Integer *page = 1; // e.g. page=1 – Up to 100 manual journals will be returned in a single API call with line items shown for each overpayment (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves manual journals
[apiInstance getManualJournalsWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
    page:page
              completionHandler: ^(ManualJournals output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="DRAFT"';  // {String} Filter by an any element

const order = 'Date ASC';  // {String} Order by an any element

const page = 1;  // {Integer} e.g. page=1 – Up to 100 manual journals will be returned in a single API call with line items shown for each overpayment


try {
  const response = await xero.accountingApi.getManualJournals(xeroTenantId, ifModifiedSince, where, order, page);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getManualJournalsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var ifModifiedSince = 2020-02-06T12:17:43.202-08:00;  // Date | Only records created or modified since this timestamp will be returned (optional)  (default to null)
            var where = Status=="DRAFT";  // String | Filter by an any element (optional)  (default to null)
            var order = Date ASC;  // String | Order by an any element (optional)  (default to null)
            var page = 1;  // Integer | e.g. page=1 – Up to 100 manual journals will be returned in a single API call with line items shown for each overpayment (optional)  (default to null)

            try
            {
                // Retrieves manual journals
                ManualJournals result = apiInstance.getManualJournals(xeroTenantId, ifModifiedSince, where, order, page);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getManualJournals: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\ManualJournal::STATUS_DRAFT . '"";
$order = "Date ASC";
$page = 1;

try {
  $result = $apiInstance->getManualJournals($xeroTenantId, $ifModifiedSince, $where, $order, $page);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getManualJournals: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = Status=="DRAFT"; # String | Filter by an any element
my $order = Date ASC; # String | Order by an any element
my $page = 1; # Integer | e.g. page=1 – Up to 100 manual journals will be returned in a single API call with line items shown for each overpayment

eval { 
    my $result = $api_instance->getManualJournals(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order, page => $page);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getManualJournals: $@\n";
}
# 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_get_manual_journals():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    ifModifiedSince = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'Status=="DRAFT"'
    order = 'Date ASC'
    
    try:
        api_response = api_instance.get_manual_journals(xeroTenantId, ifModifiedSince, where, order, page)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getManualJournals: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = Status=="DRAFT"; // String
    let order = Date ASC; // String
    let page = 1; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getManualJournals(xeroTenantId, ifModifiedSince, where, order, page, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element
page
Integer
e.g. page=1 – Up to 100 manual journals will be returned in a single API call with line items shown for each overpayment

getManualJournalsHistory

Retrieves history for a specific manual journal


/ManualJournals/{ManualJournalID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ManualJournals/{ManualJournalID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID manualJournalID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getManualJournalsHistory(accessToken, xeroTenantId, manualJournalID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getManualJournalsHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a manual journal
        try {
            HistoryRecords result = apiInstance.getManualJournalsHistory(xeroTenantId, manualJournalID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getManualJournalsHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *manualJournalID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a manual journal (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history for a specific manual journal
[apiInstance getManualJournalsHistoryWith:xeroTenantId
    manualJournalID:manualJournalID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const manualJournalID = "00000000-0000-0000-0000-000000000000";  // {UUID} Xero generated unique identifier for a manual journal

try {
  const response = await xero.accountingApi.getManualJournalsHistory(xeroTenantId, manualJournalID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getManualJournalsHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var manualJournalID = new UUID(); // UUID | Xero generated unique identifier for a manual journal (default to null)

            try
            {
                // Retrieves history for a specific manual journal
                HistoryRecords result = apiInstance.getManualJournalsHistory(xeroTenantId, manualJournalID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getManualJournalsHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$manualJournalID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getManualJournalsHistory($xeroTenantId, $manualJournalID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getManualJournalsHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $manualJournalID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a manual journal

eval { 
    my $result = $api_instance->getManualJournalsHistory(xeroTenantId => $xeroTenantId, manualJournalID => $manualJournalID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getManualJournalsHistory: $@\n";
}
# 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_get_manual_journals_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    manualJournalID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_manual_journals_history(xeroTenantId, manualJournalID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getManualJournalsHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getManualJournalsHistory(xeroTenantId, manualJournalID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
ManualJournalID*
UUID (uuid)
Xero generated unique identifier for a manual journal
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getOnlineInvoice

Retrieves a URL to an online invoice


/Invoices/{InvoiceID}/OnlineInvoice

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID}/OnlineInvoice"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID invoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            OnlineInvoices result = apiInstance.getOnlineInvoice(accessToken, xeroTenantId, invoiceID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getOnlineInvoice");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID invoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Invoice
        try {
            OnlineInvoices result = apiInstance.getOnlineInvoice(xeroTenantId, invoiceID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getOnlineInvoice");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *invoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Invoice (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a URL to an online invoice
[apiInstance getOnlineInvoiceWith:xeroTenantId
    invoiceID:invoiceID
              completionHandler: ^(OnlineInvoices output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const invoiceID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for an Invoice

try {
  const response = await xero.accountingApi.getOnlineInvoice(xeroTenantId, invoiceID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getOnlineInvoiceExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var invoiceID = new UUID(); // UUID | Unique identifier for an Invoice (default to null)

            try
            {
                // Retrieves a URL to an online invoice
                OnlineInvoices result = apiInstance.getOnlineInvoice(xeroTenantId, invoiceID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getOnlineInvoice: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$invoiceID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getOnlineInvoice($xeroTenantId, $invoiceID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getOnlineInvoice: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Invoice

eval { 
    my $result = $api_instance->getOnlineInvoice(xeroTenantId => $xeroTenantId, invoiceID => $invoiceID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getOnlineInvoice: $@\n";
}
# 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_get_online_invoice():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    invoiceID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_online_invoice(xeroTenantId, invoiceID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getOnlineInvoice: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoiceID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getOnlineInvoice(xeroTenantId, invoiceID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
InvoiceID*
UUID (uuid)
Unique identifier for an Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getOrganisationActions

Retrieves a list of the key actions your app has permission to perform in the connected Xero organisation.


/Organisation/Actions

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Organisation/Actions"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";

        try {
            Actions result = apiInstance.getOrganisationActions(accessToken, xeroTenantId);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getOrganisationActions");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        try {
            Actions result = apiInstance.getOrganisationActions(xeroTenantId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getOrganisationActions");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a list of the key actions your app has permission to perform in the connected Xero organisation.
[apiInstance getOrganisationActionsWith:xeroTenantId
              completionHandler: ^(Actions output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

try {
  const response = await xero.accountingApi.getOrganisationActions(xeroTenantId);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getOrganisationActionsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)

            try
            {
                // Retrieves a list of the key actions your app has permission to perform in the connected Xero organisation.
                Actions result = apiInstance.getOrganisationActions(xeroTenantId);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getOrganisationActions: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

try {
  $result = $apiInstance->getOrganisationActions($xeroTenantId);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getOrganisationActions: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant

eval { 
    my $result = $api_instance->getOrganisationActions(xeroTenantId => $xeroTenantId);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getOrganisationActions: $@\n";
}
# 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_get_organisation_actions():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    
    try:
        api_response = api_instance.get_organisation_actions(xeroTenantId)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getOrganisationActions: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getOrganisationActions(xeroTenantId, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getOrganisationCISSettings

Retrieves the CIS settings for the Xero organistaion.


/Organisation/{OrganisationID}/CISSettings

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Organisation/{OrganisationID}/CISSettings"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID organisationID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            CISOrgSettings result = apiInstance.getOrganisationCISSettings(accessToken, xeroTenantId, organisationID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getOrganisationCISSettings");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID organisationID = 00000000-0000-0000-0000-000000000000; // UUID | The unique Xero identifier for an organisation
        try {
            CISOrgSettings result = apiInstance.getOrganisationCISSettings(xeroTenantId, organisationID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getOrganisationCISSettings");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *organisationID = 00000000-0000-0000-0000-000000000000; // The unique Xero identifier for an organisation (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves the CIS settings for the Xero organistaion.
[apiInstance getOrganisationCISSettingsWith:xeroTenantId
    organisationID:organisationID
              completionHandler: ^(CISOrgSettings output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const organisationID = "00000000-0000-0000-0000-000000000000";  // {UUID} The unique Xero identifier for an organisation

try {
  const response = await xero.accountingApi.getOrganisationCISSettings(xeroTenantId, organisationID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getOrganisationCISSettingsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var organisationID = new UUID(); // UUID | The unique Xero identifier for an organisation (default to null)

            try
            {
                // Retrieves the CIS settings for the Xero organistaion.
                CISOrgSettings result = apiInstance.getOrganisationCISSettings(xeroTenantId, organisationID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getOrganisationCISSettings: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$organisationID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getOrganisationCISSettings($xeroTenantId, $organisationID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getOrganisationCISSettings: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $organisationID = 00000000-0000-0000-0000-000000000000; # UUID | The unique Xero identifier for an organisation

eval { 
    my $result = $api_instance->getOrganisationCISSettings(xeroTenantId => $xeroTenantId, organisationID => $organisationID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getOrganisationCISSettings: $@\n";
}
# 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_get_organisation_cis_settings():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    organisationID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_organisation_cis_settings(xeroTenantId, organisationID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getOrganisationCISSettings: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let organisationID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getOrganisationCISSettings(xeroTenantId, organisationID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Path parameters
Name Description
OrganisationID*
UUID (uuid)
The unique Xero identifier for an organisation
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getOrganisations

Retrieves Xero organisation details


/Organisation

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Organisation"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";

        try {
            Organisations result = apiInstance.getOrganisations(accessToken, xeroTenantId);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getOrganisations");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        try {
            Organisations result = apiInstance.getOrganisations(xeroTenantId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getOrganisations");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves Xero organisation details
[apiInstance getOrganisationsWith:xeroTenantId
              completionHandler: ^(Organisations output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

try {
  const response = await xero.accountingApi.getOrganisations(xeroTenantId);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getOrganisationsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)

            try
            {
                // Retrieves Xero organisation details
                Organisations result = apiInstance.getOrganisations(xeroTenantId);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getOrganisations: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

try {
  $result = $apiInstance->getOrganisations($xeroTenantId);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getOrganisations: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant

eval { 
    my $result = $api_instance->getOrganisations(xeroTenantId => $xeroTenantId);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getOrganisations: $@\n";
}
# 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_get_organisations():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    
    try:
        api_response = api_instance.get_organisations(xeroTenantId)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getOrganisations: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getOrganisations(xeroTenantId, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getOverpayment

Retrieves a specific overpayment using a unique overpayment Id


/Overpayments/{OverpaymentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Overpayments/{OverpaymentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID overpaymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Overpayments result = apiInstance.getOverpayment(accessToken, xeroTenantId, overpaymentID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getOverpayment");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID overpaymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Overpayment
        try {
            Overpayments result = apiInstance.getOverpayment(xeroTenantId, overpaymentID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getOverpayment");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *overpaymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Overpayment (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific overpayment using a unique overpayment Id
[apiInstance getOverpaymentWith:xeroTenantId
    overpaymentID:overpaymentID
              completionHandler: ^(Overpayments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const overpaymentID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Overpayment

try {
  const response = await xero.accountingApi.getOverpayment(xeroTenantId, overpaymentID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getOverpaymentExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var overpaymentID = new UUID(); // UUID | Unique identifier for a Overpayment (default to null)

            try
            {
                // Retrieves a specific overpayment using a unique overpayment Id
                Overpayments result = apiInstance.getOverpayment(xeroTenantId, overpaymentID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getOverpayment: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$overpaymentID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getOverpayment($xeroTenantId, $overpaymentID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getOverpayment: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $overpaymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Overpayment

eval { 
    my $result = $api_instance->getOverpayment(xeroTenantId => $xeroTenantId, overpaymentID => $overpaymentID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getOverpayment: $@\n";
}
# 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_get_overpayment():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    overpaymentID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_overpayment(xeroTenantId, overpaymentID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getOverpayment: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let overpaymentID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getOverpayment(xeroTenantId, overpaymentID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
OverpaymentID*
UUID (uuid)
Unique identifier for a Overpayment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getOverpaymentHistory

Retrieves history records of a specific overpayment


/Overpayments/{OverpaymentID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Overpayments/{OverpaymentID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID overpaymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getOverpaymentHistory(accessToken, xeroTenantId, overpaymentID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getOverpaymentHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID overpaymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Overpayment
        try {
            HistoryRecords result = apiInstance.getOverpaymentHistory(xeroTenantId, overpaymentID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getOverpaymentHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *overpaymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Overpayment (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history records of a specific overpayment
[apiInstance getOverpaymentHistoryWith:xeroTenantId
    overpaymentID:overpaymentID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const overpaymentID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Overpayment

try {
  const response = await xero.accountingApi.getOverpaymentHistory(xeroTenantId, overpaymentID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getOverpaymentHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var overpaymentID = new UUID(); // UUID | Unique identifier for a Overpayment (default to null)

            try
            {
                // Retrieves history records of a specific overpayment
                HistoryRecords result = apiInstance.getOverpaymentHistory(xeroTenantId, overpaymentID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getOverpaymentHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$overpaymentID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getOverpaymentHistory($xeroTenantId, $overpaymentID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getOverpaymentHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $overpaymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Overpayment

eval { 
    my $result = $api_instance->getOverpaymentHistory(xeroTenantId => $xeroTenantId, overpaymentID => $overpaymentID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getOverpaymentHistory: $@\n";
}
# 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_get_overpayment_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    overpaymentID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_overpayment_history(xeroTenantId, overpaymentID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getOverpaymentHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let overpaymentID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getOverpaymentHistory(xeroTenantId, overpaymentID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
OverpaymentID*
UUID (uuid)
Unique identifier for a Overpayment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getOverpayments

Retrieves overpayments


/Overpayments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Overpayments?where=Status=="AUTHORISED"&order=Status ASC&page=1&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = "Status=="AUTHORISED"";
        String order = "Status ASC";
        Integer page = 1;
        Integer unitdp = 4;

        try {
            Overpayments result = apiInstance.getOverpayments(accessToken, xeroTenantId, ifModifiedSince, where, order, page, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getOverpayments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = Status=="AUTHORISED"; // String | Filter by an any element
        String order = Status ASC; // String | Order by an any element
        Integer page = 1; // Integer | e.g. page=1 – Up to 100 overpayments will be returned in a single API call with line items shown for each overpayment
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Overpayments result = apiInstance.getOverpayments(xeroTenantId, ifModifiedSince, where, order, page, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getOverpayments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = Status=="AUTHORISED"; // Filter by an any element (optional) (default to null)
String *order = Status ASC; // Order by an any element (optional) (default to null)
Integer *page = 1; // e.g. page=1 – Up to 100 overpayments will be returned in a single API call with line items shown for each overpayment (optional) (default to null)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves overpayments
[apiInstance getOverpaymentsWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
    page:page
    unitdp:unitdp
              completionHandler: ^(Overpayments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="AUTHORISED"';  // {String} Filter by an any element

const order = 'Status ASC';  // {String} Order by an any element

const page = 1;  // {Integer} e.g. page=1 – Up to 100 overpayments will be returned in a single API call with line items shown for each overpayment

const unitdp = 4;  // {Integer} e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts


try {
  const response = await xero.accountingApi.getOverpayments(xeroTenantId, ifModifiedSince, where, order, page, unitdp);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getOverpaymentsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var ifModifiedSince = 2020-02-06T12:17:43.202-08:00;  // Date | Only records created or modified since this timestamp will be returned (optional)  (default to null)
            var where = Status=="AUTHORISED";  // String | Filter by an any element (optional)  (default to null)
            var order = Status ASC;  // String | Order by an any element (optional)  (default to null)
            var page = 1;  // Integer | e.g. page=1 – Up to 100 overpayments will be returned in a single API call with line items shown for each overpayment (optional)  (default to null)
            var unitdp = 4;  // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)  (default to null)

            try
            {
                // Retrieves overpayments
                Overpayments result = apiInstance.getOverpayments(xeroTenantId, ifModifiedSince, where, order, page, unitdp);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getOverpayments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\Overpayment::STATUS_AUTHORISED . '"";
$order = "Status ASC";
$page = 1;
$unitdp = 4;

try {
  $result = $apiInstance->getOverpayments($xeroTenantId, $ifModifiedSince, $where, $order, $page, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getOverpayments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = Status=="AUTHORISED"; # String | Filter by an any element
my $order = Status ASC; # String | Order by an any element
my $page = 1; # Integer | e.g. page=1 – Up to 100 overpayments will be returned in a single API call with line items shown for each overpayment
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->getOverpayments(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order, page => $page, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getOverpayments: $@\n";
}
# 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_get_overpayments():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    ifModifiedSince = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'Status=="AUTHORISED"'
    order = 'Status ASC'
    
    try:
        api_response = api_instance.get_overpayments(xeroTenantId, ifModifiedSince, where, order, page, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getOverpayments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = Status=="AUTHORISED"; // String
    let order = Status ASC; // String
    let page = 1; // Integer
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getOverpayments(xeroTenantId, ifModifiedSince, where, order, page, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element
page
Integer
e.g. page=1 – Up to 100 overpayments will be returned in a single API call with line items shown for each overpayment
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

getPayment

Retrieves a specific payment for invoices and credit notes using a unique payment Id


/Payments/{PaymentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Payments/{PaymentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID paymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Payments result = apiInstance.getPayment(accessToken, xeroTenantId, paymentID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPayment");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID paymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Payment
        try {
            Payments result = apiInstance.getPayment(xeroTenantId, paymentID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPayment");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *paymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Payment (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific payment for invoices and credit notes using a unique payment Id
[apiInstance getPaymentWith:xeroTenantId
    paymentID:paymentID
              completionHandler: ^(Payments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const paymentID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Payment

try {
  const response = await xero.accountingApi.getPayment(xeroTenantId, paymentID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getPaymentExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var paymentID = new UUID(); // UUID | Unique identifier for a Payment (default to null)

            try
            {
                // Retrieves a specific payment for invoices and credit notes using a unique payment Id
                Payments result = apiInstance.getPayment(xeroTenantId, paymentID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getPayment: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$paymentID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getPayment($xeroTenantId, $paymentID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPayment: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $paymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Payment

eval { 
    my $result = $api_instance->getPayment(xeroTenantId => $xeroTenantId, paymentID => $paymentID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPayment: $@\n";
}
# 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_get_payment():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    paymentID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_payment(xeroTenantId, paymentID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPayment: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let paymentID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getPayment(xeroTenantId, paymentID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
PaymentID*
UUID (uuid)
Unique identifier for a Payment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getPaymentHistory

Retrieves history records of a specific payment


/Payments/{PaymentID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Payments/{PaymentID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID paymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getPaymentHistory(accessToken, xeroTenantId, paymentID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPaymentHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID paymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Payment
        try {
            HistoryRecords result = apiInstance.getPaymentHistory(xeroTenantId, paymentID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPaymentHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *paymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Payment (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history records of a specific payment
[apiInstance getPaymentHistoryWith:xeroTenantId
    paymentID:paymentID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const paymentID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Payment

try {
  const response = await xero.accountingApi.getPaymentHistory(xeroTenantId, paymentID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getPaymentHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var paymentID = new UUID(); // UUID | Unique identifier for a Payment (default to null)

            try
            {
                // Retrieves history records of a specific payment
                HistoryRecords result = apiInstance.getPaymentHistory(xeroTenantId, paymentID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getPaymentHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$paymentID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getPaymentHistory($xeroTenantId, $paymentID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPaymentHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $paymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Payment

eval { 
    my $result = $api_instance->getPaymentHistory(xeroTenantId => $xeroTenantId, paymentID => $paymentID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPaymentHistory: $@\n";
}
# 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_get_payment_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    paymentID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_payment_history(xeroTenantId, paymentID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPaymentHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let paymentID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getPaymentHistory(xeroTenantId, paymentID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
PaymentID*
UUID (uuid)
Unique identifier for a Payment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getPaymentServices

Retrieves payment services


/PaymentServices

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PaymentServices"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";

        try {
            PaymentServices result = apiInstance.getPaymentServices(accessToken, xeroTenantId);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPaymentServices");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        try {
            PaymentServices result = apiInstance.getPaymentServices(xeroTenantId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPaymentServices");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves payment services
[apiInstance getPaymentServicesWith:xeroTenantId
              completionHandler: ^(PaymentServices output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

try {
  const response = await xero.accountingApi.getPaymentServices(xeroTenantId);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getPaymentServicesExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)

            try
            {
                // Retrieves payment services
                PaymentServices result = apiInstance.getPaymentServices(xeroTenantId);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getPaymentServices: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

try {
  $result = $apiInstance->getPaymentServices($xeroTenantId);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPaymentServices: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant

eval { 
    my $result = $api_instance->getPaymentServices(xeroTenantId => $xeroTenantId);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPaymentServices: $@\n";
}
# 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_get_payment_services():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    
    try:
        api_response = api_instance.get_payment_services(xeroTenantId)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPaymentServices: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getPaymentServices(xeroTenantId, &context).wait();
    println!("{:?}", result);

}

Scopes

paymentservices Grant read-write access to payment services

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getPayments

Retrieves payments for invoices and credit notes


/Payments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Payments?where=Status=="AUTHORISED"&order=Amount ASC&page=1"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = "Status=="AUTHORISED"";
        String order = "Amount ASC";
        Integer page = 1;

        try {
            Payments result = apiInstance.getPayments(accessToken, xeroTenantId, ifModifiedSince, where, order, page);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPayments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = Status=="AUTHORISED"; // String | Filter by an any element
        String order = Amount ASC; // String | Order by an any element
        Integer page = 1; // Integer | Up to 100 payments will be returned in a single API call
        try {
            Payments result = apiInstance.getPayments(xeroTenantId, ifModifiedSince, where, order, page);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPayments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = Status=="AUTHORISED"; // Filter by an any element (optional) (default to null)
String *order = Amount ASC; // Order by an any element (optional) (default to null)
Integer *page = 1; // Up to 100 payments will be returned in a single API call (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves payments for invoices and credit notes
[apiInstance getPaymentsWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
    page:page
              completionHandler: ^(Payments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="AUTHORISED"';  // {String} Filter by an any element

const order = 'Amount ASC';  // {String} Order by an any element

const page = 1;  // {Integer} Up to 100 payments will be returned in a single API call


try {
  const response = await xero.accountingApi.getPayments(xeroTenantId, ifModifiedSince, where, order, page);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getPaymentsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var ifModifiedSince = 2020-02-06T12:17:43.202-08:00;  // Date | Only records created or modified since this timestamp will be returned (optional)  (default to null)
            var where = Status=="AUTHORISED";  // String | Filter by an any element (optional)  (default to null)
            var order = Amount ASC;  // String | Order by an any element (optional)  (default to null)
            var page = 1;  // Integer | Up to 100 payments will be returned in a single API call (optional)  (default to null)

            try
            {
                // Retrieves payments for invoices and credit notes
                Payments result = apiInstance.getPayments(xeroTenantId, ifModifiedSince, where, order, page);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getPayments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\Payment::STATUS_AUTHORISED . '"";
$order = "Amount ASC";
$page = 1;

try {
  $result = $apiInstance->getPayments($xeroTenantId, $ifModifiedSince, $where, $order, $page);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPayments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = Status=="AUTHORISED"; # String | Filter by an any element
my $order = Amount ASC; # String | Order by an any element
my $page = 1; # Integer | Up to 100 payments will be returned in a single API call

eval { 
    my $result = $api_instance->getPayments(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order, page => $page);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPayments: $@\n";
}
# 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_get_payments():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    ifModifiedSince = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'Status=="AUTHORISED"'
    order = 'Amount ASC'
    
    try:
        api_response = api_instance.get_payments(xeroTenantId, ifModifiedSince, where, order, page)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPayments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = Status=="AUTHORISED"; // String
    let order = Amount ASC; // String
    let page = 1; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getPayments(xeroTenantId, ifModifiedSince, where, order, page, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element
page
Integer
Up to 100 payments will be returned in a single API call

getPrepayment

Allows you to retrieve a specified prepayments


/Prepayments/{PrepaymentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Prepayments/{PrepaymentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID prepaymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Prepayments result = apiInstance.getPrepayment(accessToken, xeroTenantId, prepaymentID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPrepayment");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID prepaymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a PrePayment
        try {
            Prepayments result = apiInstance.getPrepayment(xeroTenantId, prepaymentID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPrepayment");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *prepaymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a PrePayment (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Allows you to retrieve a specified prepayments
[apiInstance getPrepaymentWith:xeroTenantId
    prepaymentID:prepaymentID
              completionHandler: ^(Prepayments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const prepaymentID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a PrePayment

try {
  const response = await xero.accountingApi.getPrepayment(xeroTenantId, prepaymentID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getPrepaymentExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var prepaymentID = new UUID(); // UUID | Unique identifier for a PrePayment (default to null)

            try
            {
                // Allows you to retrieve a specified prepayments
                Prepayments result = apiInstance.getPrepayment(xeroTenantId, prepaymentID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getPrepayment: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$prepaymentID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getPrepayment($xeroTenantId, $prepaymentID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPrepayment: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $prepaymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a PrePayment

eval { 
    my $result = $api_instance->getPrepayment(xeroTenantId => $xeroTenantId, prepaymentID => $prepaymentID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPrepayment: $@\n";
}
# 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_get_prepayment():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    prepaymentID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_prepayment(xeroTenantId, prepaymentID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPrepayment: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let prepaymentID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getPrepayment(xeroTenantId, prepaymentID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
PrepaymentID*
UUID (uuid)
Unique identifier for a PrePayment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getPrepaymentHistory

Retrieves history record for a specific prepayment


/Prepayments/{PrepaymentID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Prepayments/{PrepaymentID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID prepaymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getPrepaymentHistory(accessToken, xeroTenantId, prepaymentID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPrepaymentHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID prepaymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a PrePayment
        try {
            HistoryRecords result = apiInstance.getPrepaymentHistory(xeroTenantId, prepaymentID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPrepaymentHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *prepaymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a PrePayment (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history record for a specific prepayment
[apiInstance getPrepaymentHistoryWith:xeroTenantId
    prepaymentID:prepaymentID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const prepaymentID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a PrePayment

try {
  const response = await xero.accountingApi.getPrepaymentHistory(xeroTenantId, prepaymentID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getPrepaymentHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var prepaymentID = new UUID(); // UUID | Unique identifier for a PrePayment (default to null)

            try
            {
                // Retrieves history record for a specific prepayment
                HistoryRecords result = apiInstance.getPrepaymentHistory(xeroTenantId, prepaymentID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getPrepaymentHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$prepaymentID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getPrepaymentHistory($xeroTenantId, $prepaymentID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPrepaymentHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $prepaymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a PrePayment

eval { 
    my $result = $api_instance->getPrepaymentHistory(xeroTenantId => $xeroTenantId, prepaymentID => $prepaymentID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPrepaymentHistory: $@\n";
}
# 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_get_prepayment_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    prepaymentID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_prepayment_history(xeroTenantId, prepaymentID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPrepaymentHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let prepaymentID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getPrepaymentHistory(xeroTenantId, prepaymentID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
PrepaymentID*
UUID (uuid)
Unique identifier for a PrePayment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getPrepayments

Retrieves prepayments


/Prepayments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Prepayments?where=Status=="AUTHORISED"&order=Reference ASC&page=1&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = "Status=="AUTHORISED"";
        String order = "Reference ASC";
        Integer page = 1;
        Integer unitdp = 4;

        try {
            Prepayments result = apiInstance.getPrepayments(accessToken, xeroTenantId, ifModifiedSince, where, order, page, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPrepayments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = Status=="AUTHORISED"; // String | Filter by an any element
        String order = Reference ASC; // String | Order by an any element
        Integer page = 1; // Integer | e.g. page=1 – Up to 100 prepayments will be returned in a single API call with line items shown for each overpayment
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Prepayments result = apiInstance.getPrepayments(xeroTenantId, ifModifiedSince, where, order, page, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPrepayments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = Status=="AUTHORISED"; // Filter by an any element (optional) (default to null)
String *order = Reference ASC; // Order by an any element (optional) (default to null)
Integer *page = 1; // e.g. page=1 – Up to 100 prepayments will be returned in a single API call with line items shown for each overpayment (optional) (default to null)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves prepayments
[apiInstance getPrepaymentsWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
    page:page
    unitdp:unitdp
              completionHandler: ^(Prepayments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="AUTHORISED"';  // {String} Filter by an any element

const order = 'Reference ASC';  // {String} Order by an any element

const page = 1;  // {Integer} e.g. page=1 – Up to 100 prepayments will be returned in a single API call with line items shown for each overpayment

const unitdp = 4;  // {Integer} e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts


try {
  const response = await xero.accountingApi.getPrepayments(xeroTenantId, ifModifiedSince, where, order, page, unitdp);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getPrepaymentsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var ifModifiedSince = 2020-02-06T12:17:43.202-08:00;  // Date | Only records created or modified since this timestamp will be returned (optional)  (default to null)
            var where = Status=="AUTHORISED";  // String | Filter by an any element (optional)  (default to null)
            var order = Reference ASC;  // String | Order by an any element (optional)  (default to null)
            var page = 1;  // Integer | e.g. page=1 – Up to 100 prepayments will be returned in a single API call with line items shown for each overpayment (optional)  (default to null)
            var unitdp = 4;  // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)  (default to null)

            try
            {
                // Retrieves prepayments
                Prepayments result = apiInstance.getPrepayments(xeroTenantId, ifModifiedSince, where, order, page, unitdp);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getPrepayments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\Prepayment::STATUS_AUTHORISED . '"";
$order = "Reference ASC";
$page = 1;
$unitdp = 4;

try {
  $result = $apiInstance->getPrepayments($xeroTenantId, $ifModifiedSince, $where, $order, $page, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPrepayments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = Status=="AUTHORISED"; # String | Filter by an any element
my $order = Reference ASC; # String | Order by an any element
my $page = 1; # Integer | e.g. page=1 – Up to 100 prepayments will be returned in a single API call with line items shown for each overpayment
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->getPrepayments(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order, page => $page, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPrepayments: $@\n";
}
# 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_get_prepayments():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    ifModifiedSince = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'Status=="AUTHORISED"'
    order = 'Reference ASC'
    
    try:
        api_response = api_instance.get_prepayments(xeroTenantId, ifModifiedSince, where, order, page, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPrepayments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = Status=="AUTHORISED"; // String
    let order = Reference ASC; // String
    let page = 1; // Integer
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getPrepayments(xeroTenantId, ifModifiedSince, where, order, page, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element
page
Integer
e.g. page=1 – Up to 100 prepayments will be returned in a single API call with line items shown for each overpayment
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

getPurchaseOrder

Retrieves a specific purchase order using a unique purchase order Id


/PurchaseOrders/{PurchaseOrderID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders/{PurchaseOrderID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID purchaseOrderID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            PurchaseOrders result = apiInstance.getPurchaseOrder(accessToken, xeroTenantId, purchaseOrderID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrder");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a PurchaseOrder
        try {
            PurchaseOrders result = apiInstance.getPurchaseOrder(xeroTenantId, purchaseOrderID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrder");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *purchaseOrderID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a PurchaseOrder (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific purchase order using a unique purchase order Id
[apiInstance getPurchaseOrderWith:xeroTenantId
    purchaseOrderID:purchaseOrderID
              completionHandler: ^(PurchaseOrders output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const purchaseOrderID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a PurchaseOrder

try {
  const response = await xero.accountingApi.getPurchaseOrder(xeroTenantId, purchaseOrderID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getPurchaseOrderExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var purchaseOrderID = new UUID(); // UUID | Unique identifier for a PurchaseOrder (default to null)

            try
            {
                // Retrieves a specific purchase order using a unique purchase order Id
                PurchaseOrders result = apiInstance.getPurchaseOrder(xeroTenantId, purchaseOrderID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getPurchaseOrder: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$purchaseOrderID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getPurchaseOrder($xeroTenantId, $purchaseOrderID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPurchaseOrder: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $purchaseOrderID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a PurchaseOrder

eval { 
    my $result = $api_instance->getPurchaseOrder(xeroTenantId => $xeroTenantId, purchaseOrderID => $purchaseOrderID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPurchaseOrder: $@\n";
}
# 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_get_purchase_order():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    purchaseOrderID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_purchase_order(xeroTenantId, purchaseOrderID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPurchaseOrder: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getPurchaseOrder(xeroTenantId, purchaseOrderID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
PurchaseOrderID*
UUID (uuid)
Unique identifier for a PurchaseOrder
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getPurchaseOrderAsPdf

Retrieves specific purchase order as PDF files using a unique purchase order Id


/PurchaseOrders/{PurchaseOrderID}/pdf

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders/{PurchaseOrderID}/pdf"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID purchaseOrderID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            ByteArrayInputStream result = apiInstance.getPurchaseOrderAsPdf(accessToken, xeroTenantId, purchaseOrderID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrderAsPdf");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Purchase Order
        try {
            File result = apiInstance.getPurchaseOrderAsPdf(xeroTenantId, purchaseOrderID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrderAsPdf");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *purchaseOrderID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Purchase Order (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves specific purchase order as PDF files using a unique purchase order Id
[apiInstance getPurchaseOrderAsPdfWith:xeroTenantId
    purchaseOrderID:purchaseOrderID
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const purchaseOrderID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for an Purchase Order

try {
  const response = await xero.accountingApi.getPurchaseOrderAsPdf(xeroTenantId, purchaseOrderID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getPurchaseOrderAsPdfExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var purchaseOrderID = new UUID(); // UUID | Unique identifier for an Purchase Order (default to null)

            try
            {
                // Retrieves specific purchase order as PDF files using a unique purchase order Id
                File result = apiInstance.getPurchaseOrderAsPdf(xeroTenantId, purchaseOrderID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getPurchaseOrderAsPdf: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$purchaseOrderID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getPurchaseOrderAsPdf($xeroTenantId, $purchaseOrderID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPurchaseOrderAsPdf: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $purchaseOrderID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Purchase Order

eval { 
    my $result = $api_instance->getPurchaseOrderAsPdf(xeroTenantId => $xeroTenantId, purchaseOrderID => $purchaseOrderID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPurchaseOrderAsPdf: $@\n";
}
# 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_get_purchase_order_as_pdf():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    purchaseOrderID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_purchase_order_as_pdf(xeroTenantId, purchaseOrderID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPurchaseOrderAsPdf: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getPurchaseOrderAsPdf(xeroTenantId, purchaseOrderID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
PurchaseOrderID*
UUID (uuid)
Unique identifier for an Purchase Order
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getPurchaseOrderAttachmentById

Retrieves specific attachment for a specific purchase order using a unique attachment Id


/PurchaseOrders/{PurchaseOrderID}/Attachments/{AttachmentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders/{PurchaseOrderID}/Attachments/{AttachmentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID purchaseOrderID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID attachmentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String contentType = "image/jpg";

        try {
            ByteArrayInputStream result = apiInstance.getPurchaseOrderAttachmentById(accessToken, xeroTenantId, purchaseOrderID, attachmentID, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrderAttachmentById");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Purchase Order object
        UUID attachmentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Attachment object
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getPurchaseOrderAttachmentById(xeroTenantId, purchaseOrderID, attachmentID, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrderAttachmentById");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *purchaseOrderID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Purchase Order object (default to null)
UUID *attachmentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Attachment object (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves specific attachment for a specific purchase order using a unique attachment Id
[apiInstance getPurchaseOrderAttachmentByIdWith:xeroTenantId
    purchaseOrderID:purchaseOrderID
    attachmentID:attachmentID
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const purchaseOrderID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for Purchase Order object
const attachmentID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for Attachment object
const contentType = "image/jpg";  // {String} The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

try {
  const response = await xero.accountingApi.getPurchaseOrderAttachmentById(xeroTenantId, purchaseOrderID, attachmentID, contentType);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getPurchaseOrderAttachmentByIdExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var purchaseOrderID = new UUID(); // UUID | Unique identifier for Purchase Order object (default to null)
            var attachmentID = new UUID(); // UUID | Unique identifier for Attachment object (default to null)
            var contentType = image/jpg;  // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

            try
            {
                // Retrieves specific attachment for a specific purchase order using a unique attachment Id
                File result = apiInstance.getPurchaseOrderAttachmentById(xeroTenantId, purchaseOrderID, attachmentID, contentType);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getPurchaseOrderAttachmentById: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$purchaseOrderID = "00000000-0000-0000-0000-000000000000";
$attachmentID = "00000000-0000-0000-0000-000000000000";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getPurchaseOrderAttachmentById($xeroTenantId, $purchaseOrderID, $attachmentID, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPurchaseOrderAttachmentById: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $purchaseOrderID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Purchase Order object
my $attachmentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Attachment object
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getPurchaseOrderAttachmentById(xeroTenantId => $xeroTenantId, purchaseOrderID => $purchaseOrderID, attachmentID => $attachmentID, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPurchaseOrderAttachmentById: $@\n";
}
# 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_get_purchase_order_attachment_by_id():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    purchaseOrderID = '00000000-0000-0000-0000-000000000000'
    attachmentID = '00000000-0000-0000-0000-000000000000'
    contentType = 'image/jpg'
    
    try:
        api_response = api_instance.get_purchase_order_attachment_by_id(xeroTenantId, purchaseOrderID, attachmentID, contentType)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPurchaseOrderAttachmentById: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID
    let attachmentID = 00000000-0000-0000-0000-000000000000; // UUID
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getPurchaseOrderAttachmentById(xeroTenantId, purchaseOrderID, attachmentID, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
PurchaseOrderID*
UUID (uuid)
Unique identifier for Purchase Order object
Required
AttachmentID*
UUID (uuid)
Unique identifier for Attachment object
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getPurchaseOrderAttachments

Retrieves attachments for a specific purchase order


/PurchaseOrders/{PurchaseOrderID}/Attachments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders/{PurchaseOrderID}/Attachments"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID purchaseOrderID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Attachments result = apiInstance.getPurchaseOrderAttachments(accessToken, xeroTenantId, purchaseOrderID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrderAttachments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Purchase Orders object
        try {
            Attachments result = apiInstance.getPurchaseOrderAttachments(xeroTenantId, purchaseOrderID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrderAttachments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *purchaseOrderID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Purchase Orders object (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves attachments for a specific purchase order
[apiInstance getPurchaseOrderAttachmentsWith:xeroTenantId
    purchaseOrderID:purchaseOrderID
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const purchaseOrderID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for Purchase Orders object

try {
  const response = await xero.accountingApi.getPurchaseOrderAttachments(xeroTenantId, purchaseOrderID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getPurchaseOrderAttachmentsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var purchaseOrderID = new UUID(); // UUID | Unique identifier for Purchase Orders object (default to null)

            try
            {
                // Retrieves attachments for a specific purchase order
                Attachments result = apiInstance.getPurchaseOrderAttachments(xeroTenantId, purchaseOrderID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getPurchaseOrderAttachments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$purchaseOrderID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getPurchaseOrderAttachments($xeroTenantId, $purchaseOrderID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPurchaseOrderAttachments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $purchaseOrderID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Purchase Orders object

eval { 
    my $result = $api_instance->getPurchaseOrderAttachments(xeroTenantId => $xeroTenantId, purchaseOrderID => $purchaseOrderID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPurchaseOrderAttachments: $@\n";
}
# 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_get_purchase_order_attachments():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    purchaseOrderID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_purchase_order_attachments(xeroTenantId, purchaseOrderID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPurchaseOrderAttachments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getPurchaseOrderAttachments(xeroTenantId, purchaseOrderID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
PurchaseOrderID*
UUID (uuid)
Unique identifier for Purchase Orders object
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getPurchaseOrderByNumber

Retrieves a specific purchase order using purchase order number


/PurchaseOrders/{PurchaseOrderNumber}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders/{PurchaseOrderNumber}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        String purchaseOrderNumber = "PO1234";

        try {
            PurchaseOrders result = apiInstance.getPurchaseOrderByNumber(accessToken, xeroTenantId, purchaseOrderNumber);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrderByNumber");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        String purchaseOrderNumber = PO1234; // String | Unique identifier for a PurchaseOrder
        try {
            PurchaseOrders result = apiInstance.getPurchaseOrderByNumber(xeroTenantId, purchaseOrderNumber);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrderByNumber");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
String *purchaseOrderNumber = PO1234; // Unique identifier for a PurchaseOrder (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific purchase order using purchase order number
[apiInstance getPurchaseOrderByNumberWith:xeroTenantId
    purchaseOrderNumber:purchaseOrderNumber
              completionHandler: ^(PurchaseOrders output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const purchaseOrderNumber = "PO1234";  // {String} Unique identifier for a PurchaseOrder

try {
  const response = await xero.accountingApi.getPurchaseOrderByNumber(xeroTenantId, purchaseOrderNumber);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getPurchaseOrderByNumberExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var purchaseOrderNumber = PO1234;  // String | Unique identifier for a PurchaseOrder (default to null)

            try
            {
                // Retrieves a specific purchase order using purchase order number
                PurchaseOrders result = apiInstance.getPurchaseOrderByNumber(xeroTenantId, purchaseOrderNumber);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getPurchaseOrderByNumber: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$purchaseOrderNumber = "PO1234";

try {
  $result = $apiInstance->getPurchaseOrderByNumber($xeroTenantId, $purchaseOrderNumber);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPurchaseOrderByNumber: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $purchaseOrderNumber = PO1234; # String | Unique identifier for a PurchaseOrder

eval { 
    my $result = $api_instance->getPurchaseOrderByNumber(xeroTenantId => $xeroTenantId, purchaseOrderNumber => $purchaseOrderNumber);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPurchaseOrderByNumber: $@\n";
}
# 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_get_purchase_order_by_number():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    purchaseOrderNumber = 'PO1234'
    
    try:
        api_response = api_instance.get_purchase_order_by_number(xeroTenantId, purchaseOrderNumber)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPurchaseOrderByNumber: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let purchaseOrderNumber = PO1234; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getPurchaseOrderByNumber(xeroTenantId, purchaseOrderNumber, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
PurchaseOrderNumber*
String
Unique identifier for a PurchaseOrder
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getPurchaseOrderHistory

Retrieves history for a specific purchase order


/PurchaseOrders/{PurchaseOrderID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders/{PurchaseOrderID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID purchaseOrderID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getPurchaseOrderHistory(accessToken, xeroTenantId, purchaseOrderID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrderHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a PurchaseOrder
        try {
            HistoryRecords result = apiInstance.getPurchaseOrderHistory(xeroTenantId, purchaseOrderID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrderHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *purchaseOrderID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a PurchaseOrder (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history for a specific purchase order
[apiInstance getPurchaseOrderHistoryWith:xeroTenantId
    purchaseOrderID:purchaseOrderID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const purchaseOrderID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a PurchaseOrder

try {
  const response = await xero.accountingApi.getPurchaseOrderHistory(xeroTenantId, purchaseOrderID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getPurchaseOrderHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var purchaseOrderID = new UUID(); // UUID | Unique identifier for a PurchaseOrder (default to null)

            try
            {
                // Retrieves history for a specific purchase order
                HistoryRecords result = apiInstance.getPurchaseOrderHistory(xeroTenantId, purchaseOrderID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getPurchaseOrderHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$purchaseOrderID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getPurchaseOrderHistory($xeroTenantId, $purchaseOrderID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPurchaseOrderHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $purchaseOrderID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a PurchaseOrder

eval { 
    my $result = $api_instance->getPurchaseOrderHistory(xeroTenantId => $xeroTenantId, purchaseOrderID => $purchaseOrderID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPurchaseOrderHistory: $@\n";
}
# 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_get_purchase_order_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    purchaseOrderID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_purchase_order_history(xeroTenantId, purchaseOrderID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPurchaseOrderHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getPurchaseOrderHistory(xeroTenantId, purchaseOrderID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
PurchaseOrderID*
UUID (uuid)
Unique identifier for a PurchaseOrder
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getPurchaseOrders

Retrieves purchase orders


/PurchaseOrders

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders?Status=SUBMITTED&DateFrom=2019-12-01&DateTo=2019-12-31&order=PurchaseOrderNumber ASC&page=1"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String status = "SUBMITTED";
        String dateFrom = "2019-12-01";
        String dateTo = "2019-12-31";
        String order = "PurchaseOrderNumber ASC";
        Integer page = 1;

        try {
            PurchaseOrders result = apiInstance.getPurchaseOrders(accessToken, xeroTenantId, ifModifiedSince, status, dateFrom, dateTo, order, page);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrders");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String status = SUBMITTED; // String | Filter by purchase order status
        String dateFrom = 2019-12-01; // String | Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31
        String dateTo = 2019-12-31; // String | Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31
        String order = PurchaseOrderNumber ASC; // String | Order by an any element
        Integer page = 1; // Integer | To specify a page, append the page parameter to the URL e.g. ?page=1. If there are 100 records in the response you will need to check if there is any more data by fetching the next page e.g ?page=2 and continuing this process until no more results are returned.
        try {
            PurchaseOrders result = apiInstance.getPurchaseOrders(xeroTenantId, ifModifiedSince, status, dateFrom, dateTo, order, page);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrders");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *status = SUBMITTED; // Filter by purchase order status (optional) (default to null)
String *dateFrom = 2019-12-01; // Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31 (optional) (default to null)
String *dateTo = 2019-12-31; // Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31 (optional) (default to null)
String *order = PurchaseOrderNumber ASC; // Order by an any element (optional) (default to null)
Integer *page = 1; // To specify a page, append the page parameter to the URL e.g. ?page=1. If there are 100 records in the response you will need to check if there is any more data by fetching the next page e.g ?page=2 and continuing this process until no more results are returned. (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves purchase orders
[apiInstance getPurchaseOrdersWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    status:status
    dateFrom:dateFrom
    dateTo:dateTo
    order:order
    page:page
              completionHandler: ^(PurchaseOrders output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const status = 'SUBMITTED';  // {String} Filter by purchase order status

const dateFrom = '2019-12-01';  // {String} Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31

const dateTo = '2019-12-31';  // {String} Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31

const order = 'PurchaseOrderNumber ASC';  // {String} Order by an any element

const page = 1;  // {Integer} To specify a page, append the page parameter to the URL e.g. ?page=1. If there are 100 records in the response you will need to check if there is any more data by fetching the next page e.g ?page=2 and continuing this process until no more results are returned.


try {
  const response = await xero.accountingApi.getPurchaseOrders(xeroTenantId, ifModifiedSince, status, dateFrom, dateTo, order, page);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getPurchaseOrdersExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var ifModifiedSince = 2020-02-06T12:17:43.202-08:00;  // Date | Only records created or modified since this timestamp will be returned (optional)  (default to null)
            var status = SUBMITTED;  // String | Filter by purchase order status (optional)  (default to null)
            var dateFrom = 2019-12-01;  // String | Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31 (optional)  (default to null)
            var dateTo = 2019-12-31;  // String | Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31 (optional)  (default to null)
            var order = PurchaseOrderNumber ASC;  // String | Order by an any element (optional)  (default to null)
            var page = 1;  // Integer | To specify a page, append the page parameter to the URL e.g. ?page=1. If there are 100 records in the response you will need to check if there is any more data by fetching the next page e.g ?page=2 and continuing this process until no more results are returned. (optional)  (default to null)

            try
            {
                // Retrieves purchase orders
                PurchaseOrders result = apiInstance.getPurchaseOrders(xeroTenantId, ifModifiedSince, status, dateFrom, dateTo, order, page);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getPurchaseOrders: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$status = "SUBMITTED";
$dateFrom = "2019-12-01";
$dateTo = "2019-12-31";
$order = "PurchaseOrderNumber ASC";
$page = 1;

try {
  $result = $apiInstance->getPurchaseOrders($xeroTenantId, $ifModifiedSince, $status, $dateFrom, $dateTo, $order, $page);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPurchaseOrders: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $status = SUBMITTED; # String | Filter by purchase order status
my $dateFrom = 2019-12-01; # String | Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31
my $dateTo = 2019-12-31; # String | Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31
my $order = PurchaseOrderNumber ASC; # String | Order by an any element
my $page = 1; # Integer | To specify a page, append the page parameter to the URL e.g. ?page=1. If there are 100 records in the response you will need to check if there is any more data by fetching the next page e.g ?page=2 and continuing this process until no more results are returned.

eval { 
    my $result = $api_instance->getPurchaseOrders(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, status => $status, dateFrom => $dateFrom, dateTo => $dateTo, order => $order, page => $page);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPurchaseOrders: $@\n";
}
# 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_get_purchase_orders():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    ifModifiedSince = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    status = 'SUBMITTED'
    dateFrom = '2019-12-01'
    dateTo = '2019-12-31'
    order = 'PurchaseOrderNumber ASC'
    
    try:
        api_response = api_instance.get_purchase_orders(xeroTenantId, ifModifiedSince, status, dateFrom, dateTo, order, page)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPurchaseOrders: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let status = SUBMITTED; // String
    let dateFrom = 2019-12-01; // String
    let dateTo = 2019-12-31; // String
    let order = PurchaseOrderNumber ASC; // String
    let page = 1; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getPurchaseOrders(xeroTenantId, ifModifiedSince, status, dateFrom, dateTo, order, page, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
Status
String
Filter by purchase order status
DateFrom
String
Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31
DateTo
String
Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31
order
String
Order by an any element
page
Integer
To specify a page, append the page parameter to the URL e.g. ?page=1. If there are 100 records in the response you will need to check if there is any more data by fetching the next page e.g ?page=2 and continuing this process until no more results are returned.

getPurchaseOrder≠AttachmentByFileName

Retrieves a specific attachment for a specific purchase order by filename


/PurchaseOrders/{PurchaseOrderID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders/{PurchaseOrderID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID purchaseOrderID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        String contentType = "image/jpg";

        try {
            ByteArrayInputStream result = apiInstance.getPurchaseOrder≠AttachmentByFileName(accessToken, xeroTenantId, purchaseOrderID, fileName, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrder≠AttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Purchase Order object
        String fileName = xero-dev.jpg; // String | Name of the attachment
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getPurchaseOrder≠AttachmentByFileName(xeroTenantId, purchaseOrderID, fileName, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrder≠AttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *purchaseOrderID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Purchase Order object (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment for a specific purchase order by filename
[apiInstance getPurchaseOrder≠AttachmentByFileNameWith:xeroTenantId
    purchaseOrderID:purchaseOrderID
    fileName:fileName
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const purchaseOrderID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for Purchase Order object
const fileName = "xero-dev.jpg";  // {String} Name of the attachment
const contentType = "image/jpg";  // {String} The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

try {
  const response = await xero.accountingApi.getPurchaseOrder≠AttachmentByFileName(xeroTenantId, purchaseOrderID, fileName, contentType);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getPurchaseOrder≠AttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var purchaseOrderID = new UUID(); // UUID | Unique identifier for Purchase Order object (default to null)
            var fileName = xero-dev.jpg;  // String | Name of the attachment (default to null)
            var contentType = image/jpg;  // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

            try
            {
                // Retrieves a specific attachment for a specific purchase order by filename
                File result = apiInstance.getPurchaseOrder≠AttachmentByFileName(xeroTenantId, purchaseOrderID, fileName, contentType);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getPurchaseOrder≠AttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$purchaseOrderID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getPurchaseOrder≠AttachmentByFileName($xeroTenantId, $purchaseOrderID, $fileName, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPurchaseOrder≠AttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $purchaseOrderID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Purchase Order object
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getPurchaseOrder≠AttachmentByFileName(xeroTenantId => $xeroTenantId, purchaseOrderID => $purchaseOrderID, fileName => $fileName, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPurchaseOrder≠AttachmentByFileName: $@\n";
}
# 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_get_purchase_order≠attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    purchaseOrderID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    contentType = 'image/jpg'
    
    try:
        api_response = api_instance.get_purchase_order≠attachment_by_file_name(xeroTenantId, purchaseOrderID, fileName, contentType)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPurchaseOrder≠AttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getPurchaseOrder≠AttachmentByFileName(xeroTenantId, purchaseOrderID, fileName, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
PurchaseOrderID*
UUID (uuid)
Unique identifier for Purchase Order object
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getQuote

Retrieves a specific quote using a unique quote Id


/Quotes/{QuoteID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Quotes/{QuoteID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID quoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Quotes result = apiInstance.getQuote(accessToken, xeroTenantId, quoteID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getQuote");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID quoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Quote
        try {
            Quotes result = apiInstance.getQuote(xeroTenantId, quoteID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getQuote");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *quoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Quote (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific quote using a unique quote Id
[apiInstance getQuoteWith:xeroTenantId
    quoteID:quoteID
              completionHandler: ^(Quotes output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const quoteID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for an Quote

try {
  const response = await xero.accountingApi.getQuote(xeroTenantId, quoteID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getQuoteExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var quoteID = new UUID(); // UUID | Unique identifier for an Quote (default to null)

            try
            {
                // Retrieves a specific quote using a unique quote Id
                Quotes result = apiInstance.getQuote(xeroTenantId, quoteID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getQuote: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$quoteID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getQuote($xeroTenantId, $quoteID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getQuote: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $quoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Quote

eval { 
    my $result = $api_instance->getQuote(xeroTenantId => $xeroTenantId, quoteID => $quoteID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getQuote: $@\n";
}
# 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_get_quote():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    quoteID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_quote(xeroTenantId, quoteID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getQuote: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let quoteID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getQuote(xeroTenantId, quoteID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
QuoteID*
UUID (uuid)
Unique identifier for an Quote
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getQuoteAsPdf

Retrieves a specific quote as a PDF file using a unique quote Id


/Quotes/{QuoteID}/pdf

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Quotes/{QuoteID}/pdf"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID quoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            ByteArrayInputStream result = apiInstance.getQuoteAsPdf(accessToken, xeroTenantId, quoteID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getQuoteAsPdf");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID quoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Quote
        try {
            File result = apiInstance.getQuoteAsPdf(xeroTenantId, quoteID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getQuoteAsPdf");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *quoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Quote (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific quote as a PDF file using a unique quote Id
[apiInstance getQuoteAsPdfWith:xeroTenantId
    quoteID:quoteID
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const quoteID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for an Quote

try {
  const response = await xero.accountingApi.getQuoteAsPdf(xeroTenantId, quoteID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getQuoteAsPdfExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var quoteID = new UUID(); // UUID | Unique identifier for an Quote (default to null)

            try
            {
                // Retrieves a specific quote as a PDF file using a unique quote Id
                File result = apiInstance.getQuoteAsPdf(xeroTenantId, quoteID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getQuoteAsPdf: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$quoteID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getQuoteAsPdf($xeroTenantId, $quoteID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getQuoteAsPdf: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $quoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Quote

eval { 
    my $result = $api_instance->getQuoteAsPdf(xeroTenantId => $xeroTenantId, quoteID => $quoteID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getQuoteAsPdf: $@\n";
}
# 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_get_quote_as_pdf():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    quoteID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_quote_as_pdf(xeroTenantId, quoteID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getQuoteAsPdf: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let quoteID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getQuoteAsPdf(xeroTenantId, quoteID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
QuoteID*
UUID (uuid)
Unique identifier for an Quote
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getQuoteAttachmentByFileName

Retrieves a specific attachment from a specific quote by filename


/Quotes/{QuoteID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Quotes/{QuoteID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID quoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        String contentType = "image/jpg";

        try {
            ByteArrayInputStream result = apiInstance.getQuoteAttachmentByFileName(accessToken, xeroTenantId, quoteID, fileName, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getQuoteAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID quoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Quote object
        String fileName = xero-dev.jpg; // String | Name of the attachment
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getQuoteAttachmentByFileName(xeroTenantId, quoteID, fileName, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getQuoteAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *quoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Quote object (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment from a specific quote by filename
[apiInstance getQuoteAttachmentByFileNameWith:xeroTenantId
    quoteID:quoteID
    fileName:fileName
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const quoteID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for Quote object
const fileName = "xero-dev.jpg";  // {String} Name of the attachment
const contentType = "image/jpg";  // {String} The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

try {
  const response = await xero.accountingApi.getQuoteAttachmentByFileName(xeroTenantId, quoteID, fileName, contentType);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getQuoteAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var quoteID = new UUID(); // UUID | Unique identifier for Quote object (default to null)
            var fileName = xero-dev.jpg;  // String | Name of the attachment (default to null)
            var contentType = image/jpg;  // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

            try
            {
                // Retrieves a specific attachment from a specific quote by filename
                File result = apiInstance.getQuoteAttachmentByFileName(xeroTenantId, quoteID, fileName, contentType);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getQuoteAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$quoteID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getQuoteAttachmentByFileName($xeroTenantId, $quoteID, $fileName, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getQuoteAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $quoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Quote object
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getQuoteAttachmentByFileName(xeroTenantId => $xeroTenantId, quoteID => $quoteID, fileName => $fileName, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getQuoteAttachmentByFileName: $@\n";
}
# 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_get_quote_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    quoteID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    contentType = 'image/jpg'
    
    try:
        api_response = api_instance.get_quote_attachment_by_file_name(xeroTenantId, quoteID, fileName, contentType)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getQuoteAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let quoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getQuoteAttachmentByFileName(xeroTenantId, quoteID, fileName, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
QuoteID*
UUID (uuid)
Unique identifier for Quote object
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getQuoteAttachmentById

Retrieves a specific attachment from a specific quote using a unique attachment Id


/Quotes/{QuoteID}/Attachments/{AttachmentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Quotes/{QuoteID}/Attachments/{AttachmentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID quoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID attachmentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String contentType = "image/jpg";

        try {
            ByteArrayInputStream result = apiInstance.getQuoteAttachmentById(accessToken, xeroTenantId, quoteID, attachmentID, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getQuoteAttachmentById");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID quoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Quote object
        UUID attachmentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Attachment object
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getQuoteAttachmentById(xeroTenantId, quoteID, attachmentID, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getQuoteAttachmentById");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *quoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Quote object (default to null)
UUID *attachmentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Attachment object (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment from a specific quote using a unique attachment Id
[apiInstance getQuoteAttachmentByIdWith:xeroTenantId
    quoteID:quoteID
    attachmentID:attachmentID
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const quoteID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for Quote object
const attachmentID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for Attachment object
const contentType = "image/jpg";  // {String} The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

try {
  const response = await xero.accountingApi.getQuoteAttachmentById(xeroTenantId, quoteID, attachmentID, contentType);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getQuoteAttachmentByIdExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var quoteID = new UUID(); // UUID | Unique identifier for Quote object (default to null)
            var attachmentID = new UUID(); // UUID | Unique identifier for Attachment object (default to null)
            var contentType = image/jpg;  // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

            try
            {
                // Retrieves a specific attachment from a specific quote using a unique attachment Id
                File result = apiInstance.getQuoteAttachmentById(xeroTenantId, quoteID, attachmentID, contentType);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getQuoteAttachmentById: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$quoteID = "00000000-0000-0000-0000-000000000000";
$attachmentID = "00000000-0000-0000-0000-000000000000";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getQuoteAttachmentById($xeroTenantId, $quoteID, $attachmentID, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getQuoteAttachmentById: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $quoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Quote object
my $attachmentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Attachment object
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getQuoteAttachmentById(xeroTenantId => $xeroTenantId, quoteID => $quoteID, attachmentID => $attachmentID, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getQuoteAttachmentById: $@\n";
}
# 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_get_quote_attachment_by_id():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    quoteID = '00000000-0000-0000-0000-000000000000'
    attachmentID = '00000000-0000-0000-0000-000000000000'
    contentType = 'image/jpg'
    
    try:
        api_response = api_instance.get_quote_attachment_by_id(xeroTenantId, quoteID, attachmentID, contentType)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getQuoteAttachmentById: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let quoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let attachmentID = 00000000-0000-0000-0000-000000000000; // UUID
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getQuoteAttachmentById(xeroTenantId, quoteID, attachmentID, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
QuoteID*
UUID (uuid)
Unique identifier for Quote object
Required
AttachmentID*
UUID (uuid)
Unique identifier for Attachment object
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getQuoteAttachments

Retrieves attachments for a specific quote


/Quotes/{QuoteID}/Attachments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Quotes/{QuoteID}/Attachments"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID quoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Attachments result = apiInstance.getQuoteAttachments(accessToken, xeroTenantId, quoteID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getQuoteAttachments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID quoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Quote object
        try {
            Attachments result = apiInstance.getQuoteAttachments(xeroTenantId, quoteID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getQuoteAttachments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *quoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Quote object (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves attachments for a specific quote
[apiInstance getQuoteAttachmentsWith:xeroTenantId
    quoteID:quoteID
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const quoteID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for Quote object

try {
  const response = await xero.accountingApi.getQuoteAttachments(xeroTenantId, quoteID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getQuoteAttachmentsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var quoteID = new UUID(); // UUID | Unique identifier for Quote object (default to null)

            try
            {
                // Retrieves attachments for a specific quote
                Attachments result = apiInstance.getQuoteAttachments(xeroTenantId, quoteID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getQuoteAttachments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$quoteID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getQuoteAttachments($xeroTenantId, $quoteID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getQuoteAttachments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $quoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Quote object

eval { 
    my $result = $api_instance->getQuoteAttachments(xeroTenantId => $xeroTenantId, quoteID => $quoteID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getQuoteAttachments: $@\n";
}
# 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_get_quote_attachments():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    quoteID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_quote_attachments(xeroTenantId, quoteID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getQuoteAttachments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let quoteID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getQuoteAttachments(xeroTenantId, quoteID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
QuoteID*
UUID (uuid)
Unique identifier for Quote object
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getQuoteHistory

Retrieves history records of a specific quote


/Quotes/{QuoteID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Quotes/{QuoteID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID quoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getQuoteHistory(accessToken, xeroTenantId, quoteID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getQuoteHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID quoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Quote
        try {
            HistoryRecords result = apiInstance.getQuoteHistory(xeroTenantId, quoteID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getQuoteHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *quoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Quote (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history records of a specific quote
[apiInstance getQuoteHistoryWith:xeroTenantId
    quoteID:quoteID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const quoteID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for an Quote

try {
  const response = await xero.accountingApi.getQuoteHistory(xeroTenantId, quoteID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getQuoteHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var quoteID = new UUID(); // UUID | Unique identifier for an Quote (default to null)

            try
            {
                // Retrieves history records of a specific quote
                HistoryRecords result = apiInstance.getQuoteHistory(xeroTenantId, quoteID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getQuoteHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$quoteID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getQuoteHistory($xeroTenantId, $quoteID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getQuoteHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $quoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Quote

eval { 
    my $result = $api_instance->getQuoteHistory(xeroTenantId => $xeroTenantId, quoteID => $quoteID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getQuoteHistory: $@\n";
}
# 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_get_quote_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    quoteID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_quote_history(xeroTenantId, quoteID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getQuoteHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let quoteID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getQuoteHistory(xeroTenantId, quoteID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
QuoteID*
UUID (uuid)
Unique identifier for an Quote
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getQuotes

Retrieves sales quotes


/Quotes

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Quotes?DateFrom=2013-10-20&DateTo=2013-10-20&ExpiryDateFrom=2013-10-20&ExpiryDateTo=2013-10-20&ContactID=00000000-0000-0000-0000-000000000000&Status=DRAFT&page=1&order=Status ASC&QuoteNumber=QU-0001"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        date dateFrom = 2013-10-20;
        date dateTo = 2013-10-20;
        date expiryDateFrom = 2013-10-20;
        date expiryDateTo = 2013-10-20;
        UUID contactID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String status = "DRAFT";
        Integer page = 1;
        String order = "Status ASC";
        String quoteNumber = "QU-0001";

        try {
            Quotes result = apiInstance.getQuotes(accessToken, xeroTenantId, ifModifiedSince, dateFrom, dateTo, expiryDateFrom, expiryDateTo, contactID, status, page, order, quoteNumber);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getQuotes");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        date dateFrom = 2013-10-20; // date | Filter for quotes after a particular date
        date dateTo = 2013-10-20; // date | Filter for quotes before a particular date
        date expiryDateFrom = 2013-10-20; // date | Filter for quotes expiring after a particular date
        date expiryDateTo = 2013-10-20; // date | Filter for quotes before a particular date
        UUID contactID = 00000000-0000-0000-0000-000000000000; // UUID | Filter for quotes belonging to a particular contact
        String status = DRAFT; // String | Filter for quotes of a particular Status
        Integer page = 1; // Integer | e.g. page=1 – Up to 100 Quotes will be returned in a single API call with line items shown for each quote
        String order = Status ASC; // String | Order by an any element
        String quoteNumber = QU-0001; // String | Filter by quote number (e.g. GET https://.../Quotes?QuoteNumber=QU-0001)
        try {
            Quotes result = apiInstance.getQuotes(xeroTenantId, ifModifiedSince, dateFrom, dateTo, expiryDateFrom, expiryDateTo, contactID, status, page, order, quoteNumber);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getQuotes");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
date *dateFrom = 2013-10-20; // Filter for quotes after a particular date (optional) (default to null)
date *dateTo = 2013-10-20; // Filter for quotes before a particular date (optional) (default to null)
date *expiryDateFrom = 2013-10-20; // Filter for quotes expiring after a particular date (optional) (default to null)
date *expiryDateTo = 2013-10-20; // Filter for quotes before a particular date (optional) (default to null)
UUID *contactID = 00000000-0000-0000-0000-000000000000; // Filter for quotes belonging to a particular contact (optional) (default to null)
String *status = DRAFT; // Filter for quotes of a particular Status (optional) (default to null)
Integer *page = 1; // e.g. page=1 – Up to 100 Quotes will be returned in a single API call with line items shown for each quote (optional) (default to null)
String *order = Status ASC; // Order by an any element (optional) (default to null)
String *quoteNumber = QU-0001; // Filter by quote number (e.g. GET https://.../Quotes?QuoteNumber=QU-0001) (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves sales quotes
[apiInstance getQuotesWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    dateFrom:dateFrom
    dateTo:dateTo
    expiryDateFrom:expiryDateFrom
    expiryDateTo:expiryDateTo
    contactID:contactID
    status:status
    page:page
    order:order
    quoteNumber:quoteNumber
              completionHandler: ^(Quotes output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const dateFrom = new Date("2013-10-20");  // {date} Filter for quotes after a particular date

const dateTo = new Date("2013-10-20");  // {date} Filter for quotes before a particular date

const expiryDateFrom = new Date("2013-10-20");  // {date} Filter for quotes expiring after a particular date

const expiryDateTo = new Date("2013-10-20");  // {date} Filter for quotes before a particular date

const contactID = '00000000-0000-0000-0000-000000000000';  // {UUID} Filter for quotes belonging to a particular contact

const status = 'DRAFT';  // {String} Filter for quotes of a particular Status

const page = 1;  // {Integer} e.g. page=1 – Up to 100 Quotes will be returned in a single API call with line items shown for each quote

const order = 'Status ASC';  // {String} Order by an any element

const quoteNumber = 'QU-0001';  // {String} Filter by quote number (e.g. GET https://.../Quotes?QuoteNumber=QU-0001)


try {
  const response = await xero.accountingApi.getQuotes(xeroTenantId, ifModifiedSince, dateFrom, dateTo, expiryDateFrom, expiryDateTo, contactID, status, page, order, quoteNumber);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getQuotesExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var ifModifiedSince = 2020-02-06T12:17:43.202-08:00;  // Date | Only records created or modified since this timestamp will be returned (optional)  (default to null)
            var dateFrom = 2013-10-20;  // date | Filter for quotes after a particular date (optional)  (default to null)
            var dateTo = 2013-10-20;  // date | Filter for quotes before a particular date (optional)  (default to null)
            var expiryDateFrom = 2013-10-20;  // date | Filter for quotes expiring after a particular date (optional)  (default to null)
            var expiryDateTo = 2013-10-20;  // date | Filter for quotes before a particular date (optional)  (default to null)
            var contactID = new UUID(); // UUID | Filter for quotes belonging to a particular contact (optional)  (default to null)
            var status = DRAFT;  // String | Filter for quotes of a particular Status (optional)  (default to null)
            var page = 1;  // Integer | e.g. page=1 – Up to 100 Quotes will be returned in a single API call with line items shown for each quote (optional)  (default to null)
            var order = Status ASC;  // String | Order by an any element (optional)  (default to null)
            var quoteNumber = QU-0001;  // String | Filter by quote number (e.g. GET https://.../Quotes?QuoteNumber=QU-0001) (optional)  (default to null)

            try
            {
                // Retrieves sales quotes
                Quotes result = apiInstance.getQuotes(xeroTenantId, ifModifiedSince, dateFrom, dateTo, expiryDateFrom, expiryDateTo, contactID, status, page, order, quoteNumber);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getQuotes: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$dateFrom = new DateTime("2013-10-20");
$dateTo = new DateTime("2013-10-20");
$expiryDateFrom = new DateTime("2013-10-20");
$expiryDateTo = new DateTime("2013-10-20");
$contactID = "00000000-0000-0000-0000-000000000000";
$status = "DRAFT";
$page = 1;
$order = "Status ASC";
$quoteNumber = "QU-0001";

try {
  $result = $apiInstance->getQuotes($xeroTenantId, $ifModifiedSince, $dateFrom, $dateTo, $expiryDateFrom, $expiryDateTo, $contactID, $status, $page, $order, $quoteNumber);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getQuotes: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $dateFrom = 2013-10-20; # date | Filter for quotes after a particular date
my $dateTo = 2013-10-20; # date | Filter for quotes before a particular date
my $expiryDateFrom = 2013-10-20; # date | Filter for quotes expiring after a particular date
my $expiryDateTo = 2013-10-20; # date | Filter for quotes before a particular date
my $contactID = 00000000-0000-0000-0000-000000000000; # UUID | Filter for quotes belonging to a particular contact
my $status = DRAFT; # String | Filter for quotes of a particular Status
my $page = 1; # Integer | e.g. page=1 – Up to 100 Quotes will be returned in a single API call with line items shown for each quote
my $order = Status ASC; # String | Order by an any element
my $quoteNumber = QU-0001; # String | Filter by quote number (e.g. GET https://.../Quotes?QuoteNumber=QU-0001)

eval { 
    my $result = $api_instance->getQuotes(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, dateFrom => $dateFrom, dateTo => $dateTo, expiryDateFrom => $expiryDateFrom, expiryDateTo => $expiryDateTo, contactID => $contactID, status => $status, page => $page, order => $order, quoteNumber => $quoteNumber);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getQuotes: $@\n";
}
# 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_get_quotes():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    ifModifiedSince = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    dateFrom = dateutil.parser.parse("2013-10-20")
    dateTo = dateutil.parser.parse("2013-10-20")
    expiryDateFrom = dateutil.parser.parse("2013-10-20")
    expiryDateTo = dateutil.parser.parse("2013-10-20")
    contactID = '00000000-0000-0000-0000-000000000000'
    status = 'DRAFT'
    order = 'Status ASC'
    quoteNumber = 'QU-0001'
    
    try:
        api_response = api_instance.get_quotes(xeroTenantId, ifModifiedSince, dateFrom, dateTo, expiryDateFrom, expiryDateTo, contactID, status, page, order, quoteNumber)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getQuotes: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let dateFrom = 2013-10-20; // date
    let dateTo = 2013-10-20; // date
    let expiryDateFrom = 2013-10-20; // date
    let expiryDateTo = 2013-10-20; // date
    let contactID = 00000000-0000-0000-0000-000000000000; // UUID
    let status = DRAFT; // String
    let page = 1; // Integer
    let order = Status ASC; // String
    let quoteNumber = QU-0001; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getQuotes(xeroTenantId, ifModifiedSince, dateFrom, dateTo, expiryDateFrom, expiryDateTo, contactID, status, page, order, quoteNumber, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
DateFrom
date (date)
Filter for quotes after a particular date
DateTo
date (date)
Filter for quotes before a particular date
ExpiryDateFrom
date (date)
Filter for quotes expiring after a particular date
ExpiryDateTo
date (date)
Filter for quotes before a particular date
ContactID
UUID (uuid)
Filter for quotes belonging to a particular contact
Status
String
Filter for quotes of a particular Status
page
Integer
e.g. page=1 – Up to 100 Quotes will be returned in a single API call with line items shown for each quote
order
String
Order by an any element
QuoteNumber
String
Filter by quote number (e.g. GET https://.../Quotes?QuoteNumber=QU-0001)

getReceipt

Retrieves a specific draft expense claim receipt by using a unique receipt Id


/Receipts/{ReceiptID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Receipts/{ReceiptID}?unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID receiptID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Integer unitdp = 4;

        try {
            Receipts result = apiInstance.getReceipt(accessToken, xeroTenantId, receiptID, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReceipt");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID receiptID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Receipt
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Receipts result = apiInstance.getReceipt(xeroTenantId, receiptID, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReceipt");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *receiptID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Receipt (default to null)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific draft expense claim receipt by using a unique receipt Id
[apiInstance getReceiptWith:xeroTenantId
    receiptID:receiptID
    unitdp:unitdp
              completionHandler: ^(Receipts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const receiptID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Receipt

const unitdp = 4;  // {Integer} e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts


try {
  const response = await xero.accountingApi.getReceipt(xeroTenantId, receiptID,  unitdp);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getReceiptExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var receiptID = new UUID(); // UUID | Unique identifier for a Receipt (default to null)
            var unitdp = 4;  // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)  (default to null)

            try
            {
                // Retrieves a specific draft expense claim receipt by using a unique receipt Id
                Receipts result = apiInstance.getReceipt(xeroTenantId, receiptID, unitdp);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getReceipt: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$receiptID = "00000000-0000-0000-0000-000000000000";
$unitdp = 4;

try {
  $result = $apiInstance->getReceipt($xeroTenantId, $receiptID, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReceipt: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $receiptID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Receipt
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->getReceipt(xeroTenantId => $xeroTenantId, receiptID => $receiptID, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReceipt: $@\n";
}
# 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_get_receipt():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    receiptID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_receipt(xeroTenantId, receiptID, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReceipt: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let receiptID = 00000000-0000-0000-0000-000000000000; // UUID
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getReceipt(xeroTenantId, receiptID, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
ReceiptID*
UUID (uuid)
Unique identifier for a Receipt
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

getReceiptAttachmentByFileName

Retrieves a specific attachment from a specific expense claim receipts by file name


/Receipts/{ReceiptID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Receipts/{ReceiptID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID receiptID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        String contentType = "image/jpg";

        try {
            ByteArrayInputStream result = apiInstance.getReceiptAttachmentByFileName(accessToken, xeroTenantId, receiptID, fileName, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReceiptAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID receiptID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Receipt
        String fileName = xero-dev.jpg; // String | The name of the file being attached to the Receipt
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getReceiptAttachmentByFileName(xeroTenantId, receiptID, fileName, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReceiptAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *receiptID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Receipt (default to null)
String *fileName = xero-dev.jpg; // The name of the file being attached to the Receipt (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment from a specific expense claim receipts by file name
[apiInstance getReceiptAttachmentByFileNameWith:xeroTenantId
    receiptID:receiptID
    fileName:fileName
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const receiptID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Receipt
const fileName = "xero-dev.jpg";  // {String} The name of the file being attached to the Receipt
const contentType = "image/jpg";  // {String} The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

try {
  const response = await xero.accountingApi.getReceiptAttachmentByFileName(xeroTenantId, receiptID, fileName, contentType);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getReceiptAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var receiptID = new UUID(); // UUID | Unique identifier for a Receipt (default to null)
            var fileName = xero-dev.jpg;  // String | The name of the file being attached to the Receipt (default to null)
            var contentType = image/jpg;  // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

            try
            {
                // Retrieves a specific attachment from a specific expense claim receipts by file name
                File result = apiInstance.getReceiptAttachmentByFileName(xeroTenantId, receiptID, fileName, contentType);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getReceiptAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$receiptID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getReceiptAttachmentByFileName($xeroTenantId, $receiptID, $fileName, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReceiptAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $receiptID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Receipt
my $fileName = xero-dev.jpg; # String | The name of the file being attached to the Receipt
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getReceiptAttachmentByFileName(xeroTenantId => $xeroTenantId, receiptID => $receiptID, fileName => $fileName, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReceiptAttachmentByFileName: $@\n";
}
# 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_get_receipt_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    receiptID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    contentType = 'image/jpg'
    
    try:
        api_response = api_instance.get_receipt_attachment_by_file_name(xeroTenantId, receiptID, fileName, contentType)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReceiptAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let receiptID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getReceiptAttachmentByFileName(xeroTenantId, receiptID, fileName, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
ReceiptID*
UUID (uuid)
Unique identifier for a Receipt
Required
FileName*
String
The name of the file being attached to the Receipt
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getReceiptAttachmentById

Retrieves a specific attachments from a specific expense claim receipts by using a unique attachment Id


/Receipts/{ReceiptID}/Attachments/{AttachmentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Receipts/{ReceiptID}/Attachments/{AttachmentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID receiptID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID attachmentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String contentType = "image/jpg";

        try {
            ByteArrayInputStream result = apiInstance.getReceiptAttachmentById(accessToken, xeroTenantId, receiptID, attachmentID, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReceiptAttachmentById");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID receiptID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Receipt
        UUID attachmentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Attachment
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getReceiptAttachmentById(xeroTenantId, receiptID, attachmentID, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReceiptAttachmentById");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *receiptID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Receipt (default to null)
UUID *attachmentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Attachment (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachments from a specific expense claim receipts by using a unique attachment Id
[apiInstance getReceiptAttachmentByIdWith:xeroTenantId
    receiptID:receiptID
    attachmentID:attachmentID
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const receiptID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Receipt
const attachmentID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Attachment
const contentType = "image/jpg";  // {String} The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

try {
  const response = await xero.accountingApi.getReceiptAttachmentById(xeroTenantId, receiptID, attachmentID, contentType);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getReceiptAttachmentByIdExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var receiptID = new UUID(); // UUID | Unique identifier for a Receipt (default to null)
            var attachmentID = new UUID(); // UUID | Unique identifier for a Attachment (default to null)
            var contentType = image/jpg;  // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

            try
            {
                // Retrieves a specific attachments from a specific expense claim receipts by using a unique attachment Id
                File result = apiInstance.getReceiptAttachmentById(xeroTenantId, receiptID, attachmentID, contentType);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getReceiptAttachmentById: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$receiptID = "00000000-0000-0000-0000-000000000000";
$attachmentID = "00000000-0000-0000-0000-000000000000";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getReceiptAttachmentById($xeroTenantId, $receiptID, $attachmentID, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReceiptAttachmentById: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $receiptID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Receipt
my $attachmentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Attachment
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getReceiptAttachmentById(xeroTenantId => $xeroTenantId, receiptID => $receiptID, attachmentID => $attachmentID, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReceiptAttachmentById: $@\n";
}
# 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_get_receipt_attachment_by_id():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    receiptID = '00000000-0000-0000-0000-000000000000'
    attachmentID = '00000000-0000-0000-0000-000000000000'
    contentType = 'image/jpg'
    
    try:
        api_response = api_instance.get_receipt_attachment_by_id(xeroTenantId, receiptID, attachmentID, contentType)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReceiptAttachmentById: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let receiptID = 00000000-0000-0000-0000-000000000000; // UUID
    let attachmentID = 00000000-0000-0000-0000-000000000000; // UUID
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getReceiptAttachmentById(xeroTenantId, receiptID, attachmentID, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
ReceiptID*
UUID (uuid)
Unique identifier for a Receipt
Required
AttachmentID*
UUID (uuid)
Unique identifier for a Attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getReceiptAttachments

Retrieves attachments for a specific expense claim receipt


/Receipts/{ReceiptID}/Attachments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Receipts/{ReceiptID}/Attachments"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID receiptID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Attachments result = apiInstance.getReceiptAttachments(accessToken, xeroTenantId, receiptID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReceiptAttachments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID receiptID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Receipt
        try {
            Attachments result = apiInstance.getReceiptAttachments(xeroTenantId, receiptID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReceiptAttachments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *receiptID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Receipt (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves attachments for a specific expense claim receipt
[apiInstance getReceiptAttachmentsWith:xeroTenantId
    receiptID:receiptID
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const receiptID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Receipt

try {
  const response = await xero.accountingApi.getReceiptAttachments(xeroTenantId, receiptID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getReceiptAttachmentsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var receiptID = new UUID(); // UUID | Unique identifier for a Receipt (default to null)

            try
            {
                // Retrieves attachments for a specific expense claim receipt
                Attachments result = apiInstance.getReceiptAttachments(xeroTenantId, receiptID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getReceiptAttachments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$receiptID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getReceiptAttachments($xeroTenantId, $receiptID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReceiptAttachments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $receiptID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Receipt

eval { 
    my $result = $api_instance->getReceiptAttachments(xeroTenantId => $xeroTenantId, receiptID => $receiptID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReceiptAttachments: $@\n";
}
# 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_get_receipt_attachments():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    receiptID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_receipt_attachments(xeroTenantId, receiptID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReceiptAttachments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let receiptID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getReceiptAttachments(xeroTenantId, receiptID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
ReceiptID*
UUID (uuid)
Unique identifier for a Receipt
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getReceiptHistory

Retrieves a history record for a specific receipt


/Receipts/{ReceiptID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Receipts/{ReceiptID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID receiptID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getReceiptHistory(accessToken, xeroTenantId, receiptID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReceiptHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID receiptID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Receipt
        try {
            HistoryRecords result = apiInstance.getReceiptHistory(xeroTenantId, receiptID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReceiptHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *receiptID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Receipt (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a history record for a specific receipt
[apiInstance getReceiptHistoryWith:xeroTenantId
    receiptID:receiptID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const receiptID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Receipt

try {
  const response = await xero.accountingApi.getReceiptHistory(xeroTenantId, receiptID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getReceiptHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var receiptID = new UUID(); // UUID | Unique identifier for a Receipt (default to null)

            try
            {
                // Retrieves a history record for a specific receipt
                HistoryRecords result = apiInstance.getReceiptHistory(xeroTenantId, receiptID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getReceiptHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$receiptID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getReceiptHistory($xeroTenantId, $receiptID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReceiptHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $receiptID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Receipt

eval { 
    my $result = $api_instance->getReceiptHistory(xeroTenantId => $xeroTenantId, receiptID => $receiptID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReceiptHistory: $@\n";
}
# 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_get_receipt_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    receiptID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_receipt_history(xeroTenantId, receiptID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReceiptHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let receiptID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getReceiptHistory(xeroTenantId, receiptID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
ReceiptID*
UUID (uuid)
Unique identifier for a Receipt
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getReceipts

Retrieves draft expense claim receipts for any user


/Receipts

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Receipts?where=Status=="DRAFT"&order=ReceiptNumber ASC&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = "Status=="DRAFT"";
        String order = "ReceiptNumber ASC";
        Integer unitdp = 4;

        try {
            Receipts result = apiInstance.getReceipts(accessToken, xeroTenantId, ifModifiedSince, where, order, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReceipts");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = Status=="DRAFT"; // String | Filter by an any element
        String order = ReceiptNumber ASC; // String | Order by an any element
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Receipts result = apiInstance.getReceipts(xeroTenantId, ifModifiedSince, where, order, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReceipts");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = Status=="DRAFT"; // Filter by an any element (optional) (default to null)
String *order = ReceiptNumber ASC; // Order by an any element (optional) (default to null)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves draft expense claim receipts for any user
[apiInstance getReceiptsWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
    unitdp:unitdp
              completionHandler: ^(Receipts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="DRAFT"';  // {String} Filter by an any element

const order = 'ReceiptNumber ASC';  // {String} Order by an any element

const unitdp = 4;  // {Integer} e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts


try {
  const response = await xero.accountingApi.getReceipts(xeroTenantId, ifModifiedSince, where, order, unitdp);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getReceiptsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var ifModifiedSince = 2020-02-06T12:17:43.202-08:00;  // Date | Only records created or modified since this timestamp will be returned (optional)  (default to null)
            var where = Status=="DRAFT";  // String | Filter by an any element (optional)  (default to null)
            var order = ReceiptNumber ASC;  // String | Order by an any element (optional)  (default to null)
            var unitdp = 4;  // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)  (default to null)

            try
            {
                // Retrieves draft expense claim receipts for any user
                Receipts result = apiInstance.getReceipts(xeroTenantId, ifModifiedSince, where, order, unitdp);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getReceipts: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\Receipt::STATUS_DRAFT . '"";
$order = "ReceiptNumber ASC";
$unitdp = 4;

try {
  $result = $apiInstance->getReceipts($xeroTenantId, $ifModifiedSince, $where, $order, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReceipts: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = Status=="DRAFT"; # String | Filter by an any element
my $order = ReceiptNumber ASC; # String | Order by an any element
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->getReceipts(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReceipts: $@\n";
}
# 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_get_receipts():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    ifModifiedSince = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'Status=="DRAFT"'
    order = 'ReceiptNumber ASC'
    
    try:
        api_response = api_instance.get_receipts(xeroTenantId, ifModifiedSince, where, order, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReceipts: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = Status=="DRAFT"; // String
    let order = ReceiptNumber ASC; // String
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getReceipts(xeroTenantId, ifModifiedSince, where, order, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

getRepeatingInvoice

Retrieves a specific repeating invoice by using a unique repeating invoice Id


/RepeatingInvoices/{RepeatingInvoiceID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/RepeatingInvoices/{RepeatingInvoiceID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID repeatingInvoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            RepeatingInvoices result = apiInstance.getRepeatingInvoice(accessToken, xeroTenantId, repeatingInvoiceID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getRepeatingInvoice");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Repeating Invoice
        try {
            RepeatingInvoices result = apiInstance.getRepeatingInvoice(xeroTenantId, repeatingInvoiceID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getRepeatingInvoice");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Repeating Invoice (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific repeating invoice by using a unique repeating invoice Id
[apiInstance getRepeatingInvoiceWith:xeroTenantId
    repeatingInvoiceID:repeatingInvoiceID
              completionHandler: ^(RepeatingInvoices output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const repeatingInvoiceID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Repeating Invoice

try {
  const response = await xero.accountingApi.getRepeatingInvoice(xeroTenantId, repeatingInvoiceID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getRepeatingInvoiceExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var repeatingInvoiceID = new UUID(); // UUID | Unique identifier for a Repeating Invoice (default to null)

            try
            {
                // Retrieves a specific repeating invoice by using a unique repeating invoice Id
                RepeatingInvoices result = apiInstance.getRepeatingInvoice(xeroTenantId, repeatingInvoiceID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getRepeatingInvoice: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$repeatingInvoiceID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getRepeatingInvoice($xeroTenantId, $repeatingInvoiceID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getRepeatingInvoice: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Repeating Invoice

eval { 
    my $result = $api_instance->getRepeatingInvoice(xeroTenantId => $xeroTenantId, repeatingInvoiceID => $repeatingInvoiceID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getRepeatingInvoice: $@\n";
}
# 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_get_repeating_invoice():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    repeatingInvoiceID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_repeating_invoice(xeroTenantId, repeatingInvoiceID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getRepeatingInvoice: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getRepeatingInvoice(xeroTenantId, repeatingInvoiceID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
RepeatingInvoiceID*
UUID (uuid)
Unique identifier for a Repeating Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getRepeatingInvoiceAttachmentByFileName

Retrieves a specific attachment from a specific repeating invoices by file name


/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID repeatingInvoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        String contentType = "image/jpg";

        try {
            ByteArrayInputStream result = apiInstance.getRepeatingInvoiceAttachmentByFileName(accessToken, xeroTenantId, repeatingInvoiceID, fileName, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getRepeatingInvoiceAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Repeating Invoice
        String fileName = xero-dev.jpg; // String | The name of the file being attached to a Repeating Invoice
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getRepeatingInvoiceAttachmentByFileName(xeroTenantId, repeatingInvoiceID, fileName, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getRepeatingInvoiceAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Repeating Invoice (default to null)
String *fileName = xero-dev.jpg; // The name of the file being attached to a Repeating Invoice (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment from a specific repeating invoices by file name
[apiInstance getRepeatingInvoiceAttachmentByFileNameWith:xeroTenantId
    repeatingInvoiceID:repeatingInvoiceID
    fileName:fileName
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const repeatingInvoiceID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Repeating Invoice
const fileName = "xero-dev.jpg";  // {String} The name of the file being attached to a Repeating Invoice
const contentType = "image/jpg";  // {String} The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

try {
  const response = await xero.accountingApi.getRepeatingInvoiceAttachmentByFileName(xeroTenantId, repeatingInvoiceID, fileName, contentType);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getRepeatingInvoiceAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var repeatingInvoiceID = new UUID(); // UUID | Unique identifier for a Repeating Invoice (default to null)
            var fileName = xero-dev.jpg;  // String | The name of the file being attached to a Repeating Invoice (default to null)
            var contentType = image/jpg;  // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

            try
            {
                // Retrieves a specific attachment from a specific repeating invoices by file name
                File result = apiInstance.getRepeatingInvoiceAttachmentByFileName(xeroTenantId, repeatingInvoiceID, fileName, contentType);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getRepeatingInvoiceAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$repeatingInvoiceID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getRepeatingInvoiceAttachmentByFileName($xeroTenantId, $repeatingInvoiceID, $fileName, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getRepeatingInvoiceAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Repeating Invoice
my $fileName = xero-dev.jpg; # String | The name of the file being attached to a Repeating Invoice
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getRepeatingInvoiceAttachmentByFileName(xeroTenantId => $xeroTenantId, repeatingInvoiceID => $repeatingInvoiceID, fileName => $fileName, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getRepeatingInvoiceAttachmentByFileName: $@\n";
}
# 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_get_repeating_invoice_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    repeatingInvoiceID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    contentType = 'image/jpg'
    
    try:
        api_response = api_instance.get_repeating_invoice_attachment_by_file_name(xeroTenantId, repeatingInvoiceID, fileName, contentType)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getRepeatingInvoiceAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getRepeatingInvoiceAttachmentByFileName(xeroTenantId, repeatingInvoiceID, fileName, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
RepeatingInvoiceID*
UUID (uuid)
Unique identifier for a Repeating Invoice
Required
FileName*
String
The name of the file being attached to a Repeating Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getRepeatingInvoiceAttachmentById

Retrieves a specific attachment from a specific repeating invoice


/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID repeatingInvoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID attachmentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String contentType = "image/jpg";

        try {
            ByteArrayInputStream result = apiInstance.getRepeatingInvoiceAttachmentById(accessToken, xeroTenantId, repeatingInvoiceID, attachmentID, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getRepeatingInvoiceAttachmentById");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Repeating Invoice
        UUID attachmentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Attachment
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getRepeatingInvoiceAttachmentById(xeroTenantId, repeatingInvoiceID, attachmentID, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getRepeatingInvoiceAttachmentById");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Repeating Invoice (default to null)
UUID *attachmentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Attachment (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment from a specific repeating invoice
[apiInstance getRepeatingInvoiceAttachmentByIdWith:xeroTenantId
    repeatingInvoiceID:repeatingInvoiceID
    attachmentID:attachmentID
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const repeatingInvoiceID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Repeating Invoice
const attachmentID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Attachment
const contentType = "image/jpg";  // {String} The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

try {
  const response = await xero.accountingApi.getRepeatingInvoiceAttachmentById(xeroTenantId, repeatingInvoiceID, attachmentID, contentType);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getRepeatingInvoiceAttachmentByIdExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var repeatingInvoiceID = new UUID(); // UUID | Unique identifier for a Repeating Invoice (default to null)
            var attachmentID = new UUID(); // UUID | Unique identifier for a Attachment (default to null)
            var contentType = image/jpg;  // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

            try
            {
                // Retrieves a specific attachment from a specific repeating invoice
                File result = apiInstance.getRepeatingInvoiceAttachmentById(xeroTenantId, repeatingInvoiceID, attachmentID, contentType);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getRepeatingInvoiceAttachmentById: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$repeatingInvoiceID = "00000000-0000-0000-0000-000000000000";
$attachmentID = "00000000-0000-0000-0000-000000000000";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getRepeatingInvoiceAttachmentById($xeroTenantId, $repeatingInvoiceID, $attachmentID, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getRepeatingInvoiceAttachmentById: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Repeating Invoice
my $attachmentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Attachment
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getRepeatingInvoiceAttachmentById(xeroTenantId => $xeroTenantId, repeatingInvoiceID => $repeatingInvoiceID, attachmentID => $attachmentID, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getRepeatingInvoiceAttachmentById: $@\n";
}
# 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_get_repeating_invoice_attachment_by_id():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    repeatingInvoiceID = '00000000-0000-0000-0000-000000000000'
    attachmentID = '00000000-0000-0000-0000-000000000000'
    contentType = 'image/jpg'
    
    try:
        api_response = api_instance.get_repeating_invoice_attachment_by_id(xeroTenantId, repeatingInvoiceID, attachmentID, contentType)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getRepeatingInvoiceAttachmentById: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID
    let attachmentID = 00000000-0000-0000-0000-000000000000; // UUID
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getRepeatingInvoiceAttachmentById(xeroTenantId, repeatingInvoiceID, attachmentID, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
RepeatingInvoiceID*
UUID (uuid)
Unique identifier for a Repeating Invoice
Required
AttachmentID*
UUID (uuid)
Unique identifier for a Attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getRepeatingInvoiceAttachments

Retrieves attachments from a specific repeating invoice


/RepeatingInvoices/{RepeatingInvoiceID}/Attachments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/RepeatingInvoices/{RepeatingInvoiceID}/Attachments"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID repeatingInvoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Attachments result = apiInstance.getRepeatingInvoiceAttachments(accessToken, xeroTenantId, repeatingInvoiceID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getRepeatingInvoiceAttachments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Repeating Invoice
        try {
            Attachments result = apiInstance.getRepeatingInvoiceAttachments(xeroTenantId, repeatingInvoiceID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getRepeatingInvoiceAttachments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Repeating Invoice (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves attachments from a specific repeating invoice
[apiInstance getRepeatingInvoiceAttachmentsWith:xeroTenantId
    repeatingInvoiceID:repeatingInvoiceID
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const repeatingInvoiceID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Repeating Invoice

try {
  const response = await xero.accountingApi.getRepeatingInvoiceAttachments(xeroTenantId, repeatingInvoiceID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getRepeatingInvoiceAttachmentsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var repeatingInvoiceID = new UUID(); // UUID | Unique identifier for a Repeating Invoice (default to null)

            try
            {
                // Retrieves attachments from a specific repeating invoice
                Attachments result = apiInstance.getRepeatingInvoiceAttachments(xeroTenantId, repeatingInvoiceID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getRepeatingInvoiceAttachments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$repeatingInvoiceID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getRepeatingInvoiceAttachments($xeroTenantId, $repeatingInvoiceID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getRepeatingInvoiceAttachments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Repeating Invoice

eval { 
    my $result = $api_instance->getRepeatingInvoiceAttachments(xeroTenantId => $xeroTenantId, repeatingInvoiceID => $repeatingInvoiceID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getRepeatingInvoiceAttachments: $@\n";
}
# 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_get_repeating_invoice_attachments():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    repeatingInvoiceID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_repeating_invoice_attachments(xeroTenantId, repeatingInvoiceID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getRepeatingInvoiceAttachments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getRepeatingInvoiceAttachments(xeroTenantId, repeatingInvoiceID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
RepeatingInvoiceID*
UUID (uuid)
Unique identifier for a Repeating Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getRepeatingInvoiceHistory

Retrieves history record for a specific repeating invoice


/RepeatingInvoices/{RepeatingInvoiceID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/RepeatingInvoices/{RepeatingInvoiceID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID repeatingInvoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getRepeatingInvoiceHistory(accessToken, xeroTenantId, repeatingInvoiceID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getRepeatingInvoiceHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Repeating Invoice
        try {
            HistoryRecords result = apiInstance.getRepeatingInvoiceHistory(xeroTenantId, repeatingInvoiceID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getRepeatingInvoiceHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Repeating Invoice (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history record for a specific repeating invoice
[apiInstance getRepeatingInvoiceHistoryWith:xeroTenantId
    repeatingInvoiceID:repeatingInvoiceID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const repeatingInvoiceID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Repeating Invoice

try {
  const response = await xero.accountingApi.getRepeatingInvoiceHistory(xeroTenantId, repeatingInvoiceID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getRepeatingInvoiceHistoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var repeatingInvoiceID = new UUID(); // UUID | Unique identifier for a Repeating Invoice (default to null)

            try
            {
                // Retrieves history record for a specific repeating invoice
                HistoryRecords result = apiInstance.getRepeatingInvoiceHistory(xeroTenantId, repeatingInvoiceID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getRepeatingInvoiceHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$repeatingInvoiceID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getRepeatingInvoiceHistory($xeroTenantId, $repeatingInvoiceID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getRepeatingInvoiceHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Repeating Invoice

eval { 
    my $result = $api_instance->getRepeatingInvoiceHistory(xeroTenantId => $xeroTenantId, repeatingInvoiceID => $repeatingInvoiceID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getRepeatingInvoiceHistory: $@\n";
}
# 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_get_repeating_invoice_history():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    repeatingInvoiceID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_repeating_invoice_history(xeroTenantId, repeatingInvoiceID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getRepeatingInvoiceHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getRepeatingInvoiceHistory(xeroTenantId, repeatingInvoiceID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
RepeatingInvoiceID*
UUID (uuid)
Unique identifier for a Repeating Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getRepeatingInvoices

Retrieves repeating invoices


/RepeatingInvoices

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/RepeatingInvoices?where=Status=="DRAFT"&order=Total ASC"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        String where = "Status=="DRAFT"";
        String order = "Total ASC";

        try {
            RepeatingInvoices result = apiInstance.getRepeatingInvoices(accessToken, xeroTenantId, where, order);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getRepeatingInvoices");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        String where = Status=="DRAFT"; // String | Filter by an any element
        String order = Total ASC; // String | Order by an any element
        try {
            RepeatingInvoices result = apiInstance.getRepeatingInvoices(xeroTenantId, where, order);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getRepeatingInvoices");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
String *where = Status=="DRAFT"; // Filter by an any element (optional) (default to null)
String *order = Total ASC; // Order by an any element (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves repeating invoices
[apiInstance getRepeatingInvoicesWith:xeroTenantId
    where:where
    order:order
              completionHandler: ^(RepeatingInvoices output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const where = 'Status=="DRAFT"';  // {String} Filter by an any element

const order = 'Total ASC';  // {String} Order by an any element


try {
  const response = await xero.accountingApi.getRepeatingInvoices(xeroTenantId,  where, order);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getRepeatingInvoicesExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var where = Status=="DRAFT";  // String | Filter by an any element (optional)  (default to null)
            var order = Total ASC;  // String | Order by an any element (optional)  (default to null)

            try
            {
                // Retrieves repeating invoices
                RepeatingInvoices result = apiInstance.getRepeatingInvoices(xeroTenantId, where, order);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getRepeatingInvoices: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoice::STATUS_DRAFT . '"";
$order = "Total ASC";

try {
  $result = $apiInstance->getRepeatingInvoices($xeroTenantId, $where, $order);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getRepeatingInvoices: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $where = Status=="DRAFT"; # String | Filter by an any element
my $order = Total ASC; # String | Order by an any element

eval { 
    my $result = $api_instance->getRepeatingInvoices(xeroTenantId => $xeroTenantId, where => $where, order => $order);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getRepeatingInvoices: $@\n";
}
# 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_get_repeating_invoices():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    where = 'Status=="DRAFT"'
    order = 'Total ASC'
    
    try:
        api_response = api_instance.get_repeating_invoices(xeroTenantId, where, order)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getRepeatingInvoices: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let where = Status=="DRAFT"; // String
    let order = Total ASC; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getRepeatingInvoices(xeroTenantId, where, order, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element

getReportAgedPayablesByContact

Retrieves report for aged payables by contact


/Reports/AgedPayablesByContact

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Reports/AgedPayablesByContact?contactId=00000000-0000-0000-0000-000000000000&date=2013-10-20&fromDate=2013-10-20&toDate=2013-10-20"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID contactId = UUID.fromString("00000000-0000-0000-0000-000000000000");
        date date = 2013-10-20;
        date fromDate = 2013-10-20;
        date toDate = 2013-10-20;

        try {
            ReportWithRows result = apiInstance.getReportAgedPayablesByContact(accessToken, xeroTenantId, contactId, date, fromDate, toDate);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReportAgedPayablesByContact");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactId = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact
        date date = 2013-10-20; // date | The date of the Aged Payables By Contact report
        date fromDate = 2013-10-20; // date | The from date of the Aged Payables By Contact report
        date toDate = 2013-10-20; // date | The to date of the Aged Payables By Contact report
        try {
            ReportWithRows result = apiInstance.getReportAgedPayablesByContact(xeroTenantId, contactId, date, fromDate, toDate);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReportAgedPayablesByContact");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactId = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact (default to null)
date *date = 2013-10-20; // The date of the Aged Payables By Contact report (optional) (default to null)
date *fromDate = 2013-10-20; // The from date of the Aged Payables By Contact report (optional) (default to null)
date *toDate = 2013-10-20; // The to date of the Aged Payables By Contact report (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves report for aged payables by contact
[apiInstance getReportAgedPayablesByContactWith:xeroTenantId
    contactId:contactId
    date:date
    fromDate:fromDate
    toDate:toDate
              completionHandler: ^(ReportWithRows output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const contactId = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Contact

const date = new Date("2013-10-20");  // {date} The date of the Aged Payables By Contact report

const fromDate = new Date("2013-10-20");  // {date} The from date of the Aged Payables By Contact report

const toDate = new Date("2013-10-20");  // {date} The to date of the Aged Payables By Contact report


try {
  const response = await xero.accountingApi.getReportAgedPayablesByContact(xeroTenantId, contactId,  date, fromDate, toDate);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getReportAgedPayablesByContactExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var contactId = new UUID(); // UUID | Unique identifier for a Contact (default to null)
            var date = 2013-10-20;  // date | The date of the Aged Payables By Contact report (optional)  (default to null)
            var fromDate = 2013-10-20;  // date | The from date of the Aged Payables By Contact report (optional)  (default to null)
            var toDate = 2013-10-20;  // date | The to date of the Aged Payables By Contact report (optional)  (default to null)

            try
            {
                // Retrieves report for aged payables by contact
                ReportWithRows result = apiInstance.getReportAgedPayablesByContact(xeroTenantId, contactId, date, fromDate, toDate);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getReportAgedPayablesByContact: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactId = "00000000-0000-0000-0000-000000000000";
$date = new DateTime("2013-10-20");
$fromDate = new DateTime("2013-10-20");
$toDate = new DateTime("2013-10-20");

try {
  $result = $apiInstance->getReportAgedPayablesByContact($xeroTenantId, $contactId, $date, $fromDate, $toDate);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReportAgedPayablesByContact: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactId = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact
my $date = 2013-10-20; # date | The date of the Aged Payables By Contact report
my $fromDate = 2013-10-20; # date | The from date of the Aged Payables By Contact report
my $toDate = 2013-10-20; # date | The to date of the Aged Payables By Contact report

eval { 
    my $result = $api_instance->getReportAgedPayablesByContact(xeroTenantId => $xeroTenantId, contactId => $contactId, date => $date, fromDate => $fromDate, toDate => $toDate);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReportAgedPayablesByContact: $@\n";
}
# 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_get_report_aged_payables_by_contact():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    contactId = '00000000-0000-0000-0000-000000000000'
    date = dateutil.parser.parse("2013-10-20")
    fromDate = dateutil.parser.parse("2013-10-20")
    toDate = dateutil.parser.parse("2013-10-20")
    
    try:
        api_response = api_instance.get_report_aged_payables_by_contact(xeroTenantId, contactId, date, fromDate, toDate)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReportAgedPayablesByContact: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactId = 00000000-0000-0000-0000-000000000000; // UUID
    let date = 2013-10-20; // date
    let fromDate = 2013-10-20; // date
    let toDate = 2013-10-20; // date

    let mut context = AccountingApi::Context::default();
    let result = client.getReportAgedPayablesByContact(xeroTenantId, contactId, date, fromDate, toDate, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.reports.read Grant read-only access to accounting reports

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
contactId*
UUID (uuid)
Unique identifier for a Contact
Required
date
date (date)
The date of the Aged Payables By Contact report
fromDate
date (date)
The from date of the Aged Payables By Contact report
toDate
date (date)
The to date of the Aged Payables By Contact report

getReportAgedReceivablesByContact

Retrieves report for aged receivables by contact


/Reports/AgedReceivablesByContact

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Reports/AgedReceivablesByContact?contactId=00000000-0000-0000-0000-000000000000&date=2013-10-20&fromDate=2013-10-20&toDate=2013-10-20"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID contactId = UUID.fromString("00000000-0000-0000-0000-000000000000");
        date date = 2013-10-20;
        date fromDate = 2013-10-20;
        date toDate = 2013-10-20;

        try {
            ReportWithRows result = apiInstance.getReportAgedReceivablesByContact(accessToken, xeroTenantId, contactId, date, fromDate, toDate);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReportAgedReceivablesByContact");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactId = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact
        date date = 2013-10-20; // date | The date of the Aged Receivables By Contact report
        date fromDate = 2013-10-20; // date | The from date of the Aged Receivables By Contact report
        date toDate = 2013-10-20; // date | The to date of the Aged Receivables By Contact report
        try {
            ReportWithRows result = apiInstance.getReportAgedReceivablesByContact(xeroTenantId, contactId, date, fromDate, toDate);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReportAgedReceivablesByContact");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactId = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact (default to null)
date *date = 2013-10-20; // The date of the Aged Receivables By Contact report (optional) (default to null)
date *fromDate = 2013-10-20; // The from date of the Aged Receivables By Contact report (optional) (default to null)
date *toDate = 2013-10-20; // The to date of the Aged Receivables By Contact report (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves report for aged receivables by contact
[apiInstance getReportAgedReceivablesByContactWith:xeroTenantId
    contactId:contactId
    date:date
    fromDate:fromDate
    toDate:toDate
              completionHandler: ^(ReportWithRows output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const contactId = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Contact

const date = new Date("2013-10-20");  // {date} The date of the Aged Receivables By Contact report

const fromDate = new Date("2013-10-20");  // {date} The from date of the Aged Receivables By Contact report

const toDate = new Date("2013-10-20");  // {date} The to date of the Aged Receivables By Contact report


try {
  const response = await xero.accountingApi.getReportAgedReceivablesByContact(xeroTenantId, contactId,  date, fromDate, toDate);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getReportAgedReceivablesByContactExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var contactId = new UUID(); // UUID | Unique identifier for a Contact (default to null)
            var date = 2013-10-20;  // date | The date of the Aged Receivables By Contact report (optional)  (default to null)
            var fromDate = 2013-10-20;  // date | The from date of the Aged Receivables By Contact report (optional)  (default to null)
            var toDate = 2013-10-20;  // date | The to date of the Aged Receivables By Contact report (optional)  (default to null)

            try
            {
                // Retrieves report for aged receivables by contact
                ReportWithRows result = apiInstance.getReportAgedReceivablesByContact(xeroTenantId, contactId, date, fromDate, toDate);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getReportAgedReceivablesByContact: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactId = "00000000-0000-0000-0000-000000000000";
$date = new DateTime("2013-10-20");
$fromDate = new DateTime("2013-10-20");
$toDate = new DateTime("2013-10-20");

try {
  $result = $apiInstance->getReportAgedReceivablesByContact($xeroTenantId, $contactId, $date, $fromDate, $toDate);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReportAgedReceivablesByContact: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactId = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact
my $date = 2013-10-20; # date | The date of the Aged Receivables By Contact report
my $fromDate = 2013-10-20; # date | The from date of the Aged Receivables By Contact report
my $toDate = 2013-10-20; # date | The to date of the Aged Receivables By Contact report

eval { 
    my $result = $api_instance->getReportAgedReceivablesByContact(xeroTenantId => $xeroTenantId, contactId => $contactId, date => $date, fromDate => $fromDate, toDate => $toDate);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReportAgedReceivablesByContact: $@\n";
}
# 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_get_report_aged_receivables_by_contact():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    contactId = '00000000-0000-0000-0000-000000000000'
    date = dateutil.parser.parse("2013-10-20")
    fromDate = dateutil.parser.parse("2013-10-20")
    toDate = dateutil.parser.parse("2013-10-20")
    
    try:
        api_response = api_instance.get_report_aged_receivables_by_contact(xeroTenantId, contactId, date, fromDate, toDate)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReportAgedReceivablesByContact: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactId = 00000000-0000-0000-0000-000000000000; // UUID
    let date = 2013-10-20; // date
    let fromDate = 2013-10-20; // date
    let toDate = 2013-10-20; // date

    let mut context = AccountingApi::Context::default();
    let result = client.getReportAgedReceivablesByContact(xeroTenantId, contactId, date, fromDate, toDate, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.reports.read Grant read-only access to accounting reports

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
contactId*
UUID (uuid)
Unique identifier for a Contact
Required
date
date (date)
The date of the Aged Receivables By Contact report
fromDate
date (date)
The from date of the Aged Receivables By Contact report
toDate
date (date)
The to date of the Aged Receivables By Contact report

getReportBASorGST

Retrieves a specific report for BAS using a unique report Id (only valid for AU orgs)


/Reports/{ReportID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Reports/{ReportID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        String reportID = "00000000-0000-0000-0000-000000000000";

        try {
            ReportWithRows result = apiInstance.getReportBASorGST(accessToken, xeroTenantId, reportID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReportBASorGST");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        String reportID = 00000000-0000-0000-0000-000000000000; // String | Unique identifier for a Report
        try {
            ReportWithRows result = apiInstance.getReportBASorGST(xeroTenantId, reportID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReportBASorGST");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
String *reportID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Report (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific report for BAS using a unique report Id (only valid for AU orgs)
[apiInstance getReportBASorGSTWith:xeroTenantId
    reportID:reportID
              completionHandler: ^(ReportWithRows output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const reportID = "00000000-0000-0000-0000-000000000000";  // {String} Unique identifier for a Report

try {
  const response = await xero.accountingApi.getReportBASorGST(xeroTenantId, reportID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getReportBASorGSTExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var reportID = 00000000-0000-0000-0000-000000000000;  // String | Unique identifier for a Report (default to null)

            try
            {
                // Retrieves a specific report for BAS using a unique report Id (only valid for AU orgs)
                ReportWithRows result = apiInstance.getReportBASorGST(xeroTenantId, reportID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getReportBASorGST: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$reportID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getReportBASorGST($xeroTenantId, $reportID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReportBASorGST: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $reportID = 00000000-0000-0000-0000-000000000000; # String | Unique identifier for a Report

eval { 
    my $result = $api_instance->getReportBASorGST(xeroTenantId => $xeroTenantId, reportID => $reportID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReportBASorGST: $@\n";
}
# 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_get_report_ba_sor_gst():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    reportID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_report_ba_sor_gst(xeroTenantId, reportID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReportBASorGST: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let reportID = 00000000-0000-0000-0000-000000000000; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getReportBASorGST(xeroTenantId, reportID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.reports.read Grant read-only access to accounting reports

Parameters

Path parameters
Name Description
ReportID*
String
Unique identifier for a Report
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getReportBASorGSTList

Retrieves report for BAS (only valid for AU orgs)


/Reports

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Reports"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";

        try {
            ReportWithRows result = apiInstance.getReportBASorGSTList(accessToken, xeroTenantId);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReportBASorGSTList");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        try {
            ReportWithRows result = apiInstance.getReportBASorGSTList(xeroTenantId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReportBASorGSTList");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves report for BAS (only valid for AU orgs)
[apiInstance getReportBASorGSTListWith:xeroTenantId
              completionHandler: ^(ReportWithRows output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

try {
  const response = await xero.accountingApi.getReportBASorGSTList(xeroTenantId);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getReportBASorGSTListExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)

            try
            {
                // Retrieves report for BAS (only valid for AU orgs)
                ReportWithRows result = apiInstance.getReportBASorGSTList(xeroTenantId);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getReportBASorGSTList: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

try {
  $result = $apiInstance->getReportBASorGSTList($xeroTenantId);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReportBASorGSTList: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant

eval { 
    my $result = $api_instance->getReportBASorGSTList(xeroTenantId => $xeroTenantId);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReportBASorGSTList: $@\n";
}
# 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_get_report_ba_sor_gst_list():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    
    try:
        api_response = api_instance.get_report_ba_sor_gst_list(xeroTenantId)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReportBASorGSTList: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getReportBASorGSTList(xeroTenantId, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.reports.read Grant read-only access to accounting reports

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getReportBalanceSheet

Retrieves report for balancesheet


/Reports/BalanceSheet

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Reports/BalanceSheet?date=2019-11-01&periods=3&timeframe=MONTH&trackingOptionID1=00000000-0000-0000-0000-000000000000&trackingOptionID2=00000000-0000-0000-0000-000000000000&standardLayout=true&paymentsOnly=false"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        date date = 2019-11-01;
        Integer periods = 3;
        String timeframe = "MONTH";
        String trackingOptionID1 = "00000000-0000-0000-0000-000000000000";
        String trackingOptionID2 = "00000000-0000-0000-0000-000000000000";
        Boolean standardLayout = true;
        Boolean paymentsOnly = false;

        try {
            ReportWithRows result = apiInstance.getReportBalanceSheet(accessToken, xeroTenantId, date, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReportBalanceSheet");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        date date = 2019-11-01; // date | The date of the Balance Sheet report
        Integer periods = 3; // Integer | The number of periods for the Balance Sheet report
        String timeframe = MONTH; // String | The period size to compare to (MONTH, QUARTER, YEAR)
        String trackingOptionID1 = 00000000-0000-0000-0000-000000000000; // String | The tracking option 1 for the Balance Sheet report
        String trackingOptionID2 = 00000000-0000-0000-0000-000000000000; // String | The tracking option 2 for the Balance Sheet report
        Boolean standardLayout = true; // Boolean | The standard layout boolean for the Balance Sheet report
        Boolean paymentsOnly = false; // Boolean | return a cash basis for the Balance Sheet report
        try {
            ReportWithRows result = apiInstance.getReportBalanceSheet(xeroTenantId, date, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReportBalanceSheet");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
date *date = 2019-11-01; // The date of the Balance Sheet report (optional) (default to null)
Integer *periods = 3; // The number of periods for the Balance Sheet report (optional) (default to null)
String *timeframe = MONTH; // The period size to compare to (MONTH, QUARTER, YEAR) (optional) (default to null)
String *trackingOptionID1 = 00000000-0000-0000-0000-000000000000; // The tracking option 1 for the Balance Sheet report (optional) (default to null)
String *trackingOptionID2 = 00000000-0000-0000-0000-000000000000; // The tracking option 2 for the Balance Sheet report (optional) (default to null)
Boolean *standardLayout = true; // The standard layout boolean for the Balance Sheet report (optional) (default to null)
Boolean *paymentsOnly = false; // return a cash basis for the Balance Sheet report (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves report for balancesheet
[apiInstance getReportBalanceSheetWith:xeroTenantId
    date:date
    periods:periods
    timeframe:timeframe
    trackingOptionID1:trackingOptionID1
    trackingOptionID2:trackingOptionID2
    standardLayout:standardLayout
    paymentsOnly:paymentsOnly
              completionHandler: ^(ReportWithRows output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const date = new Date("2019-11-01");  // {date} The date of the Balance Sheet report

const periods = 3;  // {Integer} The number of periods for the Balance Sheet report

const timeframe = 'MONTH';  // {String} The period size to compare to (MONTH, QUARTER, YEAR)

const trackingOptionID1 = '00000000-0000-0000-0000-000000000000';  // {String} The tracking option 1 for the Balance Sheet report

const trackingOptionID2 = '00000000-0000-0000-0000-000000000000';  // {String} The tracking option 2 for the Balance Sheet report

const standardLayout = true;  // {Boolean} The standard layout boolean for the Balance Sheet report

const paymentsOnly = false;  // {Boolean} return a cash basis for the Balance Sheet report


try {
  const response = await xero.accountingApi.getReportBalanceSheet(xeroTenantId,  date, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getReportBalanceSheetExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var date = 2019-11-01;  // date | The date of the Balance Sheet report (optional)  (default to null)
            var periods = 3;  // Integer | The number of periods for the Balance Sheet report (optional)  (default to null)
            var timeframe = MONTH;  // String | The period size to compare to (MONTH, QUARTER, YEAR) (optional)  (default to null)
            var trackingOptionID1 = 00000000-0000-0000-0000-000000000000;  // String | The tracking option 1 for the Balance Sheet report (optional)  (default to null)
            var trackingOptionID2 = 00000000-0000-0000-0000-000000000000;  // String | The tracking option 2 for the Balance Sheet report (optional)  (default to null)
            var standardLayout = true;  // Boolean | The standard layout boolean for the Balance Sheet report (optional)  (default to null)
            var paymentsOnly = false;  // Boolean | return a cash basis for the Balance Sheet report (optional)  (default to null)

            try
            {
                // Retrieves report for balancesheet
                ReportWithRows result = apiInstance.getReportBalanceSheet(xeroTenantId, date, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getReportBalanceSheet: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$date = new DateTime("2019-11-01");
$periods = 3;
$timeframe = "MONTH";
$trackingOptionID1 = "00000000-0000-0000-0000-000000000000";
$trackingOptionID2 = "00000000-0000-0000-0000-000000000000";
$standardLayout = true;
$paymentsOnly = false;

try {
  $result = $apiInstance->getReportBalanceSheet($xeroTenantId, $date, $periods, $timeframe, $trackingOptionID1, $trackingOptionID2, $standardLayout, $paymentsOnly);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReportBalanceSheet: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $date = 2019-11-01; # date | The date of the Balance Sheet report
my $periods = 3; # Integer | The number of periods for the Balance Sheet report
my $timeframe = MONTH; # String | The period size to compare to (MONTH, QUARTER, YEAR)
my $trackingOptionID1 = 00000000-0000-0000-0000-000000000000; # String | The tracking option 1 for the Balance Sheet report
my $trackingOptionID2 = 00000000-0000-0000-0000-000000000000; # String | The tracking option 2 for the Balance Sheet report
my $standardLayout = true; # Boolean | The standard layout boolean for the Balance Sheet report
my $paymentsOnly = false; # Boolean | return a cash basis for the Balance Sheet report

eval { 
    my $result = $api_instance->getReportBalanceSheet(xeroTenantId => $xeroTenantId, date => $date, periods => $periods, timeframe => $timeframe, trackingOptionID1 => $trackingOptionID1, trackingOptionID2 => $trackingOptionID2, standardLayout => $standardLayout, paymentsOnly => $paymentsOnly);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReportBalanceSheet: $@\n";
}
# 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_get_report_balance_sheet():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    date = dateutil.parser.parse("2019-11-01")
    timeframe = 'MONTH'
    trackingOptionID1 = '00000000-0000-0000-0000-000000000000'
    trackingOptionID2 = '00000000-0000-0000-0000-000000000000'
    standardLayout = 'true'
    paymentsOnly = 'false'
    
    try:
        api_response = api_instance.get_report_balance_sheet(xeroTenantId, date, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReportBalanceSheet: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let date = 2019-11-01; // date
    let periods = 3; // Integer
    let timeframe = MONTH; // String
    let trackingOptionID1 = 00000000-0000-0000-0000-000000000000; // String
    let trackingOptionID2 = 00000000-0000-0000-0000-000000000000; // String
    let standardLayout = true; // Boolean
    let paymentsOnly = false; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.getReportBalanceSheet(xeroTenantId, date, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.reports.read Grant read-only access to accounting reports

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
date
date (date)
The date of the Balance Sheet report
periods
Integer
The number of periods for the Balance Sheet report
timeframe
String
The period size to compare to (MONTH, QUARTER, YEAR)
trackingOptionID1
String
The tracking option 1 for the Balance Sheet report
trackingOptionID2
String
The tracking option 2 for the Balance Sheet report
standardLayout
Boolean
The standard layout boolean for the Balance Sheet report
paymentsOnly
Boolean
return a cash basis for the Balance Sheet report

getReportBankSummary

Retrieves report for bank summary


/Reports/BankSummary

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Reports/BankSummary?fromDate=2019-11-01&toDate=2019-11-30"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        date fromDate = 2019-11-01;
        date toDate = 2019-11-30;

        try {
            ReportWithRows result = apiInstance.getReportBankSummary(accessToken, xeroTenantId, fromDate, toDate);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReportBankSummary");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        date fromDate = 2019-11-01; // date | The from date for the Bank Summary report e.g. 2018-03-31
        date toDate = 2019-11-30; // date | The to date for the Bank Summary report e.g. 2018-03-31
        try {
            ReportWithRows result = apiInstance.getReportBankSummary(xeroTenantId, fromDate, toDate);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReportBankSummary");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
date *fromDate = 2019-11-01; // The from date for the Bank Summary report e.g. 2018-03-31 (optional) (default to null)
date *toDate = 2019-11-30; // The to date for the Bank Summary report e.g. 2018-03-31 (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves report for bank summary
[apiInstance getReportBankSummaryWith:xeroTenantId
    fromDate:fromDate
    toDate:toDate
              completionHandler: ^(ReportWithRows output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const fromDate = new Date("2019-11-01");  // {date} The from date for the Bank Summary report e.g. 2018-03-31

const toDate = new Date("2019-11-30");  // {date} The to date for the Bank Summary report e.g. 2018-03-31


try {
  const response = await xero.accountingApi.getReportBankSummary(xeroTenantId,  fromDate, toDate);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getReportBankSummaryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var fromDate = 2019-11-01;  // date | The from date for the Bank Summary report e.g. 2018-03-31 (optional)  (default to null)
            var toDate = 2019-11-30;  // date | The to date for the Bank Summary report e.g. 2018-03-31 (optional)  (default to null)

            try
            {
                // Retrieves report for bank summary
                ReportWithRows result = apiInstance.getReportBankSummary(xeroTenantId, fromDate, toDate);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getReportBankSummary: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$fromDate = new DateTime("2019-11-01");
$toDate = new DateTime("2019-11-30");

try {
  $result = $apiInstance->getReportBankSummary($xeroTenantId, $fromDate, $toDate);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReportBankSummary: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $fromDate = 2019-11-01; # date | The from date for the Bank Summary report e.g. 2018-03-31
my $toDate = 2019-11-30; # date | The to date for the Bank Summary report e.g. 2018-03-31

eval { 
    my $result = $api_instance->getReportBankSummary(xeroTenantId => $xeroTenantId, fromDate => $fromDate, toDate => $toDate);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReportBankSummary: $@\n";
}
# 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_get_report_bank_summary():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    fromDate = dateutil.parser.parse("2019-11-01")
    toDate = dateutil.parser.parse("2019-11-30")
    
    try:
        api_response = api_instance.get_report_bank_summary(xeroTenantId, fromDate, toDate)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReportBankSummary: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let fromDate = 2019-11-01; // date
    let toDate = 2019-11-30; // date

    let mut context = AccountingApi::Context::default();
    let result = client.getReportBankSummary(xeroTenantId, fromDate, toDate, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.reports.read Grant read-only access to accounting reports

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
fromDate
date (date)
The from date for the Bank Summary report e.g. 2018-03-31
toDate
date (date)
The to date for the Bank Summary report e.g. 2018-03-31

getReportBudgetSummary

Retrieves report for budget summary


/Reports/BudgetSummary

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Reports/BudgetSummary?date=2019-03-31&period=2&timeframe=3"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        date date = 2019-03-31;
        Integer period = 2;
        Integer timeframe = 3;

        try {
            ReportWithRows result = apiInstance.getReportBudgetSummary(accessToken, xeroTenantId, date, period, timeframe);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReportBudgetSummary");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        date date = 2019-03-31; // date | The date for the Bank Summary report e.g. 2018-03-31
        Integer period = 2; // Integer | The number of periods to compare (integer between 1 and 12)
        Integer timeframe = 3; // Integer | The period size to compare to (1=month, 3=quarter, 12=year)
        try {
            ReportWithRows result = apiInstance.getReportBudgetSummary(xeroTenantId, date, period, timeframe);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReportBudgetSummary");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
date *date = 2019-03-31; // The date for the Bank Summary report e.g. 2018-03-31 (optional) (default to null)
Integer *period = 2; // The number of periods to compare (integer between 1 and 12) (optional) (default to null)
Integer *timeframe = 3; // The period size to compare to (1=month, 3=quarter, 12=year) (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves report for budget summary
[apiInstance getReportBudgetSummaryWith:xeroTenantId
    date:date
    period:period
    timeframe:timeframe
              completionHandler: ^(ReportWithRows output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const date = new Date("2019-03-31");  // {date} The date for the Bank Summary report e.g. 2018-03-31

const period = 2;  // {Integer} The number of periods to compare (integer between 1 and 12)

const timeframe = 3;  // {Integer} The period size to compare to (1=month, 3=quarter, 12=year)


try {
  const response = await xero.accountingApi.getReportBudgetSummary(xeroTenantId,  date, period, timeframe);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getReportBudgetSummaryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var date = 2019-03-31;  // date | The date for the Bank Summary report e.g. 2018-03-31 (optional)  (default to null)
            var period = 2;  // Integer | The number of periods to compare (integer between 1 and 12) (optional)  (default to null)
            var timeframe = 3;  // Integer | The period size to compare to (1=month, 3=quarter, 12=year) (optional)  (default to null)

            try
            {
                // Retrieves report for budget summary
                ReportWithRows result = apiInstance.getReportBudgetSummary(xeroTenantId, date, period, timeframe);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getReportBudgetSummary: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$date = new DateTime("2019-03-31");
$period = 2;
$timeframe = 3;

try {
  $result = $apiInstance->getReportBudgetSummary($xeroTenantId, $date, $period, $timeframe);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReportBudgetSummary: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $date = 2019-03-31; # date | The date for the Bank Summary report e.g. 2018-03-31
my $period = 2; # Integer | The number of periods to compare (integer between 1 and 12)
my $timeframe = 3; # Integer | The period size to compare to (1=month, 3=quarter, 12=year)

eval { 
    my $result = $api_instance->getReportBudgetSummary(xeroTenantId => $xeroTenantId, date => $date, period => $period, timeframe => $timeframe);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReportBudgetSummary: $@\n";
}
# 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_get_report_budget_summary():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    date = dateutil.parser.parse("2019-03-31")
    
    try:
        api_response = api_instance.get_report_budget_summary(xeroTenantId, date, period, timeframe)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReportBudgetSummary: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let date = 2019-03-31; // date
    let period = 2; // Integer
    let timeframe = 3; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getReportBudgetSummary(xeroTenantId, date, period, timeframe, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.reports.read Grant read-only access to accounting reports

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
date
date (date)
The date for the Bank Summary report e.g. 2018-03-31
period
Integer
The number of periods to compare (integer between 1 and 12)
timeframe
Integer
The period size to compare to (1=month, 3=quarter, 12=year)

getReportExecutiveSummary

Retrieves report for executive summary


/Reports/ExecutiveSummary

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Reports/ExecutiveSummary?date=2019-03-31"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        date date = 2019-03-31;

        try {
            ReportWithRows result = apiInstance.getReportExecutiveSummary(accessToken, xeroTenantId, date);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReportExecutiveSummary");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        date date = 2019-03-31; // date | The date for the Bank Summary report e.g. 2018-03-31
        try {
            ReportWithRows result = apiInstance.getReportExecutiveSummary(xeroTenantId, date);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReportExecutiveSummary");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
date *date = 2019-03-31; // The date for the Bank Summary report e.g. 2018-03-31 (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves report for executive summary
[apiInstance getReportExecutiveSummaryWith:xeroTenantId
    date:date
              completionHandler: ^(ReportWithRows output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const date = new Date("2019-03-31");  // {date} The date for the Bank Summary report e.g. 2018-03-31


try {
  const response = await xero.accountingApi.getReportExecutiveSummary(xeroTenantId,  date);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getReportExecutiveSummaryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var date = 2019-03-31;  // date | The date for the Bank Summary report e.g. 2018-03-31 (optional)  (default to null)

            try
            {
                // Retrieves report for executive summary
                ReportWithRows result = apiInstance.getReportExecutiveSummary(xeroTenantId, date);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getReportExecutiveSummary: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$date = new DateTime("2019-03-31");

try {
  $result = $apiInstance->getReportExecutiveSummary($xeroTenantId, $date);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReportExecutiveSummary: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $date = 2019-03-31; # date | The date for the Bank Summary report e.g. 2018-03-31

eval { 
    my $result = $api_instance->getReportExecutiveSummary(xeroTenantId => $xeroTenantId, date => $date);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReportExecutiveSummary: $@\n";
}
# 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_get_report_executive_summary():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    date = dateutil.parser.parse("2019-03-31")
    
    try:
        api_response = api_instance.get_report_executive_summary(xeroTenantId, date)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReportExecutiveSummary: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let date = 2019-03-31; // date

    let mut context = AccountingApi::Context::default();
    let result = client.getReportExecutiveSummary(xeroTenantId, date, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.reports.read Grant read-only access to accounting reports

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
date
date (date)
The date for the Bank Summary report e.g. 2018-03-31

getReportProfitAndLoss

Retrieves report for profit and loss


/Reports/ProfitAndLoss

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Reports/ProfitAndLoss?fromDate=2019-03-01&toDate=2019-03-31&periods=3&timeframe=MONTH&trackingCategoryID=00000000-0000-0000-0000-000000000000&trackingCategoryID2=00000000-0000-0000-0000-000000000000&trackingOptionID=00000000-0000-0000-0000-000000000000&trackingOptionID2=00000000-0000-0000-0000-000000000000&standardLayout=true&paymentsOnly=false"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        date fromDate = 2019-03-01;
        date toDate = 2019-03-31;
        Integer periods = 3;
        String timeframe = "MONTH";
        String trackingCategoryID = "00000000-0000-0000-0000-000000000000";
        String trackingCategoryID2 = "00000000-0000-0000-0000-000000000000";
        String trackingOptionID = "00000000-0000-0000-0000-000000000000";
        String trackingOptionID2 = "00000000-0000-0000-0000-000000000000";
        Boolean standardLayout = true;
        Boolean paymentsOnly = false;

        try {
            ReportWithRows result = apiInstance.getReportProfitAndLoss(accessToken, xeroTenantId, fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReportProfitAndLoss");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        date fromDate = 2019-03-01; // date | The from date for the ProfitAndLoss report e.g. 2018-03-31
        date toDate = 2019-03-31; // date | The to date for the ProfitAndLoss report e.g. 2018-03-31
        Integer periods = 3; // Integer | The number of periods to compare (integer between 1 and 12)
        String timeframe = MONTH; // String | The period size to compare to (MONTH, QUARTER, YEAR)
        String trackingCategoryID = 00000000-0000-0000-0000-000000000000; // String | The trackingCategory 1 for the ProfitAndLoss report
        String trackingCategoryID2 = 00000000-0000-0000-0000-000000000000; // String | The trackingCategory 2 for the ProfitAndLoss report
        String trackingOptionID = 00000000-0000-0000-0000-000000000000; // String | The tracking option 1 for the ProfitAndLoss report
        String trackingOptionID2 = 00000000-0000-0000-0000-000000000000; // String | The tracking option 2 for the ProfitAndLoss report
        Boolean standardLayout = true; // Boolean | Return the standard layout for the ProfitAndLoss report
        Boolean paymentsOnly = false; // Boolean | Return cash only basis for the ProfitAndLoss report
        try {
            ReportWithRows result = apiInstance.getReportProfitAndLoss(xeroTenantId, fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReportProfitAndLoss");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
date *fromDate = 2019-03-01; // The from date for the ProfitAndLoss report e.g. 2018-03-31 (optional) (default to null)
date *toDate = 2019-03-31; // The to date for the ProfitAndLoss report e.g. 2018-03-31 (optional) (default to null)
Integer *periods = 3; // The number of periods to compare (integer between 1 and 12) (optional) (default to null)
String *timeframe = MONTH; // The period size to compare to (MONTH, QUARTER, YEAR) (optional) (default to null)
String *trackingCategoryID = 00000000-0000-0000-0000-000000000000; // The trackingCategory 1 for the ProfitAndLoss report (optional) (default to null)
String *trackingCategoryID2 = 00000000-0000-0000-0000-000000000000; // The trackingCategory 2 for the ProfitAndLoss report (optional) (default to null)
String *trackingOptionID = 00000000-0000-0000-0000-000000000000; // The tracking option 1 for the ProfitAndLoss report (optional) (default to null)
String *trackingOptionID2 = 00000000-0000-0000-0000-000000000000; // The tracking option 2 for the ProfitAndLoss report (optional) (default to null)
Boolean *standardLayout = true; // Return the standard layout for the ProfitAndLoss report (optional) (default to null)
Boolean *paymentsOnly = false; // Return cash only basis for the ProfitAndLoss report (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves report for profit and loss
[apiInstance getReportProfitAndLossWith:xeroTenantId
    fromDate:fromDate
    toDate:toDate
    periods:periods
    timeframe:timeframe
    trackingCategoryID:trackingCategoryID
    trackingCategoryID2:trackingCategoryID2
    trackingOptionID:trackingOptionID
    trackingOptionID2:trackingOptionID2
    standardLayout:standardLayout
    paymentsOnly:paymentsOnly
              completionHandler: ^(ReportWithRows output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const fromDate = new Date("2019-03-01");  // {date} The from date for the ProfitAndLoss report e.g. 2018-03-31

const toDate = new Date("2019-03-31");  // {date} The to date for the ProfitAndLoss report e.g. 2018-03-31

const periods = 3;  // {Integer} The number of periods to compare (integer between 1 and 12)

const timeframe = 'MONTH';  // {String} The period size to compare to (MONTH, QUARTER, YEAR)

const trackingCategoryID = '00000000-0000-0000-0000-000000000000';  // {String} The trackingCategory 1 for the ProfitAndLoss report

const trackingCategoryID2 = '00000000-0000-0000-0000-000000000000';  // {String} The trackingCategory 2 for the ProfitAndLoss report

const trackingOptionID = '00000000-0000-0000-0000-000000000000';  // {String} The tracking option 1 for the ProfitAndLoss report

const trackingOptionID2 = '00000000-0000-0000-0000-000000000000';  // {String} The tracking option 2 for the ProfitAndLoss report

const standardLayout = true;  // {Boolean} Return the standard layout for the ProfitAndLoss report

const paymentsOnly = false;  // {Boolean} Return cash only basis for the ProfitAndLoss report


try {
  const response = await xero.accountingApi.getReportProfitAndLoss(xeroTenantId,  fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getReportProfitAndLossExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var fromDate = 2019-03-01;  // date | The from date for the ProfitAndLoss report e.g. 2018-03-31 (optional)  (default to null)
            var toDate = 2019-03-31;  // date | The to date for the ProfitAndLoss report e.g. 2018-03-31 (optional)  (default to null)
            var periods = 3;  // Integer | The number of periods to compare (integer between 1 and 12) (optional)  (default to null)
            var timeframe = MONTH;  // String | The period size to compare to (MONTH, QUARTER, YEAR) (optional)  (default to null)
            var trackingCategoryID = 00000000-0000-0000-0000-000000000000;  // String | The trackingCategory 1 for the ProfitAndLoss report (optional)  (default to null)
            var trackingCategoryID2 = 00000000-0000-0000-0000-000000000000;  // String | The trackingCategory 2 for the ProfitAndLoss report (optional)  (default to null)
            var trackingOptionID = 00000000-0000-0000-0000-000000000000;  // String | The tracking option 1 for the ProfitAndLoss report (optional)  (default to null)
            var trackingOptionID2 = 00000000-0000-0000-0000-000000000000;  // String | The tracking option 2 for the ProfitAndLoss report (optional)  (default to null)
            var standardLayout = true;  // Boolean | Return the standard layout for the ProfitAndLoss report (optional)  (default to null)
            var paymentsOnly = false;  // Boolean | Return cash only basis for the ProfitAndLoss report (optional)  (default to null)

            try
            {
                // Retrieves report for profit and loss
                ReportWithRows result = apiInstance.getReportProfitAndLoss(xeroTenantId, fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getReportProfitAndLoss: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$fromDate = new DateTime("2019-03-01");
$toDate = new DateTime("2019-03-31");
$periods = 3;
$timeframe = "MONTH";
$trackingCategoryID = "00000000-0000-0000-0000-000000000000";
$trackingCategoryID2 = "00000000-0000-0000-0000-000000000000";
$trackingOptionID = "00000000-0000-0000-0000-000000000000";
$trackingOptionID2 = "00000000-0000-0000-0000-000000000000";
$standardLayout = true;
$paymentsOnly = false;

try {
  $result = $apiInstance->getReportProfitAndLoss($xeroTenantId, $fromDate, $toDate, $periods, $timeframe, $trackingCategoryID, $trackingCategoryID2, $trackingOptionID, $trackingOptionID2, $standardLayout, $paymentsOnly);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReportProfitAndLoss: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $fromDate = 2019-03-01; # date | The from date for the ProfitAndLoss report e.g. 2018-03-31
my $toDate = 2019-03-31; # date | The to date for the ProfitAndLoss report e.g. 2018-03-31
my $periods = 3; # Integer | The number of periods to compare (integer between 1 and 12)
my $timeframe = MONTH; # String | The period size to compare to (MONTH, QUARTER, YEAR)
my $trackingCategoryID = 00000000-0000-0000-0000-000000000000; # String | The trackingCategory 1 for the ProfitAndLoss report
my $trackingCategoryID2 = 00000000-0000-0000-0000-000000000000; # String | The trackingCategory 2 for the ProfitAndLoss report
my $trackingOptionID = 00000000-0000-0000-0000-000000000000; # String | The tracking option 1 for the ProfitAndLoss report
my $trackingOptionID2 = 00000000-0000-0000-0000-000000000000; # String | The tracking option 2 for the ProfitAndLoss report
my $standardLayout = true; # Boolean | Return the standard layout for the ProfitAndLoss report
my $paymentsOnly = false; # Boolean | Return cash only basis for the ProfitAndLoss report

eval { 
    my $result = $api_instance->getReportProfitAndLoss(xeroTenantId => $xeroTenantId, fromDate => $fromDate, toDate => $toDate, periods => $periods, timeframe => $timeframe, trackingCategoryID => $trackingCategoryID, trackingCategoryID2 => $trackingCategoryID2, trackingOptionID => $trackingOptionID, trackingOptionID2 => $trackingOptionID2, standardLayout => $standardLayout, paymentsOnly => $paymentsOnly);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReportProfitAndLoss: $@\n";
}
# 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_get_report_profit_and_loss():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    fromDate = dateutil.parser.parse("2019-03-01")
    toDate = dateutil.parser.parse("2019-03-31")
    timeframe = 'MONTH'
    trackingCategoryID = '00000000-0000-0000-0000-000000000000'
    trackingCategoryID2 = '00000000-0000-0000-0000-000000000000'
    trackingOptionID = '00000000-0000-0000-0000-000000000000'
    trackingOptionID2 = '00000000-0000-0000-0000-000000000000'
    standardLayout = 'true'
    paymentsOnly = 'false'
    
    try:
        api_response = api_instance.get_report_profit_and_loss(xeroTenantId, fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReportProfitAndLoss: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let fromDate = 2019-03-01; // date
    let toDate = 2019-03-31; // date
    let periods = 3; // Integer
    let timeframe = MONTH; // String
    let trackingCategoryID = 00000000-0000-0000-0000-000000000000; // String
    let trackingCategoryID2 = 00000000-0000-0000-0000-000000000000; // String
    let trackingOptionID = 00000000-0000-0000-0000-000000000000; // String
    let trackingOptionID2 = 00000000-0000-0000-0000-000000000000; // String
    let standardLayout = true; // Boolean
    let paymentsOnly = false; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.getReportProfitAndLoss(xeroTenantId, fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.reports.read Grant read-only access to accounting reports

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
fromDate
date (date)
The from date for the ProfitAndLoss report e.g. 2018-03-31
toDate
date (date)
The to date for the ProfitAndLoss report e.g. 2018-03-31
periods
Integer
The number of periods to compare (integer between 1 and 12)
timeframe
String
The period size to compare to (MONTH, QUARTER, YEAR)
trackingCategoryID
String
The trackingCategory 1 for the ProfitAndLoss report
trackingCategoryID2
String
The trackingCategory 2 for the ProfitAndLoss report
trackingOptionID
String
The tracking option 1 for the ProfitAndLoss report
trackingOptionID2
String
The tracking option 2 for the ProfitAndLoss report
standardLayout
Boolean
Return the standard layout for the ProfitAndLoss report
paymentsOnly
Boolean
Return cash only basis for the ProfitAndLoss report

getReportTenNinetyNine

Retrieve reports for 1099


/Reports/TenNinetyNine

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Reports/TenNinetyNine?reportYear=2019"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        String reportYear = "2019";

        try {
            Reports result = apiInstance.getReportTenNinetyNine(accessToken, xeroTenantId, reportYear);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReportTenNinetyNine");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        String reportYear = 2019; // String | The year of the 1099 report
        try {
            Reports result = apiInstance.getReportTenNinetyNine(xeroTenantId, reportYear);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReportTenNinetyNine");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
String *reportYear = 2019; // The year of the 1099 report (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieve reports for 1099
[apiInstance getReportTenNinetyNineWith:xeroTenantId
    reportYear:reportYear
              completionHandler: ^(Reports output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const reportYear = '2019';  // {String} The year of the 1099 report


try {
  const response = await xero.accountingApi.getReportTenNinetyNine(xeroTenantId,  reportYear);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getReportTenNinetyNineExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var reportYear = 2019;  // String | The year of the 1099 report (optional)  (default to null)

            try
            {
                // Retrieve reports for 1099
                Reports result = apiInstance.getReportTenNinetyNine(xeroTenantId, reportYear);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getReportTenNinetyNine: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$reportYear = "2019";

try {
  $result = $apiInstance->getReportTenNinetyNine($xeroTenantId, $reportYear);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReportTenNinetyNine: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $reportYear = 2019; # String | The year of the 1099 report

eval { 
    my $result = $api_instance->getReportTenNinetyNine(xeroTenantId => $xeroTenantId, reportYear => $reportYear);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReportTenNinetyNine: $@\n";
}
# 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_get_report_ten_ninety_nine():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    reportYear = '2019'
    
    try:
        api_response = api_instance.get_report_ten_ninety_nine(xeroTenantId, reportYear)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReportTenNinetyNine: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let reportYear = 2019; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getReportTenNinetyNine(xeroTenantId, reportYear, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.reports.tenninetynine.read Grant read-only access to 1099 reports

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
reportYear
String
The year of the 1099 report

getReportTrialBalance

Retrieves report for trial balance


/Reports/TrialBalance

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Reports/TrialBalance?date=2019-10-31&paymentsOnly=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        date date = 2019-10-31;
        Boolean paymentsOnly = true;

        try {
            ReportWithRows result = apiInstance.getReportTrialBalance(accessToken, xeroTenantId, date, paymentsOnly);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReportTrialBalance");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        date date = 2019-10-31; // date | The date for the Trial Balance report e.g. 2018-03-31
        Boolean paymentsOnly = true; // Boolean | Return cash only basis for the Trial Balance report
        try {
            ReportWithRows result = apiInstance.getReportTrialBalance(xeroTenantId, date, paymentsOnly);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReportTrialBalance");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
date *date = 2019-10-31; // The date for the Trial Balance report e.g. 2018-03-31 (optional) (default to null)
Boolean *paymentsOnly = true; // Return cash only basis for the Trial Balance report (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves report for trial balance
[apiInstance getReportTrialBalanceWith:xeroTenantId
    date:date
    paymentsOnly:paymentsOnly
              completionHandler: ^(ReportWithRows output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const date = new Date("2019-10-31");  // {date} The date for the Trial Balance report e.g. 2018-03-31

const paymentsOnly = true;  // {Boolean} Return cash only basis for the Trial Balance report


try {
  const response = await xero.accountingApi.getReportTrialBalance(xeroTenantId,  date, paymentsOnly);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getReportTrialBalanceExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var date = 2019-10-31;  // date | The date for the Trial Balance report e.g. 2018-03-31 (optional)  (default to null)
            var paymentsOnly = true;  // Boolean | Return cash only basis for the Trial Balance report (optional)  (default to null)

            try
            {
                // Retrieves report for trial balance
                ReportWithRows result = apiInstance.getReportTrialBalance(xeroTenantId, date, paymentsOnly);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getReportTrialBalance: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$date = new DateTime("2019-10-31");
$paymentsOnly = true;

try {
  $result = $apiInstance->getReportTrialBalance($xeroTenantId, $date, $paymentsOnly);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReportTrialBalance: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $date = 2019-10-31; # date | The date for the Trial Balance report e.g. 2018-03-31
my $paymentsOnly = true; # Boolean | Return cash only basis for the Trial Balance report

eval { 
    my $result = $api_instance->getReportTrialBalance(xeroTenantId => $xeroTenantId, date => $date, paymentsOnly => $paymentsOnly);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReportTrialBalance: $@\n";
}
# 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_get_report_trial_balance():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    date = dateutil.parser.parse("2019-10-31")
    paymentsOnly = 'true'
    
    try:
        api_response = api_instance.get_report_trial_balance(xeroTenantId, date, paymentsOnly)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReportTrialBalance: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let date = 2019-10-31; // date
    let paymentsOnly = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.getReportTrialBalance(xeroTenantId, date, paymentsOnly, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.reports.read Grant read-only access to accounting reports

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
date
date (date)
The date for the Trial Balance report e.g. 2018-03-31
paymentsOnly
Boolean
Return cash only basis for the Trial Balance report

getTaxRates

Retrieves tax rates


/TaxRates

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/TaxRates?where=Status=="ACTIVE"&order=Name ASC&TaxType=INPUT"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        String where = "Status=="ACTIVE"";
        String order = "Name ASC";
        String taxType = "INPUT";

        try {
            TaxRates result = apiInstance.getTaxRates(accessToken, xeroTenantId, where, order, taxType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getTaxRates");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        String where = Status=="ACTIVE"; // String | Filter by an any element
        String order = Name ASC; // String | Order by an any element
        String taxType = INPUT; // String | Filter by tax type
        try {
            TaxRates result = apiInstance.getTaxRates(xeroTenantId, where, order, taxType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getTaxRates");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
String *where = Status=="ACTIVE"; // Filter by an any element (optional) (default to null)
String *order = Name ASC; // Order by an any element (optional) (default to null)
String *taxType = INPUT; // Filter by tax type (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves tax rates
[apiInstance getTaxRatesWith:xeroTenantId
    where:where
    order:order
    taxType:taxType
              completionHandler: ^(TaxRates output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const where = 'Status=="ACTIVE"';  // {String} Filter by an any element

const order = 'Name ASC';  // {String} Order by an any element

const taxType = 'INPUT';  // {String} Filter by tax type


try {
  const response = await xero.accountingApi.getTaxRates(xeroTenantId,  where, order, taxType);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getTaxRatesExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var where = Status=="ACTIVE";  // String | Filter by an any element (optional)  (default to null)
            var order = Name ASC;  // String | Order by an any element (optional)  (default to null)
            var taxType = INPUT;  // String | Filter by tax type (optional)  (default to null)

            try
            {
                // Retrieves tax rates
                TaxRates result = apiInstance.getTaxRates(xeroTenantId, where, order, taxType);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getTaxRates: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\TaxRate::STATUS_ACTIVE . '"";
$order = "Name ASC";
$taxType = "INPUT";

try {
  $result = $apiInstance->getTaxRates($xeroTenantId, $where, $order, $taxType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getTaxRates: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $where = Status=="ACTIVE"; # String | Filter by an any element
my $order = Name ASC; # String | Order by an any element
my $taxType = INPUT; # String | Filter by tax type

eval { 
    my $result = $api_instance->getTaxRates(xeroTenantId => $xeroTenantId, where => $where, order => $order, taxType => $taxType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getTaxRates: $@\n";
}
# 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_get_tax_rates():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    where = 'Status=="ACTIVE"'
    order = 'Name ASC'
    taxType = 'INPUT'
    
    try:
        api_response = api_instance.get_tax_rates(xeroTenantId, where, order, taxType)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getTaxRates: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let where = Status=="ACTIVE"; // String
    let order = Name ASC; // String
    let taxType = INPUT; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getTaxRates(xeroTenantId, where, order, taxType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element
TaxType
String
Filter by tax type

getTrackingCategories

Retrieves tracking categories and options


/TrackingCategories

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/TrackingCategories?where=Status=="ACTIVE"&order=Name ASC&includeArchived=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        String where = "Status=="ACTIVE"";
        String order = "Name ASC";
        Boolean includeArchived = true;

        try {
            TrackingCategories result = apiInstance.getTrackingCategories(accessToken, xeroTenantId, where, order, includeArchived);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getTrackingCategories");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        String where = Status=="ACTIVE"; // String | Filter by an any element
        String order = Name ASC; // String | Order by an any element
        Boolean includeArchived = true; // Boolean | e.g. includeArchived=true - Categories and options with a status of ARCHIVED will be included in the response
        try {
            TrackingCategories result = apiInstance.getTrackingCategories(xeroTenantId, where, order, includeArchived);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getTrackingCategories");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
String *where = Status=="ACTIVE"; // Filter by an any element (optional) (default to null)
String *order = Name ASC; // Order by an any element (optional) (default to null)
Boolean *includeArchived = true; // e.g. includeArchived=true - Categories and options with a status of ARCHIVED will be included in the response (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves tracking categories and options
[apiInstance getTrackingCategoriesWith:xeroTenantId
    where:where
    order:order
    includeArchived:includeArchived
              completionHandler: ^(TrackingCategories output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const where = 'Status=="ACTIVE"';  // {String} Filter by an any element

const order = 'Name ASC';  // {String} Order by an any element

const includeArchived = true;  // {Boolean} e.g. includeArchived=true - Categories and options with a status of ARCHIVED will be included in the response


try {
  const response = await xero.accountingApi.getTrackingCategories(xeroTenantId,  where, order, includeArchived);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getTrackingCategoriesExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var where = Status=="ACTIVE";  // String | Filter by an any element (optional)  (default to null)
            var order = Name ASC;  // String | Order by an any element (optional)  (default to null)
            var includeArchived = true;  // Boolean | e.g. includeArchived=true - Categories and options with a status of ARCHIVED will be included in the response (optional)  (default to null)

            try
            {
                // Retrieves tracking categories and options
                TrackingCategories result = apiInstance.getTrackingCategories(xeroTenantId, where, order, includeArchived);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getTrackingCategories: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\TrackingCategory::STATUS_ACTIVE . '"";
$order = "Name ASC";
$includeArchived = true;

try {
  $result = $apiInstance->getTrackingCategories($xeroTenantId, $where, $order, $includeArchived);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getTrackingCategories: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $where = Status=="ACTIVE"; # String | Filter by an any element
my $order = Name ASC; # String | Order by an any element
my $includeArchived = true; # Boolean | e.g. includeArchived=true - Categories and options with a status of ARCHIVED will be included in the response

eval { 
    my $result = $api_instance->getTrackingCategories(xeroTenantId => $xeroTenantId, where => $where, order => $order, includeArchived => $includeArchived);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getTrackingCategories: $@\n";
}
# 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_get_tracking_categories():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    where = 'Status=="ACTIVE"'
    order = 'Name ASC'
    includeArchived = 'true'
    
    try:
        api_response = api_instance.get_tracking_categories(xeroTenantId, where, order, includeArchived)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getTrackingCategories: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let where = Status=="ACTIVE"; // String
    let order = Name ASC; // String
    let includeArchived = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.getTrackingCategories(xeroTenantId, where, order, includeArchived, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element
includeArchived
Boolean
e.g. includeArchived=true - Categories and options with a status of ARCHIVED will be included in the response

getTrackingCategory

Retrieves specific tracking categories and options using a unique tracking category Id


/TrackingCategories/{TrackingCategoryID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/TrackingCategories/{TrackingCategoryID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID trackingCategoryID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            TrackingCategories result = apiInstance.getTrackingCategory(accessToken, xeroTenantId, trackingCategoryID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getTrackingCategory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID trackingCategoryID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a TrackingCategory
        try {
            TrackingCategories result = apiInstance.getTrackingCategory(xeroTenantId, trackingCategoryID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getTrackingCategory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *trackingCategoryID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a TrackingCategory (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves specific tracking categories and options using a unique tracking category Id
[apiInstance getTrackingCategoryWith:xeroTenantId
    trackingCategoryID:trackingCategoryID
              completionHandler: ^(TrackingCategories output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const trackingCategoryID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a TrackingCategory

try {
  const response = await xero.accountingApi.getTrackingCategory(xeroTenantId, trackingCategoryID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getTrackingCategoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var trackingCategoryID = new UUID(); // UUID | Unique identifier for a TrackingCategory (default to null)

            try
            {
                // Retrieves specific tracking categories and options using a unique tracking category Id
                TrackingCategories result = apiInstance.getTrackingCategory(xeroTenantId, trackingCategoryID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getTrackingCategory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$trackingCategoryID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getTrackingCategory($xeroTenantId, $trackingCategoryID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getTrackingCategory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $trackingCategoryID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a TrackingCategory

eval { 
    my $result = $api_instance->getTrackingCategory(xeroTenantId => $xeroTenantId, trackingCategoryID => $trackingCategoryID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getTrackingCategory: $@\n";
}
# 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_get_tracking_category():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    trackingCategoryID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_tracking_category(xeroTenantId, trackingCategoryID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getTrackingCategory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let trackingCategoryID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getTrackingCategory(xeroTenantId, trackingCategoryID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Path parameters
Name Description
TrackingCategoryID*
UUID (uuid)
Unique identifier for a TrackingCategory
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getUser

Retrieves a specific user


/Users/{UserID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Users/{UserID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID userID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Users result = apiInstance.getUser(accessToken, xeroTenantId, userID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getUser");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID userID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a User
        try {
            Users result = apiInstance.getUser(xeroTenantId, userID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getUser");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *userID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a User (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific user
[apiInstance getUserWith:xeroTenantId
    userID:userID
              completionHandler: ^(Users output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const userID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a User

try {
  const response = await xero.accountingApi.getUser(xeroTenantId, userID);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getUserExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var userID = new UUID(); // UUID | Unique identifier for a User (default to null)

            try
            {
                // Retrieves a specific user
                Users result = apiInstance.getUser(xeroTenantId, userID);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getUser: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$userID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getUser($xeroTenantId, $userID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getUser: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $userID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a User

eval { 
    my $result = $api_instance->getUser(xeroTenantId => $xeroTenantId, userID => $userID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getUser: $@\n";
}
# 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_get_user():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    userID = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_user(xeroTenantId, userID)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getUser: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let userID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getUser(xeroTenantId, userID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Path parameters
Name Description
UserID*
UUID (uuid)
Unique identifier for a User
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getUsers

Retrieves users


/Users

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Users?where=IsSubscriber==true&order=LastName ASC"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = "IsSubscriber==true";
        String order = "LastName ASC";

        try {
            Users result = apiInstance.getUsers(accessToken, xeroTenantId, ifModifiedSince, where, order);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getUsers");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = IsSubscriber==true; // String | Filter by an any element
        String order = LastName ASC; // String | Order by an any element
        try {
            Users result = apiInstance.getUsers(xeroTenantId, ifModifiedSince, where, order);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getUsers");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = IsSubscriber==true; // Filter by an any element (optional) (default to null)
String *order = LastName ASC; // Order by an any element (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves users
[apiInstance getUsersWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
              completionHandler: ^(Users output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant

const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'IsSubscriber==true';  // {String} Filter by an any element

const order = 'LastName ASC';  // {String} Order by an any element


try {
  const response = await xero.accountingApi.getUsers(xeroTenantId, ifModifiedSince, where, order);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class getUsersExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var ifModifiedSince = 2020-02-06T12:17:43.202-08:00;  // Date | Only records created or modified since this timestamp will be returned (optional)  (default to null)
            var where = IsSubscriber==true;  // String | Filter by an any element (optional)  (default to null)
            var order = LastName ASC;  // String | Order by an any element (optional)  (default to null)

            try
            {
                // Retrieves users
                Users result = apiInstance.getUsers(xeroTenantId, ifModifiedSince, where, order);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.getUsers: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "IsSubscriber==true";
$order = "LastName ASC";

try {
  $result = $apiInstance->getUsers($xeroTenantId, $ifModifiedSince, $where, $order);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getUsers: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = IsSubscriber==true; # String | Filter by an any element
my $order = LastName ASC; # String | Order by an any element

eval { 
    my $result = $api_instance->getUsers(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getUsers: $@\n";
}
# 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_get_users():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    ifModifiedSince = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'IsSubscriber==true'
    order = 'LastName ASC'
    
    try:
        api_response = api_instance.get_users(xeroTenantId, ifModifiedSince, where, order)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getUsers: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = IsSubscriber==true; // String
    let order = LastName ASC; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getUsers(xeroTenantId, ifModifiedSince, where, order, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element

postSetup

Sets the chart of accounts, the conversion date and conversion balances


/Setup

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Setup"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        Account account = new Account();
        account.setCode("123");
        account.setName("Business supplies");
        account.setType(com.xero.models.accounting.AccountType.EXPENSE);
        List<Account> accounts = new ArrayList<Account>();
        accounts.add(account);
        ConversionDate conversionDate = new ConversionDate();
        conversionDate.setMonth(10);
        conversionDate.setYear(2020);
        List<ConversionBalances> conversionBalances = new ArrayList<ConversionBalances>();
        Setup setup = new Setup();
        setup.setAccounts(accounts);
        setup.setConversionDate(conversionDate);
        setup.setConversionBalances(conversionBalances);

        try {
            ImportSummaryObject result = apiInstance.postSetup(accessToken, xeroTenantId, setup);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#postSetup");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Setup setup = { "ConversionDate": {}, "ConversionBalances": [], "Accounts": [ { "Code": "200", "Name": "Sales", "Type": "SALES", "ReportingCode": "REV.TRA.GOO" }, { "Code": "400", "Name": "Advertising", "Type": "OVERHEADS", "ReportingCode": "EXP" }, { "Code": "610", "Name": "Accounts Receivable", "Type": "CURRENT", "SystemAccount": "DEBTORS", "ReportingCode": "ASS.CUR.REC.TRA" }, { "Code": "800", "Name": "Accounts Payable", "Type": "CURRLIAB", "SystemAccount": "CREDITORS", "ReportingCode": "LIA.CUR.PAY" } ] }; // Setup | 
        try {
            ImportSummaryObject result = apiInstance.postSetup(xeroTenantId, setup);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#postSetup");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Setup *setup = { "ConversionDate": {}, "ConversionBalances": [], "Accounts": [ { "Code": "200", "Name": "Sales", "Type": "SALES", "ReportingCode": "REV.TRA.GOO" }, { "Code": "400", "Name": "Advertising", "Type": "OVERHEADS", "ReportingCode": "EXP" }, { "Code": "610", "Name": "Accounts Receivable", "Type": "CURRENT", "SystemAccount": "DEBTORS", "ReportingCode": "ASS.CUR.REC.TRA" }, { "Code": "800", "Name": "Accounts Payable", "Type": "CURRLIAB", "SystemAccount": "CREDITORS", "ReportingCode": "LIA.CUR.PAY" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Sets the chart of accounts, the conversion date and conversion balances
[apiInstance postSetupWith:xeroTenantId
    setup:setup
              completionHandler: ^(ImportSummaryObject output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);
const setup: Setup = { "ConversionDate": {}, "ConversionBalances": [], "Accounts": [ { "Code": "200", "Name": "Sales", "Type": "SALES", "ReportingCode": "REV.TRA.GOO" }, { "Code": "400", "Name": "Advertising", "Type": "OVERHEADS", "ReportingCode": "EXP" }, { "Code": "610", "Name": "Accounts Receivable", "Type": "CURRENT", "SystemAccount": "DEBTORS", "ReportingCode": "ASS.CUR.REC.TRA" }, { "Code": "800", "Name": "Accounts Payable", "Type": "CURRLIAB", "SystemAccount": "CREDITORS", "ReportingCode": "LIA.CUR.PAY" } ] };  // {Setup} 
const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant


try {
  const response = await xero.accountingApi.postSetup(xeroTenantId, setup);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class postSetupExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var setup = new Setup(); // Setup | 

            try
            {
                // Sets the chart of accounts, the conversion date and conversion balances
                ImportSummaryObject result = apiInstance.postSetup(xeroTenantId, setup);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.postSetup: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

$account = new XeroAPI\XeroPHP\Models\Accounting\Account;
$account->setCode('123');
$account->setName('Business supplies');
$account->setType(XeroAPI\XeroPHP\Models\Accounting\AccountType::EXPENSE);
$accounts = [];
array_push($accounts, $account);

$conversionDate = new XeroAPI\XeroPHP\Models\Accounting\ConversionDate;
$conversionDate->setMonth(10);
$conversionDate->setYear(2020);
$conversionBalances = [];

$setup = new XeroAPI\XeroPHP\Models\Accounting\Setup;
$setup->setAccounts($accounts);
$setup->setConversionDate($conversionDate);
$setup->setConversionBalances($conversionBalances);

try {
  $result = $apiInstance->postSetup($xeroTenantId, $setup);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->postSetup: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $setup = ::Object::Setup->new(); # Setup | 

eval { 
    my $result = $api_instance->postSetup(xeroTenantId => $xeroTenantId, setup => $setup);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->postSetup: $@\n";
}
# 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_post_setup():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'

    account = Account(
        code = "123",
        name = "Business supplies",
        type = AccountType.EXPENSE)
    
    accounts = []    
    accounts.append(account)

    conversion_date = ConversionDate(
        month = 10,
        year = 2020)
    
    conversion_balances = []

    setup = Setup(
        accounts = accounts,
        conversion_date = conversion_date,
        conversion_balances = conversion_balances)
    
    try:
        api_response = api_instance.post_setup(xeroTenantId, setup)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->postSetup: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let setup = { "ConversionDate": {}, "ConversionBalances": [], "Accounts": [ { "Code": "200", "Name": "Sales", "Type": "SALES", "ReportingCode": "REV.TRA.GOO" }, { "Code": "400", "Name": "Advertising", "Type": "OVERHEADS", "ReportingCode": "EXP" }, { "Code": "610", "Name": "Accounts Receivable", "Type": "CURRENT", "SystemAccount": "DEBTORS", "ReportingCode": "ASS.CUR.REC.TRA" }, { "Code": "800", "Name": "Accounts Payable", "Type": "CURRLIAB", "SystemAccount": "CREDITORS", "ReportingCode": "LIA.CUR.PAY" } ] }; // Setup

    let mut context = AccountingApi::Context::default();
    let result = client.postSetup(xeroTenantId, setup, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
setup *
Setup
Object including an accounts array, a conversion balances array and a conversion date object in body of request
Required

updateAccount

Updates a chart of accounts


/Accounts/{AccountID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Accounts/{AccountID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID accountID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Account account = new Account();
        account.setCode("123456");
        account.setName("BarFoo");
        account.setType(com.xero.models.accounting.AccountType.EXPENSE);
        account.setDescription("Hello World");
        account.setTaxType("NONE");
        Accounts accounts = new Accounts();
        accounts.addAccountsItem(account);

        try {
            Accounts result = apiInstance.updateAccount(accessToken, xeroTenantId, accountID, accounts);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateAccount");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID accountID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for retrieving single object
        Accounts accounts = { "Accounts":[ { "Code":"123456", "Name":"BarFoo", "AccountID":"99ce6032-0678-4aa0-8148-240c75fee33a", "Type":"EXPENSE", "Description":"GoodBye World", "TaxType":"INPUT", "EnablePaymentsToAccount":false, "ShowInExpenseClaims":false, "Class":"EXPENSE", "ReportingCode":"EXP", "ReportingCodeName":"Expense", "UpdatedDateUTC":"2019-02-21T16:29:47.96-08:00" } ] }; // Accounts | 
        try {
            Accounts result = apiInstance.updateAccount(xeroTenantId, accountID, accounts);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateAccount");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *accountID = 00000000-0000-0000-0000-000000000000; // Unique identifier for retrieving single object (default to null)
Accounts *accounts = { "Accounts":[ { "Code":"123456", "Name":"BarFoo", "AccountID":"99ce6032-0678-4aa0-8148-240c75fee33a", "Type":"EXPENSE", "Description":"GoodBye World", "TaxType":"INPUT", "EnablePaymentsToAccount":false, "ShowInExpenseClaims":false, "Class":"EXPENSE", "ReportingCode":"EXP", "ReportingCodeName":"Expense", "UpdatedDateUTC":"2019-02-21T16:29:47.96-08:00" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a chart of accounts
[apiInstance updateAccountWith:xeroTenantId
    accountID:accountID
    accounts:accounts
              completionHandler: ^(Accounts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const accountID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for retrieving single object
const accounts: Accounts = { accounts: [{ code: "123456", name: "BarFoo", accountID: "00000000-0000-0000-0000-000000000000", type: AccountType.EXPENSE, description: "GoodBye World", taxType: TaxType.INPUT }]}

try {
  const response = await xero.accountingApi.updateAccount(xeroTenantId, accountID, accounts);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateAccountExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var accountID = new UUID(); // UUID | Unique identifier for retrieving single object (default to null)
            var accounts = new Accounts(); // Accounts | 

            try
            {
                // Updates a chart of accounts
                Accounts result = apiInstance.updateAccount(xeroTenantId, accountID, accounts);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateAccount: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$accountID = "00000000-0000-0000-0000-000000000000";

$account = new XeroAPI\XeroPHP\Models\Accounting\Account;
$account->setCode('123456');
$account->setName('BarFoo');
$account->setType(XeroAPI\XeroPHP\Models\Accounting\AccountType::EXPENSE);
$account->setDescription('Hello World');
$account->setTaxType('NONE');

$accounts = new XeroAPI\XeroPHP\Models\Accounting\Accounts;
$arr_accounts = [];
array_push($arr_accounts, $account);
$accounts->setAccounts($arr_accounts);

try {
  $result = $apiInstance->updateAccount($xeroTenantId, $accountID, $accounts);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateAccount: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $accountID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for retrieving single object
my $accounts = ::Object::Accounts->new(); # Accounts | 

eval { 
    my $result = $api_instance->updateAccount(xeroTenantId => $xeroTenantId, accountID => $accountID, accounts => $accounts);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateAccount: $@\n";
}
# 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_update_account():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    accountID = '00000000-0000-0000-0000-000000000000'

    account = Account(
        code = "123456",
        name = "BarFoo",
        type = AccountType.EXPENSE,
        description = "Hello World",
        tax_type = "NONE")

    accounts = Accounts( 
        accounts = [account])
    
    try:
        api_response = api_instance.update_account(xeroTenantId, accountID, accounts)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateAccount: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let accountID = 00000000-0000-0000-0000-000000000000; // UUID
    let accounts = { "Accounts":[ { "Code":"123456", "Name":"BarFoo", "AccountID":"99ce6032-0678-4aa0-8148-240c75fee33a", "Type":"EXPENSE", "Description":"GoodBye World", "TaxType":"INPUT", "EnablePaymentsToAccount":false, "ShowInExpenseClaims":false, "Class":"EXPENSE", "ReportingCode":"EXP", "ReportingCodeName":"Expense", "UpdatedDateUTC":"2019-02-21T16:29:47.96-08:00" } ] }; // Accounts

    let mut context = AccountingApi::Context::default();
    let result = client.updateAccount(xeroTenantId, accountID, accounts, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Path parameters
Name Description
AccountID*
UUID (uuid)
Unique identifier for retrieving single object
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
accounts *
Accounts
Request of type Accounts array with one Account
Required

updateAccountAttachmentByFileName

Updates attachment on a specific account by filename


/Accounts/{AccountID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Accounts/{AccountID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID accountID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.updateAccountAttachmentByFileName(accessToken, xeroTenantId, accountID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateAccountAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID accountID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Account object
        String fileName = xero-dev.jpg; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.updateAccountAttachmentByFileName(xeroTenantId, accountID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateAccountAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *accountID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Account object (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates attachment on a specific account by filename
[apiInstance updateAccountAttachmentByFileNameWith:xeroTenantId
    accountID:accountID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const accountID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for Account object
const fileName = "xero-dev.jpg";  // {String} Name of the attachment
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
import * as fs from "fs";
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.updateAccountAttachmentByFileName(xeroTenantId, accountID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateAccountAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var accountID = new UUID(); // UUID | Unique identifier for Account object (default to null)
            var fileName = xero-dev.jpg;  // String | Name of the attachment (default to null)
            var body = BYTE_ARRAY_DATA_HERE;  // byte[] | 

            try
            {
                // Updates attachment on a specific account by filename
                Attachments result = apiInstance.updateAccountAttachmentByFileName(xeroTenantId, accountID, fileName, body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateAccountAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$accountID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->updateAccountAttachmentByFileName($xeroTenantId, $accountID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateAccountAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $accountID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Account object
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->updateAccountAttachmentByFileName(xeroTenantId => $xeroTenantId, accountID => $accountID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateAccountAttachmentByFileName: $@\n";
}
# 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_update_account_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    accountID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    
        // TODO: BINARY CREATE 
    try:
        api_response = api_instance.update_account_attachment_by_file_name(xeroTenantId, accountID, fileName, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateAccountAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let accountID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.updateAccountAttachmentByFileName(xeroTenantId, accountID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
AccountID*
UUID (uuid)
Unique identifier for Account object
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

updateBankTransaction

Updates a single spent or received money transaction


/BankTransactions/{BankTransactionID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransactions/{BankTransactionID}?unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID bankTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Integer unitdp = 4;
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        LineItem lineItem = new LineItem();
        lineItem.setDescription("Foobar");
        lineItem.setQuantity(1.0);
        lineItem.setUnitAmount(20.0);
        lineItem.setAccountCode("000");
        List<LineItems> lineItems = new ArrayList<LineItems>();
        lineItems.add(lineItem);
        Account bankAccount = new Account();
        bankAccount.setAccountID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        BankTransaction bankTransaction = new BankTransaction();
        bankTransaction.setReference("You just updated");
        bankTransaction.setType(com.xero.models.accounting.BankTransaction.TypeEnum.RECEIVE);
        bankTransaction.setContact(contact);
        bankTransaction.setLineItems(lineItems);
        bankTransaction.setBankAccount(bankAccount);
        BankTransactions bankTransactions = new BankTransactions();
        bankTransactions.addBankTransactionsItem(bankTransaction);

        try {
            BankTransactions result = apiInstance.updateBankTransaction(accessToken, xeroTenantId, bankTransactionID, bankTransactions, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateBankTransaction");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transaction
        BankTransactions bankTransactions = { "BankTransactions": [ { "Type": "SPEND", "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000", "ContactStatus": "ACTIVE", "Name": "Buzz Lightyear", "FirstName": "Buzz", "LastName": "Lightyear", "EmailAddress": "buzz.Lightyear@email.com", "ContactPersons": [], "BankAccountDetails": "", "Addresses": [ { "AddressType": "STREET", "City": "", "Region": "", "PostalCode": "", "Country": "" }, { "AddressType": "POBOX", "AddressLine1": "", "AddressLine2": "", "AddressLine3": "", "AddressLine4": "", "City": "Palo Alto", "Region": "CA", "PostalCode": "94020", "Country": "United States" } ], "Phones": [ { "PhoneType": "DEFAULT", "PhoneNumber": "847-1294", "PhoneAreaCode": "(626)", "PhoneCountryCode": "" }, { "PhoneType": "DDI", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "FAX", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "MOBILE", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" } ], "UpdatedDateUTC": "2017-08-21T13:49:04.227-07:00", "ContactGroups": [] }, "Lineitems": [], "BankAccount": { "Code": "088", "Name": "Business Wells Fargo", "AccountID": "00000000-0000-0000-0000-000000000000" }, "IsReconciled": false, "Date": "2019-02-25", "Reference": "You just updated", "CurrencyCode": "USD", "CurrencyRate": 1, "Status": "AUTHORISED", "LineAmountTypes": "Inclusive", "TotalTax": 1.74, "BankTransactionID": "00000000-0000-0000-0000-000000000000", "UpdatedDateUTC": "2019-02-26T12:39:27.813-08:00" } ] }; // BankTransactions | 
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            BankTransactions result = apiInstance.updateBankTransaction(xeroTenantId, bankTransactionID, bankTransactions, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateBankTransaction");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransactionID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transaction (default to null)
BankTransactions *bankTransactions = { "BankTransactions": [ { "Type": "SPEND", "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000", "ContactStatus": "ACTIVE", "Name": "Buzz Lightyear", "FirstName": "Buzz", "LastName": "Lightyear", "EmailAddress": "buzz.Lightyear@email.com", "ContactPersons": [], "BankAccountDetails": "", "Addresses": [ { "AddressType": "STREET", "City": "", "Region": "", "PostalCode": "", "Country": "" }, { "AddressType": "POBOX", "AddressLine1": "", "AddressLine2": "", "AddressLine3": "", "AddressLine4": "", "City": "Palo Alto", "Region": "CA", "PostalCode": "94020", "Country": "United States" } ], "Phones": [ { "PhoneType": "DEFAULT", "PhoneNumber": "847-1294", "PhoneAreaCode": "(626)", "PhoneCountryCode": "" }, { "PhoneType": "DDI", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "FAX", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "MOBILE", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" } ], "UpdatedDateUTC": "2017-08-21T13:49:04.227-07:00", "ContactGroups": [] }, "Lineitems": [], "BankAccount": { "Code": "088", "Name": "Business Wells Fargo", "AccountID": "00000000-0000-0000-0000-000000000000" }, "IsReconciled": false, "Date": "2019-02-25", "Reference": "You just updated", "CurrencyCode": "USD", "CurrencyRate": 1, "Status": "AUTHORISED", "LineAmountTypes": "Inclusive", "TotalTax": 1.74, "BankTransactionID": "00000000-0000-0000-0000-000000000000", "UpdatedDateUTC": "2019-02-26T12:39:27.813-08:00" } ] }; // 
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a single spent or received money transaction
[apiInstance updateBankTransactionWith:xeroTenantId
    bankTransactionID:bankTransactionID
    bankTransactions:bankTransactions
    unitdp:unitdp
              completionHandler: ^(BankTransactions output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const bankTransactionID = "00000000-0000-0000-0000-000000000000";  // {UUID} Xero generated unique identifier for a bank transaction


const unitdp = 4;  // {Integer} e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
const bankTransactions: BankTransactions = { bankTransactions: [{ type: BankTransaction.TypeEnum.SPEND, date: "2019-02-25", reference: "You just updated", status: BankTransaction.StatusEnum.AUTHORISED, bankTransactionID: "00000000-0000-0000-0000-000000000000", lineItems: [], contact: {}, bankAccount: { accountID: "00000000-0000-0000-0000-000000000000" }}]}

try {
  const response = await xero.accountingApi.updateBankTransaction(xeroTenantId, bankTransactionID, bankTransactions,  unitdp);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateBankTransactionExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var bankTransactionID = new UUID(); // UUID | Xero generated unique identifier for a bank transaction (default to null)
            var bankTransactions = new BankTransactions(); // BankTransactions | 
            var unitdp = 4;  // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)  (default to null)

            try
            {
                // Updates a single spent or received money transaction
                BankTransactions result = apiInstance.updateBankTransaction(xeroTenantId, bankTransactionID, bankTransactions, unitdp);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateBankTransaction: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransactionID = "00000000-0000-0000-0000-000000000000";
$unitdp = 4;

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
$lineItem->setDescription('Foobar');
$lineItem->setQuantity(1.0);
$lineItem->setUnitAmount(20.0);
$lineItem->setAccountCode('000');
$lineItems = [];
array_push($lineItems, $lineItem);

$bankAccount = new XeroAPI\XeroPHP\Models\Accounting\Account;
$bankAccount->setAccountID('00000000-0000-0000-0000-000000000000');

$bankTransaction = new XeroAPI\XeroPHP\Models\Accounting\BankTransaction;
$bankTransaction->setReference('You just updated');
$bankTransaction->setType(XeroAPI\XeroPHP\Models\Accounting\BankTransaction::TYPE_RECEIVE);
$bankTransaction->setContact($contact);
$bankTransaction->setLineItems($lineItems);
$bankTransaction->setBankAccount($bankAccount);

$bankTransactions = new XeroAPI\XeroPHP\Models\Accounting\BankTransactions;
$arr_bank_transactions = [];
array_push($arr_bank_transactions, $bankTransaction);
$bankTransactions->setBankTransactions($arr_bank_transactions);

try {
  $result = $apiInstance->updateBankTransaction($xeroTenantId, $bankTransactionID, $bankTransactions, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateBankTransaction: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transaction
my $bankTransactions = ::Object::BankTransactions->new(); # BankTransactions | 
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->updateBankTransaction(xeroTenantId => $xeroTenantId, bankTransactionID => $bankTransactionID, bankTransactions => $bankTransactions, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateBankTransaction: $@\n";
}
# 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_update_bank_transaction():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    bankTransactionID = '00000000-0000-0000-0000-000000000000'

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    line_item = LineItem(
        description = "Foobar",
        quantity = 1.0,
        unit_amount = 20.0,
        account_code = "000")
    
    line_items = []    
    line_items.append(line_item)

    bank_account = Account(
        account_id = "00000000-0000-0000-0000-000000000000")

    bank_transaction = BankTransaction(
        reference = "You just updated",
        type = "RECEIVE",
        contact = contact,
        lineItems = lineItems,
        bank_account = bank_account)

    bankTransactions = BankTransactions( 
        bank_transactions = [bank_transaction])
    
    try:
        api_response = api_instance.update_bank_transaction(xeroTenantId, bankTransactionID, bankTransactions, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateBankTransaction: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID
    let bankTransactions = { "BankTransactions": [ { "Type": "SPEND", "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000", "ContactStatus": "ACTIVE", "Name": "Buzz Lightyear", "FirstName": "Buzz", "LastName": "Lightyear", "EmailAddress": "buzz.Lightyear@email.com", "ContactPersons": [], "BankAccountDetails": "", "Addresses": [ { "AddressType": "STREET", "City": "", "Region": "", "PostalCode": "", "Country": "" }, { "AddressType": "POBOX", "AddressLine1": "", "AddressLine2": "", "AddressLine3": "", "AddressLine4": "", "City": "Palo Alto", "Region": "CA", "PostalCode": "94020", "Country": "United States" } ], "Phones": [ { "PhoneType": "DEFAULT", "PhoneNumber": "847-1294", "PhoneAreaCode": "(626)", "PhoneCountryCode": "" }, { "PhoneType": "DDI", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "FAX", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "MOBILE", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" } ], "UpdatedDateUTC": "2017-08-21T13:49:04.227-07:00", "ContactGroups": [] }, "Lineitems": [], "BankAccount": { "Code": "088", "Name": "Business Wells Fargo", "AccountID": "00000000-0000-0000-0000-000000000000" }, "IsReconciled": false, "Date": "2019-02-25", "Reference": "You just updated", "CurrencyCode": "USD", "CurrencyRate": 1, "Status": "AUTHORISED", "LineAmountTypes": "Inclusive", "TotalTax": 1.74, "BankTransactionID": "00000000-0000-0000-0000-000000000000", "UpdatedDateUTC": "2019-02-26T12:39:27.813-08:00" } ] }; // BankTransactions
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.updateBankTransaction(xeroTenantId, bankTransactionID, bankTransactions, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
BankTransactionID*
UUID (uuid)
Xero generated unique identifier for a bank transaction
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
bankTransactions *
BankTransactions
Required
Query parameters
Name Description
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

updateBankTransactionAttachmentByFileName

Updates a specific attachment from a specific bank transaction by filename


/BankTransactions/{BankTransactionID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransactions/{BankTransactionID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID bankTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.updateBankTransactionAttachmentByFileName(accessToken, xeroTenantId, bankTransactionID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateBankTransactionAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transaction
        String fileName = xero-dev.jpg; // String | The name of the file being attached
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.updateBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateBankTransactionAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransactionID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transaction (default to null)
String *fileName = xero-dev.jpg; // The name of the file being attached (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific attachment from a specific bank transaction by filename
[apiInstance updateBankTransactionAttachmentByFileNameWith:xeroTenantId
    bankTransactionID:bankTransactionID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const bankTransactionID = "00000000-0000-0000-0000-000000000000";  // {UUID} Xero generated unique identifier for a bank transaction
const fileName = "xero-dev.jpg";  // {String} The name of the file being attached
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
import * as fs from "fs";
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.updateBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateBankTransactionAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var bankTransactionID = new UUID(); // UUID | Xero generated unique identifier for a bank transaction (default to null)
            var fileName = xero-dev.jpg;  // String | The name of the file being attached (default to null)
            var body = BYTE_ARRAY_DATA_HERE;  // byte[] | 

            try
            {
                // Updates a specific attachment from a specific bank transaction by filename
                Attachments result = apiInstance.updateBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateBankTransactionAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransactionID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->updateBankTransactionAttachmentByFileName($xeroTenantId, $bankTransactionID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateBankTransactionAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transaction
my $fileName = xero-dev.jpg; # String | The name of the file being attached
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->updateBankTransactionAttachmentByFileName(xeroTenantId => $xeroTenantId, bankTransactionID => $bankTransactionID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateBankTransactionAttachmentByFileName: $@\n";
}
# 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_update_bank_transaction_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    bankTransactionID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    
        // TODO: BINARY CREATE 
    try:
        api_response = api_instance.update_bank_transaction_attachment_by_file_name(xeroTenantId, bankTransactionID, fileName, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateBankTransactionAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.updateBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
BankTransactionID*
UUID (uuid)
Xero generated unique identifier for a bank transaction
Required
FileName*
String
The name of the file being attached
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

updateBankTransferAttachmentByFileName


/BankTransfers/{BankTransferID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransfers/{BankTransferID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID bankTransferID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.updateBankTransferAttachmentByFileName(accessToken, xeroTenantId, bankTransferID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateBankTransferAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transfer
        String fileName = xero-dev.jpg; // String | The name of the file being attached to a Bank Transfer
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.updateBankTransferAttachmentByFileName(xeroTenantId, bankTransferID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateBankTransferAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransferID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transfer (default to null)
String *fileName = xero-dev.jpg; // The name of the file being attached to a Bank Transfer (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// 
[apiInstance updateBankTransferAttachmentByFileNameWith:xeroTenantId
    bankTransferID:bankTransferID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const bankTransferID = "00000000-0000-0000-0000-000000000000";  // {UUID} Xero generated unique identifier for a bank transfer
const fileName = "xero-dev.jpg";  // {String} The name of the file being attached to a Bank Transfer
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
import * as fs from "fs";
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.updateBankTransferAttachmentByFileName(xeroTenantId, bankTransferID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateBankTransferAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var bankTransferID = new UUID(); // UUID | Xero generated unique identifier for a bank transfer (default to null)
            var fileName = xero-dev.jpg;  // String | The name of the file being attached to a Bank Transfer (default to null)
            var body = BYTE_ARRAY_DATA_HERE;  // byte[] | 

            try
            {
                // 
                Attachments result = apiInstance.updateBankTransferAttachmentByFileName(xeroTenantId, bankTransferID, fileName, body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateBankTransferAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransferID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->updateBankTransferAttachmentByFileName($xeroTenantId, $bankTransferID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateBankTransferAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransferID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transfer
my $fileName = xero-dev.jpg; # String | The name of the file being attached to a Bank Transfer
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->updateBankTransferAttachmentByFileName(xeroTenantId => $xeroTenantId, bankTransferID => $bankTransferID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateBankTransferAttachmentByFileName: $@\n";
}
# 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_update_bank_transfer_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    bankTransferID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    
        // TODO: BINARY CREATE 
    try:
        api_response = api_instance.update_bank_transfer_attachment_by_file_name(xeroTenantId, bankTransferID, fileName, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateBankTransferAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.updateBankTransferAttachmentByFileName(xeroTenantId, bankTransferID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
BankTransferID*
UUID (uuid)
Xero generated unique identifier for a bank transfer
Required
FileName*
String
The name of the file being attached to a Bank Transfer
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

updateContact

Updates a specific contact in a Xero organisation


/Contacts/{ContactID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts/{ContactID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID contactID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Contact contact = new Contact();
        contact.setName("Thanos");
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        Contacts contacts = new Contacts();
        contacts.addContactsItem(contact);

        try {
            Contacts result = apiInstance.updateContact(accessToken, xeroTenantId, contactID, contacts);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateContact");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact
        Contacts contacts = { "Contacts": [{ "ContactID": "00000000-0000-0000-0000-000000000000", "Name": "Thanos" }]}; // Contacts | 
        try {
            Contacts result = apiInstance.updateContact(xeroTenantId, contactID, contacts);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateContact");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact (default to null)
Contacts *contacts = { "Contacts": [{ "ContactID": "00000000-0000-0000-0000-000000000000", "Name": "Thanos" }]}; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific contact in a Xero organisation
[apiInstance updateContactWith:xeroTenantId
    contactID:contactID
    contacts:contacts
              completionHandler: ^(Contacts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const contactID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Contact
const contacts: Contacts = { contacts: [{ contactID: "00000000-0000-0000-0000-000000000000", name: "Thanos" }]}

try {
  const response = await xero.accountingApi.updateContact(xeroTenantId, contactID, contacts);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateContactExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var contactID = new UUID(); // UUID | Unique identifier for a Contact (default to null)
            var contacts = new Contacts(); // Contacts | 

            try
            {
                // Updates a specific contact in a Xero organisation
                Contacts result = apiInstance.updateContact(xeroTenantId, contactID, contacts);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateContact: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactID = "00000000-0000-0000-0000-000000000000";

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setName('Thanos');
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$contacts = new XeroAPI\XeroPHP\Models\Accounting\Contacts;
$arr_contacts = [];
array_push($arr_contacts, $contact);
$contacts->setContacts($arr_contacts);

try {
  $result = $apiInstance->updateContact($xeroTenantId, $contactID, $contacts);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateContact: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact
my $contacts = ::Object::Contacts->new(); # Contacts | 

eval { 
    my $result = $api_instance->updateContact(xeroTenantId => $xeroTenantId, contactID => $contactID, contacts => $contacts);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateContact: $@\n";
}
# 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_update_contact():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    contactID = '00000000-0000-0000-0000-000000000000'

    contact = Contact(
        name = "Thanos",
        contactID = "00000000-0000-0000-0000-000000000000")

    contacts = Contacts( 
        contacts = [contact])
    
    try:
        api_response = api_instance.update_contact(xeroTenantId, contactID, contacts)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateContact: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactID = 00000000-0000-0000-0000-000000000000; // UUID
    let contacts = { "Contacts": [{ "ContactID": "00000000-0000-0000-0000-000000000000", "Name": "Thanos" }]}; // Contacts

    let mut context = AccountingApi::Context::default();
    let result = client.updateContact(xeroTenantId, contactID, contacts, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts Grant read-write access to contacts and contact groups

Parameters

Path parameters
Name Description
ContactID*
UUID (uuid)
Unique identifier for a Contact
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
contacts *
Contacts
an array of Contacts containing single Contact object with properties to update
Required

updateContactAttachmentByFileName


/Contacts/{ContactID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts/{ContactID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID contactID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.updateContactAttachmentByFileName(accessToken, xeroTenantId, contactID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateContactAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact
        String fileName = xero-dev.jpg; // String | Name for the file you are attaching
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.updateContactAttachmentByFileName(xeroTenantId, contactID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateContactAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact (default to null)
String *fileName = xero-dev.jpg; // Name for the file you are attaching (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// 
[apiInstance updateContactAttachmentByFileNameWith:xeroTenantId
    contactID:contactID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const contactID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Contact
const fileName = "xero-dev.jpg";  // {String} Name for the file you are attaching
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
import * as fs from "fs";
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.updateContactAttachmentByFileName(xeroTenantId, contactID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateContactAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var contactID = new UUID(); // UUID | Unique identifier for a Contact (default to null)
            var fileName = xero-dev.jpg;  // String | Name for the file you are attaching (default to null)
            var body = BYTE_ARRAY_DATA_HERE;  // byte[] | 

            try
            {
                // 
                Attachments result = apiInstance.updateContactAttachmentByFileName(xeroTenantId, contactID, fileName, body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateContactAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->updateContactAttachmentByFileName($xeroTenantId, $contactID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateContactAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact
my $fileName = xero-dev.jpg; # String | Name for the file you are attaching
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->updateContactAttachmentByFileName(xeroTenantId => $xeroTenantId, contactID => $contactID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateContactAttachmentByFileName: $@\n";
}
# 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_update_contact_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    contactID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    
        // TODO: BINARY CREATE 
    try:
        api_response = api_instance.update_contact_attachment_by_file_name(xeroTenantId, contactID, fileName, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateContactAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.updateContactAttachmentByFileName(xeroTenantId, contactID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
ContactID*
UUID (uuid)
Unique identifier for a Contact
Required
FileName*
String
Name for the file you are attaching
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

updateContactGroup

Updates a specific contact group


/ContactGroups/{ContactGroupID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ContactGroups/{ContactGroupID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID contactGroupID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        ContactGroup contactGroup = new ContactGroup();
        contactGroup.setName("Vendor");
        ContactGroups contactGroups = new ContactGroups();
        contactGroups.addContactGroupsItem(contactGroup);

        try {
            ContactGroups result = apiInstance.updateContactGroup(accessToken, xeroTenantId, contactGroupID, contactGroups);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateContactGroup");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactGroupID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact Group
        ContactGroups contactGroups = { "ContactGroups":[ { "Name":"Suppliers" } ] }; // ContactGroups | 
        try {
            ContactGroups result = apiInstance.updateContactGroup(xeroTenantId, contactGroupID, contactGroups);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateContactGroup");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactGroupID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact Group (default to null)
ContactGroups *contactGroups = { "ContactGroups":[ { "Name":"Suppliers" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific contact group
[apiInstance updateContactGroupWith:xeroTenantId
    contactGroupID:contactGroupID
    contactGroups:contactGroups
              completionHandler: ^(ContactGroups output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const contactGroupID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Contact Group
const contactGroups: ContactGroups = { contactGroups: [{ name: "Vendor" }]}

try {
  const response = await xero.accountingApi.updateContactGroup(xeroTenantId, contactGroupID, contactGroups);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateContactGroupExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var contactGroupID = new UUID(); // UUID | Unique identifier for a Contact Group (default to null)
            var contactGroups = new ContactGroups(); // ContactGroups | 

            try
            {
                // Updates a specific contact group
                ContactGroups result = apiInstance.updateContactGroup(xeroTenantId, contactGroupID, contactGroups);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateContactGroup: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactGroupID = "00000000-0000-0000-0000-000000000000";

$contactGroup = new XeroAPI\XeroPHP\Models\Accounting\ContactGroup;
$contactGroup->setName('Vendor');

$contactGroups = new XeroAPI\XeroPHP\Models\Accounting\ContactGroups;
$arr_contact_groups = [];
array_push($arr_contact_groups, $contactGroup);
$contactGroups->setContactGroups($arr_contact_groups);

try {
  $result = $apiInstance->updateContactGroup($xeroTenantId, $contactGroupID, $contactGroups);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateContactGroup: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactGroupID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact Group
my $contactGroups = ::Object::ContactGroups->new(); # ContactGroups | 

eval { 
    my $result = $api_instance->updateContactGroup(xeroTenantId => $xeroTenantId, contactGroupID => $contactGroupID, contactGroups => $contactGroups);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateContactGroup: $@\n";
}
# 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_update_contact_group():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    contactGroupID = '00000000-0000-0000-0000-000000000000'

    contact_group = ContactGroup(
        name = "Vendor")

    contactGroups = ContactGroups( 
        contact_groups = [contact_group])
    
    try:
        api_response = api_instance.update_contact_group(xeroTenantId, contactGroupID, contactGroups)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateContactGroup: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactGroupID = 00000000-0000-0000-0000-000000000000; // UUID
    let contactGroups = { "ContactGroups":[ { "Name":"Suppliers" } ] }; // ContactGroups

    let mut context = AccountingApi::Context::default();
    let result = client.updateContactGroup(xeroTenantId, contactGroupID, contactGroups, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts Grant read-write access to contacts and contact groups

Parameters

Path parameters
Name Description
ContactGroupID*
UUID (uuid)
Unique identifier for a Contact Group
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
contactGroups *
ContactGroups
an array of Contact groups with Name of specific group to update
Required

updateCreditNote

Updates a specific credit note


/CreditNotes/{CreditNoteID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes/{CreditNoteID}?unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID creditNoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Integer unitdp = 4;
        LocalDate currDate = LocalDate.now();
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        LineItem lineItem = new LineItem();
        lineItem.setDescription("Foobar");
        lineItem.setQuantity(1.0);
        lineItem.setUnitAmount(20.0);
        lineItem.setAccountCode("000");
        List<LineItems> lineItems = new ArrayList<LineItems>();
        lineItems.add(lineItem);
        CreditNote creditNote = new CreditNote();
        creditNote.setType(com.xero.models.accounting.CreditNote.TypeEnum.ACCPAYCREDIT);
        creditNote.setStatus(com.xero.models.accounting.CreditNote.StatusEnum.AUTHORISED);
        creditNote.setReference("My ref.");
        creditNote.setContact(contact);
        creditNote.setDate(currDate);
        creditNote.setLineItems(lineItems);
        CreditNotes creditNotes = new CreditNotes();
        creditNotes.addCreditNotesItem(creditNote);

        try {
            CreditNotes result = apiInstance.updateCreditNote(accessToken, xeroTenantId, creditNoteID, creditNotes, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateCreditNote");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Credit Note
        CreditNotes creditNotes = { "CreditNotes": [ { "Type": "ACCPAYCREDIT", "Contact": { "ContactID": "430fa14a-f945-44d3-9f97-5df5e28441b8" }, "Date": "2019-01-05", "Status": "AUTHORISED", "Reference": "HelloWorld", "LineItems": [ { "Description": "Foobar", "Quantity": 2, "UnitAmount": 20, "AccountCode": "400" } ] } ] }; // CreditNotes | 
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            CreditNotes result = apiInstance.updateCreditNote(xeroTenantId, creditNoteID, creditNotes, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateCreditNote");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *creditNoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Credit Note (default to null)
CreditNotes *creditNotes = { "CreditNotes": [ { "Type": "ACCPAYCREDIT", "Contact": { "ContactID": "430fa14a-f945-44d3-9f97-5df5e28441b8" }, "Date": "2019-01-05", "Status": "AUTHORISED", "Reference": "HelloWorld", "LineItems": [ { "Description": "Foobar", "Quantity": 2, "UnitAmount": 20, "AccountCode": "400" } ] } ] }; // 
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific credit note
[apiInstance updateCreditNoteWith:xeroTenantId
    creditNoteID:creditNoteID
    creditNotes:creditNotes
    unitdp:unitdp
              completionHandler: ^(CreditNotes output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const creditNoteID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Credit Note


const unitdp = 4;  // {Integer} e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
const creditNotes: CreditNotes = { creditNotes: [{ type: CreditNote.TypeEnum.ACCPAYCREDIT, contact: { contactID: "00000000-0000-0000-0000-000000000000" }, date: "2019-01-05", status: CreditNote.StatusEnum.AUTHORISED, reference: "Mind stone", lineItems: [{ description: "Infinity Stones", quantity: 1.0, unitAmount: 100.0, accountCode: "400" } ]}]}

try {
  const response = await xero.accountingApi.updateCreditNote(xeroTenantId, creditNoteID, creditNotes,  unitdp);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateCreditNoteExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var creditNoteID = new UUID(); // UUID | Unique identifier for a Credit Note (default to null)
            var creditNotes = new CreditNotes(); // CreditNotes | 
            var unitdp = 4;  // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)  (default to null)

            try
            {
                // Updates a specific credit note
                CreditNotes result = apiInstance.updateCreditNote(xeroTenantId, creditNoteID, creditNotes, unitdp);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateCreditNote: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$creditNoteID = "00000000-0000-0000-0000-000000000000";
$unitdp = 4;
$currDate = new DateTime('2020-12-10');

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
$lineItem->setDescription('Foobar');
$lineItem->setQuantity(1.0);
$lineItem->setUnitAmount(20.0);
$lineItem->setAccountCode('000');
$lineItems = [];
array_push($lineItems, $lineItem);

$creditNote = new XeroAPI\XeroPHP\Models\Accounting\CreditNote;
$creditNote->setType(XeroAPI\XeroPHP\Models\Accounting\CreditNote::TYPE_ACCPAYCREDIT);
$creditNote->setStatus(XeroAPI\XeroPHP\Models\Accounting\CreditNote::STATUS_AUTHORISED);
$creditNote->setReference('My ref.');
$creditNote->setContact($contact);
$creditNote->setDate($currDate);
$creditNote->setLineItems($lineItems);

$creditNotes = new XeroAPI\XeroPHP\Models\Accounting\CreditNotes;
$arr_credit_notes = [];
array_push($arr_credit_notes, $creditNote);
$creditNotes->setCreditNotes($arr_credit_notes);

try {
  $result = $apiInstance->updateCreditNote($xeroTenantId, $creditNoteID, $creditNotes, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateCreditNote: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $creditNoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Credit Note
my $creditNotes = ::Object::CreditNotes->new(); # CreditNotes | 
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->updateCreditNote(xeroTenantId => $xeroTenantId, creditNoteID => $creditNoteID, creditNotes => $creditNotes, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateCreditNote: $@\n";
}
# 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_update_credit_note():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    creditNoteID = '00000000-0000-0000-0000-000000000000'
    curr_date = dateutil.parser.parse('2020-12-03T00:00:00Z')

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    line_item = LineItem(
        description = "Foobar",
        quantity = 1.0,
        unit_amount = 20.0,
        account_code = "000")
    
    line_items = []    
    line_items.append(line_item)

    credit_note = CreditNote(
        type = "ACCPAYCREDIT",
        status = "AUTHORISED",
        reference = "My ref.",
        contact = contact,
        date = curr_date,
        line_items = line_items)

    creditNotes = CreditNotes( 
        credit_notes = [credit_note])
    
    try:
        api_response = api_instance.update_credit_note(xeroTenantId, creditNoteID, creditNotes, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateCreditNote: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let creditNotes = { "CreditNotes": [ { "Type": "ACCPAYCREDIT", "Contact": { "ContactID": "430fa14a-f945-44d3-9f97-5df5e28441b8" }, "Date": "2019-01-05", "Status": "AUTHORISED", "Reference": "HelloWorld", "LineItems": [ { "Description": "Foobar", "Quantity": 2, "UnitAmount": 20, "AccountCode": "400" } ] } ] }; // CreditNotes
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.updateCreditNote(xeroTenantId, creditNoteID, creditNotes, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
CreditNoteID*
UUID (uuid)
Unique identifier for a Credit Note
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
creditNotes *
CreditNotes
an array of Credit Notes containing credit note details to update
Required
Query parameters
Name Description
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

updateCreditNoteAttachmentByFileName

Updates attachments on a specific credit note by file name


/CreditNotes/{CreditNoteID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes/{CreditNoteID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID creditNoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.updateCreditNoteAttachmentByFileName(accessToken, xeroTenantId, creditNoteID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateCreditNoteAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Credit Note
        String fileName = xero-dev.jpg; // String | Name of the file you are attaching to Credit Note
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.updateCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateCreditNoteAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *creditNoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Credit Note (default to null)
String *fileName = xero-dev.jpg; // Name of the file you are attaching to Credit Note (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates attachments on a specific credit note by file name
[apiInstance updateCreditNoteAttachmentByFileNameWith:xeroTenantId
    creditNoteID:creditNoteID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const creditNoteID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Credit Note
const fileName = "xero-dev.jpg";  // {String} Name of the file you are attaching to Credit Note
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
import * as fs from "fs";
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.updateCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateCreditNoteAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var creditNoteID = new UUID(); // UUID | Unique identifier for a Credit Note (default to null)
            var fileName = xero-dev.jpg;  // String | Name of the file you are attaching to Credit Note (default to null)
            var body = BYTE_ARRAY_DATA_HERE;  // byte[] | 

            try
            {
                // Updates attachments on a specific credit note by file name
                Attachments result = apiInstance.updateCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, fileName, body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateCreditNoteAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$creditNoteID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->updateCreditNoteAttachmentByFileName($xeroTenantId, $creditNoteID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateCreditNoteAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $creditNoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Credit Note
my $fileName = xero-dev.jpg; # String | Name of the file you are attaching to Credit Note
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->updateCreditNoteAttachmentByFileName(xeroTenantId => $xeroTenantId, creditNoteID => $creditNoteID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateCreditNoteAttachmentByFileName: $@\n";
}
# 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_update_credit_note_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    creditNoteID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    
        // TODO: BINARY CREATE 
    try:
        api_response = api_instance.update_credit_note_attachment_by_file_name(xeroTenantId, creditNoteID, fileName, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateCreditNoteAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.updateCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
CreditNoteID*
UUID (uuid)
Unique identifier for a Credit Note
Required
FileName*
String
Name of the file you are attaching to Credit Note
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

updateExpenseClaim

Updates a specific expense claims


/ExpenseClaims/{ExpenseClaimID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ExpenseClaims/{ExpenseClaimID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID expenseClaimID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        LocalDate currDate = LocalDate.now();
        User user = new User();
        user.setUserID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        Receipt receipt = new Receipt();
        receipt.setReceiptID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        receipt.setDate(currDate);
        List<Receipt> receipts = new ArrayList<Receipt>();
        receipts.add(receipt);
        ExpenseClaim expenseClaim = new ExpenseClaim();
        expenseClaim.setStatus(com.xero.models.accounting.ExpenseClaim.StatusEnum.SUBMITTED);
        expenseClaim.setUser(user);
        expenseClaim.setReceipts(receipts);
        ExpenseClaims expenseClaims = new ExpenseClaims();
        expenseClaims.addExpenseClaimsItem(expenseClaim);

        try {
            ExpenseClaims result = apiInstance.updateExpenseClaim(accessToken, xeroTenantId, expenseClaimID, expenseClaims);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateExpenseClaim");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID expenseClaimID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a ExpenseClaim
        ExpenseClaims expenseClaims = { "ExpenseClaims": [ { "Status": "SUBMITTED", "User": { "UserID": "d1164823-0ac1-41ad-987b-b4e30fe0b273" }, "Receipts": [ { "Lineitems": [], "ReceiptID": "dc1c7f6d-0a4c-402f-acac-551d62ce5816" } ] } ] }; // ExpenseClaims | 
        try {
            ExpenseClaims result = apiInstance.updateExpenseClaim(xeroTenantId, expenseClaimID, expenseClaims);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateExpenseClaim");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *expenseClaimID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a ExpenseClaim (default to null)
ExpenseClaims *expenseClaims = { "ExpenseClaims": [ { "Status": "SUBMITTED", "User": { "UserID": "d1164823-0ac1-41ad-987b-b4e30fe0b273" }, "Receipts": [ { "Lineitems": [], "ReceiptID": "dc1c7f6d-0a4c-402f-acac-551d62ce5816" } ] } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific expense claims
[apiInstance updateExpenseClaimWith:xeroTenantId
    expenseClaimID:expenseClaimID
    expenseClaims:expenseClaims
              completionHandler: ^(ExpenseClaims output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const expenseClaimID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a ExpenseClaim
const expenseClaims: ExpenseClaims = { expenseClaims: [{ status: ExpenseClaim.StatusEnum.AUTHORISED, user: { userID: "00000000-0000-0000-0000-000000000000" }, receipts: [{ receiptID: "00000000-0000-0000-0000-000000000000", lineItems: [], contact: {}, date: "2020-01-01", user: {} }]}]}

try {
  const response = await xero.accountingApi.updateExpenseClaim(xeroTenantId, expenseClaimID, expenseClaims);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateExpenseClaimExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var expenseClaimID = new UUID(); // UUID | Unique identifier for a ExpenseClaim (default to null)
            var expenseClaims = new ExpenseClaims(); // ExpenseClaims | 

            try
            {
                // Updates a specific expense claims
                ExpenseClaims result = apiInstance.updateExpenseClaim(xeroTenantId, expenseClaimID, expenseClaims);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateExpenseClaim: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$expenseClaimID = "00000000-0000-0000-0000-000000000000";
$currDate = new DateTime('2020-12-10');

$user = new XeroAPI\XeroPHP\Models\Accounting\User;
$user->setUserID('00000000-0000-0000-0000-000000000000');

$receipt = new XeroAPI\XeroPHP\Models\Accounting\Receipt;
$receipt->setReceiptID('00000000-0000-0000-0000-000000000000');
$receipt->setDate($currDate);
$receipts = [];
array_push($receipts, $receipt);

$expenseClaim = new XeroAPI\XeroPHP\Models\Accounting\ExpenseClaim;
$expenseClaim->setStatus(XeroAPI\XeroPHP\Models\Accounting\ExpenseClaim::STATUS_SUBMITTED);
$expenseClaim->setUser($user);
$expenseClaim->setReceipts($receipts);

$expenseClaims = new XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims;
$arr_expense_claims = [];
array_push($arr_expense_claims, $expenseClaim);
$expenseClaims->setExpenseClaims($arr_expense_claims);

try {
  $result = $apiInstance->updateExpenseClaim($xeroTenantId, $expenseClaimID, $expenseClaims);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateExpenseClaim: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $expenseClaimID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a ExpenseClaim
my $expenseClaims = ::Object::ExpenseClaims->new(); # ExpenseClaims | 

eval { 
    my $result = $api_instance->updateExpenseClaim(xeroTenantId => $xeroTenantId, expenseClaimID => $expenseClaimID, expenseClaims => $expenseClaims);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateExpenseClaim: $@\n";
}
# 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_update_expense_claim():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    expenseClaimID = '00000000-0000-0000-0000-000000000000'
    curr_date = dateutil.parser.parse('2020-12-03T00:00:00Z')

    user = User(
        user_id = "00000000-0000-0000-0000-000000000000")

    receipt = Receipt(
        receipt_id = "00000000-0000-0000-0000-000000000000",
        date = curr_date)
    
    receipts = []    
    receipts.append(receipt)

    expense_claim = ExpenseClaim(
        status = "SUBMITTED",
        user = user,
        receipts = receipts)

    expenseClaims = ExpenseClaims( 
        expense_claims = [expense_claim])
    
    try:
        api_response = api_instance.update_expense_claim(xeroTenantId, expenseClaimID, expenseClaims)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateExpenseClaim: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let expenseClaimID = 00000000-0000-0000-0000-000000000000; // UUID
    let expenseClaims = { "ExpenseClaims": [ { "Status": "SUBMITTED", "User": { "UserID": "d1164823-0ac1-41ad-987b-b4e30fe0b273" }, "Receipts": [ { "Lineitems": [], "ReceiptID": "dc1c7f6d-0a4c-402f-acac-551d62ce5816" } ] } ] }; // ExpenseClaims

    let mut context = AccountingApi::Context::default();
    let result = client.updateExpenseClaim(xeroTenantId, expenseClaimID, expenseClaims, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
ExpenseClaimID*
UUID (uuid)
Unique identifier for a ExpenseClaim
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
expenseClaims *
ExpenseClaims
Required

updateInvoice

Updates a specific sales invoices or purchase bills


/Invoices/{InvoiceID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID}?unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID invoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Integer unitdp = 4;
        Invoice invoice = new Invoice();
        invoice.setReference("I am Iron man");
        Invoices invoices = new Invoices();
        invoices.addInvoicesItem(invoice);

        try {
            Invoices result = apiInstance.updateInvoice(accessToken, xeroTenantId, invoiceID, invoices, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateInvoice");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID invoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Invoice
        Invoices invoices = { "Invoices": [{ Reference: "May the force be with you", "InvoiceID": "00000000-0000-0000-0000-000000000000", "LineItems": [], "Contact": {}, "Type": "ACCPAY" }]}; // Invoices | 
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Invoices result = apiInstance.updateInvoice(xeroTenantId, invoiceID, invoices, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateInvoice");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *invoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Invoice (default to null)
Invoices *invoices = { "Invoices": [{ Reference: "May the force be with you", "InvoiceID": "00000000-0000-0000-0000-000000000000", "LineItems": [], "Contact": {}, "Type": "ACCPAY" }]}; // 
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific sales invoices or purchase bills
[apiInstance updateInvoiceWith:xeroTenantId
    invoiceID:invoiceID
    invoices:invoices
    unitdp:unitdp
              completionHandler: ^(Invoices output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const invoiceID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for an Invoice


const unitdp = 4;  // {Integer} e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
const invoices: Invoices = { invoices: [{ reference: "I am Iron Man", invoiceID: "00000000-0000-0000-0000-000000000000", lineItems: [], contact: {}, type: Invoice.TypeEnum.ACCPAY }]}

try {
  const response = await xero.accountingApi.updateInvoice(xeroTenantId, invoiceID, invoices,  unitdp);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateInvoiceExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var invoiceID = new UUID(); // UUID | Unique identifier for an Invoice (default to null)
            var invoices = new Invoices(); // Invoices | 
            var unitdp = 4;  // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)  (default to null)

            try
            {
                // Updates a specific sales invoices or purchase bills
                Invoices result = apiInstance.updateInvoice(xeroTenantId, invoiceID, invoices, unitdp);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateInvoice: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$invoiceID = "00000000-0000-0000-0000-000000000000";
$unitdp = 4;

$invoice = new XeroAPI\XeroPHP\Models\Accounting\Invoice;
$invoice->setReference('I am Iron man');

$invoices = new XeroAPI\XeroPHP\Models\Accounting\Invoices;
$arr_invoices = [];
array_push($arr_invoices, $invoice);
$invoices->setInvoices($arr_invoices);

try {
  $result = $apiInstance->updateInvoice($xeroTenantId, $invoiceID, $invoices, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateInvoice: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Invoice
my $invoices = ::Object::Invoices->new(); # Invoices | 
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->updateInvoice(xeroTenantId => $xeroTenantId, invoiceID => $invoiceID, invoices => $invoices, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateInvoice: $@\n";
}
# 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_update_invoice():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    invoiceID = '00000000-0000-0000-0000-000000000000'

    invoice = Invoice(
        reference = "I am Iron man")

    invoices = Invoices( 
        invoices = [invoice])
    
    try:
        api_response = api_instance.update_invoice(xeroTenantId, invoiceID, invoices, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateInvoice: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoiceID = 00000000-0000-0000-0000-000000000000; // UUID
    let invoices = { "Invoices": [{ Reference: "May the force be with you", "InvoiceID": "00000000-0000-0000-0000-000000000000", "LineItems": [], "Contact": {}, "Type": "ACCPAY" }]}; // Invoices
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.updateInvoice(xeroTenantId, invoiceID, invoices, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
InvoiceID*
UUID (uuid)
Unique identifier for an Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
invoices *
Invoices
Required
Query parameters
Name Description
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

updateInvoiceAttachmentByFileName

Updates an attachment from a specific invoices or purchase bill by filename


/Invoices/{InvoiceID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID invoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.updateInvoiceAttachmentByFileName(accessToken, xeroTenantId, invoiceID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateInvoiceAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID invoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Invoice
        String fileName = xero-dev.jpg; // String | Name of the file you are attaching
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.updateInvoiceAttachmentByFileName(xeroTenantId, invoiceID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateInvoiceAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *invoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Invoice (default to null)
String *fileName = xero-dev.jpg; // Name of the file you are attaching (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates an attachment from a specific invoices or purchase bill by filename
[apiInstance updateInvoiceAttachmentByFileNameWith:xeroTenantId
    invoiceID:invoiceID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const invoiceID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for an Invoice
const fileName = "xero-dev.jpg";  // {String} Name of the file you are attaching
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
import * as fs from "fs";
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.updateInvoiceAttachmentByFileName(xeroTenantId, invoiceID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateInvoiceAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var invoiceID = new UUID(); // UUID | Unique identifier for an Invoice (default to null)
            var fileName = xero-dev.jpg;  // String | Name of the file you are attaching (default to null)
            var body = BYTE_ARRAY_DATA_HERE;  // byte[] | 

            try
            {
                // Updates an attachment from a specific invoices or purchase bill by filename
                Attachments result = apiInstance.updateInvoiceAttachmentByFileName(xeroTenantId, invoiceID, fileName, body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateInvoiceAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$invoiceID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->updateInvoiceAttachmentByFileName($xeroTenantId, $invoiceID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateInvoiceAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Invoice
my $fileName = xero-dev.jpg; # String | Name of the file you are attaching
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->updateInvoiceAttachmentByFileName(xeroTenantId => $xeroTenantId, invoiceID => $invoiceID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateInvoiceAttachmentByFileName: $@\n";
}
# 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_update_invoice_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    invoiceID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    
        // TODO: BINARY CREATE 
    try:
        api_response = api_instance.update_invoice_attachment_by_file_name(xeroTenantId, invoiceID, fileName, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateInvoiceAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoiceID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.updateInvoiceAttachmentByFileName(xeroTenantId, invoiceID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
InvoiceID*
UUID (uuid)
Unique identifier for an Invoice
Required
FileName*
String
Name of the file you are attaching
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

updateItem

Updates a specific item


/Items/{ItemID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Items/{ItemID}?unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID itemID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Integer unitdp = 4;
        Item item = new Item();
        item.setCode("ItemCode123");
        item.setDescription("Goodbye");
        Items items = new Items();
        items.addItemsItem(item);

        try {
            Items result = apiInstance.updateItem(accessToken, xeroTenantId, itemID, items, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateItem");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID itemID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Item
        Items items = { "Items": [ { "Code": "ItemCode123", "Description": "Description 123" } ] }; // Items | 
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Items result = apiInstance.updateItem(xeroTenantId, itemID, items, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateItem");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *itemID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Item (default to null)
Items *items = { "Items": [ { "Code": "ItemCode123", "Description": "Description 123" } ] }; // 
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific item
[apiInstance updateItemWith:xeroTenantId
    itemID:itemID
    items:items
    unitdp:unitdp
              completionHandler: ^(Items output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const itemID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for an Item


const unitdp = 4;  // {Integer} e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
const items: Items = { items: [{ code: "ItemCode123", description: "Description 123" }]}

try {
  const response = await xero.accountingApi.updateItem(xeroTenantId, itemID, items,  unitdp);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateItemExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var itemID = new UUID(); // UUID | Unique identifier for an Item (default to null)
            var items = new Items(); // Items | 
            var unitdp = 4;  // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)  (default to null)

            try
            {
                // Updates a specific item
                Items result = apiInstance.updateItem(xeroTenantId, itemID, items, unitdp);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateItem: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$itemID = "00000000-0000-0000-0000-000000000000";
$unitdp = 4;

$item = new XeroAPI\XeroPHP\Models\Accounting\Item;
$item->setCode('ItemCode123');
$item->setDescription('Goodbye');

$items = new XeroAPI\XeroPHP\Models\Accounting\Items;
$arr_items = [];
array_push($arr_items, $item);
$items->setItems($arr_items);

try {
  $result = $apiInstance->updateItem($xeroTenantId, $itemID, $items, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateItem: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $itemID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Item
my $items = ::Object::Items->new(); # Items | 
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->updateItem(xeroTenantId => $xeroTenantId, itemID => $itemID, items => $items, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateItem: $@\n";
}
# 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_update_item():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    itemID = '00000000-0000-0000-0000-000000000000'

    item = Item(
        code = "ItemCode123",
        description = "Goodbye")

    items = Items( 
        items = [item])
    
    try:
        api_response = api_instance.update_item(xeroTenantId, itemID, items, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateItem: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let itemID = 00000000-0000-0000-0000-000000000000; // UUID
    let items = { "Items": [ { "Code": "ItemCode123", "Description": "Description 123" } ] }; // Items
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.updateItem(xeroTenantId, itemID, items, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Path parameters
Name Description
ItemID*
UUID (uuid)
Unique identifier for an Item
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
items *
Items
Required
Query parameters
Name Description
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

updateLinkedTransaction

Updates a specific linked transactions (billable expenses)


/LinkedTransactions/{LinkedTransactionID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/LinkedTransactions/{LinkedTransactionID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID linkedTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        LinkedTransaction linkedTransaction = new LinkedTransaction();
        linkedTransaction.setSourceLineItemID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        linkedTransaction.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        LinkedTransactions linkedTransactions = new LinkedTransactions();
        linkedTransactions.addLinkedTransactionsItem(linkedTransaction);

        try {
            LinkedTransactions result = apiInstance.updateLinkedTransaction(accessToken, xeroTenantId, linkedTransactionID, linkedTransactions);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateLinkedTransaction");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID linkedTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a LinkedTransaction
        LinkedTransactions linkedTransactions = { "LinkedTransactions": [ { "SourceTransactionID": "00000000-0000-0000-0000-000000000000", "SourceLineItemID": "00000000-0000-0000-0000-000000000000" } ] }; // LinkedTransactions | 
        try {
            LinkedTransactions result = apiInstance.updateLinkedTransaction(xeroTenantId, linkedTransactionID, linkedTransactions);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateLinkedTransaction");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *linkedTransactionID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a LinkedTransaction (default to null)
LinkedTransactions *linkedTransactions = { "LinkedTransactions": [ { "SourceTransactionID": "00000000-0000-0000-0000-000000000000", "SourceLineItemID": "00000000-0000-0000-0000-000000000000" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific linked transactions (billable expenses)
[apiInstance updateLinkedTransactionWith:xeroTenantId
    linkedTransactionID:linkedTransactionID
    linkedTransactions:linkedTransactions
              completionHandler: ^(LinkedTransactions output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const linkedTransactionID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a LinkedTransaction
const linkedTransactions: LinkedTransactions = { linkedTransactions: [{ sourceLineItemID: "00000000-0000-0000-0000-000000000000", contactID: "00000000-0000-0000-0000-000000000000" }]}

try {
  const response = await xero.accountingApi.updateLinkedTransaction(xeroTenantId, linkedTransactionID, linkedTransactions);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateLinkedTransactionExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var linkedTransactionID = new UUID(); // UUID | Unique identifier for a LinkedTransaction (default to null)
            var linkedTransactions = new LinkedTransactions(); // LinkedTransactions | 

            try
            {
                // Updates a specific linked transactions (billable expenses)
                LinkedTransactions result = apiInstance.updateLinkedTransaction(xeroTenantId, linkedTransactionID, linkedTransactions);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateLinkedTransaction: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$linkedTransactionID = "00000000-0000-0000-0000-000000000000";

$linkedTransaction = new XeroAPI\XeroPHP\Models\Accounting\LinkedTransaction;
$linkedTransaction->setSourceLineItemID('00000000-0000-0000-0000-000000000000');
$linkedTransaction->setContactID('00000000-0000-0000-0000-000000000000');

$linkedTransactions = new XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions;
$arr_linked_transactions = [];
array_push($arr_linked_transactions, $linkedTransaction);
$linkedTransactions->setLinkedTransactions($arr_linked_transactions);

try {
  $result = $apiInstance->updateLinkedTransaction($xeroTenantId, $linkedTransactionID, $linkedTransactions);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateLinkedTransaction: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $linkedTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a LinkedTransaction
my $linkedTransactions = ::Object::LinkedTransactions->new(); # LinkedTransactions | 

eval { 
    my $result = $api_instance->updateLinkedTransaction(xeroTenantId => $xeroTenantId, linkedTransactionID => $linkedTransactionID, linkedTransactions => $linkedTransactions);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateLinkedTransaction: $@\n";
}
# 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_update_linked_transaction():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    linkedTransactionID = '00000000-0000-0000-0000-000000000000'

    linked_transaction = LinkedTransaction(
        source_line_item_id = "00000000-0000-0000-0000-000000000000",
        contactID = "00000000-0000-0000-0000-000000000000")

    linkedTransactions = LinkedTransactions( 
        linked_transactions = [linked_transaction])
    
    try:
        api_response = api_instance.update_linked_transaction(xeroTenantId, linkedTransactionID, linkedTransactions)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateLinkedTransaction: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let linkedTransactionID = 00000000-0000-0000-0000-000000000000; // UUID
    let linkedTransactions = { "LinkedTransactions": [ { "SourceTransactionID": "00000000-0000-0000-0000-000000000000", "SourceLineItemID": "00000000-0000-0000-0000-000000000000" } ] }; // LinkedTransactions

    let mut context = AccountingApi::Context::default();
    let result = client.updateLinkedTransaction(xeroTenantId, linkedTransactionID, linkedTransactions, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
LinkedTransactionID*
UUID (uuid)
Unique identifier for a LinkedTransaction
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
linkedTransactions *
LinkedTransactions
Required

updateManualJournal

Updates a specific manual journal


/ManualJournals/{ManualJournalID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ManualJournals/{ManualJournalID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID manualJournalID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        LocalDate dateValue = LocalDate.of(2020, Month.OCTOBER, 10);
        List<ManualJournalLine> manualJournalLines = new ArrayList<ManualJournalLine>();
        ManualJournalLine credit = new ManualJournalLine();
        credit.setLineAmount(100.0);
        credit.setAccountCode("400");
        credit.setDescription("Hello there");
        manualJournalLines.add(credit);
        ManualJournalLine debit = new ManualJournalLine();
        debit.setLineAmount(-100.0);
        debit.setAccountCode("120");
        debit.setDescription("Hello there");
        manualJournalLines.add(debit);
        ManualJournal manualJournal = new ManualJournal();
        manualJournal.setNarration("Foobar");
        manualJournal.setDate(dateValue);
        manualJournal.setJournalLines(manualJournalLines);
        ManualJournals manualJournals = new ManualJournals();
        manualJournals.addManualJournalsItem(manualJournal);

        try {
            ManualJournals result = apiInstance.updateManualJournal(accessToken, xeroTenantId, manualJournalID, manualJournals);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateManualJournal");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a ManualJournal
        ManualJournals manualJournals = { "ManualJournals": [ { "Narration": "Hello Xero", "ManualJournalID": "00000000-0000-0000-0000-000000000000", "JournalLines": [] } ] }; // ManualJournals | 
        try {
            ManualJournals result = apiInstance.updateManualJournal(xeroTenantId, manualJournalID, manualJournals);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateManualJournal");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *manualJournalID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a ManualJournal (default to null)
ManualJournals *manualJournals = { "ManualJournals": [ { "Narration": "Hello Xero", "ManualJournalID": "00000000-0000-0000-0000-000000000000", "JournalLines": [] } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific manual journal
[apiInstance updateManualJournalWith:xeroTenantId
    manualJournalID:manualJournalID
    manualJournals:manualJournals
              completionHandler: ^(ManualJournals output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const manualJournalID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a ManualJournal
const manualJournals: ManualJournals = { manualJournals: [{ narration: "Hello Xero", manualJournalId: "00000000-0000-0000-0000-000000000000", journalLines: [] }]}

try {
  const response = await xero.accountingApi.updateManualJournal(xeroTenantId, manualJournalID, manualJournals);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateManualJournalExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var manualJournalID = new UUID(); // UUID | Unique identifier for a ManualJournal (default to null)
            var manualJournals = new ManualJournals(); // ManualJournals | 

            try
            {
                // Updates a specific manual journal
                ManualJournals result = apiInstance.updateManualJournal(xeroTenantId, manualJournalID, manualJournals);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateManualJournal: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$manualJournalID = "00000000-0000-0000-0000-000000000000";
$dateValue = new DateTime('2020-10-10');
$manualJournalLines = [];

$credit = new XeroAPI\XeroPHP\Models\Accounting\ManualJournalLine;
$credit->setLineAmount(100.0);
$credit->setAccountCode('400');
$credit->setDescription('Hello there');
array_push($manualJournalLines, $credit);

$debit = new XeroAPI\XeroPHP\Models\Accounting\ManualJournalLine;
$debit->setLineAmount(-100.0);
$debit->setAccountCode('120');
$debit->setDescription('Hello there');
array_push($manualJournalLines, $debit);

$manualJournal = new XeroAPI\XeroPHP\Models\Accounting\ManualJournal;
$manualJournal->setNarration('Foobar');
$manualJournal->setDate($dateValue);
$manualJournal->setJournalLines($manualJournalLines);

$manualJournals = new XeroAPI\XeroPHP\Models\Accounting\ManualJournals;
$arr_manual_journals = [];
array_push($arr_manual_journals, $manualJournal);
$manualJournals->setManualJournals($arr_manual_journals);

try {
  $result = $apiInstance->updateManualJournal($xeroTenantId, $manualJournalID, $manualJournals);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateManualJournal: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $manualJournalID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a ManualJournal
my $manualJournals = ::Object::ManualJournals->new(); # ManualJournals | 

eval { 
    my $result = $api_instance->updateManualJournal(xeroTenantId => $xeroTenantId, manualJournalID => $manualJournalID, manualJournals => $manualJournals);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateManualJournal: $@\n";
}
# 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_update_manual_journal():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    manualJournalID = '00000000-0000-0000-0000-000000000000'
    date_value = dateutil.parser.parse('2020-12-03T00:00:00Z')
    
    manual_journal_lines = []

    credit = ManualJournalLine(
        line_amount = 100.0,
        account_code = "400",
        description = "Hello there")    
    manual_journal_lines.append(credit)

    debit = ManualJournalLine(
        line_amount = -100.0,
        account_code = "120",
        description = "Hello there")    
    manual_journal_lines.append(debit)

    manual_journal = ManualJournal(
        narration = "Foobar",
        date = date_value,
        journal_lines = manual_journal_lines)

    manualJournals = ManualJournals( 
        manual_journals = [manual_journal])
    
    try:
        api_response = api_instance.update_manual_journal(xeroTenantId, manualJournalID, manualJournals)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateManualJournal: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID
    let manualJournals = { "ManualJournals": [ { "Narration": "Hello Xero", "ManualJournalID": "00000000-0000-0000-0000-000000000000", "JournalLines": [] } ] }; // ManualJournals

    let mut context = AccountingApi::Context::default();
    let result = client.updateManualJournal(xeroTenantId, manualJournalID, manualJournals, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
ManualJournalID*
UUID (uuid)
Unique identifier for a ManualJournal
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
manualJournals *
ManualJournals
Required

updateManualJournalAttachmentByFileName

Updates a specific attachment from a specific manual journal by file name


/ManualJournals/{ManualJournalID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ManualJournals/{ManualJournalID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID manualJournalID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.updateManualJournalAttachmentByFileName(accessToken, xeroTenantId, manualJournalID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateManualJournalAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a ManualJournal
        String fileName = xero-dev.jpg; // String | The name of the file being attached to a ManualJournal
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.updateManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateManualJournalAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *manualJournalID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a ManualJournal (default to null)
String *fileName = xero-dev.jpg; // The name of the file being attached to a ManualJournal (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific attachment from a specific manual journal by file name
[apiInstance updateManualJournalAttachmentByFileNameWith:xeroTenantId
    manualJournalID:manualJournalID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const manualJournalID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a ManualJournal
const fileName = "xero-dev.jpg";  // {String} The name of the file being attached to a ManualJournal
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
import * as fs from "fs";
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.updateManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateManualJournalAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var manualJournalID = new UUID(); // UUID | Unique identifier for a ManualJournal (default to null)
            var fileName = xero-dev.jpg;  // String | The name of the file being attached to a ManualJournal (default to null)
            var body = BYTE_ARRAY_DATA_HERE;  // byte[] | 

            try
            {
                // Updates a specific attachment from a specific manual journal by file name
                Attachments result = apiInstance.updateManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, fileName, body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateManualJournalAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$manualJournalID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->updateManualJournalAttachmentByFileName($xeroTenantId, $manualJournalID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateManualJournalAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $manualJournalID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a ManualJournal
my $fileName = xero-dev.jpg; # String | The name of the file being attached to a ManualJournal
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->updateManualJournalAttachmentByFileName(xeroTenantId => $xeroTenantId, manualJournalID => $manualJournalID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateManualJournalAttachmentByFileName: $@\n";
}
# 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_update_manual_journal_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    manualJournalID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    
        // TODO: BINARY CREATE 
    try:
        api_response = api_instance.update_manual_journal_attachment_by_file_name(xeroTenantId, manualJournalID, fileName, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateManualJournalAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.updateManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
ManualJournalID*
UUID (uuid)
Unique identifier for a ManualJournal
Required
FileName*
String
The name of the file being attached to a ManualJournal
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

updateOrCreateBankTransactions

Updates or creates one or more spent or received money transaction


/BankTransactions

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransactions?summarizeErrors=true&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        Boolean summarizeErrors = true;
        Integer unitdp = 4;
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        LineItem lineItem = new LineItem();
        lineItem.setDescription("Foobar");
        lineItem.setQuantity(1.0);
        lineItem.setUnitAmount(20.0);
        lineItem.setAccountCode("000");
        List<LineItems> lineItems = new ArrayList<LineItems>();
        lineItems.add(lineItem);
        Account bankAccount = new Account();
        bankAccount.setAccountID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        BankTransaction bankTransaction = new BankTransaction();
        bankTransaction.setType(com.xero.models.accounting.BankTransaction.TypeEnum.RECEIVE);
        bankTransaction.setContact(contact);
        bankTransaction.setLineItems(lineItems);
        bankTransaction.setBankAccount(bankAccount);
        BankTransactions bankTransactions = new BankTransactions();
        bankTransactions.addBankTransactionsItem(bankTransaction);

        try {
            BankTransactions result = apiInstance.updateOrCreateBankTransactions(accessToken, xeroTenantId, bankTransactions, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateBankTransactions");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        BankTransactions bankTransactions = { "BankTransactions": [ { "Type": "SPEND", "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "Lineitems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "400" } ], "BankAccount": { "Code": "088" } } ] }; // BankTransactions | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            BankTransactions result = apiInstance.updateOrCreateBankTransactions(xeroTenantId, bankTransactions, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateBankTransactions");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
BankTransactions *bankTransactions = { "BankTransactions": [ { "Type": "SPEND", "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "Lineitems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "400" } ], "BankAccount": { "Code": "088" } } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates or creates one or more spent or received money transaction
[apiInstance updateOrCreateBankTransactionsWith:xeroTenantId
    bankTransactions:bankTransactions
    summarizeErrors:summarizeErrors
    unitdp:unitdp
              completionHandler: ^(BankTransactions output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant


const summarizeErrors = true;  // {Boolean} If false return 200 OK and mix of successfully created objects and any with validation errors

const unitdp = 4;  // {Integer} e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
const bankTransactions: BankTransactions = { bankTransactions: [{ type: BankTransaction.TypeEnum.SPEND, contact: { contactId: "00000000-0000-0000-0000-000000000000" }, lineItems: [{ description: "Foobar", quantity: 1.0, unitAmount: 20.0, accountCode: "000" }], bankAccount: { code: "000" }}]}

try {
  const response = await xero.accountingApi.updateOrCreateBankTransactions(xeroTenantId, bankTransactions,  summarizeErrors, unitdp);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateOrCreateBankTransactionsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var bankTransactions = new BankTransactions(); // BankTransactions | 
            var summarizeErrors = true;  // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors (optional)  (default to false)
            var unitdp = 4;  // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)  (default to null)

            try
            {
                // Updates or creates one or more spent or received money transaction
                BankTransactions result = apiInstance.updateOrCreateBankTransactions(xeroTenantId, bankTransactions, summarizeErrors, unitdp);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateOrCreateBankTransactions: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$unitdp = 4;

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
$lineItem->setDescription('Foobar');
$lineItem->setQuantity(1.0);
$lineItem->setUnitAmount(20.0);
$lineItem->setAccountCode('000');
$lineItems = [];
array_push($lineItems, $lineItem);

$bankAccount = new XeroAPI\XeroPHP\Models\Accounting\Account;
$bankAccount->setAccountID('00000000-0000-0000-0000-000000000000');

$bankTransaction = new XeroAPI\XeroPHP\Models\Accounting\BankTransaction;
$bankTransaction->setType(XeroAPI\XeroPHP\Models\Accounting\BankTransaction::TYPE_RECEIVE);
$bankTransaction->setContact($contact);
$bankTransaction->setLineItems($lineItems);
$bankTransaction->setBankAccount($bankAccount);

$bankTransactions = new XeroAPI\XeroPHP\Models\Accounting\BankTransactions;
$arr_bank_transactions = [];
array_push($arr_bank_transactions, $bankTransaction);
$bankTransactions->setBankTransactions($arr_bank_transactions);

try {
  $result = $apiInstance->updateOrCreateBankTransactions($xeroTenantId, $bankTransactions, $summarizeErrors, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateOrCreateBankTransactions: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransactions = ::Object::BankTransactions->new(); # BankTransactions | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->updateOrCreateBankTransactions(xeroTenantId => $xeroTenantId, bankTransactions => $bankTransactions, summarizeErrors => $summarizeErrors, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateOrCreateBankTransactions: $@\n";
}
# 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_update_or_create_bank_transactions():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    summarizeErrors = 'True'

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    line_item = LineItem(
        description = "Foobar",
        quantity = 1.0,
        unit_amount = 20.0,
        account_code = "000")
    
    line_items = []    
    line_items.append(line_item)

    bank_account = Account(
        account_id = "00000000-0000-0000-0000-000000000000")

    bank_transaction = BankTransaction(
        type = "RECEIVE",
        contact = contact,
        lineItems = lineItems,
        bank_account = bank_account)

    bankTransactions = BankTransactions( 
        bank_transactions = [bank_transaction])
    
    try:
        api_response = api_instance.update_or_create_bank_transactions(xeroTenantId, bankTransactions, summarizeErrors, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateOrCreateBankTransactions: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransactions = { "BankTransactions": [ { "Type": "SPEND", "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "Lineitems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "400" } ], "BankAccount": { "Code": "088" } } ] }; // BankTransactions
    let summarizeErrors = true; // Boolean
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.updateOrCreateBankTransactions(xeroTenantId, bankTransactions, summarizeErrors, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
bankTransactions *
BankTransactions
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

updateOrCreateContacts

Updates or creates one or more contacts in a Xero organisation


/Contacts

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        Boolean summarizeErrors = true;
        Phone phone = new Phone();
        phone.setPhoneNumber("555-1212");
        phone.setPhoneType(com.xero.models.accounting.Phone.PhoneTypeEnum.MOBILE);
        List<Phone> phones = new ArrayList<Phone>();
        phones.add(phone);
        Contact contact = new Contact();
        contact.setName("Bruce Banner");
        contact.setEmailAddress("hulk@avengers.com");
        contact.setPhones(phones);
        Contacts contacts = new Contacts();
        contacts.addContactsItem(contact);

        try {
            Contacts result = apiInstance.updateOrCreateContacts(accessToken, xeroTenantId, contacts, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateContacts");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Contacts contacts = { "Contacts": [ { "Name": "Bruce Banner", "EmailAddress": "hulk@avengers.com", "Phones": [ { "PhoneType": "MOBILE", "PhoneNumber": "555-1212", "PhoneAreaCode": "415" } ], "PaymentTerms": { "Bills": { "Day": 15, "Type": "OFCURRENTMONTH" }, "Sales": { "Day": 10, "Type": "DAYSAFTERBILLMONTH" } } } ] }; // Contacts | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            Contacts result = apiInstance.updateOrCreateContacts(xeroTenantId, contacts, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateContacts");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Contacts *contacts = { "Contacts": [ { "Name": "Bruce Banner", "EmailAddress": "hulk@avengers.com", "Phones": [ { "PhoneType": "MOBILE", "PhoneNumber": "555-1212", "PhoneAreaCode": "415" } ], "PaymentTerms": { "Bills": { "Day": 15, "Type": "OFCURRENTMONTH" }, "Sales": { "Day": 10, "Type": "DAYSAFTERBILLMONTH" } } } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates or creates one or more contacts in a Xero organisation
[apiInstance updateOrCreateContactsWith:xeroTenantId
    contacts:contacts
    summarizeErrors:summarizeErrors
              completionHandler: ^(Contacts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant


const summarizeErrors = true;  // {Boolean} If false return 200 OK and mix of successfully created objects and any with validation errors
const contacts: Contacts = { contacts: [{ name: "Bruce Banner", emailAddress: "hulk@avengers.com", phones: [{ phoneType: Phone.PhoneTypeEnum.MOBILE, phoneNumber: "555-1212", phoneAreaCode: "415" }], paymentTerms: { bills: { day: 15, type: PaymentTermType.OFCURRENTMONTH }, sales: { day: 10, type: PaymentTermType.DAYSAFTERBILLMONTH }}}]}

try {
  const response = await xero.accountingApi.updateOrCreateContacts(xeroTenantId, contacts,  summarizeErrors);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateOrCreateContactsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var contacts = new Contacts(); // Contacts | 
            var summarizeErrors = true;  // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors (optional)  (default to false)

            try
            {
                // Updates or creates one or more contacts in a Xero organisation
                Contacts result = apiInstance.updateOrCreateContacts(xeroTenantId, contacts, summarizeErrors);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateOrCreateContacts: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;

$phone = new XeroAPI\XeroPHP\Models\Accounting\Phone;
$phone->setPhoneNumber('555-1212');
$phone->setPhoneType(XeroAPI\XeroPHP\Models\Accounting\Phone::PHONE_TYPE_MOBILE);
$phones = [];
array_push($phones, $phone);

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setName('Bruce Banner');
$contact->setEmailAddress('hulk@avengers.com');
$contact->setPhones($phones);

$contacts = new XeroAPI\XeroPHP\Models\Accounting\Contacts;
$arr_contacts = [];
array_push($arr_contacts, $contact);
$contacts->setContacts($arr_contacts);

try {
  $result = $apiInstance->updateOrCreateContacts($xeroTenantId, $contacts, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateOrCreateContacts: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contacts = ::Object::Contacts->new(); # Contacts | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->updateOrCreateContacts(xeroTenantId => $xeroTenantId, contacts => $contacts, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateOrCreateContacts: $@\n";
}
# 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_update_or_create_contacts():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    summarizeErrors = 'True'

    phone = Phone(
        phone_number = "555-1212",
        phone_type = "MOBILE")
    
    phones = []    
    phones.append(phone)

    contact = Contact(
        name = "Bruce Banner",
        email_address = "hulk@avengers.com",
        phones = phones)

    contacts = Contacts( 
        contacts = [contact])
    
    try:
        api_response = api_instance.update_or_create_contacts(xeroTenantId, contacts, summarizeErrors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateOrCreateContacts: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contacts = { "Contacts": [ { "Name": "Bruce Banner", "EmailAddress": "hulk@avengers.com", "Phones": [ { "PhoneType": "MOBILE", "PhoneNumber": "555-1212", "PhoneAreaCode": "415" } ], "PaymentTerms": { "Bills": { "Day": 15, "Type": "OFCURRENTMONTH" }, "Sales": { "Day": 10, "Type": "DAYSAFTERBILLMONTH" } } } ] }; // Contacts
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.updateOrCreateContacts(xeroTenantId, contacts, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts Grant read-write access to contacts and contact groups

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
contacts *
Contacts
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

updateOrCreateCreditNotes

Updates or creates one or more credit notes


/CreditNotes

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes?summarizeErrors=true&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        Boolean summarizeErrors = true;
        Integer unitdp = 4;
        LocalDate currDate = LocalDate.now();
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        LineItem lineItem = new LineItem();
        lineItem.setDescription("Foobar");
        lineItem.setQuantity(1.0);
        lineItem.setUnitAmount(20.0);
        lineItem.setAccountCode("000");
        List<LineItems> lineItems = new ArrayList<LineItems>();
        lineItems.add(lineItem);
        CreditNote creditNote = new CreditNote();
        creditNote.setType(com.xero.models.accounting.CreditNote.TypeEnum.ACCPAYCREDIT);
        creditNote.setContact(contact);
        creditNote.setDate(currDate);
        creditNote.setLineItems(lineItems);
        CreditNotes creditNotes = new CreditNotes();
        creditNotes.addCreditNotesItem(creditNote);

        try {
            CreditNotes result = apiInstance.updateOrCreateCreditNotes(accessToken, xeroTenantId, creditNotes, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateCreditNotes");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        CreditNotes creditNotes = { "CreditNotes":[ { "Type":"ACCPAYCREDIT", "Contact":{ "ContactID":"430fa14a-f945-44d3-9f97-5df5e28441b8" }, "Date":"2019-01-05", "Status":"AUTHORISED", "Reference": "HelloWorld", "LineItems":[ { "Description":"Foobar", "Quantity":2.0, "UnitAmount":20.0, "AccountCode":"400" } ] } ] }; // CreditNotes | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            CreditNotes result = apiInstance.updateOrCreateCreditNotes(xeroTenantId, creditNotes, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateCreditNotes");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
CreditNotes *creditNotes = { "CreditNotes":[ { "Type":"ACCPAYCREDIT", "Contact":{ "ContactID":"430fa14a-f945-44d3-9f97-5df5e28441b8" }, "Date":"2019-01-05", "Status":"AUTHORISED", "Reference": "HelloWorld", "LineItems":[ { "Description":"Foobar", "Quantity":2.0, "UnitAmount":20.0, "AccountCode":"400" } ] } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates or creates one or more credit notes
[apiInstance updateOrCreateCreditNotesWith:xeroTenantId
    creditNotes:creditNotes
    summarizeErrors:summarizeErrors
    unitdp:unitdp
              completionHandler: ^(CreditNotes output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant


const summarizeErrors = true;  // {Boolean} If false return 200 OK and mix of successfully created objects and any with validation errors

const unitdp = 4;  // {Integer} e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
const creditNotes: CreditNotes = { creditNotes: [{ type: CreditNote.TypeEnum.ACCPAYCREDIT, contact: { contactID: "00000000-0000-0000-0000-000000000000" }, date: "2019-01-05", lineItems: [{ description: "Foobar", quantity: 2.0, unitAmount: 20.0, accountCode: "400" }]}]}

try {
  const response = await xero.accountingApi.updateOrCreateCreditNotes(xeroTenantId, creditNotes,  summarizeErrors, unitdp);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateOrCreateCreditNotesExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var creditNotes = new CreditNotes(); // CreditNotes | 
            var summarizeErrors = true;  // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors (optional)  (default to false)
            var unitdp = 4;  // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)  (default to null)

            try
            {
                // Updates or creates one or more credit notes
                CreditNotes result = apiInstance.updateOrCreateCreditNotes(xeroTenantId, creditNotes, summarizeErrors, unitdp);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateOrCreateCreditNotes: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$unitdp = 4;
$currDate = new DateTime('2020-12-10');

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
$lineItem->setDescription('Foobar');
$lineItem->setQuantity(1.0);
$lineItem->setUnitAmount(20.0);
$lineItem->setAccountCode('000');
$lineItems = [];
array_push($lineItems, $lineItem);

$creditNote = new XeroAPI\XeroPHP\Models\Accounting\CreditNote;
$creditNote->setType(XeroAPI\XeroPHP\Models\Accounting\CreditNote::TYPE_ACCPAYCREDIT);
$creditNote->setContact($contact);
$creditNote->setDate($currDate);
$creditNote->setLineItems($lineItems);

$creditNotes = new XeroAPI\XeroPHP\Models\Accounting\CreditNotes;
$arr_credit_notes = [];
array_push($arr_credit_notes, $creditNote);
$creditNotes->setCreditNotes($arr_credit_notes);

try {
  $result = $apiInstance->updateOrCreateCreditNotes($xeroTenantId, $creditNotes, $summarizeErrors, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateOrCreateCreditNotes: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $creditNotes = ::Object::CreditNotes->new(); # CreditNotes | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->updateOrCreateCreditNotes(xeroTenantId => $xeroTenantId, creditNotes => $creditNotes, summarizeErrors => $summarizeErrors, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateOrCreateCreditNotes: $@\n";
}
# 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_update_or_create_credit_notes():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    summarizeErrors = 'True'
    curr_date = dateutil.parser.parse('2020-12-03T00:00:00Z')

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    line_item = LineItem(
        description = "Foobar",
        quantity = 1.0,
        unit_amount = 20.0,
        account_code = "000")
    
    line_items = []    
    line_items.append(line_item)

    credit_note = CreditNote(
        type = "ACCPAYCREDIT",
        contact = contact,
        date = curr_date,
        line_items = line_items)

    creditNotes = CreditNotes( 
        credit_notes = [credit_note])
    
    try:
        api_response = api_instance.update_or_create_credit_notes(xeroTenantId, creditNotes, summarizeErrors, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateOrCreateCreditNotes: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let creditNotes = { "CreditNotes":[ { "Type":"ACCPAYCREDIT", "Contact":{ "ContactID":"430fa14a-f945-44d3-9f97-5df5e28441b8" }, "Date":"2019-01-05", "Status":"AUTHORISED", "Reference": "HelloWorld", "LineItems":[ { "Description":"Foobar", "Quantity":2.0, "UnitAmount":20.0, "AccountCode":"400" } ] } ] }; // CreditNotes
    let summarizeErrors = true; // Boolean
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.updateOrCreateCreditNotes(xeroTenantId, creditNotes, summarizeErrors, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
creditNotes *
CreditNotes
an array of Credit Notes with a single CreditNote object.
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

updateOrCreateEmployees

Creates a single new employees used in Xero payrun


/Employees

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Employees?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        Boolean summarizeErrors = true;
        Employee employee = new Employee();
        employee.setFirstName("Nick");
        employee.setLastName("Fury");
        Employees employees = new Employees();
        employees.addEmployeesItem(employee);

        try {
            Employees result = apiInstance.updateOrCreateEmployees(accessToken, xeroTenantId, employees, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateEmployees");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Employees employees = { "Employees": [ { "FirstName": "Nick", "LastName": "Fury", "ExternalLink": { "Url": "http://twitter.com/#!/search/Nick+Fury" } } ] }; // Employees | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            Employees result = apiInstance.updateOrCreateEmployees(xeroTenantId, employees, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateEmployees");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Employees *employees = { "Employees": [ { "FirstName": "Nick", "LastName": "Fury", "ExternalLink": { "Url": "http://twitter.com/#!/search/Nick+Fury" } } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a single new employees used in Xero payrun
[apiInstance updateOrCreateEmployeesWith:xeroTenantId
    employees:employees
    summarizeErrors:summarizeErrors
              completionHandler: ^(Employees output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant


const summarizeErrors = true;  // {Boolean} If false return 200 OK and mix of successfully created objects and any with validation errors
const employees: Employees = { employees: [{ firstName: "Nick", lastName: "Fury", externalLink: { url: "http://twitter.com/#!/search/Nick+Fury" }}]}

try {
  const response = await xero.accountingApi.updateOrCreateEmployees(xeroTenantId, employees,  summarizeErrors);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateOrCreateEmployeesExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var employees = new Employees(); // Employees | 
            var summarizeErrors = true;  // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors (optional)  (default to false)

            try
            {
                // Creates a single new employees used in Xero payrun
                Employees result = apiInstance.updateOrCreateEmployees(xeroTenantId, employees, summarizeErrors);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateOrCreateEmployees: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;

$employee = new XeroAPI\XeroPHP\Models\Accounting\Employee;
$employee->setFirstName('Nick');
$employee->setLastName('Fury');

$employees = new XeroAPI\XeroPHP\Models\Accounting\Employees;
$arr_employees = [];
array_push($arr_employees, $employee);
$employees->setEmployees($arr_employees);

try {
  $result = $apiInstance->updateOrCreateEmployees($xeroTenantId, $employees, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateOrCreateEmployees: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $employees = ::Object::Employees->new(); # Employees | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->updateOrCreateEmployees(xeroTenantId => $xeroTenantId, employees => $employees, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateOrCreateEmployees: $@\n";
}
# 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_update_or_create_employees():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    summarizeErrors = 'True'

    employee = Employee(
        first_name = "Nick",
        last_name = "Fury")

    employees = Employees( 
        employees = [employee])
    
    try:
        api_response = api_instance.update_or_create_employees(xeroTenantId, employees, summarizeErrors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateOrCreateEmployees: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let employees = { "Employees": [ { "FirstName": "Nick", "LastName": "Fury", "ExternalLink": { "Url": "http://twitter.com/#!/search/Nick+Fury" } } ] }; // Employees
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.updateOrCreateEmployees(xeroTenantId, employees, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
employees *
Employees
Employees with array of Employee object in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

updateOrCreateInvoices

Updates or creates one or more sales invoices or purchase bills


/Invoices

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices?summarizeErrors=true&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        Boolean summarizeErrors = true;
        Integer unitdp = 4;
        LocalDate dateValue = LocalDate.of(2020, Month.OCTOBER, 10);
        LocalDate dueDateValue = LocalDate.of(2020, Month.OCTOBER, 28);
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        LineItem lineItem = new LineItem();
        lineItem.setDescription("Foobar");
        lineItem.setQuantity(1.0);
        lineItem.setUnitAmount(20.0);
        lineItem.setAccountCode("000");
        List<LineItems> lineItems = new ArrayList<LineItems>();
        lineItems.add(lineItem);
        Invoice invoice = new Invoice();
        invoice.setType(com.xero.models.accounting.Invoice.TypeEnum.ACCREC);
        invoice.setContact(contact);
        invoice.setDate(dateValue);
        invoice.setDate(dueDateValue);
        invoice.setLineItems(lineItems);
        invoice.setReference("Website Design");
        invoice.setStatus(com.xero.models.accounting.Invoice.StatusEnum.DRAFT);
        Invoices invoices = new Invoices();
        invoices.addInvoicesItem(invoice);

        try {
            Invoices result = apiInstance.updateOrCreateInvoices(accessToken, xeroTenantId, invoices, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateInvoices");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Invoices invoices = { "Invoices": [ { "Type": "ACCREC", "Contact": { "ContactID": "430fa14a-f945-44d3-9f97-5df5e28441b8" }, "LineItems": [ { "Description": "Acme Tires", "Quantity": 2, "UnitAmount": 20, "AccountCode": "200", "TaxType": "NONE", "LineAmount": 40 } ], "Date": "2019-03-11", "DueDate": "2018-12-10", "Reference": "Website Design", "Status": "AUTHORISED" } ] }; // Invoices | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Invoices result = apiInstance.updateOrCreateInvoices(xeroTenantId, invoices, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateInvoices");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Invoices *invoices = { "Invoices": [ { "Type": "ACCREC", "Contact": { "ContactID": "430fa14a-f945-44d3-9f97-5df5e28441b8" }, "LineItems": [ { "Description": "Acme Tires", "Quantity": 2, "UnitAmount": 20, "AccountCode": "200", "TaxType": "NONE", "LineAmount": 40 } ], "Date": "2019-03-11", "DueDate": "2018-12-10", "Reference": "Website Design", "Status": "AUTHORISED" } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates or creates one or more sales invoices or purchase bills
[apiInstance updateOrCreateInvoicesWith:xeroTenantId
    invoices:invoices
    summarizeErrors:summarizeErrors
    unitdp:unitdp
              completionHandler: ^(Invoices output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant


const summarizeErrors = true;  // {Boolean} If false return 200 OK and mix of successfully created objects and any with validation errors

const unitdp = 4;  // {Integer} e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
const invoices: Invoices = { invoices: [{ type: Invoice.TypeEnum.ACCREC, contact: { contactID:"00000000-0000-0000-0000-000000000000" }, lineItems:[ { description:"Acme Tires", quantity:2.0, unitAmount:20.0, accountCode:"200", taxType:"NONE", lineAmount:40.0 } ], date: "2019-03-11", dueDate:"2018-12-10", reference:"Website Design", status: Invoice.StatusEnum.AUTHORISED } ] }

try {
  const response = await xero.accountingApi.updateOrCreateInvoices(xeroTenantId, invoices,  summarizeErrors, unitdp);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateOrCreateInvoicesExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var invoices = new Invoices(); // Invoices | 
            var summarizeErrors = true;  // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors (optional)  (default to false)
            var unitdp = 4;  // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)  (default to null)

            try
            {
                // Updates or creates one or more sales invoices or purchase bills
                Invoices result = apiInstance.updateOrCreateInvoices(xeroTenantId, invoices, summarizeErrors, unitdp);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateOrCreateInvoices: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$unitdp = 4;
$dateValue = new DateTime('2020-10-10');
$dueDateValue = new DateTime('2020-10-28');

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
$lineItem->setDescription('Foobar');
$lineItem->setQuantity(1.0);
$lineItem->setUnitAmount(20.0);
$lineItem->setAccountCode('000');
$lineItems = [];
array_push($lineItems, $lineItem);

$invoice = new XeroAPI\XeroPHP\Models\Accounting\Invoice;
$invoice->setType(XeroAPI\XeroPHP\Models\Accounting\Invoice::TYPE_ACCREC);
$invoice->setContact($contact);
$invoice->setDate($dateValue);
$invoice->setDate($dueDateValue);
$invoice->setLineItems($lineItems);
$invoice->setReference('Website Design');
$invoice->setStatus(XeroAPI\XeroPHP\Models\Accounting\Invoice::STATUS_DRAFT);

$invoices = new XeroAPI\XeroPHP\Models\Accounting\Invoices;
$arr_invoices = [];
array_push($arr_invoices, $invoice);
$invoices->setInvoices($arr_invoices);

try {
  $result = $apiInstance->updateOrCreateInvoices($xeroTenantId, $invoices, $summarizeErrors, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateOrCreateInvoices: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoices = ::Object::Invoices->new(); # Invoices | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->updateOrCreateInvoices(xeroTenantId => $xeroTenantId, invoices => $invoices, summarizeErrors => $summarizeErrors, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateOrCreateInvoices: $@\n";
}
# 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_update_or_create_invoices():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    summarizeErrors = 'True'
    date_value = dateutil.parser.parse('2020-10-10T00:00:00Z')
    due_date_value = dateutil.parser.parse('2020-10-28T00:00:00Z')

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    line_item = LineItem(
        description = "Foobar",
        quantity = 1.0,
        unit_amount = 20.0,
        account_code = "000")
    
    line_items = []    
    line_items.append(line_item)

    invoice = Invoice(
        type = "ACCREC",
        contact = contact,
        date = date_value,
        due_date = due_date_value,
        line_items = line_items,
        reference = "Website Design",
        status = "DRAFT")

    invoices = Invoices( 
        invoices = [invoice])
    
    try:
        api_response = api_instance.update_or_create_invoices(xeroTenantId, invoices, summarizeErrors, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateOrCreateInvoices: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoices = { "Invoices": [ { "Type": "ACCREC", "Contact": { "ContactID": "430fa14a-f945-44d3-9f97-5df5e28441b8" }, "LineItems": [ { "Description": "Acme Tires", "Quantity": 2, "UnitAmount": 20, "AccountCode": "200", "TaxType": "NONE", "LineAmount": 40 } ], "Date": "2019-03-11", "DueDate": "2018-12-10", "Reference": "Website Design", "Status": "AUTHORISED" } ] }; // Invoices
    let summarizeErrors = true; // Boolean
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.updateOrCreateInvoices(xeroTenantId, invoices, summarizeErrors, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
invoices *
Invoices
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

updateOrCreateItems

Updates or creates one or more items


/Items

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Items?summarizeErrors=true&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        Boolean summarizeErrors = true;
        Integer unitdp = 4;
        Item item = new Item();
        item.setCode("abcXYZ123");
        item.setName("HelloWorld");
        item.setDescription("Foobar");
        Items items = new Items();
        items.addItemsItem(item);

        try {
            Items result = apiInstance.updateOrCreateItems(accessToken, xeroTenantId, items, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateItems");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Items items = { "Items": [ { "Code": "ItemCode123", "Name": "ItemName XYZ", "Description": "Item Description ABC" } ] }; // Items | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Items result = apiInstance.updateOrCreateItems(xeroTenantId, items, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateItems");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Items *items = { "Items": [ { "Code": "ItemCode123", "Name": "ItemName XYZ", "Description": "Item Description ABC" } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates or creates one or more items
[apiInstance updateOrCreateItemsWith:xeroTenantId
    items:items
    summarizeErrors:summarizeErrors
    unitdp:unitdp
              completionHandler: ^(Items output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant


const summarizeErrors = true;  // {Boolean} If false return 200 OK and mix of successfully created objects and any with validation errors

const unitdp = 4;  // {Integer} e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
const items: Items = { items: [{ code: "ItemCode123", name: "ItemName XYZ", description: "Item Description ABC" }]}

try {
  const response = await xero.accountingApi.updateOrCreateItems(xeroTenantId, items,  summarizeErrors, unitdp);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateOrCreateItemsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var items = new Items(); // Items | 
            var summarizeErrors = true;  // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors (optional)  (default to false)
            var unitdp = 4;  // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)  (default to null)

            try
            {
                // Updates or creates one or more items
                Items result = apiInstance.updateOrCreateItems(xeroTenantId, items, summarizeErrors, unitdp);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateOrCreateItems: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$unitdp = 4;

$item = new XeroAPI\XeroPHP\Models\Accounting\Item;
$item->setCode('abcXYZ123');
$item->setName('HelloWorld');
$item->setDescription('Foobar');

$items = new XeroAPI\XeroPHP\Models\Accounting\Items;
$arr_items = [];
array_push($arr_items, $item);
$items->setItems($arr_items);

try {
  $result = $apiInstance->updateOrCreateItems($xeroTenantId, $items, $summarizeErrors, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateOrCreateItems: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $items = ::Object::Items->new(); # Items | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->updateOrCreateItems(xeroTenantId => $xeroTenantId, items => $items, summarizeErrors => $summarizeErrors, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateOrCreateItems: $@\n";
}
# 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_update_or_create_items():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    summarizeErrors = 'True'

    item = Item(
        code = "abcXYZ123",
        name = "HelloWorld",
        description = "Foobar")

    items = Items( 
        items = [item])
    
    try:
        api_response = api_instance.update_or_create_items(xeroTenantId, items, summarizeErrors, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateOrCreateItems: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let items = { "Items": [ { "Code": "ItemCode123", "Name": "ItemName XYZ", "Description": "Item Description ABC" } ] }; // Items
    let summarizeErrors = true; // Boolean
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.updateOrCreateItems(xeroTenantId, items, summarizeErrors, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
items *
Items
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

updateOrCreateManualJournals

Updates or creates a single manual journal


/ManualJournals

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ManualJournals?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        Boolean summarizeErrors = true;
        LocalDate dateValue = LocalDate.of(2020, Month.OCTOBER, 10);
        List<ManualJournalLine> manualJournalLines = new ArrayList<ManualJournalLine>();
        ManualJournalLine credit = new ManualJournalLine();
        credit.setLineAmount(100.0);
        credit.setAccountCode("400");
        credit.setDescription("Hello there");
        manualJournalLines.add(credit);
        ManualJournalLine debit = new ManualJournalLine();
        debit.setLineAmount(-100.0);
        debit.setAccountCode("120");
        debit.setDescription("Hello there");
        manualJournalLines.add(debit);
        ManualJournal manualJournal = new ManualJournal();
        manualJournal.setNarration("Foobar");
        manualJournal.setDate(dateValue);
        manualJournal.setJournalLines(manualJournalLines);
        ManualJournals manualJournals = new ManualJournals();
        manualJournals.addManualJournalsItem(manualJournal);

        try {
            ManualJournals result = apiInstance.updateOrCreateManualJournals(accessToken, xeroTenantId, manualJournals, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateManualJournals");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        ManualJournals manualJournals = { "ManualJournals": [ { "Narration": "Journal Desc", "JournalLines": [ { "LineAmount": 100, "AccountCode": "400", "Description": "Money Movement" }, { "LineAmount": -100, "AccountCode": "400", "Description": "Prepayment of things", "Tracking": [ { "Name": "North", "Option": "Region" } ] } ], "Date": "2019-03-14" } ] }; // ManualJournals | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            ManualJournals result = apiInstance.updateOrCreateManualJournals(xeroTenantId, manualJournals, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateManualJournals");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
ManualJournals *manualJournals = { "ManualJournals": [ { "Narration": "Journal Desc", "JournalLines": [ { "LineAmount": 100, "AccountCode": "400", "Description": "Money Movement" }, { "LineAmount": -100, "AccountCode": "400", "Description": "Prepayment of things", "Tracking": [ { "Name": "North", "Option": "Region" } ] } ], "Date": "2019-03-14" } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates or creates a single manual journal
[apiInstance updateOrCreateManualJournalsWith:xeroTenantId
    manualJournals:manualJournals
    summarizeErrors:summarizeErrors
              completionHandler: ^(ManualJournals output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant


const summarizeErrors = true;  // {Boolean} If false return 200 OK and mix of successfully created objects and any with validation errors
const manualJournals: ManualJournals = { manualJournals: [{ narration: "Foo bar", journalLines: [{ lineAmount: 100.0, accountCode: "400", description: "Hello there" },{ lineAmount: -100.0, accountCode: "400", description: "Goodbye", tracking: [{ name: "Simpsons", option: "Bart" }]}], date: "2019-03-14" }]}

try {
  const response = await xero.accountingApi.updateOrCreateManualJournals(xeroTenantId, manualJournals,  summarizeErrors);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateOrCreateManualJournalsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var manualJournals = new ManualJournals(); // ManualJournals | 
            var summarizeErrors = true;  // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors (optional)  (default to false)

            try
            {
                // Updates or creates a single manual journal
                ManualJournals result = apiInstance.updateOrCreateManualJournals(xeroTenantId, manualJournals, summarizeErrors);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateOrCreateManualJournals: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$dateValue = new DateTime('2020-10-10');
$manualJournalLines = [];

$credit = new XeroAPI\XeroPHP\Models\Accounting\ManualJournalLine;
$credit->setLineAmount(100.0);
$credit->setAccountCode('400');
$credit->setDescription('Hello there');
array_push($manualJournalLines, $credit);

$debit = new XeroAPI\XeroPHP\Models\Accounting\ManualJournalLine;
$debit->setLineAmount(-100.0);
$debit->setAccountCode('120');
$debit->setDescription('Hello there');
array_push($manualJournalLines, $debit);

$manualJournal = new XeroAPI\XeroPHP\Models\Accounting\ManualJournal;
$manualJournal->setNarration('Foobar');
$manualJournal->setDate($dateValue);
$manualJournal->setJournalLines($manualJournalLines);

$manualJournals = new XeroAPI\XeroPHP\Models\Accounting\ManualJournals;
$arr_manual_journals = [];
array_push($arr_manual_journals, $manualJournal);
$manualJournals->setManualJournals($arr_manual_journals);

try {
  $result = $apiInstance->updateOrCreateManualJournals($xeroTenantId, $manualJournals, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateOrCreateManualJournals: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $manualJournals = ::Object::ManualJournals->new(); # ManualJournals | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->updateOrCreateManualJournals(xeroTenantId => $xeroTenantId, manualJournals => $manualJournals, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateOrCreateManualJournals: $@\n";
}
# 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_update_or_create_manual_journals():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    summarizeErrors = 'True'
    date_value = dateutil.parser.parse('2020-12-03T00:00:00Z')
    
    manual_journal_lines = []

    credit = ManualJournalLine(
        line_amount = 100.0,
        account_code = "400",
        description = "Hello there")    
    manual_journal_lines.append(credit)

    debit = ManualJournalLine(
        line_amount = -100.0,
        account_code = "120",
        description = "Hello there")    
    manual_journal_lines.append(debit)

    manual_journal = ManualJournal(
        narration = "Foobar",
        date = date_value,
        journal_lines = manual_journal_lines)

    manualJournals = ManualJournals( 
        manual_journals = [manual_journal])
    
    try:
        api_response = api_instance.update_or_create_manual_journals(xeroTenantId, manualJournals, summarizeErrors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateOrCreateManualJournals: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let manualJournals = { "ManualJournals": [ { "Narration": "Journal Desc", "JournalLines": [ { "LineAmount": 100, "AccountCode": "400", "Description": "Money Movement" }, { "LineAmount": -100, "AccountCode": "400", "Description": "Prepayment of things", "Tracking": [ { "Name": "North", "Option": "Region" } ] } ], "Date": "2019-03-14" } ] }; // ManualJournals
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.updateOrCreateManualJournals(xeroTenantId, manualJournals, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
manualJournals *
ManualJournals
ManualJournals array with ManualJournal object in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

updateOrCreatePurchaseOrders

Updates or creates one or more purchase orders


/PurchaseOrders

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        Boolean summarizeErrors = true;
        LocalDate dateValue = LocalDate.of(2020, Month.OCTOBER, 10);
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        LineItem lineItem = new LineItem();
        lineItem.setDescription("Foobar");
        lineItem.setQuantity(1.0);
        lineItem.setUnitAmount(20.0);
        lineItem.setAccountCode("000");
        List<LineItems> lineItems = new ArrayList<LineItems>();
        lineItems.add(lineItem);
        PurchaseOrder purchaseOrder = new PurchaseOrder();
        purchaseOrder.setContact(contact);
        purchaseOrder.setLineItems(lineItems);
        purchaseOrder.setDate(dateValue);
        PurchaseOrders purchaseOrders = new PurchaseOrders();
        purchaseOrders.addPurchaseOrdersItem(purchaseOrder);

        try {
            PurchaseOrders result = apiInstance.updateOrCreatePurchaseOrders(accessToken, xeroTenantId, purchaseOrders, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreatePurchaseOrders");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        PurchaseOrders purchaseOrders = { "PurchaseOrders": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "LineItems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "710" } ], "Date": "2019-03-13" } ] }; // PurchaseOrders | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            PurchaseOrders result = apiInstance.updateOrCreatePurchaseOrders(xeroTenantId, purchaseOrders, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreatePurchaseOrders");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
PurchaseOrders *purchaseOrders = { "PurchaseOrders": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "LineItems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "710" } ], "Date": "2019-03-13" } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates or creates one or more purchase orders
[apiInstance updateOrCreatePurchaseOrdersWith:xeroTenantId
    purchaseOrders:purchaseOrders
    summarizeErrors:summarizeErrors
              completionHandler: ^(PurchaseOrders output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant


const summarizeErrors = true;  // {Boolean} If false return 200 OK and mix of successfully created objects and any with validation errors
const purchaseOrders: PurchaseOrders = { purchaseOrders: [ { contact: { contactID: "00000000-0000-0000-0000-000000000000" }, lineItems: [{ description: "Foobar", quantity: 1.0, unitAmount: 20.0, accountCode: "710" }], date: "2019-03-13" }]}

try {
  const response = await xero.accountingApi.updateOrCreatePurchaseOrders(xeroTenantId, purchaseOrders,  summarizeErrors);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateOrCreatePurchaseOrdersExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var purchaseOrders = new PurchaseOrders(); // PurchaseOrders | 
            var summarizeErrors = true;  // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors (optional)  (default to false)

            try
            {
                // Updates or creates one or more purchase orders
                PurchaseOrders result = apiInstance.updateOrCreatePurchaseOrders(xeroTenantId, purchaseOrders, summarizeErrors);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateOrCreatePurchaseOrders: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$dateValue = new DateTime('2020-12-10');

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
$lineItem->setDescription('Foobar');
$lineItem->setQuantity(1.0);
$lineItem->setUnitAmount(20.0);
$lineItem->setAccountCode('000');
$lineItems = [];
array_push($lineItems, $lineItem);

$purchaseOrder = new XeroAPI\XeroPHP\Models\Accounting\PurchaseOrder;
$purchaseOrder->setContact($contact);
$purchaseOrder->setLineItems($lineItems);
$purchaseOrder->setDate($dateValue);

$purchaseOrders = new XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders;
$arr_purchase_orders = [];
array_push($arr_purchase_orders, $purchaseOrder);
$purchaseOrders->setPurchaseOrders($arr_purchase_orders);

try {
  $result = $apiInstance->updateOrCreatePurchaseOrders($xeroTenantId, $purchaseOrders, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateOrCreatePurchaseOrders: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $purchaseOrders = ::Object::PurchaseOrders->new(); # PurchaseOrders | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->updateOrCreatePurchaseOrders(xeroTenantId => $xeroTenantId, purchaseOrders => $purchaseOrders, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateOrCreatePurchaseOrders: $@\n";
}
# 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_update_or_create_purchase_orders():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    summarizeErrors = 'True'
    date_value = dateutil.parser.parse('2020-12-03T00:00:00Z')

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    line_item = LineItem(
        description = "Foobar",
        quantity = 1.0,
        unit_amount = 20.0,
        account_code = "000")
    
    line_items = []    
    line_items.append(line_item)

    purchase_order = PurchaseOrder(
        contact = contact,
        line_items = line_items,
        date = date_value)

    purchaseOrders = PurchaseOrders( 
        purchase_orders = [purchase_order])
    
    try:
        api_response = api_instance.update_or_create_purchase_orders(xeroTenantId, purchaseOrders, summarizeErrors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateOrCreatePurchaseOrders: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let purchaseOrders = { "PurchaseOrders": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "LineItems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "710" } ], "Date": "2019-03-13" } ] }; // PurchaseOrders
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.updateOrCreatePurchaseOrders(xeroTenantId, purchaseOrders, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
purchaseOrders *
PurchaseOrders
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

updateOrCreateQuotes

Updates or creates one or more quotes


/Quotes

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Quotes?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        Boolean summarizeErrors = true;
        LocalDate dateValue = LocalDate.of(2020, Month.OCTOBER, 10);
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        LineItem lineItem = new LineItem();
        lineItem.setDescription("Foobar");
        lineItem.setQuantity(1.0);
        lineItem.setUnitAmount(20.0);
        lineItem.setAccountCode("000");
        List<LineItems> lineItems = new ArrayList<LineItems>();
        lineItems.add(lineItem);
        Quote quote = new Quote();
        quote.setContact(contact);
        quote.setLineItems(lineItems);
        quote.setDate(dateValue);
        Quotes quotes = new Quotes();
        quotes.addQuotesItem(quote);

        try {
            Quotes result = apiInstance.updateOrCreateQuotes(accessToken, xeroTenantId, quotes, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateQuotes");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Quotes quotes = { "Quotes": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "LineItems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "12775" } ], "Date": "2020-02-01" } ] }; // Quotes | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            Quotes result = apiInstance.updateOrCreateQuotes(xeroTenantId, quotes, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateQuotes");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Quotes *quotes = { "Quotes": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "LineItems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "12775" } ], "Date": "2020-02-01" } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates or creates one or more quotes
[apiInstance updateOrCreateQuotesWith:xeroTenantId
    quotes:quotes
    summarizeErrors:summarizeErrors
              completionHandler: ^(Quotes output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant


const summarizeErrors = true;  // {Boolean} If false return 200 OK and mix of successfully created objects and any with validation errors
const quotes: Quotes = { quotes: [{ contact: { contactID: "00000000-0000-0000-0000-000000000000" }, lineItems: [{ description: "Foobar", quantity: 1.0, unitAmount: 20.0, accountCode: "12775" }], date: "2020-02-01" }]}

try {
  const response = await xero.accountingApi.updateOrCreateQuotes(xeroTenantId, quotes,  summarizeErrors);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateOrCreateQuotesExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var quotes = new Quotes(); // Quotes | 
            var summarizeErrors = true;  // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors (optional)  (default to false)

            try
            {
                // Updates or creates one or more quotes
                Quotes result = apiInstance.updateOrCreateQuotes(xeroTenantId, quotes, summarizeErrors);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateOrCreateQuotes: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$dateValue = new DateTime('2020-12-10');

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
$lineItem->setDescription('Foobar');
$lineItem->setQuantity(1.0);
$lineItem->setUnitAmount(20.0);
$lineItem->setAccountCode('000');
$lineItems = [];
array_push($lineItems, $lineItem);

$quote = new XeroAPI\XeroPHP\Models\Accounting\Quote;
$quote->setContact($contact);
$quote->setLineItems($lineItems);
$quote->setDate($dateValue);

$quotes = new XeroAPI\XeroPHP\Models\Accounting\Quotes;
$arr_quotes = [];
array_push($arr_quotes, $quote);
$quotes->setQuotes($arr_quotes);

try {
  $result = $apiInstance->updateOrCreateQuotes($xeroTenantId, $quotes, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateOrCreateQuotes: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $quotes = ::Object::Quotes->new(); # Quotes | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->updateOrCreateQuotes(xeroTenantId => $xeroTenantId, quotes => $quotes, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateOrCreateQuotes: $@\n";
}
# 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_update_or_create_quotes():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    summarizeErrors = 'True'
    date_value = dateutil.parser.parse('2020-12-03T00:00:00Z')

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    line_item = LineItem(
        description = "Foobar",
        quantity = 1.0,
        unit_amount = 20.0,
        account_code = "000")
    
    line_items = []    
    line_items.append(line_item)

    quote = Quote(
        contact = contact,
        line_items = line_items,
        date = date_value)

    quotes = Quotes( 
        quotes = [quote])
    
    try:
        api_response = api_instance.update_or_create_quotes(xeroTenantId, quotes, summarizeErrors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateOrCreateQuotes: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let quotes = { "Quotes": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "LineItems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "12775" } ], "Date": "2020-02-01" } ] }; // Quotes
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.updateOrCreateQuotes(xeroTenantId, quotes, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
quotes *
Quotes
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

updatePurchaseOrder

Updates a specific purchase order


/PurchaseOrders/{PurchaseOrderID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders/{PurchaseOrderID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID purchaseOrderID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        PurchaseOrder purchaseOrder = new PurchaseOrder();
        purchaseOrder.setAttentionTo("Peter Parker");
        PurchaseOrders purchaseOrders = new PurchaseOrders();
        purchaseOrders.addPurchaseOrdersItem(purchaseOrder);

        try {
            PurchaseOrders result = apiInstance.updatePurchaseOrder(accessToken, xeroTenantId, purchaseOrderID, purchaseOrders);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updatePurchaseOrder");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a PurchaseOrder
        PurchaseOrders purchaseOrders = { "PurchaseOrders": [ { "AttentionTo": "Peter Parker", "LineItems": [], "Contact": {} } ] }; // PurchaseOrders | 
        try {
            PurchaseOrders result = apiInstance.updatePurchaseOrder(xeroTenantId, purchaseOrderID, purchaseOrders);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updatePurchaseOrder");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *purchaseOrderID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a PurchaseOrder (default to null)
PurchaseOrders *purchaseOrders = { "PurchaseOrders": [ { "AttentionTo": "Peter Parker", "LineItems": [], "Contact": {} } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific purchase order
[apiInstance updatePurchaseOrderWith:xeroTenantId
    purchaseOrderID:purchaseOrderID
    purchaseOrders:purchaseOrders
              completionHandler: ^(PurchaseOrders output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const purchaseOrderID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a PurchaseOrder
const purchaseOrders: PurchaseOrders = { purchaseOrders:[ { attentionTo: "Peter Parker", lineItems: [], contact: {} }]}

try {
  const response = await xero.accountingApi.updatePurchaseOrder(xeroTenantId, purchaseOrderID, purchaseOrders);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updatePurchaseOrderExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var purchaseOrderID = new UUID(); // UUID | Unique identifier for a PurchaseOrder (default to null)
            var purchaseOrders = new PurchaseOrders(); // PurchaseOrders | 

            try
            {
                // Updates a specific purchase order
                PurchaseOrders result = apiInstance.updatePurchaseOrder(xeroTenantId, purchaseOrderID, purchaseOrders);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updatePurchaseOrder: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$purchaseOrderID = "00000000-0000-0000-0000-000000000000";

$purchaseOrder = new XeroAPI\XeroPHP\Models\Accounting\PurchaseOrder;
$purchaseOrder->setAttentionTo('Peter Parker');

$purchaseOrders = new XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders;
$arr_purchase_orders = [];
array_push($arr_purchase_orders, $purchaseOrder);
$purchaseOrders->setPurchaseOrders($arr_purchase_orders);

try {
  $result = $apiInstance->updatePurchaseOrder($xeroTenantId, $purchaseOrderID, $purchaseOrders);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updatePurchaseOrder: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $purchaseOrderID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a PurchaseOrder
my $purchaseOrders = ::Object::PurchaseOrders->new(); # PurchaseOrders | 

eval { 
    my $result = $api_instance->updatePurchaseOrder(xeroTenantId => $xeroTenantId, purchaseOrderID => $purchaseOrderID, purchaseOrders => $purchaseOrders);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updatePurchaseOrder: $@\n";
}
# 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_update_purchase_order():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    purchaseOrderID = '00000000-0000-0000-0000-000000000000'

    purchase_order = PurchaseOrder(
        attentionTo = "Peter Parker")

    purchaseOrders = PurchaseOrders( 
        purchase_orders = [purchase_order])
    
    try:
        api_response = api_instance.update_purchase_order(xeroTenantId, purchaseOrderID, purchaseOrders)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updatePurchaseOrder: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID
    let purchaseOrders = { "PurchaseOrders": [ { "AttentionTo": "Peter Parker", "LineItems": [], "Contact": {} } ] }; // PurchaseOrders

    let mut context = AccountingApi::Context::default();
    let result = client.updatePurchaseOrder(xeroTenantId, purchaseOrderID, purchaseOrders, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
PurchaseOrderID*
UUID (uuid)
Unique identifier for a PurchaseOrder
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
purchaseOrders *
PurchaseOrders
Required

updatePurchaseOrderAttachmentByFileName

Updates a specific attachment for a specific purchase order by filename


/PurchaseOrders/{PurchaseOrderID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders/{PurchaseOrderID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID purchaseOrderID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.png";
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.updatePurchaseOrderAttachmentByFileName(accessToken, xeroTenantId, purchaseOrderID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updatePurchaseOrderAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Purchase Order object
        String fileName = xero-dev.png; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.updatePurchaseOrderAttachmentByFileName(xeroTenantId, purchaseOrderID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updatePurchaseOrderAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *purchaseOrderID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Purchase Order object (default to null)
String *fileName = xero-dev.png; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific attachment for a specific purchase order by filename
[apiInstance updatePurchaseOrderAttachmentByFileNameWith:xeroTenantId
    purchaseOrderID:purchaseOrderID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const purchaseOrderID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for Purchase Order object
const fileName = "xero-dev.png";  // {String} Name of the attachment
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
import * as fs from "fs";
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.updatePurchaseOrderAttachmentByFileName(xeroTenantId, purchaseOrderID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updatePurchaseOrderAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var purchaseOrderID = new UUID(); // UUID | Unique identifier for Purchase Order object (default to null)
            var fileName = xero-dev.png;  // String | Name of the attachment (default to null)
            var body = BYTE_ARRAY_DATA_HERE;  // byte[] | 

            try
            {
                // Updates a specific attachment for a specific purchase order by filename
                Attachments result = apiInstance.updatePurchaseOrderAttachmentByFileName(xeroTenantId, purchaseOrderID, fileName, body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updatePurchaseOrderAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$purchaseOrderID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.png";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->updatePurchaseOrderAttachmentByFileName($xeroTenantId, $purchaseOrderID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updatePurchaseOrderAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $purchaseOrderID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Purchase Order object
my $fileName = xero-dev.png; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->updatePurchaseOrderAttachmentByFileName(xeroTenantId => $xeroTenantId, purchaseOrderID => $purchaseOrderID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updatePurchaseOrderAttachmentByFileName: $@\n";
}
# 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_update_purchase_order_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    purchaseOrderID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.png'
    
        // TODO: BINARY CREATE 
    try:
        api_response = api_instance.update_purchase_order_attachment_by_file_name(xeroTenantId, purchaseOrderID, fileName, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updatePurchaseOrderAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.png; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.updatePurchaseOrderAttachmentByFileName(xeroTenantId, purchaseOrderID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
PurchaseOrderID*
UUID (uuid)
Unique identifier for Purchase Order object
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

updateQuote

Updates a specific quote


/Quotes/{QuoteID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Quotes/{QuoteID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID quoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        LocalDate dateValue = LocalDate.of(2020, Month.OCTOBER, 10);
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        Quote quote = new Quote();
        quote.setReference("I am an update");
        quote.setContact(contact);
        quote.setDate(dateValue);
        Quotes quotes = new Quotes();
        quotes.addQuotesItem(quote);

        try {
            Quotes result = apiInstance.updateQuote(accessToken, xeroTenantId, quoteID, quotes);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateQuote");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID quoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Quote
        Quotes quotes = { "Quotes": [ { "Reference": "I am an update", "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "Date": "2020-02-01" } ] }; // Quotes | 
        try {
            Quotes result = apiInstance.updateQuote(xeroTenantId, quoteID, quotes);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateQuote");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *quoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Quote (default to null)
Quotes *quotes = { "Quotes": [ { "Reference": "I am an update", "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "Date": "2020-02-01" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific quote
[apiInstance updateQuoteWith:xeroTenantId
    quoteID:quoteID
    quotes:quotes
              completionHandler: ^(Quotes output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const quoteID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for an Quote
const quotes: Quotes = { quotes: [{ reference: "I am an update", contact: { contactID: "00000000-0000-0000-0000-000000000000" }, date: "2020-02-01" }]}

try {
  const response = await xero.accountingApi.updateQuote(xeroTenantId, quoteID, quotes);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateQuoteExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var quoteID = new UUID(); // UUID | Unique identifier for an Quote (default to null)
            var quotes = new Quotes(); // Quotes | 

            try
            {
                // Updates a specific quote
                Quotes result = apiInstance.updateQuote(xeroTenantId, quoteID, quotes);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateQuote: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$quoteID = "00000000-0000-0000-0000-000000000000";
$dateValue = new DateTime('2020-12-10');

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$quote = new XeroAPI\XeroPHP\Models\Accounting\Quote;
$quote->setReference('I am an update');
$quote->setContact($contact);
$quote->setDate($dateValue);

$quotes = new XeroAPI\XeroPHP\Models\Accounting\Quotes;
$arr_quotes = [];
array_push($arr_quotes, $quote);
$quotes->setQuotes($arr_quotes);

try {
  $result = $apiInstance->updateQuote($xeroTenantId, $quoteID, $quotes);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateQuote: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $quoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Quote
my $quotes = ::Object::Quotes->new(); # Quotes | 

eval { 
    my $result = $api_instance->updateQuote(xeroTenantId => $xeroTenantId, quoteID => $quoteID, quotes => $quotes);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateQuote: $@\n";
}
# 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_update_quote():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    quoteID = '00000000-0000-0000-0000-000000000000'
    date_value = dateutil.parser.parse('2020-12-03T00:00:00Z')

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    quote = Quote(
        reference = "I am an update",
        contact = contact,
        date = date_value)

    quotes = Quotes( 
        quotes = [quote])
    
    try:
        api_response = api_instance.update_quote(xeroTenantId, quoteID, quotes)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateQuote: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let quoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let quotes = { "Quotes": [ { "Reference": "I am an update", "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "Date": "2020-02-01" } ] }; // Quotes

    let mut context = AccountingApi::Context::default();
    let result = client.updateQuote(xeroTenantId, quoteID, quotes, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
QuoteID*
UUID (uuid)
Unique identifier for an Quote
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
quotes *
Quotes
Required

updateQuoteAttachmentByFileName

Updates a specific attachment from a specific quote by filename


/Quotes/{QuoteID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Quotes/{QuoteID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID quoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.updateQuoteAttachmentByFileName(accessToken, xeroTenantId, quoteID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateQuoteAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID quoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Quote object
        String fileName = xero-dev.jpg; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.updateQuoteAttachmentByFileName(xeroTenantId, quoteID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateQuoteAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *quoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Quote object (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific attachment from a specific quote by filename
[apiInstance updateQuoteAttachmentByFileNameWith:xeroTenantId
    quoteID:quoteID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const quoteID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for Quote object
const fileName = "xero-dev.jpg";  // {String} Name of the attachment
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
import * as fs from "fs";
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.updateQuoteAttachmentByFileName(xeroTenantId, quoteID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateQuoteAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var quoteID = new UUID(); // UUID | Unique identifier for Quote object (default to null)
            var fileName = xero-dev.jpg;  // String | Name of the attachment (default to null)
            var body = BYTE_ARRAY_DATA_HERE;  // byte[] | 

            try
            {
                // Updates a specific attachment from a specific quote by filename
                Attachments result = apiInstance.updateQuoteAttachmentByFileName(xeroTenantId, quoteID, fileName, body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateQuoteAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$quoteID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->updateQuoteAttachmentByFileName($xeroTenantId, $quoteID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateQuoteAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $quoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Quote object
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->updateQuoteAttachmentByFileName(xeroTenantId => $xeroTenantId, quoteID => $quoteID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateQuoteAttachmentByFileName: $@\n";
}
# 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_update_quote_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    quoteID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    
        // TODO: BINARY CREATE 
    try:
        api_response = api_instance.update_quote_attachment_by_file_name(xeroTenantId, quoteID, fileName, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateQuoteAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let quoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.updateQuoteAttachmentByFileName(xeroTenantId, quoteID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
QuoteID*
UUID (uuid)
Unique identifier for Quote object
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

updateReceipt

Updates a specific draft expense claim receipts


/Receipts/{ReceiptID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Receipts/{ReceiptID}?unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID receiptID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Integer unitdp = 4;
        LocalDate dateValue = LocalDate.of(2020, Month.OCTOBER, 10);
        User user = new User();
        user.setUserID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        Receipt receipt = new Receipt();
        receipt.setUser(user);
        receipt.setReference("Foobar");
        receipt.setDate(dateValue);
        Receipts receipts = new Receipts();
        receipts.addReceiptsItem(receipt);

        try {
            Receipts result = apiInstance.updateReceipt(accessToken, xeroTenantId, receiptID, receipts, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateReceipt");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID receiptID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Receipt
        Receipts receipts = { "Receipts": [ { "Lineitems": [], "User": { "UserID": "00000000-0000-0000-0000-000000000000" }, "Reference": "Foobar" } ] }; // Receipts | 
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Receipts result = apiInstance.updateReceipt(xeroTenantId, receiptID, receipts, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateReceipt");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *receiptID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Receipt (default to null)
Receipts *receipts = { "Receipts": [ { "Lineitems": [], "User": { "UserID": "00000000-0000-0000-0000-000000000000" }, "Reference": "Foobar" } ] }; // 
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific draft expense claim receipts
[apiInstance updateReceiptWith:xeroTenantId
    receiptID:receiptID
    receipts:receipts
    unitdp:unitdp
              completionHandler: ^(Receipts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const receiptID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Receipt


const unitdp = 4;  // {Integer} e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
const receipts: Receipts = { receipts: [{ user: { userID: "00000000-0000-0000-0000-000000000000" }, reference: "Foobar", date: "2020-01-01", contact: {}, lineItems: [] }]}

try {
  const response = await xero.accountingApi.updateReceipt(xeroTenantId, receiptID, receipts,  unitdp);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateReceiptExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var receiptID = new UUID(); // UUID | Unique identifier for a Receipt (default to null)
            var receipts = new Receipts(); // Receipts | 
            var unitdp = 4;  // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional)  (default to null)

            try
            {
                // Updates a specific draft expense claim receipts
                Receipts result = apiInstance.updateReceipt(xeroTenantId, receiptID, receipts, unitdp);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateReceipt: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$receiptID = "00000000-0000-0000-0000-000000000000";
$unitdp = 4;
$dateValue = new DateTime('2020-12-10');

$user = new XeroAPI\XeroPHP\Models\Accounting\User;
$user->setUserID('00000000-0000-0000-0000-000000000000');

$receipt = new XeroAPI\XeroPHP\Models\Accounting\Receipt;
$receipt->setUser($user);
$receipt->setReference('Foobar');
$receipt->setDate($dateValue);

$receipts = new XeroAPI\XeroPHP\Models\Accounting\Receipts;
$arr_receipts = [];
array_push($arr_receipts, $receipt);
$receipts->setReceipts($arr_receipts);

try {
  $result = $apiInstance->updateReceipt($xeroTenantId, $receiptID, $receipts, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateReceipt: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $receiptID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Receipt
my $receipts = ::Object::Receipts->new(); # Receipts | 
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->updateReceipt(xeroTenantId => $xeroTenantId, receiptID => $receiptID, receipts => $receipts, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateReceipt: $@\n";
}
# 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_update_receipt():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    receiptID = '00000000-0000-0000-0000-000000000000'
    dateValue = dateutil.parser.parse('2020-10-10T00:00:00Z')

    user = User(
        user_id = "00000000-0000-0000-0000-000000000000")

    receipt = Receipt(
        user = user,
        reference = "Foobar",
        date = dateValue)

    receipts = Receipts( 
        receipts = [receipt])
    
    try:
        api_response = api_instance.update_receipt(xeroTenantId, receiptID, receipts, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateReceipt: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let receiptID = 00000000-0000-0000-0000-000000000000; // UUID
    let receipts = { "Receipts": [ { "Lineitems": [], "User": { "UserID": "00000000-0000-0000-0000-000000000000" }, "Reference": "Foobar" } ] }; // Receipts
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.updateReceipt(xeroTenantId, receiptID, receipts, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
ReceiptID*
UUID (uuid)
Unique identifier for a Receipt
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
receipts *
Receipts
Required
Query parameters
Name Description
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

updateReceiptAttachmentByFileName

Updates a specific attachment on a specific expense claim receipts by file name


/Receipts/{ReceiptID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Receipts/{ReceiptID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID receiptID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.updateReceiptAttachmentByFileName(accessToken, xeroTenantId, receiptID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateReceiptAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID receiptID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Receipt
        String fileName = xero-dev.jpg; // String | The name of the file being attached to the Receipt
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.updateReceiptAttachmentByFileName(xeroTenantId, receiptID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateReceiptAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *receiptID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Receipt (default to null)
String *fileName = xero-dev.jpg; // The name of the file being attached to the Receipt (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific attachment on a specific expense claim receipts by file name
[apiInstance updateReceiptAttachmentByFileNameWith:xeroTenantId
    receiptID:receiptID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const receiptID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Receipt
const fileName = "xero-dev.jpg";  // {String} The name of the file being attached to the Receipt
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
import * as fs from "fs";
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.updateReceiptAttachmentByFileName(xeroTenantId, receiptID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateReceiptAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var receiptID = new UUID(); // UUID | Unique identifier for a Receipt (default to null)
            var fileName = xero-dev.jpg;  // String | The name of the file being attached to the Receipt (default to null)
            var body = BYTE_ARRAY_DATA_HERE;  // byte[] | 

            try
            {
                // Updates a specific attachment on a specific expense claim receipts by file name
                Attachments result = apiInstance.updateReceiptAttachmentByFileName(xeroTenantId, receiptID, fileName, body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateReceiptAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$receiptID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->updateReceiptAttachmentByFileName($xeroTenantId, $receiptID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateReceiptAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $receiptID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Receipt
my $fileName = xero-dev.jpg; # String | The name of the file being attached to the Receipt
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->updateReceiptAttachmentByFileName(xeroTenantId => $xeroTenantId, receiptID => $receiptID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateReceiptAttachmentByFileName: $@\n";
}
# 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_update_receipt_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    receiptID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    
        // TODO: BINARY CREATE 
    try:
        api_response = api_instance.update_receipt_attachment_by_file_name(xeroTenantId, receiptID, fileName, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateReceiptAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let receiptID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.updateReceiptAttachmentByFileName(xeroTenantId, receiptID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
ReceiptID*
UUID (uuid)
Unique identifier for a Receipt
Required
FileName*
String
The name of the file being attached to the Receipt
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

updateRepeatingInvoiceAttachmentByFileName

Updates a specific attachment from a specific repeating invoices by file name


/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID repeatingInvoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = "xero-dev.jpg";
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.updateRepeatingInvoiceAttachmentByFileName(accessToken, xeroTenantId, repeatingInvoiceID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateRepeatingInvoiceAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Repeating Invoice
        String fileName = xero-dev.jpg; // String | The name of the file being attached to a Repeating Invoice
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.updateRepeatingInvoiceAttachmentByFileName(xeroTenantId, repeatingInvoiceID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateRepeatingInvoiceAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Repeating Invoice (default to null)
String *fileName = xero-dev.jpg; // The name of the file being attached to a Repeating Invoice (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific attachment from a specific repeating invoices by file name
[apiInstance updateRepeatingInvoiceAttachmentByFileNameWith:xeroTenantId
    repeatingInvoiceID:repeatingInvoiceID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const repeatingInvoiceID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Repeating Invoice
const fileName = "xero-dev.jpg";  // {String} The name of the file being attached to a Repeating Invoice
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
import * as fs from "fs";
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.updateRepeatingInvoiceAttachmentByFileName(xeroTenantId, repeatingInvoiceID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateRepeatingInvoiceAttachmentByFileNameExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var repeatingInvoiceID = new UUID(); // UUID | Unique identifier for a Repeating Invoice (default to null)
            var fileName = xero-dev.jpg;  // String | The name of the file being attached to a Repeating Invoice (default to null)
            var body = BYTE_ARRAY_DATA_HERE;  // byte[] | 

            try
            {
                // Updates a specific attachment from a specific repeating invoices by file name
                Attachments result = apiInstance.updateRepeatingInvoiceAttachmentByFileName(xeroTenantId, repeatingInvoiceID, fileName, body);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateRepeatingInvoiceAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$repeatingInvoiceID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->updateRepeatingInvoiceAttachmentByFileName($xeroTenantId, $repeatingInvoiceID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateRepeatingInvoiceAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Repeating Invoice
my $fileName = xero-dev.jpg; # String | The name of the file being attached to a Repeating Invoice
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->updateRepeatingInvoiceAttachmentByFileName(xeroTenantId => $xeroTenantId, repeatingInvoiceID => $repeatingInvoiceID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateRepeatingInvoiceAttachmentByFileName: $@\n";
}
# 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_update_repeating_invoice_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    repeatingInvoiceID = '00000000-0000-0000-0000-000000000000'
    fileName = 'xero-dev.jpg'
    
        // TODO: BINARY CREATE 
    try:
        api_response = api_instance.update_repeating_invoice_attachment_by_file_name(xeroTenantId, repeatingInvoiceID, fileName, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateRepeatingInvoiceAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.updateRepeatingInvoiceAttachmentByFileName(xeroTenantId, repeatingInvoiceID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
RepeatingInvoiceID*
UUID (uuid)
Unique identifier for a Repeating Invoice
Required
FileName*
String
The name of the file being attached to a Repeating Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

updateTaxRate

Updates tax rates


/TaxRates

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/TaxRates"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        TaxComponent taxComponent = new TaxComponent();
        taxComponent.setName("State Tax");
        taxComponent.setRate(2.25);
        List<TaxComponents> taxComponents = new ArrayList<TaxComponents>();
        taxComponents.add(taxComponent);
        TaxRate taxRate = new TaxRate();
        taxRate.setName("CA State Tax");
        taxRate.setTaxComponents(taxComponents);
        TaxRates taxRates = new TaxRates();
        taxRates.addTaxRatesItem(taxRate);

        try {
            TaxRates result = apiInstance.updateTaxRate(accessToken, xeroTenantId, taxRates);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateTaxRate");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        TaxRates taxRates = { "TaxRates": [ { "Name": "State Tax NY", "TaxComponents": [ { "Name": "State Tax", "Rate": 2.25 } ], "Status": "DELETED", "ReportTaxType": "INPUT" } ] }; // TaxRates | 
        try {
            TaxRates result = apiInstance.updateTaxRate(xeroTenantId, taxRates);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateTaxRate");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
TaxRates *taxRates = { "TaxRates": [ { "Name": "State Tax NY", "TaxComponents": [ { "Name": "State Tax", "Rate": 2.25 } ], "Status": "DELETED", "ReportTaxType": "INPUT" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates tax rates
[apiInstance updateTaxRateWith:xeroTenantId
    taxRates:taxRates
              completionHandler: ^(TaxRates output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const taxRates: TaxRates = { taxRates: [{ name: "State Tax NY", taxComponents: [{ name: "State Tax", rate: 2.25 }], status: TaxRate.StatusEnum.DELETED, reportTaxType: TaxRate.ReportTaxTypeEnum.INPUT }]}

try {
  const response = await xero.accountingApi.updateTaxRate(xeroTenantId, taxRates);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateTaxRateExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var taxRates = new TaxRates(); // TaxRates | 

            try
            {
                // Updates tax rates
                TaxRates result = apiInstance.updateTaxRate(xeroTenantId, taxRates);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateTaxRate: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

$taxComponent = new XeroAPI\XeroPHP\Models\Accounting\TaxComponent;
$taxComponent->setName('State Tax');
$taxComponent->setRate(2.25);
$taxComponents = [];
array_push($taxComponents, $taxComponent);

$taxRate = new XeroAPI\XeroPHP\Models\Accounting\TaxRate;
$taxRate->setName('CA State Tax');
$taxRate->setTaxComponents($taxComponents);

$taxRates = new XeroAPI\XeroPHP\Models\Accounting\TaxRates;
$arr_tax_rates = [];
array_push($arr_tax_rates, $taxRate);
$taxRates->setTaxRates($arr_tax_rates);

try {
  $result = $apiInstance->updateTaxRate($xeroTenantId, $taxRates);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateTaxRate: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $taxRates = ::Object::TaxRates->new(); # TaxRates | 

eval { 
    my $result = $api_instance->updateTaxRate(xeroTenantId => $xeroTenantId, taxRates => $taxRates);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateTaxRate: $@\n";
}
# 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_update_tax_rate():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'

    tax_component = TaxComponent(
        name = "State Tax",
        rate = 2.25)
    
    taxComponents = []    
    tax_components.append(tax_component)

    tax_rate = TaxRate(
        name = "CA State Tax",
        taxComponents = taxComponents,

    taxRates = TaxRates( 
        tax_rates = [tax_rate])
    
    try:
        api_response = api_instance.update_tax_rate(xeroTenantId, taxRates)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateTaxRate: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let taxRates = { "TaxRates": [ { "Name": "State Tax NY", "TaxComponents": [ { "Name": "State Tax", "Rate": 2.25 } ], "Status": "DELETED", "ReportTaxType": "INPUT" } ] }; // TaxRates

    let mut context = AccountingApi::Context::default();
    let result = client.updateTaxRate(xeroTenantId, taxRates, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
taxRates *
TaxRates
Required

updateTrackingCategory

Updates a specific tracking category


/TrackingCategories/{TrackingCategoryID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/TrackingCategories/{TrackingCategoryID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID trackingCategoryID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        TrackingCategory trackingCategory = new TrackingCategory();
        trackingCategory.setName("Foobar");

        try {
            TrackingCategories result = apiInstance.updateTrackingCategory(accessToken, xeroTenantId, trackingCategoryID, trackingCategory);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateTrackingCategory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID trackingCategoryID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a TrackingCategory
        TrackingCategory trackingCategory = { "Name": "Avengers" }; // TrackingCategory | 
        try {
            TrackingCategories result = apiInstance.updateTrackingCategory(xeroTenantId, trackingCategoryID, trackingCategory);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateTrackingCategory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *trackingCategoryID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a TrackingCategory (default to null)
TrackingCategory *trackingCategory = { "Name": "Avengers" }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific tracking category
[apiInstance updateTrackingCategoryWith:xeroTenantId
    trackingCategoryID:trackingCategoryID
    trackingCategory:trackingCategory
              completionHandler: ^(TrackingCategories output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);

const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const trackingCategoryID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a TrackingCategory
const trackingCategory: TrackingCategory = { name: "Avengers" }

try {
  const response = await xero.accountingApi.updateTrackingCategory(xeroTenantId, trackingCategoryID, trackingCategory);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateTrackingCategoryExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var trackingCategoryID = new UUID(); // UUID | Unique identifier for a TrackingCategory (default to null)
            var trackingCategory = new TrackingCategory(); // TrackingCategory | 

            try
            {
                // Updates a specific tracking category
                TrackingCategories result = apiInstance.updateTrackingCategory(xeroTenantId, trackingCategoryID, trackingCategory);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateTrackingCategory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$trackingCategoryID = "00000000-0000-0000-0000-000000000000";

$trackingCategory = new XeroAPI\XeroPHP\Models\Accounting\TrackingCategory;
$trackingCategory->setName('Foobar');

try {
  $result = $apiInstance->updateTrackingCategory($xeroTenantId, $trackingCategoryID, $trackingCategory);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateTrackingCategory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $trackingCategoryID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a TrackingCategory
my $trackingCategory = ::Object::TrackingCategory->new(); # TrackingCategory | 

eval { 
    my $result = $api_instance->updateTrackingCategory(xeroTenantId => $xeroTenantId, trackingCategoryID => $trackingCategoryID, trackingCategory => $trackingCategory);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateTrackingCategory: $@\n";
}
# 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_update_tracking_category():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    trackingCategoryID = '00000000-0000-0000-0000-000000000000'

    trackingCategory = TrackingCategory(
        name = "Foobar")
    
    try:
        api_response = api_instance.update_tracking_category(xeroTenantId, trackingCategoryID, trackingCategory)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateTrackingCategory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let trackingCategoryID = 00000000-0000-0000-0000-000000000000; // UUID
    let trackingCategory = { "Name": "Avengers" }; // TrackingCategory

    let mut context = AccountingApi::Context::default();
    let result = client.updateTrackingCategory(xeroTenantId, trackingCategoryID, trackingCategory, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Path parameters
Name Description
TrackingCategoryID*
UUID (uuid)
Unique identifier for a TrackingCategory
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
trackingCategory *
TrackingCategory
Required

updateTrackingOptions

Updates a specific option for a specific tracking category


/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        // Init AccountingApi client
        ApiClient defaultClient = new ApiClient();

        // Get Singleton - instance of accounting client
        apiInstance = AccountingApi.getInstance(defaultClient);	
        
        String xeroTenantId = "YOUR_XERO_TENANT_ID";
        UUID trackingCategoryID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID trackingOptionID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        TrackingOption trackingOption = new TrackingOption();
        trackingOption.setName("Foobar");

        try {
            TrackingOptions result = apiInstance.updateTrackingOptions(accessToken, xeroTenantId, trackingCategoryID, trackingOptionID, trackingOption);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateTrackingOptions");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID trackingCategoryID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a TrackingCategory
        UUID trackingOptionID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Tracking Option
        TrackingOption trackingOption = { name: "Vision" }; // TrackingOption | 
        try {
            TrackingOptions result = apiInstance.updateTrackingOptions(xeroTenantId, trackingCategoryID, trackingOptionID, trackingOption);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateTrackingOptions");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *trackingCategoryID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a TrackingCategory (default to null)
UUID *trackingOptionID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Tracking Option (default to null)
TrackingOption *trackingOption = { name: "Vision" }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific option for a specific tracking category
[apiInstance updateTrackingOptionsWith:xeroTenantId
    trackingCategoryID:trackingCategoryID
    trackingOptionID:trackingOptionID
    trackingOption:trackingOption
              completionHandler: ^(TrackingOptions output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
const tokenSet: TokenSet =  {
  id_token: 'xxx',
  access_token: 'yyy',
  expires_at: 1582308862,
  token_type: 'Bearer',
  refresh_token: 'zzz',
  session_state: 'xxx'
}
await xero.setTokenSet(tokenSet);
const trackingOption: TrackingOption = { name: "Vision" };  // {TrackingOption} 
const xeroTenantId = "YOUR_XERO_TENANT_ID";  // {String} Xero identifier for Tenant
const trackingCategoryID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a TrackingCategory
const trackingOptionID = "00000000-0000-0000-0000-000000000000";  // {UUID} Unique identifier for a Tracking Option


try {
  const response = await xero.accountingApi.updateTrackingOptions(xeroTenantId, trackingCategoryID, trackingOptionID, trackingOption);
  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}`);
}
using System;
using System.Diagnostics;
using .Api;
using .Client;
using .Model;

namespace Example
{
    public class updateTrackingOptionsExample
    {
        public void main()
        {
            
            // Configure OAuth2 access token for authorization: OAuth2
            Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new AccountingApi();
            var xeroTenantId = YOUR_XERO_TENANT_ID;  // String | Xero identifier for Tenant (default to null)
            var trackingCategoryID = new UUID(); // UUID | Unique identifier for a TrackingCategory (default to null)
            var trackingOptionID = new UUID(); // UUID | Unique identifier for a Tracking Option (default to null)
            var trackingOption = new TrackingOption(); // TrackingOption | 

            try
            {
                // Updates a specific option for a specific tracking category
                TrackingOptions result = apiInstance.updateTrackingOptions(xeroTenantId, trackingCategoryID, trackingOptionID, trackingOption);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountingApi.updateTrackingOptions: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$trackingCategoryID = "00000000-0000-0000-0000-000000000000";
$trackingOptionID = "00000000-0000-0000-0000-000000000000";

$trackingOption = new XeroAPI\XeroPHP\Models\Accounting\TrackingOption;
$trackingOption->setName('Foobar');

try {
  $result = $apiInstance->updateTrackingOptions($xeroTenantId, $trackingCategoryID, $trackingOptionID, $trackingOption);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateTrackingOptions: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $trackingCategoryID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a TrackingCategory
my $trackingOptionID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Tracking Option
my $trackingOption = ::Object::TrackingOption->new(); # TrackingOption | 

eval { 
    my $result = $api_instance->updateTrackingOptions(xeroTenantId => $xeroTenantId, trackingCategoryID => $trackingCategoryID, trackingOptionID => $trackingOptionID, trackingOption => $trackingOption);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateTrackingOptions: $@\n";
}
# 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_update_tracking_options():
    api_instance = AccountingApi(api_client)
    xeroTenantId = 'YOUR_XERO_TENANT_ID'
    trackingCategoryID = '00000000-0000-0000-0000-000000000000'
    trackingOptionID = '00000000-0000-0000-0000-000000000000'

    trackingOption = TrackingOption(
        name = "Foobar")
    
    try:
        api_response = api_instance.update_tracking_options(xeroTenantId, trackingCategoryID, trackingOptionID, trackingOption)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateTrackingOptions: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let trackingCategoryID = 00000000-0000-0000-0000-000000000000; // UUID
    let trackingOptionID = 00000000-0000-0000-0000-000000000000; // UUID
    let trackingOption = { name: "Vision" }; // TrackingOption

    let mut context = AccountingApi::Context::default();
    let result = client.updateTrackingOptions(xeroTenantId, trackingCategoryID, trackingOptionID, trackingOption, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Path parameters
Name Description
TrackingCategoryID*
UUID (uuid)
Unique identifier for a TrackingCategory
Required
TrackingOptionID*
UUID (uuid)
Unique identifier for a Tracking Option
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
trackingOption *
TrackingOption
Required