Xero Accounting API

Accounting

createAccount

Creates a new chart of accounts


/Accounts

Usage and SDK Samples

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateAccountExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";

            var account = new Account();
            account.Code = "123456";
            account.Name = "FooBar";
            account.Type = AccountType.EXPENSE;
            account.Description = "Hello World";
            
            try {
                var result = await apiInstance.CreateAccountAsync(accessToken, xeroTenantId, account);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateAccount: " + e.Message );
            }
        }
    }
}

Scopes

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

Parameters

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateAccountAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var accountID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.CreateAccountAttachmentByFileNameAsync(accessToken, xeroTenantId, accountID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateAccountAttachmentByFileName: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateBankTransactionAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransactionID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.CreateBankTransactionAttachmentByFileNameAsync(accessToken, xeroTenantId, bankTransactionID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateBankTransactionAttachmentByFileName: " + e.Message );
            }
        }
    }
}

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
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

createBankTransactionHistoryRecord

Creates a history record for a specific bank transactions


/BankTransactions/{BankTransactionID}/History

Usage and SDK Samples

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateBankTransactionHistoryRecordExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransactionID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreateBankTransactionHistoryRecordAsync(accessToken, xeroTenantId, bankTransactionID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateBankTransactionHistoryRecord: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateBankTransactionsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;
            var unitdp = 4;

            var contact = new Contact();
            contact.ContactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var lineItem = new LineItem();
            lineItem.Description = "Foobar";
            lineItem.Quantity = new decimal(1.0);
            lineItem.UnitAmount = new decimal(20.0);
            lineItem.AccountCode = "000";
            var lineItems = new List<LineItem>();
            lineItems.Add(lineItem);

            var bankAccount = new Account();
            bankAccount.AccountID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var bankTransaction = new BankTransaction();
            bankTransaction.Type = BankTransaction.TypeEnum.RECEIVE;
            bankTransaction.Contact = contact;
            bankTransaction.LineItems = lineItems;
            bankTransaction.BankAccount = bankAccount;

            var bankTransactions = new BankTransactions();
            var bankTransactionsList = new List<BankTransaction>();
            bankTransactionsList.Add(bankTransaction); 
            bankTransactions._BankTransactions = bankTransactionsList;
            
            try {
                var result = await apiInstance.CreateBankTransactionsAsync(accessToken, xeroTenantId, bankTransactions, summarizeErrors, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateBankTransactions: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateBankTransferExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";

            var fromBankAccount = new Account();
            fromBankAccount.AccountID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var toBankAccount = new Account();
            toBankAccount.AccountID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var bankTransfer = new BankTransfer();
            bankTransfer.FromBankAccount = fromBankAccount;
            bankTransfer.ToBankAccount = toBankAccount;
            bankTransfer.Amount = new decimal(1.0);

            var bankTransfers = new BankTransfers();
            var bankTransfersList = new List<BankTransfer>();
            bankTransfersList.Add(bankTransfer); 
            bankTransfers._BankTransfers = bankTransfersList;
            
            try {
                var result = await apiInstance.CreateBankTransferAsync(accessToken, xeroTenantId, bankTransfers);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateBankTransfer: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateBankTransferAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransferID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.CreateBankTransferAttachmentByFileNameAsync(accessToken, xeroTenantId, bankTransferID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateBankTransferAttachmentByFileName: " + e.Message );
            }
        }
    }
}

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
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

createBankTransferHistoryRecord

Creates a history record for a specific bank transfer


/BankTransfers/{BankTransferID}/History

Usage and SDK Samples

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateBankTransferHistoryRecordExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransferID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreateBankTransferHistoryRecordAsync(accessToken, xeroTenantId, bankTransferID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateBankTransferHistoryRecord: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateBatchPaymentExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;
            var currDate = DateTime.Now;

            var paymentAccount = new Account();
            paymentAccount.AccountID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var bankAccount = new Account();
            bankAccount.AccountID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var invoice = new Invoice();
            invoice.InvoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var payment = new Payment();
            payment.Account = bankAccount;
            payment.Date = currDate;
            payment.Amount = new decimal(1.0);
            payment.Invoice = invoice;
            var payments = new List<Payment>();
            payments.Add(payment);

            var batchPayment = new BatchPayment();
            batchPayment.Account = paymentAccount;
            batchPayment.Reference = "hello foobar";
            batchPayment.Date = currDate;
            batchPayment.Payments = payments;

            var batchPayments = new BatchPayments();
            var batchPaymentsList = new List<BatchPayment>();
            batchPaymentsList.Add(batchPayment); 
            batchPayments._BatchPayments = batchPaymentsList;
            
            try {
                var result = await apiInstance.CreateBatchPaymentAsync(accessToken, xeroTenantId, batchPayments, summarizeErrors);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateBatchPayment: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateBatchPaymentHistoryRecordExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var batchPaymentID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreateBatchPaymentHistoryRecordAsync(accessToken, xeroTenantId, batchPaymentID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateBatchPaymentHistoryRecord: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateBrandingThemePaymentServicesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var brandingThemeID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var paymentService = new PaymentService();
            paymentService.PaymentServiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            paymentService.PaymentServiceName = "ACME Payments";
            paymentService.PaymentServiceUrl = "https://www.payupnow.com/";
            paymentService.PayNowText = "Pay Now";
            
            try {
                var result = await apiInstance.CreateBrandingThemePaymentServicesAsync(accessToken, xeroTenantId, brandingThemeID, paymentService);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateBrandingThemePaymentServices: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateContactAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.CreateContactAttachmentByFileNameAsync(accessToken, xeroTenantId, contactID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateContactAttachmentByFileName: " + e.Message );
            }
        }
    }
}

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 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

createContactGroup

Creates a contact group


/ContactGroups

Usage and SDK Samples

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateContactGroupExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";

            var contactGroup = new ContactGroup();
            contactGroup.Name = "VIPs";

            var contactGroups = new ContactGroups();
            var contactGroupsList = new List<ContactGroup>();
            contactGroupsList.Add(contactGroup); 
            contactGroups._ContactGroups = contactGroupsList;
            
            try {
                var result = await apiInstance.CreateContactGroupAsync(accessToken, xeroTenantId, contactGroups);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateContactGroup: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateContactGroupContactsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactGroupID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var contact = new Contact();
            contact.ContactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var contacts = new Contacts();
            var contactsList = new List<Contact>();
            contactsList.Add(contact); 
            contacts._Contacts = contactsList;
            
            try {
                var result = await apiInstance.CreateContactGroupContactsAsync(accessToken, xeroTenantId, contactGroupID, contacts);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateContactGroupContacts: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateContactHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreateContactHistoryAsync(accessToken, xeroTenantId, contactID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateContactHistory: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateContactsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;

            var phone = new Phone();
            phone.PhoneNumber = "555-1212";
            phone.PhoneType = Phone.PhoneTypeEnum.MOBILE;
            var phones = new List<Phone>();
            phones.Add(phone);

            var contact = new Contact();
            contact.Name = "Bruce Banner";
            contact.EmailAddress = "hulk@avengers.com";
            contact.Phones = phones;

            var contacts = new Contacts();
            var contactsList = new List<Contact>();
            contactsList.Add(contact); 
            contacts._Contacts = contactsList;
            
            try {
                var result = await apiInstance.CreateContactsAsync(accessToken, xeroTenantId, contacts, summarizeErrors);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateContacts: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateCreditNoteAllocationExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var creditNoteID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var summarizeErrors = true;
            var currDate = DateTime.Now;

            var invoice = new Invoice();
            invoice.InvoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var allocation = new Allocation();
            allocation.Amount = new decimal(1.0);
            allocation.Date = currDate;
            allocation.Invoice = invoice;

            var allocations = new Allocations();
            var allocationsList = new List<Allocation>();
            allocationsList.Add(allocation); 
            allocations._Allocations = allocationsList;
            
            try {
                var result = await apiInstance.CreateCreditNoteAllocationAsync(accessToken, xeroTenantId, creditNoteID, allocations, summarizeErrors);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateCreditNoteAllocation: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateCreditNoteAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var creditNoteID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            var includeOnline = true;
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.CreateCreditNoteAttachmentByFileNameAsync(accessToken, xeroTenantId, creditNoteID, fileName, body, includeOnline);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateCreditNoteAttachmentByFileName: " + e.Message );
            }
        }
    }
}

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 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
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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateCreditNoteHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var creditNoteID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreateCreditNoteHistoryAsync(accessToken, xeroTenantId, creditNoteID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateCreditNoteHistory: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateCreditNotesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;
            var unitdp = 4;
            var currDate = DateTime.Now;

            var contact = new Contact();
            contact.ContactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var lineItem = new LineItem();
            lineItem.Description = "Foobar";
            lineItem.Quantity = new decimal(1.0);
            lineItem.UnitAmount = new decimal(20.0);
            lineItem.AccountCode = "000";
            var lineItems = new List<LineItem>();
            lineItems.Add(lineItem);

            var creditNote = new CreditNote();
            creditNote.Type = CreditNote.TypeEnum.ACCPAYCREDIT;
            creditNote.Contact = contact;
            creditNote.Date = currDate;
            creditNote.LineItems = lineItems;

            var creditNotes = new CreditNotes();
            var creditNotesList = new List<CreditNote>();
            creditNotesList.Add(creditNote); 
            creditNotes._CreditNotes = creditNotesList;
            
            try {
                var result = await apiInstance.CreateCreditNotesAsync(accessToken, xeroTenantId, creditNotes, summarizeErrors, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateCreditNotes: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateCurrencyExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";

            var currency = new Currency();
            currency.Code = CurrencyCode.USD;
            currency.Description = "United States Dollar";
            
            try {
                var result = await apiInstance.CreateCurrencyAsync(accessToken, xeroTenantId, currency);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateCurrency: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateEmployeesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;

            var employee = new Employee();
            employee.FirstName = "Nick";
            employee.LastName = "Fury";

            var employees = new Employees();
            var employeesList = new List<Employee>();
            employeesList.Add(employee); 
            employees._Employees = employeesList;
            
            try {
                var result = await apiInstance.CreateEmployeesAsync(accessToken, xeroTenantId, employees, summarizeErrors);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateEmployees: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateExpenseClaimHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var expenseClaimID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreateExpenseClaimHistoryAsync(accessToken, xeroTenantId, expenseClaimID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateExpenseClaimHistory: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateExpenseClaimsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var currDate = DateTime.Now;

            var user = new User();
            user.UserID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var receipt = new Receipt();
            receipt.ReceiptID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            receipt.Date = currDate;
            var receipts = new List<Receipt>();
            receipts.Add(receipt);

            var expenseClaim = new ExpenseClaim();
            expenseClaim.Status = ExpenseClaim.StatusEnum.SUBMITTED;
            expenseClaim.User = user;
            expenseClaim.Receipts = receipts;

            var expenseClaims = new ExpenseClaims();
            var expenseClaimsList = new List<ExpenseClaim>();
            expenseClaimsList.Add(expenseClaim); 
            expenseClaims._ExpenseClaims = expenseClaimsList;
            
            try {
                var result = await apiInstance.CreateExpenseClaimsAsync(accessToken, xeroTenantId, expenseClaims);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateExpenseClaims: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateInvoiceAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var invoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            var includeOnline = true;
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.CreateInvoiceAttachmentByFileNameAsync(accessToken, xeroTenantId, invoiceID, fileName, body, includeOnline);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateInvoiceAttachmentByFileName: " + e.Message );
            }
        }
    }
}

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 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
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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateInvoiceHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var invoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreateInvoiceHistoryAsync(accessToken, xeroTenantId, invoiceID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateInvoiceHistory: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateInvoicesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;
            var unitdp = 4;
            var dateValue = new DateTime(2020, 10, 10);
            var dueDateValue = new DateTime(2020, 10, 10);

            var contact = new Contact();
            contact.ContactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var lineItemTracking = new LineItemTracking();
            lineItemTracking.TrackingCategoryID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            lineItemTracking.TrackingOptionID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var lineItemTrackings = new List<LineItemTracking>();
            lineItemTrackings.Add(lineItemTracking);

            var lineItem = new LineItem();
            lineItem.Description = "Foobar";
            lineItem.Quantity = new decimal(1.0);
            lineItem.UnitAmount = new decimal(20.0);
            lineItem.AccountCode = "000";
            lineItem.Tracking = lineItemTrackings;
            var lineItems = new List<LineItem>();
            lineItems.Add(lineItem);

            var invoice = new Invoice();
            invoice.Type = Invoice.TypeEnum.ACCREC;
            invoice.Contact = contact;
            invoice.Date = dateValue;
            invoice.DueDate = dueDateValue;
            invoice.LineItems = lineItems;
            invoice.Reference = "Website Design";
            invoice.Status = Invoice.StatusEnum.DRAFT;

            var invoices = new Invoices();
            var invoicesList = new List<Invoice>();
            invoicesList.Add(invoice); 
            invoices._Invoices = invoicesList;
            
            try {
                var result = await apiInstance.CreateInvoicesAsync(accessToken, xeroTenantId, invoices, summarizeErrors, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateInvoices: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateItemHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var itemID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreateItemHistoryAsync(accessToken, xeroTenantId, itemID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateItemHistory: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateItemsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;
            var unitdp = 4;

            var purchaseDetails = new Purchase();
            purchaseDetails.COGSAccountCode = "500";

            var item = new Item();
            item.Code = "abcXYZ123";
            item.Name = "HelloWorld";
            item.Description = "Foobar";
            item.InventoryAssetAccountCode = "140";
            item.PurchaseDetails = purchaseDetails;

            var items = new Items();
            var itemsList = new List<Item>();
            itemsList.Add(item); 
            items._Items = itemsList;
            
            try {
                var result = await apiInstance.CreateItemsAsync(accessToken, xeroTenantId, items, summarizeErrors, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateItems: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateLinkedTransactionExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";

            var linkedTransaction = new LinkedTransaction();
            linkedTransaction.SourceTransactionID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            linkedTransaction.SourceLineItemID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.CreateLinkedTransactionAsync(accessToken, xeroTenantId, linkedTransaction);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateLinkedTransaction: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateManualJournalAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var manualJournalID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.CreateManualJournalAttachmentByFileNameAsync(accessToken, xeroTenantId, manualJournalID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateManualJournalAttachmentByFileName: " + e.Message );
            }
        }
    }
}

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
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

createManualJournalHistoryRecord

Creates a history record for a specific manual journal


/ManualJournals/{ManualJournalID}/History

Usage and SDK Samples

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateManualJournalHistoryRecordExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var manualJournalID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreateManualJournalHistoryRecordAsync(accessToken, xeroTenantId, manualJournalID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateManualJournalHistoryRecord: " + e.Message );
            }
        }
    }
}

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
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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateManualJournalsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;
            var dateValue = new DateTime(2020, 10, 10);
            var manualJournalLines = new List<ManualJournalLine>();

            var credit = new ManualJournalLine();
            credit.LineAmount = new decimal(100.0);
            credit.AccountCode = "400";
            credit.Description = "Hello there";
            manualJournalLines.Add(credit);

            var debit = new ManualJournalLine();
            debit.LineAmount = new decimal(-100.0);
            debit.AccountCode = "120";
            debit.Description = "Hello there";
            manualJournalLines.Add(debit);

            var manualJournal = new ManualJournal();
            manualJournal.Narration = "Foobar";
            manualJournal.Date = dateValue;
            manualJournal.JournalLines = manualJournalLines;

            var manualJournals = new ManualJournals();
            var manualJournalsList = new List<ManualJournal>();
            manualJournalsList.Add(manualJournal); 
            manualJournals._ManualJournals = manualJournalsList;
            
            try {
                var result = await apiInstance.CreateManualJournalsAsync(accessToken, xeroTenantId, manualJournals, summarizeErrors);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateManualJournals: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateOverpaymentAllocationsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var overpaymentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var summarizeErrors = true;
            var currDate = DateTime.Now;

            var invoice = new Invoice();
            invoice.InvoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var allocation = new Allocation();
            allocation.Amount = new decimal(1.0);
            allocation.Date = currDate;
            allocation.Invoice = invoice;

            var allocations = new Allocations();
            var allocationsList = new List<Allocation>();
            allocationsList.Add(allocation); 
            allocations._Allocations = allocationsList;
            
            try {
                var result = await apiInstance.CreateOverpaymentAllocationsAsync(accessToken, xeroTenantId, overpaymentID, allocations, summarizeErrors);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateOverpaymentAllocations: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateOverpaymentHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var overpaymentID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreateOverpaymentHistoryAsync(accessToken, xeroTenantId, overpaymentID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateOverpaymentHistory: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreatePaymentExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var dateValue = DateTime.Now;

            var invoice = new Invoice();
            invoice.InvoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var account = new Account();
            account.AccountID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var payment = new Payment();
            payment.Invoice = invoice;
            payment.Account = account;
            payment.Amount = new decimal(1.0);
            payment.Date = dateValue;

            var payments = new Payments();
            var paymentsList = new List<Payment>();
            paymentsList.Add(payment); 
            payments._Payments = paymentsList;
            
            try {
                var result = await apiInstance.CreatePaymentAsync(accessToken, xeroTenantId, payment);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreatePayment: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreatePaymentHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var paymentID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreatePaymentHistoryAsync(accessToken, xeroTenantId, paymentID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreatePaymentHistory: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreatePaymentServiceExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";

            var paymentService = new PaymentService();
            paymentService.PaymentServiceName = "ACME Payments";
            paymentService.PaymentServiceUrl = "https://www.payupnow.com/";
            paymentService.PayNowText = "Pay Now";

            var paymentServices = new PaymentServices();
            var paymentServicesList = new List<PaymentService>();
            paymentServicesList.Add(paymentService); 
            paymentServices._PaymentServices = paymentServicesList;
            
            try {
                var result = await apiInstance.CreatePaymentServiceAsync(accessToken, xeroTenantId, paymentServices);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreatePaymentService: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreatePaymentsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;
            var dateValue = DateTime.Now;

            var invoice = new Invoice();
            invoice.InvoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var account = new Account();
            account.AccountID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var payment = new Payment();
            payment.Invoice = invoice;
            payment.Account = account;
            payment.Amount = new decimal(1.0);
            payment.Date = dateValue;

            var payments = new Payments();
            var paymentsList = new List<Payment>();
            paymentsList.Add(payment); 
            payments._Payments = paymentsList;
            
            try {
                var result = await apiInstance.CreatePaymentsAsync(accessToken, xeroTenantId, payments, summarizeErrors);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreatePayments: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreatePrepaymentAllocationsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var prepaymentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var summarizeErrors = true;
            var currDate = DateTime.Now;

            var invoice = new Invoice();
            invoice.InvoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var allocation = new Allocation();
            allocation.Invoice = invoice;
            allocation.Amount = new decimal(1.0);
            allocation.Date = currDate;

            var allocations = new Allocations();
            var allocationsList = new List<Allocation>();
            allocationsList.Add(allocation); 
            allocations._Allocations = allocationsList;
            
            try {
                var result = await apiInstance.CreatePrepaymentAllocationsAsync(accessToken, xeroTenantId, prepaymentID, allocations, summarizeErrors);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreatePrepaymentAllocations: " + e.Message );
            }
        }
    }
}

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
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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreatePrepaymentHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var prepaymentID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreatePrepaymentHistoryAsync(accessToken, xeroTenantId, prepaymentID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreatePrepaymentHistory: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreatePurchaseOrderAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var purchaseOrderID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.CreatePurchaseOrderAttachmentByFileNameAsync(accessToken, xeroTenantId, purchaseOrderID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreatePurchaseOrderAttachmentByFileName: " + e.Message );
            }
        }
    }
}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
PurchaseOrderID*
UUID (uuid)
Unique identifier for an Purchase Order
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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreatePurchaseOrderHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var purchaseOrderID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreatePurchaseOrderHistoryAsync(accessToken, xeroTenantId, purchaseOrderID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreatePurchaseOrderHistory: " + e.Message );
            }
        }
    }
}

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 an Purchase Order
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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreatePurchaseOrdersExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;
            var dateValue = DateTime.Now;

            var contact = new Contact();
            contact.ContactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var lineItem = new LineItem();
            lineItem.Description = "Foobar";
            lineItem.Quantity = new decimal(1.0);
            lineItem.UnitAmount = new decimal(20.0);
            lineItem.AccountCode = "000";
            var lineItems = new List<LineItem>();
            lineItems.Add(lineItem);

            var purchaseOrder = new PurchaseOrder();
            purchaseOrder.Contact = contact;
            purchaseOrder.LineItems = lineItems;
            purchaseOrder.Date = dateValue;

            var purchaseOrders = new PurchaseOrders();
            var purchaseOrdersList = new List<PurchaseOrder>();
            purchaseOrdersList.Add(purchaseOrder); 
            purchaseOrders._PurchaseOrders = purchaseOrdersList;
            
            try {
                var result = await apiInstance.CreatePurchaseOrdersAsync(accessToken, xeroTenantId, purchaseOrders, summarizeErrors);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreatePurchaseOrders: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateQuoteAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var quoteID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.CreateQuoteAttachmentByFileNameAsync(accessToken, xeroTenantId, quoteID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateQuoteAttachmentByFileName: " + e.Message );
            }
        }
    }
}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
QuoteID*
UUID (uuid)
Unique identifier for an Quote
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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateQuoteHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var quoteID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreateQuoteHistoryAsync(accessToken, xeroTenantId, quoteID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateQuoteHistory: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateQuotesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;
            var dateValue = DateTime.Now;

            var contact = new Contact();
            contact.ContactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var lineItem = new LineItem();
            lineItem.Description = "Foobar";
            lineItem.Quantity = new decimal(1.0);
            lineItem.UnitAmount = new decimal(20.0);
            lineItem.AccountCode = "000";
            var lineItems = new List<LineItem>();
            lineItems.Add(lineItem);

            var quote = new Quote();
            quote.Contact = contact;
            quote.LineItems = lineItems;
            quote.Date = dateValue;

            var quotes = new Quotes();
            var quotesList = new List<Quote>();
            quotesList.Add(quote); 
            quotes._Quotes = quotesList;
            
            try {
                var result = await apiInstance.CreateQuotesAsync(accessToken, xeroTenantId, quotes, summarizeErrors);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateQuotes: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateReceiptExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var unitdp = 4;

            var contact = new Contact();
            contact.ContactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var user = new User();
            user.UserID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var lineItem = new LineItem();
            lineItem.Description = "Foobar";
            lineItem.Quantity = new decimal(1.0);
            lineItem.UnitAmount = new decimal(20.0);
            lineItem.AccountCode = "000";
            var lineItems = new List<LineItem>();
            lineItems.Add(lineItem);

            var receipt = new Receipt();
            receipt.Contact = contact;
            receipt.User = user;
            receipt.LineItems = lineItems;
            receipt.LineAmountTypes = LineAmountTypes.Exclusive;
            receipt.Status = Receipt.StatusEnum.DRAFT;

            var receipts = new Receipts();
            var receiptsList = new List<Receipt>();
            receiptsList.Add(receipt); 
            receipts._Receipts = receiptsList;
            
            try {
                var result = await apiInstance.CreateReceiptAsync(accessToken, xeroTenantId, receipts, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateReceipt: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateReceiptAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var receiptID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.CreateReceiptAttachmentByFileNameAsync(accessToken, xeroTenantId, receiptID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateReceiptAttachmentByFileName: " + e.Message );
            }
        }
    }
}

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
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

createReceiptHistory

Creates a history record for a specific receipt


/Receipts/{ReceiptID}/History

Usage and SDK Samples

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateReceiptHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var receiptID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreateReceiptHistoryAsync(accessToken, xeroTenantId, receiptID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateReceiptHistory: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateRepeatingInvoiceAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var repeatingInvoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.CreateRepeatingInvoiceAttachmentByFileNameAsync(accessToken, xeroTenantId, repeatingInvoiceID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateRepeatingInvoiceAttachmentByFileName: " + e.Message );
            }
        }
    }
}

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
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

createRepeatingInvoiceHistory

Creates a history record for a specific repeating invoice


/RepeatingInvoices/{RepeatingInvoiceID}/History

Usage and SDK Samples

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateRepeatingInvoiceHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var repeatingInvoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreateRepeatingInvoiceHistoryAsync(accessToken, xeroTenantId, repeatingInvoiceID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateRepeatingInvoiceHistory: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateTaxRatesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";

            var taxComponent = new TaxComponent();
            taxComponent.Name = "State Tax";
            taxComponent.Rate = new decimal(2.25);
            var taxComponent = new List<TaxComponent>();
            taxComponents.Add(taxComponent);

            var taxRate = new TaxRate();
            taxRate.Name = "CA State Tax";
            taxRate.TaxComponents = taxComponents;

            var taxRates = new TaxRates();
            var taxRatesList = new List<TaxRate>();
            taxRatesList.Add(taxRate); 
            taxRates._TaxRates = taxRatesList;
            
            try {
                var result = await apiInstance.CreateTaxRatesAsync(accessToken, xeroTenantId, taxRates);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateTaxRates: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateTrackingCategoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";

            var trackingCategory = new TrackingCategory();
            trackingCategory.Name = "Foobar";
            
            try {
                var result = await apiInstance.CreateTrackingCategoryAsync(accessToken, xeroTenantId, trackingCategory);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateTrackingCategory: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateTrackingOptionsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var trackingCategoryID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var trackingOption = new TrackingOption();
            trackingOption.Name = "Foobar";
            
            try {
                var result = await apiInstance.CreateTrackingOptionsAsync(accessToken, xeroTenantId, trackingCategoryID, trackingOption);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateTrackingOptions: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class DeleteAccountExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var accountID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.DeleteAccountAsync(accessToken, xeroTenantId, accountID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.DeleteAccount: " + e.Message );
            }
        }
    }
}

Scopes

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

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

deleteContactGroupContact

Deletes a specific contact from a contact group using a unique contact Id


/ContactGroups/{ContactGroupID}/Contacts/{ContactID}

Usage and SDK Samples

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class DeleteContactGroupContactExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactGroupID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var contactID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                await apiInstance.DeleteContactGroupContactAsync(accessToken, xeroTenantId, contactGroupID, contactID);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.DeleteContactGroupContact: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class DeleteContactGroupContactsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactGroupID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                await apiInstance.DeleteContactGroupContactsAsync(accessToken, xeroTenantId, contactGroupID);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.DeleteContactGroupContacts: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class DeleteItemExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var itemID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                await apiInstance.DeleteItemAsync(accessToken, xeroTenantId, itemID);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.DeleteItem: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class DeleteLinkedTransactionExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var linkedTransactionID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                await apiInstance.DeleteLinkedTransactionAsync(accessToken, xeroTenantId, linkedTransactionID);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.DeleteLinkedTransaction: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class DeletePaymentExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var paymentID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var paymentDelete = new PaymentDelete();
            paymentDelete.Status = "DELETED";
            
            try {
                var result = await apiInstance.DeletePaymentAsync(accessToken, xeroTenantId, paymentID, paymentDelete);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.DeletePayment: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class DeleteTrackingCategoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var trackingCategoryID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.DeleteTrackingCategoryAsync(accessToken, xeroTenantId, trackingCategoryID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.DeleteTrackingCategory: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class DeleteTrackingOptionsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var trackingCategoryID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var trackingOptionID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.DeleteTrackingOptionsAsync(accessToken, xeroTenantId, trackingCategoryID, trackingOptionID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.DeleteTrackingOptions: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class EmailInvoiceExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var invoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var requestEmpty = new RequestEmpty();
            
            try {
                await apiInstance.EmailInvoiceAsync(accessToken, xeroTenantId, invoiceID, requestEmpty);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.EmailInvoice: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetAccountExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var accountID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetAccountAsync(accessToken, xeroTenantId, accountID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetAccount: " + e.Message );
            }
        }
    }
}

Scopes

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

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

getAccountAttachmentByFileName

Retrieves an attachment for a specific account by filename


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

Usage and SDK Samples

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetAccountAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var accountID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetAccountAttachmentByFileNameAsync(accessToken, xeroTenantId, accountID, fileName, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetAccountAttachmentByFileName: " + e.Message );
            }
        }
    }
}

Scopes

accounting.attachments Grant read-write access to attachments
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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetAccountAttachmentByIdExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var accountID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var attachmentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetAccountAttachmentByIdAsync(accessToken, xeroTenantId, accountID, attachmentID, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetAccountAttachmentById: " + e.Message );
            }
        }
    }
}

