Xero Accounting API

Accounting

createAccount

Creates a new chart of accounts


/Accounts

Usage and SDK Samples

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_account():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    idempotency_key = 'KEY_VALUE'

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

Scopes

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

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_account_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    account_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    idempotency_key = 'KEY_VALUE'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.create_account_attachment_by_file_name(xero_tenant_id, account_id, file_name, body, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createAccountAttachmentByFileName: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_bank_transaction_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transaction_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    idempotency_key = 'KEY_VALUE'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.create_bank_transaction_attachment_by_file_name(xero_tenant_id, bank_transaction_id, file_name, body, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createBankTransactionAttachmentByFileName: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_bank_transaction_history_record():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transaction_id = '00000000-0000-0000-0000-000000000000'
    idempotency_key = 'KEY_VALUE'

    history_record = HistoryRecord(
        details = "Hello World")

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

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_bank_transactions():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'
    idempotency_key = 'KEY_VALUE'

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

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

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

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

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

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_bank_transfer():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    idempotency_key = 'KEY_VALUE'

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

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

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

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

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_bank_transfer_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transfer_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    idempotency_key = 'KEY_VALUE'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.create_bank_transfer_attachment_by_file_name(xero_tenant_id, bank_transfer_id, file_name, body, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createBankTransferAttachmentByFileName: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_bank_transfer_history_record():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transfer_id = '00000000-0000-0000-0000-000000000000'
    idempotency_key = 'KEY_VALUE'

    history_record = HistoryRecord(
        details = "Hello World")

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

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_batch_payment():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'
    idempotency_key = 'KEY_VALUE'
    curr_date = dateutil.parser.parse('2020-12-03T00:00:00Z')

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

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

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

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

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

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

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_batch_payment_history_record():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    batch_payment_id = '00000000-0000-0000-0000-000000000000'
    idempotency_key = 'KEY_VALUE'

    history_record = HistoryRecord(
        details = "Hello World")

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

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_branding_theme_payment_services():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    branding_theme_id = '00000000-0000-0000-0000-000000000000'
    idempotency_key = 'KEY_VALUE'

    payment_service = PaymentService(
        payment_service_id = "00000000-0000-0000-0000-000000000000",
        payment_service_name = "ACME Payments",
        payment_service_url = "https://www.payupnow.com/",
        pay_now_text = "Pay Now")

    paymentServices = PaymentServices( 
        paymentServices = [paymentService])
    
    try:
        api_response = api_instance.create_branding_theme_payment_services(xero_tenant_id, branding_theme_id, paymentServices, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createBrandingThemePaymentServices: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
paymentServices *
PaymentServices
PaymentServices array with PaymentService object in body of request
Required

createContactAttachmentByFileName


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

Usage and SDK Samples

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_contact_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    contact_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    idempotency_key = 'KEY_VALUE'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.create_contact_attachment_by_file_name(xero_tenant_id, contact_id, file_name, body, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createContactAttachmentByFileName: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_contact_group():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    idempotency_key = 'KEY_VALUE'

    contact_group = ContactGroup(
        name = "VIPs")

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

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_contact_group_contacts():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    contact_group_id = '00000000-0000-0000-0000-000000000000'
    idempotency_key = 'KEY_VALUE'

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

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

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_contact_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    contact_id = '00000000-0000-0000-0000-000000000000'
    idempotency_key = 'KEY_VALUE'

    history_record = HistoryRecord(
        details = "Hello World")

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

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_contacts():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'
    idempotency_key = 'KEY_VALUE'

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

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

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

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_credit_note_allocation():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    credit_note_id = '00000000-0000-0000-0000-000000000000'
    summarize_errors = 'True'
    idempotency_key = 'KEY_VALUE'
    curr_date = dateutil.parser.parse('2020-12-03T00:00:00Z')

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

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

    allocations = Allocations( 
        allocations = [allocation])
    
    try:
        api_response = api_instance.create_credit_note_allocation(xero_tenant_id, credit_note_id, allocations, summarize_errors, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createCreditNoteAllocation: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_credit_note_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    credit_note_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    include_online = 'True'
    idempotency_key = 'KEY_VALUE'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.create_credit_note_attachment_by_file_name(xero_tenant_id, credit_note_id, file_name, body, include_online, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createCreditNoteAttachmentByFileName: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_credit_note_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    credit_note_id = '00000000-0000-0000-0000-000000000000'
    idempotency_key = 'KEY_VALUE'

    history_record = HistoryRecord(
        details = "Hello World")

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

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_credit_notes():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'
    idempotency_key = 'KEY_VALUE'
    curr_date = dateutil.parser.parse('2020-12-03T00:00:00Z')

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

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

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

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

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_currency():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    idempotency_key = 'KEY_VALUE'

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

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_employees():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'
    idempotency_key = 'KEY_VALUE'

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

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

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_expense_claim_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    expense_claim_id = '00000000-0000-0000-0000-000000000000'
    idempotency_key = 'KEY_VALUE'

    history_record = HistoryRecord(
        details = "Hello World")

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

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_expense_claims():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    idempotency_key = 'KEY_VALUE'
    curr_date = dateutil.parser.parse('2020-12-03T00:00:00Z')

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

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

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

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

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_invoice_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    invoice_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    include_online = 'True'
    idempotency_key = 'KEY_VALUE'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.create_invoice_attachment_by_file_name(xero_tenant_id, invoice_id, file_name, body, include_online, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createInvoiceAttachmentByFileName: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_invoice_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    invoice_id = '00000000-0000-0000-0000-000000000000'
    idempotency_key = 'KEY_VALUE'

    history_record = HistoryRecord(
        details = "Hello World")

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

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_invoices():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'
    idempotency_key = 'KEY_VALUE'
    date_value = dateutil.parser.parse('2020-10-10T00:00:00Z')
    due_date_value = dateutil.parser.parse('2020-10-28T00:00:00Z')

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

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

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

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

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

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_item_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    item_id = '00000000-0000-0000-0000-000000000000'
    idempotency_key = 'KEY_VALUE'

    history_record = HistoryRecord(
        details = "Hello World")

    historyRecords = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_item_history(xero_tenant_id, item_id, historyRecords, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createItemHistory: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_items():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'
    idempotency_key = 'KEY_VALUE'

    purchase_details = Purchase(
        cogs_account_code = "500")

    item = Item(
        code = "abcXYZ123",
        name = "HelloWorld",
        description = "Foobar",
        inventory_asset_account_code = "140",
        purchase_details = purchase_details)

    items = Items( 
        items = [item])
    
    try:
        api_response = api_instance.create_items(xero_tenant_id, items, summarize_errors, unitdp, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createItems: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_linked_transaction():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    idempotency_key = 'KEY_VALUE'

    linked_transaction = LinkedTransaction(
        source_transaction_id = "00000000-0000-0000-0000-000000000000",
        source_line_item_id = "00000000-0000-0000-0000-000000000000")
    
    try:
        api_response = api_instance.create_linked_transaction(xero_tenant_id, linkedTransaction, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createLinkedTransaction: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_manual_journal_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    manual_journal_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    idempotency_key = 'KEY_VALUE'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.create_manual_journal_attachment_by_file_name(xero_tenant_id, manual_journal_id, file_name, body, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createManualJournalAttachmentByFileName: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_manual_journal_history_record():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    manual_journal_id = '00000000-0000-0000-0000-000000000000'
    idempotency_key = 'KEY_VALUE'

    history_record = HistoryRecord(
        details = "Hello World")

    historyRecords = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_manual_journal_history_record(xero_tenant_id, manual_journal_id, historyRecords, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createManualJournalHistoryRecord: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_manual_journals():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'
    idempotency_key = 'KEY_VALUE'
    date_value = dateutil.parser.parse('2020-12-03T00:00:00Z')
    
    manual_journal_lines = []

    credit = ManualJournalLine(
        line_amount = -100.0,
        account_code = "400",
        description = "Hello there")    
    manual_journal_lines.append(credit)

    debit = ManualJournalLine(
        line_amount = 100.0,
        account_code = "120",
        description = "Hello there")    
    manual_journal_lines.append(debit)

    manual_journal = ManualJournal(
        narration = "Foobar",
        date = date_value,
        journal_lines = manual_journal_lines)

    manualJournals = ManualJournals( 
        manual_journals = [manual_journal])
    
    try:
        api_response = api_instance.create_manual_journals(xero_tenant_id, manualJournals, summarize_errors, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createManualJournals: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_overpayment_allocations():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    overpayment_id = '00000000-0000-0000-0000-000000000000'
    summarize_errors = 'True'
    idempotency_key = 'KEY_VALUE'
    curr_date = dateutil.parser.parse('2020-12-03T00:00:00Z')

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

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

    allocations = Allocations( 
        allocations = [allocation])
    
    try:
        api_response = api_instance.create_overpayment_allocations(xero_tenant_id, overpayment_id, allocations, summarize_errors, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createOverpaymentAllocations: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_overpayment_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    overpayment_id = '00000000-0000-0000-0000-000000000000'
    idempotency_key = 'KEY_VALUE'

    history_record = HistoryRecord(
        details = "Hello World")

    historyRecords = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_overpayment_history(xero_tenant_id, overpayment_id, historyRecords, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createOverpaymentHistory: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_payment():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    idempotency_key = 'KEY_VALUE'
    date_value = dateutil.parser.parse('2020-10-10T00:00:00Z')

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

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

    payment = Payment(
        invoice = invoice,
        account = account,
        amount = 1.0,
        date = date_value)

    payments = Payments( 
        payments = [payment])
    
    try:
        api_response = api_instance.create_payment(xero_tenant_id, payment, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPayment: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_payment_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    payment_id = '00000000-0000-0000-0000-000000000000'
    idempotency_key = 'KEY_VALUE'

    history_record = HistoryRecord(
        details = "Hello World")

    historyRecords = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_payment_history(xero_tenant_id, payment_id, historyRecords, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPaymentHistory: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_payment_service():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    idempotency_key = 'KEY_VALUE'

    payment_service = PaymentService(
        payment_service_name = "ACME Payments",
        payment_service_url = "https://www.payupnow.com/",
        pay_now_text = "Pay Now")

    paymentServices = PaymentServices( 
        paymentServices = [paymentService])
    
    try:
        api_response = api_instance.create_payment_service(xero_tenant_id, paymentServices, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPaymentService: %s\n" % e)

Scopes

paymentservices Grant read-write access to payment services

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_payments():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'
    idempotency_key = 'KEY_VALUE'
    date_value = dateutil.parser.parse('2020-10-10T00:00:00Z')

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

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

    payment = Payment(
        invoice = invoice,
        account = account,
        amount = 1.0,
        date = date_value)

    payments = Payments( 
        payments = [payment])
    
    try:
        api_response = api_instance.create_payments(xero_tenant_id, payments, summarize_errors, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPayments: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_prepayment_allocations():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    prepayment_id = '00000000-0000-0000-0000-000000000000'
    summarize_errors = 'True'
    idempotency_key = 'KEY_VALUE'
    curr_date = dateutil.parser.parse('2020-12-03T00:00:00Z')

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

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

    allocations = Allocations( 
        allocations = [allocation])
    
    try:
        api_response = api_instance.create_prepayment_allocations(xero_tenant_id, prepayment_id, allocations, summarize_errors, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPrepaymentAllocations: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_prepayment_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    prepayment_id = '00000000-0000-0000-0000-000000000000'
    idempotency_key = 'KEY_VALUE'

    history_record = HistoryRecord(
        details = "Hello World")

    historyRecords = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_prepayment_history(xero_tenant_id, prepayment_id, historyRecords, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPrepaymentHistory: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_purchase_order_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    purchase_order_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    idempotency_key = 'KEY_VALUE'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.create_purchase_order_attachment_by_file_name(xero_tenant_id, purchase_order_id, file_name, body, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPurchaseOrderAttachmentByFileName: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_purchase_order_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    purchase_order_id = '00000000-0000-0000-0000-000000000000'
    idempotency_key = 'KEY_VALUE'

    history_record = HistoryRecord(
        details = "Hello World")

    historyRecords = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_purchase_order_history(xero_tenant_id, purchase_order_id, historyRecords, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPurchaseOrderHistory: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_purchase_orders():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'
    idempotency_key = 'KEY_VALUE'
    date_value = dateutil.parser.parse('2020-12-03T00:00:00Z')

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

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

    purchase_order = PurchaseOrder(
        contact = contact,
        line_items = line_items,
        date = date_value)

    purchaseOrders = PurchaseOrders( 
        purchase_orders = [purchase_order])
    
    try:
        api_response = api_instance.create_purchase_orders(xero_tenant_id, purchaseOrders, summarize_errors, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPurchaseOrders: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_quote_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    quote_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    idempotency_key = 'KEY_VALUE'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.create_quote_attachment_by_file_name(xero_tenant_id, quote_id, file_name, body, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createQuoteAttachmentByFileName: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_quote_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    quote_id = '00000000-0000-0000-0000-000000000000'
    idempotency_key = 'KEY_VALUE'

    history_record = HistoryRecord(
        details = "Hello World")

    historyRecords = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_quote_history(xero_tenant_id, quote_id, historyRecords, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createQuoteHistory: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_quotes():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'
    idempotency_key = 'KEY_VALUE'
    date_value = dateutil.parser.parse('2020-12-03T00:00:00Z')

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

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

    quote = Quote(
        contact = contact,
        line_items = line_items,
        date = date_value)

    quotes = Quotes( 
        quotes = [quote])
    
    try:
        api_response = api_instance.create_quotes(xero_tenant_id, quotes, summarize_errors, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createQuotes: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_receipt():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    idempotency_key = 'KEY_VALUE'

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

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

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

    receipt = Receipt(
        contact = contact,
        user = user,
        line_items = line_items,
        line_amount_types = LineAmountTypes.INCLUSIVE,
        status = "DRAFT")

    receipts = Receipts( 
        receipts = [receipt])
    
    try:
        api_response = api_instance.create_receipt(xero_tenant_id, receipts, unitdp, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createReceipt: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_receipt_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    receipt_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    idempotency_key = 'KEY_VALUE'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.create_receipt_attachment_by_file_name(xero_tenant_id, receipt_id, file_name, body, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createReceiptAttachmentByFileName: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_receipt_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    receipt_id = '00000000-0000-0000-0000-000000000000'
    idempotency_key = 'KEY_VALUE'

    history_record = HistoryRecord(
        details = "Hello World")

    historyRecords = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_receipt_history(xero_tenant_id, receipt_id, historyRecords, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createReceiptHistory: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_repeating_invoice_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    repeating_invoice_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    idempotency_key = 'KEY_VALUE'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.create_repeating_invoice_attachment_by_file_name(xero_tenant_id, repeating_invoice_id, file_name, body, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createRepeatingInvoiceAttachmentByFileName: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_repeating_invoice_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    repeating_invoice_id = '00000000-0000-0000-0000-000000000000'
    idempotency_key = 'KEY_VALUE'

    history_record = HistoryRecord(
        details = "Hello World")

    historyRecords = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_repeating_invoice_history(xero_tenant_id, repeating_invoice_id, historyRecords, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createRepeatingInvoiceHistory: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createRepeatingInvoices

Creates one or more repeating invoice templates


/RepeatingInvoices

Usage and SDK Samples

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_repeating_invoices():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'
    idempotency_key = 'KEY_VALUE'
    
    try:
        api_response = api_instance.create_repeating_invoices(xero_tenant_id, repeatingInvoices, summarize_errors, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createRepeatingInvoices: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
repeatingInvoices *
RepeatingInvoices
RepeatingInvoices with an array of repeating 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

createTaxRates

Creates one or more tax rates


/TaxRates

Usage and SDK Samples

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_tax_rates():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    idempotency_key = 'KEY_VALUE'

    tax_component = TaxComponent(
        name = "State Tax",
        rate = 2.25)
    
    taxComponent = []    
    tax_components.append(tax_component)

    tax_rate = TaxRate(
        name = "CA State Tax",
        taxComponents = taxComponents,

    taxRates = TaxRates( 
        tax_rates = [tax_rate])
    
    try:
        api_response = api_instance.create_tax_rates(xero_tenant_id, taxRates, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createTaxRates: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_tracking_category():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    idempotency_key = 'KEY_VALUE'

    trackingCategory = TrackingCategory(
        name = "Foobar")
    
    try:
        api_response = api_instance.create_tracking_category(xero_tenant_id, trackingCategory, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createTrackingCategory: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_tracking_options():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    tracking_category_id = '00000000-0000-0000-0000-000000000000'
    idempotency_key = 'KEY_VALUE'

    trackingOption = TrackingOption(
        name = "Foobar")
    
    try:
        api_response = api_instance.create_tracking_options(xero_tenant_id, tracking_category_id, trackingOption, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createTrackingOptions: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_delete_account():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    account_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.delete_account(xero_tenant_id, account_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deleteAccount: %s\n" % e)

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

deleteBatchPayment

Updates a specific batch payment for invoices and credit notes


/BatchPayments

Usage and SDK Samples

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_delete_batch_payment():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    idempotency_key = 'KEY_VALUE'

    batchPaymentDelete = BatchPaymentDelete(
        status = "DELETED")
        batch_payment_id = "00000000-0000-0000-0000-000000000000")
    
    try:
        api_response = api_instance.delete_batch_payment(xero_tenant_id, batchPaymentDelete, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deleteBatchPayment: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
batchPaymentDelete *
BatchPaymentDelete
Required

deleteBatchPaymentByUrlParam

Updates a specific batch payment for invoices and credit notes


/BatchPayments/{BatchPaymentID}

Usage and SDK Samples

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_delete_batch_payment_by_url_param():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    batch_payment_id = '00000000-0000-0000-0000-000000000000'
    idempotency_key = 'KEY_VALUE'
    
    try:
        api_response = api_instance.delete_batch_payment_by_url_param(xero_tenant_id, batch_payment_id, batchPaymentDeleteByUrlParam, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deleteBatchPaymentByUrlParam: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
batchPaymentDeleteByUrlParam *
BatchPaymentDeleteByUrlParam
Required

deleteContactGroupContact

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


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

Usage and SDK Samples

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_delete_contact_group_contact():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    contact_group_id = '00000000-0000-0000-0000-000000000000'
    contact_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_instance.delete_contact_group_contact(xero_tenant_id, contact_group_id, contact_id)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deleteContactGroupContact: %s\n" % e)

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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_delete_contact_group_contacts():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    contact_group_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_instance.delete_contact_group_contacts(xero_tenant_id, contact_group_id)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deleteContactGroupContacts: %s\n" % e)

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

deleteCreditNoteAllocations

Deletes an Allocation from a Credit Note


/CreditNotes/{CreditNoteID}/Allocations/{AllocationID}

Usage and SDK Samples

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_delete_credit_note_allocations():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    credit_note_id = '00000000-0000-0000-0000-000000000000'
    allocation_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.delete_credit_note_allocations(xero_tenant_id, credit_note_id, allocation_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deleteCreditNoteAllocations: %s\n" % e)

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
AllocationID*
UUID (uuid)
Unique identifier for Allocation object
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_delete_item():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    item_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_instance.delete_item(xero_tenant_id, item_id)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deleteItem: %s\n" % e)

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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_delete_linked_transaction():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    linked_transaction_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_instance.delete_linked_transaction(xero_tenant_id, linked_transaction_id)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deleteLinkedTransaction: %s\n" % e)

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

deleteOverpaymentAllocations

Deletes an Allocation from an overpayment


/Overpayments/{OverpaymentID}/Allocations/{AllocationID}

Usage and SDK Samples

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_delete_overpayment_allocations():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    overpayment_id = '00000000-0000-0000-0000-000000000000'
    allocation_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.delete_overpayment_allocations(xero_tenant_id, overpayment_id, allocation_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deleteOverpaymentAllocations: %s\n" % e)

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
AllocationID*
UUID (uuid)
Unique identifier for Allocation object
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_delete_payment():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    payment_id = '00000000-0000-0000-0000-000000000000'
    idempotency_key = 'KEY_VALUE'

    paymentDelete = PaymentDelete(
        status = "DELETED")
    
    try:
        api_response = api_instance.delete_payment(xero_tenant_id, payment_id, paymentDelete, idempotency_key)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deletePayment: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
Body parameters
Name Description
paymentDelete *
PaymentDelete
Required

deletePrepaymentAllocations

Deletes an Allocation from a Prepayment


/Prepayments/{PrepaymentID}/Allocations/{AllocationID}

Usage and SDK Samples

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_delete_prepayment_allocations():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    prepayment_id = '00000000-0000-0000-0000-000000000000'
    allocation_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.delete_prepayment_allocations(xero_tenant_id, prepayment_id, allocation_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deletePrepaymentAllocations: %s\n" % e)

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

deleteTrackingCategory

Deletes a specific tracking category


/TrackingCategories/{TrackingCategoryID}

Usage and SDK Samples

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_delete_tracking_category():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    tracking_category_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.delete_tracking_category(xero_tenant_id, tracking_category_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deleteTrackingCategory: %s\n" % e)

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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_delete_tracking_options():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    tracking_category_id = '00000000-0000-0000-0000-000000000000'
    tracking_option_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.delete_tracking_options(xero_tenant_id, tracking_category_id, tracking_option_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deleteTrackingOptions: %s\n" % e)

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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_email_invoice():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    invoice_id = '00000000-0000-0000-0000-000000000000'
    idempotency_key = 'KEY_VALUE'

    requestEmpty = RequestEmpty()
    
    try:
        api_instance.email_invoice(xero_tenant_id, invoice_id, requestEmpty, idempotency_key)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->emailInvoice: %s\n" % e)

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
Idempotency-Key
String
This allows you to safely retry requests without the risk of duplicate processing. 128 character max.
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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_account():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    account_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_account(xero_tenant_id, account_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getAccount: %s\n" % e)

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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_account_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    account_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_account_attachment_by_file_name(xero_tenant_id, account_id, file_name, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getAccountAttachmentByFileName: %s\n" % e)

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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_account_attachment_by_id():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    account_id = '00000000-0000-0000-0000-000000000000'
    attachment_id = '00000000-0000-0000-0000-000000000000'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_account_attachment_by_id(xero_tenant_id, account_id, attachment_id, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getAccountAttachmentById: %s\n" % e)

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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_account_attachments():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    account_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_account_attachments(xero_tenant_id, account_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getAccountAttachments: %s\n" % e)

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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_accounts():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    if_modified_since = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'Status=="ACTIVE" AND Type=="BANK"'
    order = 'Name ASC'
    
    try:
        api_response = api_instance.get_accounts(xero_tenant_id, if_modified_since, where, order)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getAccounts: %s\n" % e)

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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_bank_transaction():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transaction_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_bank_transaction(xero_tenant_id, bank_transaction_id, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransaction: %s\n" % e)

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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_bank_transaction_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transaction_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_bank_transaction_attachment_by_file_name(xero_tenant_id, bank_transaction_id, file_name, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransactionAttachmentByFileName: %s\n" % e)

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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_bank_transaction_attachment_by_id():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transaction_id = '00000000-0000-0000-0000-000000000000'
    attachment_id = '00000000-0000-0000-0000-000000000000'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_bank_transaction_attachment_by_id(xero_tenant_id, bank_transaction_id, attachment_id, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransactionAttachmentById: %s\n" % e)

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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_bank_transaction_attachments():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transaction_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_bank_transaction_attachments(xero_tenant_id, bank_transaction_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransactionAttachments: %s\n" % e)

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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_bank_transactions():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    if_modified_since = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'Status=="AUTHORISED"'
    order = 'Type ASC'
    
    try:
        api_response = api_instance.get_bank_transactions(xero_tenant_id, if_modified_since, where, order, page, unitdp, pageSize)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransactions: %s\n" % e)

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
pageSize
Integer
Number of records to retrieve per page

getBankTransactionsHistory

Retrieves history from a specific bank transaction using a unique bank transaction Id


/BankTransactions/{BankTransactionID}/History

Usage and SDK Samples

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_bank_transactions_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transaction_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_bank_transactions_history(xero_tenant_id, bank_transaction_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransactionsHistory: %s\n" % e)

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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_bank_transfer():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transfer_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_bank_transfer(xero_tenant_id, bank_transfer_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransfer: %s\n" % e)

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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_bank_transfer_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transfer_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_bank_transfer_attachment_by_file_name(xero_tenant_id, bank_transfer_id, file_name, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransferAttachmentByFileName: %s\n" % e)

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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_bank_transfer_attachment_by_id():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transfer_id = '00000000-0000-0000-0000-000000000000'
    attachment_id = '00000000-0000-0000-0000-000000000000'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_bank_transfer_attachment_by_id(xero_tenant_id, bank_transfer_id, attachment_id, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransferAttachmentById: %s\n" % e)

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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_bank_transfer_attachments():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transfer_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_bank_transfer_attachments(xero_tenant_id, bank_transfer_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransferAttachments: %s\n" % e)

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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_bank_transfer_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transfer_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_bank_transfer_history(xero_tenant_id, bank_transfer_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransferHistory: %s\n" % e)

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

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_bank_transfers():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    if_modified_since = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'HasAttachments==true'
    order = 'Amount ASC'
    
    try:
        api_response = api_instance.get_bank_transfers(xero_tenant_id, if_modified_since, where, order)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransfers: %s\n" % e)

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

getBatchPayment

Retrieves a specific batch payment using a unique batch payment Id


/BatchPayments/{BatchPaymentID}

Usage and SDK Samples

# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_batch_payment():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    batch_payment_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_batch_payment(xero_tenant_id, batch_payment_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBatchPayment: %s\n" % e)

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