Package: codat-accounting
Accounting﻿Codat's Accounting API is a flexible API for pulling and pushing up-to-date accounting data to your customer's accounting software.
It gives you a simple way to view, create, update adn delete data without having to worry about each platform's specific complexities.SDK Installationpipinstallcodat-accountingExample UsageSDK Example UsageExampleimportcodataccountingfromcodataccounting.modelsimportoperations,shareds=codataccounting.CodatAccounting(security=shared.Security(auth_header="Basic BASE_64_ENCODED(API_KEY)",),)req=operations.GetAccountTransactionRequest(account_transaction_id='string',company_id='8a210b68-6988-11ed-a1eb-0242ac120002',connection_id='2e9d2c44-f675-40ba-8049-353bfcb5e171',)res=s.account_transactions.get(req)ifres.account_transactionisnotNone:# handle responsepassAvailable Resources and Operationsaccount_transactionsget- Get account transactionlist- List account transactionsbank_accountscreate- Create bank accountget- Get bank accountget_create_update_model- Get create/update bank account modellist- List bank accountsupdate- Update bank accountbank_account_transactionscreate- Create bank account transactionsget_create_model- Get create bank account transactions modellist- List bank account transactionsbillscreate- Create billdelete- Delete billdownload_attachment- Download bill attachmentget- Get billget_attachment- Get bill attachmentget_create_update_model- Get create/update bill modellist- List billslist_attachments- List bill attachmentsupdate- Update billupload_attachment- Upload bill attachmentcustomerscreate- Create customerdownload_attachment- Download customer attachmentget- Get customerget_attachment- Get customer attachmentget_create_update_model- Get create/update customer modellist- List customerslist_attachments- List customer attachmentsupdate- Update customerdirect_costscreate- Create direct costdownload_attachment- Download direct cost attachmentget- Get direct costget_attachment- Get direct cost attachmentget_create_model- Get create direct cost modellist- List direct costslist_attachments- List direct cost attachmentsupload_attachment- Upload direct cost attachmentdirect_incomescreate- Create direct incomedownload_attachment- Download direct income attachmentget- Get direct incomeget_attachment- Get direct income attachmentget_create_model- Get create direct income modellist- List direct incomeslist_attachments- List direct income attachmentsupload_attachment- Create direct income attachmentinvoicescreate- Create invoicedelete- Delete invoicedownload_attachment- Download invoice attachmentdownload_pdf- Get invoice as PDFget- Get invoiceget_attachment- Get invoice attachmentget_create_update_model- Get create/update invoice modellist- List invoiceslist_attachments- List invoice attachmentsupdate- Update invoiceupload_attachment- Upload invoice attachmentitem_receiptsget- Get item receiptlist- List item receiptspurchase_orderscreate- Create purchase orderdownload_attachment- Download purchase order attachmentdownload_purchase_order_pdf- Download purchase order as PDFget- Get purchase orderget_attachment- Get purchase order attachmentget_create_update_model- Get create/update purchase order modellist- List purchase orderslist_attachments- List purchase order attachmentsupdate- Update purchase ordersupplierscreate- Create supplierdownload_attachment- Download supplier attachmentget- Get supplierget_attachment- Get supplier attachmentget_create_update_model- Get create/update supplier modellist- List supplierslist_attachments- List supplier attachmentsupdate- Update suppliertransferscreate- Create transferget- Get transferget_create_model- Get create transfer modellist- List transfersupload_attachment- Upload invoice attachmentbill_credit_notescreate- Create bill credit noteget- Get bill credit noteget_create_update_model- Get create/update bill credit note modellist- List bill credit notesupdate- Update bill credit noteupload_attachment- Upload bill credit note attachmentbill_paymentscreate- Create bill paymentsdelete- Delete bill paymentget- Get bill paymentget_create_model- Get create bill payment modellist- List bill paymentsaccountscreate- Create accountget- Get accountget_create_model- Get create account modellist- List accountscredit_notescreate- Create credit noteget- Get credit noteget_create_update_model- Get create/update credit note modellist- List credit notesupdate- Update credit noteitemscreate- Create itemget- Get itemget_create_model- Get create item modellist- List itemsjournal_entriescreate- Create journal entrydelete- Delete journal entryget- Get journal entryget_create_model- Get create journal entry modellist- List journal entriesjournalscreate- Create journalget- Get journalget_create_model- Get create journal modellist- List journalspaymentscreate- Create paymentget- Get paymentget_create_model- Get create payment modellist- List paymentsreportsget_aged_creditors_report- Aged creditors reportget_aged_debtors_report- Aged debtors reportget_balance_sheet- Get balance sheetget_cash_flow_statement- Get cash flow statementget_profit_and_loss- Get profit and lossis_aged_creditors_report_available- Aged creditors report availableis_aged_debtor_report_available- Aged debtors report availablecompany_infoget- Get company inforefresh- Refresh company infopayment_methodsget- Get payment methodlist- List payment methodssales_ordersget- Get sales orderlist- List sales orderstax_ratesget- Get tax ratelist- List all tax ratestracking_categoriesget- Get tracking categorieslist- List tracking categoriesRetriesSome of the endpoints in this SDK support retries.  If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API.  However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:importcodataccountingfromcodataccounting.modelsimportoperations,sharedfromcodataccounting.utilsimportBackoffStrategy,RetryConfigs=codataccounting.CodatAccounting(security=shared.Security(auth_header="Basic BASE_64_ENCODED(API_KEY)",),)req=operations.GetAccountTransactionRequest(account_transaction_id='string',company_id='8a210b68-6988-11ed-a1eb-0242ac120002',connection_id='2e9d2c44-f675-40ba-8049-353bfcb5e171',)res=s.account_transactions.get(req,RetryConfig('backoff',BackoffStrategy(1,50,1.1,100),False))ifres.account_transactionisnotNone:# handle responsepassIf you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:importcodataccountingfromcodataccounting.modelsimportoperations,sharedfromcodataccounting.utilsimportBackoffStrategy,RetryConfigs=codataccounting.CodatAccounting(retry_config=RetryConfig('backoff',BackoffStrategy(1,50,1.1,100),False)security=shared.Security(auth_header="Basic BASE_64_ENCODED(API_KEY)",),)req=operations.GetAccountTransactionRequest(account_transaction_id='string',company_id='8a210b68-6988-11ed-a1eb-0242ac120002',connection_id='2e9d2c44-f675-40ba-8049-353bfcb5e171',)res=s.account_transactions.get(req)ifres.account_transactionisnotNone:# handle responsepassError HandlingHandling errors in this SDK should largely match your expectations.  All operations return a response object or raise an error.  If Error objects are specified in your OpenAPI Spec, the SDK will raise the appropriate Error type.Error ObjectStatus CodeContent Typeerrors.ErrorMessage401,402,403,404,409,429,500,503application/jsonerrors.SDKError400-600/Exampleimportcodataccountingfromcodataccounting.modelsimportoperations,shareds=codataccounting.CodatAccounting(security=shared.Security(auth_header="Basic BASE_64_ENCODED(API_KEY)",),)req=operations.GetAccountTransactionRequest(account_transaction_id='string',company_id='8a210b68-6988-11ed-a1eb-0242ac120002',connection_id='2e9d2c44-f675-40ba-8049-353bfcb5e171',)res=Nonetry:res=s.account_transactions.get(req)excepterrors.ErrorMessagease:print(e)# handle exceptionraise(e)excepterrors.SDKErrorase:print(e)# handle exceptionraise(e)ifres.account_transactionisnotNone:# handle responsepassServer SelectionSelect Server by IndexYou can override the default server globally by passing a server index to theserver_idx: intoptional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:#ServerVariables0https://api.codat.ioNoneExampleimportcodataccountingfromcodataccounting.modelsimportoperations,shareds=codataccounting.CodatAccounting(server_idx=0,security=shared.Security(auth_header="Basic BASE_64_ENCODED(API_KEY)",),)req=operations.GetAccountTransactionRequest(account_transaction_id='string',company_id='8a210b68-6988-11ed-a1eb-0242ac120002',connection_id='2e9d2c44-f675-40ba-8049-353bfcb5e171',)res=s.account_transactions.get(req)ifres.account_transactionisnotNone:# handle responsepassOverride Server URL Per-ClientThe default server can also be overridden globally by passing a URL to theserver_url: stroptional parameter when initializing the SDK client instance. For example:importcodataccountingfromcodataccounting.modelsimportoperations,shareds=codataccounting.CodatAccounting(server_url="https://api.codat.io",security=shared.Security(auth_header="Basic BASE_64_ENCODED(API_KEY)",),)req=operations.GetAccountTransactionRequest(account_transaction_id='string',company_id='8a210b68-6988-11ed-a1eb-0242ac120002',connection_id='2e9d2c44-f675-40ba-8049-353bfcb5e171',)res=s.account_transactions.get(req)ifres.account_transactionisnotNone:# handle responsepassCustom HTTP ClientThe Python SDK makes API calls using the (requests)[https://pypi.org/project/requests/] HTTP library.  In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with a customrequests.Sessionobject.For example, you could specify a header for every request that this sdk makes as follows:importcodataccountingimportrequestshttp_client=requests.Session()http_client.headers.update({'x-custom-header':'someValue'})s=codataccounting.CodatAccounting(client:http_client)AuthenticationPer-Client Security SchemesThis SDK supports the following security scheme globally:NameTypeSchemeauth_headerapiKeyAPI keyYou can set the security parameters through thesecurityoptional parameter when initializing the SDK client instance. For example:importcodataccountingfromcodataccounting.modelsimportoperations,shareds=codataccounting.CodatAccounting(security=shared.Security(auth_header="Basic BASE_64_ENCODED(API_KEY)",),)req=operations.GetAccountTransactionRequest(account_transaction_id='string',company_id='8a210b68-6988-11ed-a1eb-0242ac120002',connection_id='2e9d2c44-f675-40ba-8049-353bfcb5e171',)res=s.account_transactions.get(req)ifres.account_transactionisnotNone:# handle responsepassSupportIf you encounter any challenges while utilizing our SDKs, please don't hesitate to reach out for assistance.
You can raise any issues by contacting your dedicated Codat representative or reaching out to oursupport team.
We're here to help ensure a smooth experience for you.Library generated bySpeakeasy