Scopes

accounting.attachments Grant read-write access to attachments
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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetAccountAttachmentsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var accountID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetAccountAttachmentsAsync(accessToken, xeroTenantId, accountID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetAccountAttachments: " + e.Message );
            }
        }
    }
}

Scopes

accounting.attachments Grant read-write access to attachments
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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetAccountsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var ifModifiedSince = DateTime.Parse("2020-02-06T12:17:43.202-08:00");
            var where = "Status==\"ACTIVE\"";
            var order = "Name ASC";
            
            try {
                var result = await apiInstance.GetAccountsAsync(accessToken, xeroTenantId, ifModifiedSince, where, order);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetAccounts: " + e.Message );
            }
        }
    }
}

Scopes

accounting.settings Grant read-write access to organisation and account settings
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

getBankTransaction

Retrieves a single spent or received money transaction by using a unique bank transaction Id


/BankTransactions/{BankTransactionID}

Usage and SDK Samples

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBankTransactionExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransactionID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var unitdp = 4;
            
            try {
                var result = await apiInstance.GetBankTransactionAsync(accessToken, xeroTenantId, bankTransactionID, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBankTransaction: " + e.Message );
            }
        }
    }
}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices
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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBankTransactionAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransactionID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetBankTransactionAttachmentByFileNameAsync(accessToken, xeroTenantId, bankTransactionID, fileName, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBankTransactionAttachmentByFileName: " + e.Message );
            }
        }
    }
}

