API integration FAQ

Table of contents
  1. What’s my API rate limit?
  2. How should I handle API service downtime?
  3. How should I handle errors?

What’s my API rate limit?

Each Anrok seller has a default soft rate limit of 10 transactions per second. For rate limits, API callers would receive an HTTP 429: Too Many Requests response and Integer Retry-After: Number of seconds to wait for the rate limit to reset. The recommendation is to retry the request after the response value.

How should I handle API service downtime?

While Anrok API downtime is rare, we recommend integrators set up some error handling and API request retries as part of an integration plan. If Anrok is down, API callers would receive a timeout or HTTP 50x (e.g. 500, 502, 503, 504, etc.) or similar. In that case, there are two options:

  • Delay invoicing until the API is available again.
  • Continue invoicing without collecting tax, add $0 tax as a placeholder.

The risk with continuing to invoice without collecting tax is that sellers will incur these costs out-of-pocket since the tax liability still exists even if not collected from the customer. However, this may be a better option ultimately than not invoicing at all.

In all cases, we recommend a retry policy for failed retryable API requests to Anrok. A retry policy can be set up to call the Anrok API at a fixed interval or with exponential decay to reattempt tax calculations up to a certain maximum number or over a fixed time period.

Another option may be to configure whether to delay invoicing or continue invoicing with $0 tax based on the size and materiality of the invoice. If the invoice is large and non-time-sensitive, delaying invoicing may be a better approach.

How should I handle errors?

When building an Anrok integration, it’s important to have comprehensive handling of all the possible response types available in the Anrok API and to consider what messages to display to users when any of these response types occur.

There are various errors that can be returned by the Anrok API. These might be related to network problems, external services, or invalid requests. Below is a list of the most common errors you may receive and the recommended resolution for each.

Error Description Resolution
accountingTimeZoneNotSetForSeller No accounting timezone has been set for your Anrok account. Navigate to your Anrok settings and select an accounting timezone.
accountingTimeZoneNotSupported The provided accounting timezone is not supported by Anrok. Navigate to your Anrok settings to view the list of supported timezones.
certificateIdNotFound An exemption certificate matching certificateId cannot be found in Anrok. Correct the certificate ID and retry the request.
currencyCodeNotSupported The provided currency code for the transaction is not currently supported by Anrok. Retry the transaction with a supported currency code.
customerAddressCouldNotResolve The customerAddress provided for the transaction does not have enough information to determine a tax jurisdiction or the information is invalid. Collect additional address information or correct the existing information, then retry the request.
customerIdNotFound The provided customerId does not exist in Anrok. Retry the request with a customer ID that exists in Anrok or provide customerName so a customer can be created.
duplicateJurisIds Duplicate juris IDs were provided in the request when creating an exemption certificate. Remove the duplicate jurisId and retry the request.
externalServiceError An external service used by Anrok is experiencing technical difficulties. Retry the request.
productExternalIdUnknown The provided productExternalId for one or more of the transaction line items does not exist in Anrok. Add the Product ID to Anrok and select a tax configuration.
taxDateTooFarInFuture The provided accountingDate or taxDate of the transaction is too far in the future to accurately calculate tax. Anrok accepts dates up-to 31 days in the future. Adjust the date of the transaction or retry the request closer to the transaction date.
transactionFrozenForFiling The provided transaction has been added to a return and can no longer be modified. Negate the transaction and create a new transaction instead.
429: Too Many Requests The rate of requests for your API key has exceeded the rate limit. Retry the request after headers[Retry-After] seconds.