Xero Accounting API

Accounting

createAccount

Creates a new chart of accounts


/Accounts

Usage and SDK Samples

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';

const account: Account = { 
  code: "123456",
  name: "FooBar",
  type: AccountType.EXPENSE,
  description: "Hello World"
}; 

try {
  const response = await xero.accountingApi.createAccount(xeroTenantId, account);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const accountID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createAccountAttachmentByFileName(xeroTenantId, accountID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransactionID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransactionID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
  details: "Hello World"
}; 

const historyRecords: HistoryRecords = {  
  historyRecords: [historyRecord]
}; 

try {
  const response = await xero.accountingApi.createBankTransactionHistoryRecord(xeroTenantId, bankTransactionID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;
const unitdp = 4;

const contact: Contact = { 
  contactID: "00000000-0000-0000-0000-000000000000"
}; 

const lineItem: LineItem = { 
  description: "Foobar",
  quantity: 1.0,
  unitAmount: 20.0,
  accountCode: "000"
};   
const lineItems = [];
lineItems.push(lineItem)

const bankAccount: Account = { 
  accountID: "00000000-0000-0000-0000-000000000000"
}; 

const bankTransaction: BankTransaction = { 
  type: BankTransaction.TypeEnum.RECEIVE,
  contact: contact,
  lineItems: lineItems,
  bankAccount: bankAccount
}; 

const bankTransactions: BankTransactions = {  
  bankTransactions: [bankTransaction]
}; 

try {
  const response = await xero.accountingApi.createBankTransactions(xeroTenantId, bankTransactions,  summarizeErrors, unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';

const fromBankAccount: Account = { 
  accountID: "00000000-0000-0000-0000-000000000000"
}; 

const toBankAccount: Account = { 
  accountID: "00000000-0000-0000-0000-000000000000"
}; 

const bankTransfer: BankTransfer = { 
  fromBankAccount: fromBankAccount,
  toBankAccount: toBankAccount,
  amount: 1.0
}; 

const bankTransfers: BankTransfers = {  
  bankTransfers: [bankTransfer]
}; 

try {
  const response = await xero.accountingApi.createBankTransfer(xeroTenantId, bankTransfers);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransferID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createBankTransferAttachmentByFileName(xeroTenantId, bankTransferID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransferID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
  details: "Hello World"
}; 

const historyRecords: HistoryRecords = {  
  historyRecords: [historyRecord]
}; 

try {
  const response = await xero.accountingApi.createBankTransferHistoryRecord(xeroTenantId, bankTransferID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;
const currDate = '2020-12-10'

const paymentAccount: Account = { 
  accountID: "00000000-0000-0000-0000-000000000000"
}; 

const bankAccount: Account = { 
  accountID: "00000000-0000-0000-0000-000000000000"
}; 

const invoice: Invoice = { 
  invoiceID: "00000000-0000-0000-0000-000000000000"
}; 

const payment: Payment = { 
  account: bankAccount,
  date: currDate,
  amount: 1.0,
  invoice: invoice
};   
const payments = [];
payments.push(payment)

const batchPayment: BatchPayment = { 
  account: paymentAccount,
  reference: "hello foobar",
  date: currDate,
  payments: payments
}; 

const batchPayments: BatchPayments = {  
  batchPayments: [batchPayment]
}; 

try {
  const response = await xero.accountingApi.createBatchPayment(xeroTenantId, batchPayments,  summarizeErrors);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const batchPaymentID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
  details: "Hello World"
}; 

const historyRecords: HistoryRecords = {  
  historyRecords: [historyRecord]
}; 

try {
  const response = await xero.accountingApi.createBatchPaymentHistoryRecord(xeroTenantId, batchPaymentID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const brandingThemeID = '00000000-0000-0000-0000-000000000000';

const paymentService: PaymentService = { 
  paymentServiceID: "00000000-0000-0000-0000-000000000000",
  paymentServiceName: "ACME Payments",
  paymentServiceUrl: "https://www.payupnow.com/",
  payNowText: "Pay Now"
}; 

try {
  const response = await xero.accountingApi.createBrandingThemePaymentServices(xeroTenantId, brandingThemeID, paymentService);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createContactAttachmentByFileName(xeroTenantId, contactID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';

const contactGroup: ContactGroup = { 
  name: "VIPs"
}; 

const contactGroups: ContactGroups = {  
  contactGroups: [contactGroup]
}; 

try {
  const response = await xero.accountingApi.createContactGroup(xeroTenantId, contactGroups);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactGroupID = '00000000-0000-0000-0000-000000000000';

const contact: Contact = { 
  contactID: "00000000-0000-0000-0000-000000000000"
}; 

const contacts: Contacts = {  
  contacts: [contact]
}; 

try {
  const response = await xero.accountingApi.createContactGroupContacts(xeroTenantId, contactGroupID, contacts);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
  details: "Hello World"
}; 

const historyRecords: HistoryRecords = {  
  historyRecords: [historyRecord]
}; 

try {
  const response = await xero.accountingApi.createContactHistory(xeroTenantId, contactID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;

const phone: Phone = { 
  phoneNumber: "555-1212",
  phoneType: Phone.PhoneTypeEnum.MOBILE
};   
const phones = [];
phones.push(phone)

const contact: Contact = { 
  name: "Bruce Banner",
  emailAddress: "hulk@avengers.com",
  phones: phones
}; 

const contacts: Contacts = {  
  contacts: [contact]
}; 

try {
  const response = await xero.accountingApi.createContacts(xeroTenantId, contacts,  summarizeErrors);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const creditNoteID = '00000000-0000-0000-0000-000000000000';
const summarizeErrors = true;
const currDate = '2020-12-10'

const invoice: Invoice = { 
  invoiceID: "00000000-0000-0000-0000-000000000000"
}; 

const allocation: Allocation = { 
  amount: 1.0,
  date: currDate,
  invoice: invoice
}; 

const allocations: Allocations = {  
  allocations: [allocation]
}; 

try {
  const response = await xero.accountingApi.createCreditNoteAllocation(xeroTenantId, creditNoteID, allocations,  summarizeErrors);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const creditNoteID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const includeOnline = true;
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, fileName, body,  includeOnline, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const creditNoteID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
  details: "Hello World"
}; 

const historyRecords: HistoryRecords = {  
  historyRecords: [historyRecord]
}; 

try {
  const response = await xero.accountingApi.createCreditNoteHistory(xeroTenantId, creditNoteID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;
const unitdp = 4;
const currDate = '2020-12-10'

const contact: Contact = { 
  contactID: "00000000-0000-0000-0000-000000000000"
}; 

const lineItem: LineItem = { 
  description: "Foobar",
  quantity: 1.0,
  unitAmount: 20.0,
  accountCode: "000"
};   
const lineItems = [];
lineItems.push(lineItem)

const creditNote: CreditNote = { 
  type: CreditNote.TypeEnum.ACCPAYCREDIT,
  contact: contact,
  date: currDate,
  lineItems: lineItems
}; 

const creditNotes: CreditNotes = {  
  creditNotes: [creditNote]
}; 

try {
  const response = await xero.accountingApi.createCreditNotes(xeroTenantId, creditNotes,  summarizeErrors, unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';

const currency: Currency = { 
  code: CurrencyCode.USD,
  description: "United States Dollar"
}; 

try {
  const response = await xero.accountingApi.createCurrency(xeroTenantId, currency);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;

const employee: Employee = { 
  firstName: "Nick",
  lastName: "Fury"
}; 

const employees: Employees = {  
  employees: [employee]
}; 

try {
  const response = await xero.accountingApi.createEmployees(xeroTenantId, employees,  summarizeErrors);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const expenseClaimID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
  details: "Hello World"
}; 

const historyRecords: HistoryRecords = {  
  historyRecords: [historyRecord]
}; 

try {
  const response = await xero.accountingApi.createExpenseClaimHistory(xeroTenantId, expenseClaimID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const currDate = '2020-12-10'

const user: User = { 
  userID: "00000000-0000-0000-0000-000000000000"
}; 

const receipt: Receipt = { 
  receiptID: "00000000-0000-0000-0000-000000000000",
  date: currDate
};   
const receipts = [];
receipts.push(receipt)

const expenseClaim: ExpenseClaim = { 
  status: ExpenseClaim.StatusEnum.SUBMITTED,
  user: user,
  receipts: receipts
}; 

const expenseClaims: ExpenseClaims = {  
  expenseClaims: [expenseClaim]
}; 

try {
  const response = await xero.accountingApi.createExpenseClaims(xeroTenantId, expenseClaims);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const invoiceID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const includeOnline = true;
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createInvoiceAttachmentByFileName(xeroTenantId, invoiceID, fileName, body,  includeOnline, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const invoiceID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
  details: "Hello World"
}; 

const historyRecords: HistoryRecords = {  
  historyRecords: [historyRecord]
}; 

try {
  const response = await xero.accountingApi.createInvoiceHistory(xeroTenantId, invoiceID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;
const unitdp = 4;
const dateValue = '2020-10-10'
const dueDateValue = '2020-10-28'

const contact: Contact = { 
  contactID: "00000000-0000-0000-0000-000000000000"
}; 

const lineItemTracking: LineItemTracking = { 
  trackingCategoryID: "00000000-0000-0000-0000-000000000000",
  trackingOptionID: "00000000-0000-0000-0000-000000000000"
};   
const lineItemTrackings = [];
lineItemTrackings.push(lineItemTracking)

const lineItem: LineItem = { 
  description: "Foobar",
  quantity: 1.0,
  unitAmount: 20.0,
  accountCode: "000",
  tracking: lineItemTrackings
};   
const lineItems = [];
lineItems.push(lineItem)

const invoice: Invoice = { 
  type: Invoice.TypeEnum.ACCREC,
  contact: contact,
  date: dateValue,
  dueDate: dueDateValue,
  lineItems: lineItems,
  reference: "Website Design",
  status: Invoice.StatusEnum.DRAFT
}; 

const invoices: Invoices = {  
  invoices: [invoice]
}; 

try {
  const response = await xero.accountingApi.createInvoices(xeroTenantId, invoices,  summarizeErrors, unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const itemID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
  details: "Hello World"
}; 

const historyRecords: HistoryRecords = {  
  historyRecords: [historyRecord]
}; 

try {
  const response = await xero.accountingApi.createItemHistory(xeroTenantId, itemID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;
const unitdp = 4;

const purchaseDetails: Purchase = { 
  cOGSAccountCode: "500"
}; 

const item: Item = { 
  code: "abcXYZ123",
  name: "HelloWorld",
  description: "Foobar",
  inventoryAssetAccountCode: "140",
  purchaseDetails: purchaseDetails
}; 

const items: Items = {  
  items: [item]
}; 

try {
  const response = await xero.accountingApi.createItems(xeroTenantId, items,  summarizeErrors, unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';

const linkedTransaction: LinkedTransaction = { 
  sourceTransactionID: "00000000-0000-0000-0000-000000000000",
  sourceLineItemID: "00000000-0000-0000-0000-000000000000"
}; 

try {
  const response = await xero.accountingApi.createLinkedTransaction(xeroTenantId, linkedTransaction);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const manualJournalID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const manualJournalID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
  details: "Hello World"
}; 

const historyRecords: HistoryRecords = {  
  historyRecords: [historyRecord]
}; 

try {
  const response = await xero.accountingApi.createManualJournalHistoryRecord(xeroTenantId, manualJournalID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;
const dateValue = '2020-10-10'  
const manualJournalLines = [];

const credit: ManualJournalLine = { 
  lineAmount: 100.0,
  accountCode: "400",
  description: "Hello there"
}; 
manualJournalLines.push(credit)

const debit: ManualJournalLine = { 
  lineAmount: -100.0,
  accountCode: "120",
  description: "Hello there"
}; 
manualJournalLines.push(debit)

const manualJournal: ManualJournal = { 
  narration: "Foobar",
  date: dateValue,
  journalLines: manualJournalLines
}; 

const manualJournals: ManualJournals = {  
  manualJournals: [manualJournal]
}; 

try {
  const response = await xero.accountingApi.createManualJournals(xeroTenantId, manualJournals,  summarizeErrors);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const overpaymentID = '00000000-0000-0000-0000-000000000000';
const summarizeErrors = true;
const currDate = '2020-12-10'

const invoice: Invoice = { 
  invoiceID: "00000000-0000-0000-0000-000000000000"
}; 

const allocation: Allocation = { 
  amount: 1.0,
  date: currDate,
  invoice: invoice
}; 

const allocations: Allocations = {  
  allocations: [allocation]
}; 

try {
  const response = await xero.accountingApi.createOverpaymentAllocations(xeroTenantId, overpaymentID, allocations,  summarizeErrors);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const overpaymentID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
  details: "Hello World"
}; 

const historyRecords: HistoryRecords = {  
  historyRecords: [historyRecord]
}; 

try {
  const response = await xero.accountingApi.createOverpaymentHistory(xeroTenantId, overpaymentID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const dateValue = '2020-10-10'

const invoice: Invoice = { 
  invoiceID: "00000000-0000-0000-0000-000000000000"
}; 

const account: Account = { 
  accountID: "00000000-0000-0000-0000-000000000000"
}; 

const payment: Payment = { 
  invoice: invoice,
  account: account,
  amount: 1.0,
  date: dateValue
}; 

const payments: Payments = {  
  payments: [payment]
}; 

try {
  const response = await xero.accountingApi.createPayment(xeroTenantId, payment);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const paymentID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
  details: "Hello World"
}; 

const historyRecords: HistoryRecords = {  
  historyRecords: [historyRecord]
}; 

try {
  const response = await xero.accountingApi.createPaymentHistory(xeroTenantId, paymentID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';

const paymentService: PaymentService = { 
  paymentServiceName: "ACME Payments",
  paymentServiceUrl: "https://www.payupnow.com/",
  payNowText: "Pay Now"
}; 

const paymentServices: PaymentServices = {  
  paymentServices: [paymentService]
}; 

try {
  const response = await xero.accountingApi.createPaymentService(xeroTenantId, paymentServices);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;
const dateValue = '2020-10-10'

const invoice: Invoice = { 
  invoiceID: "00000000-0000-0000-0000-000000000000"
}; 

const account: Account = { 
  accountID: "00000000-0000-0000-0000-000000000000"
}; 

const payment: Payment = { 
  invoice: invoice,
  account: account,
  amount: 1.0,
  date: dateValue
}; 

const payments: Payments = {  
  payments: [payment]
}; 

try {
  const response = await xero.accountingApi.createPayments(xeroTenantId, payments,  summarizeErrors);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const prepaymentID = '00000000-0000-0000-0000-000000000000';
const summarizeErrors = true;
const currDate = '2020-12-10'

const invoice: Invoice = { 
  invoiceID: "00000000-0000-0000-0000-000000000000"
}; 

const allocation: Allocation = { 
  invoice: invoice,
  amount: 1.0,
  date: currDate
}; 

const allocations: Allocations = {  
  allocations: [allocation]
}; 

try {
  const response = await xero.accountingApi.createPrepaymentAllocations(xeroTenantId, prepaymentID, allocations,  summarizeErrors);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const prepaymentID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
  details: "Hello World"
}; 

const historyRecords: HistoryRecords = {  
  historyRecords: [historyRecord]
}; 

try {
  const response = await xero.accountingApi.createPrepaymentHistory(xeroTenantId, prepaymentID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const purchaseOrderID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createPurchaseOrderAttachmentByFileName(xeroTenantId, purchaseOrderID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const purchaseOrderID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
  details: "Hello World"
}; 

const historyRecords: HistoryRecords = {  
  historyRecords: [historyRecord]
}; 

try {
  const response = await xero.accountingApi.createPurchaseOrderHistory(xeroTenantId, purchaseOrderID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;
const dateValue = '2020-10-10'

const contact: Contact = { 
  contactID: "00000000-0000-0000-0000-000000000000"
}; 

const lineItem: LineItem = { 
  description: "Foobar",
  quantity: 1.0,
  unitAmount: 20.0,
  accountCode: "000"
};   
const lineItems = [];
lineItems.push(lineItem)

const purchaseOrder: PurchaseOrder = { 
  contact: contact,
  lineItems: lineItems,
  date: dateValue
}; 

const purchaseOrders: PurchaseOrders = {  
  purchaseOrders: [purchaseOrder]
}; 

try {
  const response = await xero.accountingApi.createPurchaseOrders(xeroTenantId, purchaseOrders,  summarizeErrors);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const quoteID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createQuoteAttachmentByFileName(xeroTenantId, quoteID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const quoteID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
  details: "Hello World"
}; 

const historyRecords: HistoryRecords = {  
  historyRecords: [historyRecord]
}; 

try {
  const response = await xero.accountingApi.createQuoteHistory(xeroTenantId, quoteID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;
const dateValue = '2020-10-10'

const contact: Contact = { 
  contactID: "00000000-0000-0000-0000-000000000000"
}; 

const lineItem: LineItem = { 
  description: "Foobar",
  quantity: 1.0,
  unitAmount: 20.0,
  accountCode: "000"
};   
const lineItems = [];
lineItems.push(lineItem)

const quote: Quote = { 
  contact: contact,
  lineItems: lineItems,
  date: dateValue
}; 

const quotes: Quotes = {  
  quotes: [quote]
}; 

try {
  const response = await xero.accountingApi.createQuotes(xeroTenantId, quotes,  summarizeErrors);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const unitdp = 4;

const contact: Contact = { 
  contactID: "00000000-0000-0000-0000-000000000000"
}; 

const user: User = { 
  userID: "00000000-0000-0000-0000-000000000000"
}; 

const lineItem: LineItem = { 
  description: "Foobar",
  quantity: 1.0,
  unitAmount: 20.0,
  accountCode: "000"
};   
const lineItems = [];
lineItems.push(lineItem)

const receipt: Receipt = { 
  contact: contact,
  user: user,
  lineItems: lineItems,
  lineAmountTypes: LineAmountTypes.Inclusive,
  status: Receipt.StatusEnum.DRAFT
}; 

const receipts: Receipts = {  
  receipts: [receipt]
}; 

try {
  const response = await xero.accountingApi.createReceipt(xeroTenantId, receipts,  unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const receiptID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createReceiptAttachmentByFileName(xeroTenantId, receiptID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const receiptID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
  details: "Hello World"
}; 

const historyRecords: HistoryRecords = {  
  historyRecords: [historyRecord]
}; 

try {
  const response = await xero.accountingApi.createReceiptHistory(xeroTenantId, receiptID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const repeatingInvoiceID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createRepeatingInvoiceAttachmentByFileName(xeroTenantId, repeatingInvoiceID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const repeatingInvoiceID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
  details: "Hello World"
}; 

const historyRecords: HistoryRecords = {  
  historyRecords: [historyRecord]
}; 

try {
  const response = await xero.accountingApi.createRepeatingInvoiceHistory(xeroTenantId, repeatingInvoiceID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';

const taxComponent: TaxComponent = { 
  name: "State Tax",
  rate: 2.25
};   
const taxComponent = [];
taxComponents.push(taxComponent)

const taxRate: TaxRate = { 
  name: "CA State Tax",
  taxComponents: taxComponents,

const taxRates: TaxRates = {  
  taxRates: [taxRate]
}; 

try {
  const response = await xero.accountingApi.createTaxRates(xeroTenantId, taxRates);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';

const trackingCategory: TrackingCategory = { 
  name: "Foobar"
}; 

try {
  const response = await xero.accountingApi.createTrackingCategory(xeroTenantId, trackingCategory);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const trackingCategoryID = '00000000-0000-0000-0000-000000000000';

const trackingOption: TrackingOption = { 
  name: "Foobar"
}; 

try {
  const response = await xero.accountingApi.createTrackingOptions(xeroTenantId, trackingCategoryID, trackingOption);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const accountID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.deleteAccount(xeroTenantId, accountID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactGroupID = '00000000-0000-0000-0000-000000000000';
const contactID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.deleteContactGroupContact(xeroTenantId, contactGroupID, contactID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactGroupID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.deleteContactGroupContacts(xeroTenantId, contactGroupID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const itemID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.deleteItem(xeroTenantId, itemID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const linkedTransactionID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.deleteLinkedTransaction(xeroTenantId, linkedTransactionID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const paymentID = '00000000-0000-0000-0000-000000000000';

const paymentDelete: PaymentDelete = { 
  status: "DELETED"
}; 

try {
  const response = await xero.accountingApi.deletePayment(xeroTenantId, paymentID, paymentDelete);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const trackingCategoryID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.deleteTrackingCategory(xeroTenantId, trackingCategoryID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const trackingCategoryID = '00000000-0000-0000-0000-000000000000';
const trackingOptionID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.deleteTrackingOptions(xeroTenantId, trackingCategoryID, trackingOptionID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const invoiceID = '00000000-0000-0000-0000-000000000000';

const requestEmpty: RequestEmpty = { };

try {
  const response = await xero.accountingApi.emailInvoice(xeroTenantId, invoiceID, requestEmpty);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const accountID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getAccount(xeroTenantId, accountID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const accountID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getAccountAttachmentByFileName(xeroTenantId, accountID, fileName, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const accountID = '00000000-0000-0000-0000-000000000000';
const attachmentID = '00000000-0000-0000-0000-000000000000';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getAccountAttachmentById(xeroTenantId, accountID, attachmentID, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const accountID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getAccountAttachments(xeroTenantId, accountID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="ACTIVE" AND Type=="BANK"';
const order = 'Name ASC';

try {
  const response = await xero.accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransactionID = '00000000-0000-0000-0000-000000000000';
const unitdp = 4;

try {
  const response = await xero.accountingApi.getBankTransaction(xeroTenantId, bankTransactionID,  unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransactionID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransactionID = '00000000-0000-0000-0000-000000000000';
const attachmentID = '00000000-0000-0000-0000-000000000000';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getBankTransactionAttachmentById(xeroTenantId, bankTransactionID, attachmentID, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransactionID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getBankTransactionAttachments(xeroTenantId, bankTransactionID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="AUTHORISED"';
const order = 'Type ASC';
const page = 1;
const unitdp = 4;

try {
  const response = await xero.accountingApi.getBankTransactions(xeroTenantId, ifModifiedSince, where, order, page, unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransactionID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getBankTransactionsHistory(xeroTenantId, bankTransactionID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransferID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getBankTransfer(xeroTenantId, bankTransferID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransferID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getBankTransferAttachmentByFileName(xeroTenantId, bankTransferID, fileName, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransferID = '00000000-0000-0000-0000-000000000000';
const attachmentID = '00000000-0000-0000-0000-000000000000';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getBankTransferAttachmentById(xeroTenantId, bankTransferID, attachmentID, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransferID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getBankTransferAttachments(xeroTenantId, bankTransferID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransferID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getBankTransferHistory(xeroTenantId, bankTransferID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'HasAttachments==true';
const order = 'Amount ASC';

try {
  const response = await xero.accountingApi.getBankTransfers(xeroTenantId, ifModifiedSince, where, order);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const batchPaymentID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getBatchPaymentHistory(xeroTenantId, batchPaymentID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="AUTHORISED"';
const order = 'Date ASC';

try {
  const response = await xero.accountingApi.getBatchPayments(xeroTenantId, ifModifiedSince, where, order);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const brandingThemeID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getBrandingTheme(xeroTenantId, brandingThemeID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const brandingThemeID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getBrandingThemePaymentServices(xeroTenantId, brandingThemeID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';

try {
  const response = await xero.accountingApi.getBrandingThemes(xeroTenantId);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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 budget, which includes budget lines


/Budgets/{BudgetID}

Usage and SDK Samples

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const budgetID = '00000000-0000-0000-0000-000000000000';
const dateTo: Date = new Date("2019-10-31");
const dateFrom: Date = new Date("2019-10-31");

try {
  const response = await xero.accountingApi.getBudget(xeroTenantId, budgetID,  dateTo, dateFrom);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

Scopes

accounting.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
Query parameters
Name Description
DateTo
date (date)
Filter by start date
DateFrom
date (date)
Filter by end date

getBudgets

Retrieve a list of budgets


/Budgets

Usage and SDK Samples

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const iDs = ["00000000-0000-0000-0000-000000000000"];
const dateTo: Date = new Date("2019-10-31");
const dateFrom: Date = new Date("2019-10-31");

try {
  const response = await xero.accountingApi.getBudgets(xeroTenantId,  iDs, dateTo, dateFrom);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

Scopes

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getContact(xeroTenantId, contactID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getContactAttachmentByFileName(xeroTenantId, contactID, fileName, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactID = '00000000-0000-0000-0000-000000000000';
const attachmentID = '00000000-0000-0000-0000-000000000000';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getContactAttachmentById(xeroTenantId, contactID, attachmentID, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getContactAttachments(xeroTenantId, contactID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactNumber = 'SB2';

try {
  const response = await xero.accountingApi.getContactByContactNumber(xeroTenantId, contactNumber);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getContactCISSettings(xeroTenantId, contactID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactGroupID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getContactGroup(xeroTenantId, contactGroupID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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*
UUID (uuid)
Unique identifier for a Contact Group
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getContactGroups

Retrieves the contact Id and name of each contact group


/ContactGroups

Usage and SDK Samples

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const where = 'Status=="ACTIVE"';
const order = 'Name ASC';

try {
  const response = await xero.accountingApi.getContactGroups(xeroTenantId,  where, order);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element

getContactHistory

Retrieves history records for a specific contact


/Contacts/{ContactID}/History

Usage and SDK Samples

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getContactHistory(xeroTenantId, contactID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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

getContacts

Retrieves all contacts in a Xero organisation


/Contacts

Usage and SDK Samples

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'ContactStatus=="ACTIVE"';
const order = 'Name ASC';
const iDs = ["00000000-0000-0000-0000-000000000000"];
const page = 1;
const includeArchived = true;
const summaryOnly = true;
const searchTerm = 'searchTerm=Joe Bloggs';

try {
  const response = await xero.accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, iDs, page, includeArchived, summaryOnly, searchTerm);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

Scopes

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

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element
IDs
array[UUID] (uuid)
Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call.
page
Integer
e.g. page=1 - Up to 100 contacts will be returned in a single API call.
includeArchived
Boolean
e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response
summaryOnly
Boolean
Use summaryOnly=true in GET Contacts and Invoices endpoint to retrieve a smaller version of the response object. This returns only lightweight fields, excluding computation-heavy fields from the response, making the API calls quick and efficient.
searchTerm
String
Search parameter that performs a case-insensitive text search across the Name, FirstName, LastName, ContactNumber and EmailAddress fields.

getCreditNote

Retrieves a specific credit note using a unique credit note Id


/CreditNotes/{CreditNoteID}

Usage and SDK Samples

await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const creditNoteID = '00000000-0000-0000-0000-000000000000';
const unitdp = 4;

try {
  const response = await xero.accountingApi.getCreditNote(xeroTenantId, creditNoteID,  unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}

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
CreditNoteID*
UUID (uuid)
Unique identifier for a Credit Note
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query par