Skip to main content

Optimize API calls

Learn how to use our APIs efficiently and ensure you are not reaching our rate limits

Rate limits

Ensure you are familiar with our rate limits before optimizing your APIAPI A set of rules and protocols that allows different software applications to communicate with each other. Codat provides APIs for accessing financial data from accounting, banking, and commerce platforms. calls to Codat.

Making as few calls to Codat as possible allows you to reduce your costs and your system's computational times, and decreases internet traffic between you and Codat. It also allows you to process less data and access that data faster, delivering reduced waiting time and an improved experience for your users.

Use our querying, ordering, and notification systems and optimize how you access Codat and fetch the data with the methods below.

Querying by the record date

You can query data by using the modifiedDate. This is the date the records have been updated in Codat's database. This gives you only new or updated data since your last APIAPI A set of rules and protocols that allows different software applications to communicate with each other. Codat provides APIs for accessing financial data from accounting, banking, and commerce platforms. call.

You can also order the results by modifiedDate. This allows you to page through the relevant data from newest to oldest and effectively acts as an index.

Modified dates

In addition to modifiedDate, Codat also stores sourceModifiedDate, which indicates the date a record was changed in the source platform. Not all platforms support sourceModifiedDate. Refer to Using modified dates for more information.

If you also store the last queried date per companyCompany In Codat, a company represents your customer's business entity. Companies can have multiple connections to different data sources. and per data type, you are able to call our APIAPI A set of rules and protocols that allows different software applications to communicate with each other. Codat provides APIs for accessing financial data from accounting, banking, and commerce platforms. the minimum number of times to return only new or changed data.

When a user linksLink The authorization flow that allows end users to connect their accounting, banking, or commerce platforms to your application via Codat. for the first time, there may be a need to read all data, for all time. Make sure this is truly required, and if so, perform this read only once. Afterwards, only query and access data since the last read operation.

Pagination

We also recommend using a page size of 100 to return the results faster. This is especially relevant when a user is waiting for a UI to load. The maximum page size is 5000 results, which means fewer APIAPI A set of rules and protocols that allows different software applications to communicate with each other. Codat provides APIs for accessing financial data from accounting, banking, and commerce platforms. calls, but much slower responses.

Querying by the record date: example

You can query our List accounts endpoint with modifiedDate as follows:

https://api.codat.io/companies/{companyId}/data/accounts?page=1&pageSize=100&query=modifiedDate>2022-08-23&orderby=-modifiedDate

This returns any accounts for the given companyId that were added or updated in Codat since midnight UTC on the 23 of August. Newest results are displayed first and paged with a size of 100.

Optimising by use case

As part of your implementation, check which data types are relevant to your use case, and focus on reading only those data types. You can also use query parameters to further filter down the number of results by use case when calling to our APIAPI A set of rules and protocols that allows different software applications to communicate with each other. Codat provides APIs for accessing financial data from accounting, banking, and commerce platforms..

These approaches allow you to minimise the number of APIAPI A set of rules and protocols that allows different software applications to communicate with each other. Codat provides APIs for accessing financial data from accounting, banking, and commerce platforms. calls and the volume of data returned. As a result, this speeds up your system, returns the data faster, and improves your user experience.

Querying for a use case: example

You can query our Invoices endpoint for an invoice use case as follows:

https://api.codat.io/companies/{companyId}/data/invoices?page=1&pageSize=100&query=customerRef.companyName=NewCo

This returns all invoices for a companyCompany In Codat, a company represents your customer's business entity. Companies can have multiple connections to different data sources. issued by a specific customer. Instead of customerRef.companyName, you can use customerRef.id to filter by their Id instead.

Making use of webhooksWebhook An automated notification sent from Codat to your application when specific events occur, such as when data syncs complete or connections change status.

Consider configuring a webhook consumer to listen for a DatasetDataChanged event. This will send an event per companyCompany In Codat, a company represents your customer's business entity. Companies can have multiple connections to different data sources. when new data becomes available for each data type.

This is sent in the form of a POST request to a webhookWebhook An automated notification sent from Codat to your application when specific events occur, such as when data syncs complete or connections change status. URL you specified. Once you receive the message, you can query our APIAPI A set of rules and protocols that allows different software applications to communicate with each other. Codat provides APIs for accessing financial data from accounting, banking, and commerce platforms. for that specific companyCompany In Codat, a company represents your customer's business entity. Companies can have multiple connections to different data sources. and data type. This means you will only call the APIAPI A set of rules and protocols that allows different software applications to communicate with each other. Codat provides APIs for accessing financial data from accounting, banking, and commerce platforms. when data is changed, instead of periodically polling our data to check for changes and updates.


Was this page useful?
👏
👍
🤔
👎
😭