What Rate Limits does Exact Online have?
Exact Online has an ever-growing number of restrictions on the use of the API, so-called “rate limits”, such as:
- a limit on API calls per day, administration and app;
- a limit on API calls per minute, administration and app;
- new limits since 2021.
The original rate limits - of which the error message described is one - were and still are easy to apply and resolve. The new rate limits are not at their best, partly due to their mutual interaction.
Exact Online rate limit per day
Exact Online has a limit on the number of API calls per day, per administration (“division”, or “partition” in Invantive SQL) and application. This is a hard limit; if exceeded, no successful API call can be made with the combination of app (“client ID”) and division until the reset moment. The reset moment occurs at the day boundary.
The maximum number of calls per day, division and app usually lies between 5,000 and 50,000. Exact Online has been known to drastically reduce apps that, in their view, make too many calls, sometimes down to as little as 150 or 300 API calls per day. This can cause confusion, as 300 (API calls) is also a per-minute limit. Therefore, read the error messages carefully and always state the error code itgenXXX999.
Other rate limits on Exact Online
In addition, Exact Online has several other so-called “rate limiters”, including a limit per minute and various new rate limits, such as the interval between renewing authorisation (see Impact Exact Online API aanpassingen 1 juli 2021). Limits are also reportedly set on the error rate; see Triggering the new error rate limit active of 10 per app, endpoint, Exact Online division, user and hour and Impact analysis of 10 error messages per app, endpoint, division, user and hour.
See also:
How do you analyse an overshoot of the daily rate limit?
There are several ways to carry out your own analysis of how the 15,000 API calls for this administration were consumed:
SessionIOs@DataDictionary: consult this runtime-available view with current API usage
- Invantive Cloud session I/Os: consult this cumulative record of session I/Os collected on Invantive Cloud
dc_table_partition_versions_r: consult this view in the backing database (usually SQL Server) to find out which tables are really large and replicated for this division (Invantive SQL usage: “partition”).
- the views described at Analyseer Exact Online API gebruik met `RateLimits` of `SystemPartitions`.
SessionIOs@DataDictionary to Excel sheet
In the view SessionIOs@DataDictionary, every completed API call is stored.
The contents of SessionIOs@DataDictionary are volatile; the data is lost when the program is closed.
A series of statements in the Exact Online replication script such as:
select *
from SessionIOs@DataDictionary
local export results as "c:\temp\mijn-ios.xlsx" format xlsx include technical headers
ensures that an Excel sheet is available after the program finishes, containing every executed API call. Filter on the PARTITION column to find the administration concerned.
Make sure to use local on error continue so that an error message does not cause the replication script to stop immediately as soon as it encounters the Exact Online error message.
Invantive Cloud Session I/Os
On Invantive Cloud, all session I/Os are registered centrally. They can be retrieved there via the “Session I/Os” screen. After filtering, they can be downloaded as Excel, CSV or PDF. You can also click through to the individual statements, such as this statement on Exact Online:
Unfortunately, the Session I/Os screen in Invantive Cloud is often no longer usable. Despite daily compression, over 1 million API calls are recorded per day, spread across 20,000 companies and 75 platforms. Due to the security layers, only your own session I/Os are visible, but they are nearly all processed in full when retrieved. We had not expected these numbers in such a short timeframe. This question prompted us to improve the speed. The upcoming release is expected to include the ability to click through from Organisation and Agreement to the Session I/Os, so that filtering can be applied immediately and performance becomes acceptable again.
Repository view dc_table_partition_versions_r
The view dc_table_partition_versions_r, based on the Data Replicator table dc_table_partition_versions, shows the number of rows processed per combination of data container, table, partition (administration/division) and version number.
By filtering a SQL statement on the partition, you can quickly determine which tables in this administration are very large. A column such as tpn_count_rows indicates how many rows it contains. Columns with historical values and growth are also available.
To calculate back to the number of API calls, you first need to distinguish between the “seeding approach” in tpn_seeding_approach_used_code, being Trickle Loading (“T”) or Complete (“C”). With Trickle Loading, Exact Online webhooks are used; with Complete, the full list is retrieved.
Each mutation via Trickle Loading costs between 0.1 and 0.02 API calls thanks to bundling. The mutations can be found by adding up the columns tpn_count_rows_deleted, tpn_count_rows_inserted and tpn_count_rows_updated.
In the case of Complete, all rows have been loaded. Then look at the table name:
- Table name ends in “Bulk”: divide the total number of rows by 1,000 for the number of API calls.
- Table name ends in “Incremental”: take the fixed value of 5 as a reasonable estimate for these Exact Online Sync APIs.
- Table name contains “ExactOnlineXML”: divide the total number of rows by 100 for the number of API calls.
- All other cases: divide the number of rows by 60 for the number of API calls.
How do you remove the cause of the rate limit being exceeded?
After analysing which tables consume relatively many API calls, a plan of attack can be determined. Without aiming for completeness, the following steps are recommended:
- Are there tables that are still loaded daily but are no longer needed because, for example, a
*Bulk or *Incremental version is also being loaded? Remove these with alter persistent cache drop... and check that those replication scripts do not automatically add them again.
- Are there tables that can be replaced by the
*Incremental tables, such as TransactionLinesIncremental? If so, replace them.
- Are there tables that can switch to trickle loading, such as
PjtTimeTransactions (the project hours have no Sync API for an unknown reason)? If so, turn on trickle loading.
In other cases, we recommend a brief consultation with Invantive to analyse and improve the situation.
How do you limit the damage caused by rate limits?
Usually, only a few administrations (“divisions”) within a large group exceed the maximum limit, for example because they contain a huge number of time registrations that are blindly retrieved in full every day.
However, an error message during loading can cause a (potentially large) part of the remaining administrations not to be processed. In that case, it is advisable to first select all divisions except the problematic one(s) using a use statement, and then update the replica:
use select code, 'eol' from systemdivisions@eol where code not in (123456, 234567)
alter persistent cache refresh
After that, you can try to load what is possible:
use 123456@eol, 234567@eol
alter persistent cache refresh
If desired, the tables can also be updated in order of the amount of API calls required, via an alter persistent cache statement.