Scopes

accounting.attachments Grant read-write access to attachments
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
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

getBankTransactionAttachmentById

Retrieves specific attachments from a specific BankTransaction using a unique attachment Id


/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}

Usage and SDK Samples

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBankTransactionAttachmentByIdExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransactionID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var attachmentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetBankTransactionAttachmentByIdAsync(accessToken, xeroTenantId, bankTransactionID, attachmentID, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBankTransactionAttachmentById: " + e.Message );
            }
        }
    }
}

Scopes

accounting.attachments Grant read-write access to attachments
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)
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

getBankTransactionAttachments

Retrieves any attachments from a specific bank transactions


/BankTransactions/{BankTransactionID}/Attachments

Usage and SDK Samples

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBankTransactionAttachmentsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransactionID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetBankTransactionAttachmentsAsync(accessToken, xeroTenantId, bankTransactionID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBankTransactionAttachments: " + e.Message );
            }
        }
    }
}

Scopes

accounting.attachments Grant read-write access to attachments
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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBankTransactionsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var ifModifiedSince = DateTime.Parse("2020-02-06T12:17:43.202-08:00");
            var where = "Status==\"AUTHORISED\"";
            var order = "Type ASC";
            var page = 1;
            var unitdp = 4;
            
            try {
                var result = await apiInstance.GetBankTransactionsAsync(accessToken, xeroTenantId, ifModifiedSince, where, order, page, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBankTransactions: " + e.Message );
            }
        }
    }
}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices
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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBankTransactionsHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransactionID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetBankTransactionsHistoryAsync(accessToken, xeroTenantId, bankTransactionID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBankTransactionsHistory: " + e.Message );
            }
        }
    }
}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices
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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBankTransferExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransferID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetBankTransferAsync(accessToken, xeroTenantId, bankTransferID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBankTransfer: " + e.Message );
            }
        }
    }
}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices
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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBankTransferAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransferID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetBankTransferAttachmentByFileNameAsync(accessToken, xeroTenantId, bankTransferID, fileName, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBankTransferAttachmentByFileName: " + e.Message );
            }
        }
    }
}

