This is a staging build of the docs
We've reorganized our products to make building with Codat easier than ever
Skip to main content

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.

Status codes

Status codeExplanation
200Success
202Accepted (pending)
400Bad Request: The server can't process the request because of an apparent client-side error.
401Unauthorized: The supplied Codat API key is incorrect.
402Payment Required: An account limit has been reached. The type of account limit is described in the error property:
- Company limit exceeded: You have exceeded the 50-company limit that applies to a Free plan. We recommend that you delete any companies you no longer need and retry the request.
- SyncSettingsValidationException: Sync schedule not allowed: You have requested an hourly sync schedule; this functionality is not included in the Free plan.
- Payment Required: Your Free account is older than 365 days and has expired. Please contact our solutions team to upgrade your plan.
For example responses, see Example account limit errors.
403Forbidden: 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.
404Not 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]".
405Method Not Allowed: You are attempting to use an unauthorized method.
409Conflict: 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.
429Too Many Requests: You have made too many requests in a given amount of time; please retry later.
500Internal Server Error: There is a problem with our server. Please try again later.
503Service 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.

50-company limit

Error response from POST /companies when you have exceeded the 50-company limit that applies to the Free plan.

For example:

{
"statusCode": 402,
"service": "PublicApi",
"error": "CompanyValidationException: Company limit exceeded",
"correlationId": "00000000-0000-0000-0000-000000000000",
"validation": {
"errors": [
{
"itemId": "Company",
"message": "Company limit exceeded. Learn more at https://docs.codat.io/using-the-api/errors",
"validatorName": "CreateCompany"
}
],
"warnings": []
}
}

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.

{
"statusCode": 402,
"service": "PublicApi",
"error": "Payment Required",
"correlationId": "00000000-0000-0000-0000-000000000000",
"validation": {
"errors": [
{
"message": "Account expired. Learn more at https://docs.codat.io/using-the-api/errors",
}
],
"warnings": []
}
}

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.

{
"statusCode": 404,
"service": "QuickbooksOnline",
"error": "InvoicePdfNotFoundException: Invoice not found for company 360cb9b3-d9cf-4f66-b8db-8a3523fe3dc5 and invoice ID 12345",
"correlationId": "131f0225-5467-421a-b179-4531d6b4a942"
}

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.

Recap

You've learned about error codes you might encounter while using the API.



Was this page useful?
❤️
👍
🤔
👎
😭