Status codes and errors
Learn about status codes and errors of Codat's APIs
The following page describes the status codes and standard error responses used in the Codat API.
|400||Bad Request: The server can't process the request because of an apparent client-side error.|
|401||Unauthorized: The supplied Codat API key is incorrect.|
|402||Payment Required: An account limit has been reached. The type of account limit is described in the |
For example responses, see Example account limit errors.
|403||Forbidden: This error is returned in the following scenarios: |
You're using an outdated API key or a key not associated with that resource.
- The requested endpoint is for administrators only.
- A downstream endpoint can't be accessed.
|404||Not Found: This error is returned in the following scenarios: |
- The requested resource could not be found.
- The data type is not supported by the underlying platform.
In this case, the error message is: "Datatype [name] not supported by platform(s) [name]".
|405||Method Not Allowed: You are attempting to use an unauthorized method.|
|409||Conflict: The resource is not ready. |
If syncing a data set, this could mean that either:
- The data set has not been requested.
- The syncing of data set has not been completed.
|429||Too Many Requests: You have made too many requests in a given amount of time; please retry later.|
|500||Internal Server Error: There is a problem with our server. Please try again later.|
|503||Service Unavailable: The Codat API is temporarily offline for maintenance. Please try again later.|
Example account limit errors
When an API request causes an account limit to be exceeded, you'll receive a 402 response code. The response body indicates which account limit was exceeded.
Error response from POST /companies when you have exceeded the 50-company limit that applies to the Free plan.
"error": "CompanyValidationException: Company limit exceeded",
"message": "Company limit exceeded. Learn more at https://docs.codat.io/using-the-api/errors",
365 day free account limit
Error response when your account has expired and you make a request to any endpoint. This error is returned if your Free account is older than 365 days and has expired.
"error": "Payment Required",
"message": "Account expired. Learn more at https://docs.codat.io/using-the-api/errors",
Correlation IDs in error responses
The content of an error response includes a more detailed error message and a
correlationId, which can be used to identify a particular response. Please include the
correlationId in text format if you are contacting Codat support regarding an error.
"error": "InvoicePdfNotFoundException: Invoice not found for company 360cb9b3-d9cf-4f66-b8db-8a3523fe3dc5 and invoice ID 12345",
Status codes in asynchronous push responses
Status codes for push operations created in the Codat API might be different from the status codes returned in the responses from the service providers.
When a push operation is created in the API, some service providers may use a
202 Accepted code, which implies that the request has been accepted for processing, but the processing has not completed. However, the push API may return a 200 Success code for the push operation successfully created in the Codat API.
You've learned about error codes you might encounter while using the API.