Scopes

accounting.attachments Grant read-write access to attachments
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
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

getBankTransferAttachmentById

Retrieves a specific attachment from a specific bank transfer using a unique attachment ID


/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}

Usage and SDK Samples

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBankTransferAttachmentByIdExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransferID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var attachmentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetBankTransferAttachmentByIdAsync(accessToken, xeroTenantId, bankTransferID, attachmentID, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBankTransferAttachmentById: " + e.Message );
            }
        }
    }
}

Scopes

accounting.attachments Grant read-write access to attachments
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)
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

getBankTransferAttachments

Retrieves attachments from a specific bank transfer


/BankTransfers/{BankTransferID}/Attachments

Usage and SDK Samples

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBankTransferAttachmentsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransferID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetBankTransferAttachmentsAsync(accessToken, xeroTenantId, bankTransferID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBankTransferAttachments: " + e.Message );
            }
        }
    }
}

Scopes

accounting.attachments Grant read-write access to attachments
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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBankTransferHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransferID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetBankTransferHistoryAsync(accessToken, xeroTenantId, bankTransferID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBankTransferHistory: " + e.Message );
            }
        }
    }
}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices
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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBankTransfersExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var ifModifiedSince = DateTime.Parse("2020-02-06T12:17:43.202-08:00");
            var where = "HasAttachments==true";
            var order = "Amount ASC";
            
            try {
                var result = await apiInstance.GetBankTransfersAsync(accessToken, xeroTenantId, ifModifiedSince, where, order);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBankTransfers: " + e.Message );
            }
        }
    }
}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices
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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBatchPaymentHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var batchPaymentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetBatchPaymentHistoryAsync(accessToken, xeroTenantId, batchPaymentID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBatchPaymentHistory: " + e.Message );
            }
        }
    }
}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices
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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBatchPaymentsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var ifModifiedSince = DateTime.Parse("2020-02-06T12:17:43.202-08:00");
            var where = "Status==\"AUTHORISED\"";
            var order = "Date ASC";
            
            try {
                var result = await apiInstance.GetBatchPaymentsAsync(accessToken, xeroTenantId, ifModifiedSince, where, order);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBatchPayments: " + e.Message );
            }
        }
    }
}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices
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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBrandingThemeExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var brandingThemeID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetBrandingThemeAsync(accessToken, xeroTenantId, brandingThemeID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBrandingTheme: " + e.Message );
            }
        }
    }
}

