Accounts Payable
Retrieve and create bills using the Accounting API
Accounts payable
In Codat's API a Bill represents an invoice from a supplier, for this use case bills can be retrieved from the Accounting API, or you can create bills within your platform and post them to your customers accounting software.
Managing suppliers
In the accounting API a supplier represents a business or sole trader that provides goods or services to a company.
Suppliers are relevant for the bill pay use case as each bill is associated to a supplier - suppliers also have important information such as addresses and contact details which could be used to notify a supplier once a payment is made.
Retrieve a list of suppliers
You can get a list of suppliers using the Accounting API
GET https://api.codat.io/companies/{companyId}/data/suppliers?page=1&pageSize=100
Query parameters can also be used to narrow the list of suppliers e.g.
status=Active
returns only active suppliersdefaultCurrency=USD
returns suppliers that provide goods or services in dollarssupplierName=Acme
returns suppliers with a name that matches the query
Currently the accounting API does not expose supplier balances on the supplier endpoint, however you can access these by
- Aggregating bills by supplier
- Using the Aged debtors report
Creating a new supplier
In some cases, a company may do business with a new supplier for the first time, when this happens you should create the supplier first before creating a bill against the supplier.
POST https://api.codat.io/companies/{companyId}/connections/{connectionId}/push/suppliers
Updating a supplier
If a supplier changes address or business name, you may want to reflect this change in the companies accounting software by updating the supplier.
PUT https://api.codat.io/companies/{companyId}/connections/{connectionId}/push/suppliers/{supplierId}
Bills
Bills can either be created in the companies accounting software and then queried through the Accounting API, or bills can be created in your application and then posted to the companies accounting software.
Get a list of bills
You can get a list of bills for a company from the Accounting API
GET https://api.codat.io/companies/{companyId}/data/bills?page=1&pageSize=100
Query parameters can be used to filter and narrow the returned results e.g.
supplierRef.supplierName=acme inc
returns only bills associated to the specified supplierdueDate>2023-06-01&&dueDate<2023-06-30
returns only bills due for payment between June 1st and June 30thamountDue>0
returns only outstanding bills with due amounts
You can also retrieve any associated attachments for a given bill such as a pdf copy of the invoice issued by the supplier.
Create a bill
You can also create a new bill in your companies accounting software to represent goods or services purchased from a supplier.
POST https://api.codat.io/companies/{companyId}/connections/{connectionId}/push/bills
Upload a copy of the invoice
In some cases where a bill is being created in your application, the company may also want to save a copy of the pdf invoice against the bill in their accounting software. This can be supported via the bill attachments API
POST https://api.codat.io/companies/{companyId}/connections/{connectionId}/push/bills/{billId}/attachments
Read next
- Payment mapping - Enable SMBs to choose how to make payments