Scopes

accounting.settings Grant read-write access to organisation and account settings
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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBrandingThemePaymentServicesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var brandingThemeID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetBrandingThemePaymentServicesAsync(accessToken, xeroTenantId, brandingThemeID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBrandingThemePaymentServices: " + e.Message );
            }
        }
    }
}

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBrandingThemesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            
            try {
                var result = await apiInstance.GetBrandingThemesAsync(accessToken, xeroTenantId);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBrandingThemes: " + e.Message );
            }
        }
    }
}

Scopes

accounting.settings Grant read-write access to organisation and account settings
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

getBudget

Retrieves a specific budgets, which includes budget lines


/Budgets/{BudgetID}

Usage and SDK Samples

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBudgetExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var budgetID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetBudgetAsync(accessToken, xeroTenantId, budgetID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBudget: " + e.Message );
            }
        }
    }
}

Scopes

accounting.budgets.read

Parameters

Path parameters
Name Description
BudgetID*
UUID (uuid)
Unique identifier for Budgets
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getBudgets

Retrieve a list of budgets


/Budgets

Usage and SDK Samples

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBudgetsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var iDs = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var dateTo = DateTime.Parse("2013-10-20");
            var dateFrom = DateTime.Parse("2013-10-20");
            
            try {
                var result = await apiInstance.GetBudgetsAsync(accessToken, xeroTenantId, iDs, dateTo, dateFrom);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBudgets: " + e.Message );
            }
        }
    }
}

Scopes

accounting.budgets.read

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
IDs
array[UUID] (uuid)
Filter by BudgetID. Allows you to retrieve a specific individual budget.
DateTo
date (date)
Filter by start date
DateFrom
date (date)
Filter by end date

getContact

Retrieves a specific contacts in a Xero organisation using a unique contact Id


/Contacts/{ContactID}

Usage and SDK Samples

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetContactExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetContactAsync(accessToken, xeroTenantId, contactID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetContact: " + e.Message );
            }
        }
    }
}

Scopes

accounting.contacts Grant read-write access to contacts and contact groups
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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetContactAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetContactAttachmentByFileNameAsync(accessToken, xeroTenantId, contactID, fileName, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetContactAttachmentByFileName: " + e.Message );
            }
        }
    }
}

Scopes

accounting.attachments Grant read-write access to attachments
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 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

getContactAttachmentById

Retrieves a specific attachment from a specific contact using a unique attachment Id


/Contacts/{ContactID}/Attachments/{AttachmentID}

Usage and SDK Samples

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetContactAttachmentByIdExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var attachmentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetContactAttachmentByIdAsync(accessToken, xeroTenantId, contactID, attachmentID, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetContactAttachmentById: " + e.Message );
            }
        }
    }
}

Scopes

accounting.attachments Grant read-write access to attachments
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 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

getContactAttachments

Retrieves attachments for a specific contact in a Xero organisation


/Contacts/{ContactID}/Attachments

Usage and SDK Samples

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetContactAttachmentsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetContactAttachmentsAsync(accessToken, xeroTenantId, contactID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetContactAttachments: " + e.Message );
            }
        }
    }
}

Scopes

accounting.attachments Grant read-write access to attachments
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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetContactByContactNumberExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactNumber = "SB2";
            
            try {
                var result = await apiInstance.GetContactByContactNumberAsync(accessToken, xeroTenantId, contactNumber);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetContactByContactNumber: " + e.Message );
            }
        }
    }
}

Scopes

accounting.contacts Grant read-write access to contacts and contact groups
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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetContactCISSettingsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetContactCISSettingsAsync(accessToken, xeroTenantId, contactID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetContactCISSettings: " + e.Message );
            }
        }
    }
}

Scopes

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

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

using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetContactGroupExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactGroupID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetContactGroupAsync(accessToken, xeroTenantId, contactGroupID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetContactGroup: " + e.Message );
            }
        }
    }
}

Scopes

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

Parameters

Path parameters
Name Description
ContactGroupID*