Errors
How a failed request is reported, what to do about each error code, the rate limits and limits, and why an analysis can fail.
A failed request returns an HTTP error status. The body is a problem as defined in RFC 9457, with
the content type application/problem+json. The problem is the top-level object:
{
"type": "https://api.aircredit.de/problems/invalid-spec",
"title": "Invalid specification",
"status": 422,
"detail": "Invalid specification",
"request_id": "req_example",
"errors": [{"pointer": "/spec/checks/income/uses/0", "code": "unknown_field_key",
"message": "The referenced field is unknown."}]
}
In this example, the uses list of a custom check names a field that does not exist. A problem has
these members:
typeidentifies the kind of problem,titlenames it anddetailexplains it.statusrepeats the HTTP status.request_idrepeats thex-request-idresponse header.instance, when present, identifies this occurrence.errorslists each problem with a part of the request. Every entry has apointerto that part, written as an RFC 6901 JSON Pointer, a machine-readablecodeand amessage. An error in a header has the root pointer"".
Base your error handling on the code, not on the wording of a message. New codes can appear in v1.
Handle a code you do not know by its HTTP status.
Error codes
| Status | Codes | What to do |
|---|---|---|
| 400 | invalid_request | Fix the syntax, the headers or the shape of the body. |
| 401 | invalid_api_key | Check the API key. Replace a revoked key. |
| 402 | insufficient_balance | Top up the prepaid balance, then retry with the same Idempotency-Key and body. |
| 403 | api_client_disabled, permission_denied | Use a key that may perform this operation, or create a new one. |
| 404 | not_found | Check the ID, and that it belongs to the integration and mode of your key. |
| 405 | method_not_allowed | Use the documented HTTP method. |
| 409 | idempotency_conflict, conflict | Send the original request again, or use a new Idempotency-Key for a new request. |
| 409 | upload_in_progress, preview_not_ready | Wait, then retry. |
| 409 | analysis_in_progress | Cancel the analysis and wait until it has finished before you delete it. |
| 409 | file_limit_reached | Delete files or wait for them to expire, then retry (Limits). |
| 409 | partner_data_purge_in_progress | The workspace that owns the integration is being deleted. Stop sending new requests. |
| 410 | resource_deleted | Your resource was deleted or has expired. Create a new one. |
| 410 | api_version_retired | This major version is retired. Move to its successor (Versioning). |
| 413 | payload_too_large | Make the uploaded file or the JSON request body smaller. |
| 415 | unsupported_content_type | Use a supported media type, and UTF-8 for text. |
| 422 | invalid_spec, invalid_field, unsupported_language, unsupported_candidate, duplicate_requirement_key, unknown_field_key, unknown_catalog_key, document_too_large, unreadable_document | Correct the part of the request that errors points to. Do not send custom document types. |
| 429 | rate_limited | Wait Retry-After seconds, then retry with the same Idempotency-Key and body. |
| 500 | internal_error | Retry with backoff. If the error persists, report the request_id. |
| 501 | not_implemented | The request uses a capability that is not supported. Do not retry it unchanged. |
| 503 | service_unavailable | Retry with backoff. For a create request, use the same Idempotency-Key and body. |
402 insufficient_balance occurs only with live keys. Its problem type is
https://api.aircredit.de/problems/insufficient-balance. The request created nothing and charged
nothing. Billing explains how to top up.
Rate limits
AirCredit limits the number of requests in three ways:
- Each integration has its own request budget, shared by its test and live keys.
- Test requests also draw on a second budget, shared by the test keys of all integrations in your workspace.
- Requests from one IP address share a ceiling across all integrations.
429 rate_limited has only three causes. A request exceeds one of these budgets, processing
capacity is exhausted, or too many analyses are in progress
(Concurrent analyses). The response always has a Retry-After
header in seconds. Wait at least that long, then retry with the same Idempotency-Key and body.
Limits
These are the current default limits. They can change, so rely on the error codes, not on the numbers.
| Limit | Default | When exceeded |
|---|---|---|
| Retained files per integration and mode | 256 | 409 file_limit_reached on upload |
| Files per analysis | 32 | 422 invalid_spec |
| Queued or running analyses per integration and mode | 32 | 429 rate_limited with Retry-After |
| Pages per document | 500 | An analysis of the document fails |
| Upload size | 100 MiB | 413 payload_too_large |
| JSON request body | 1 MiB | 413 payload_too_large |
| Resolved fields per analysis, including check dependencies | 256 | 422 invalid_spec |
| Checks per analysis | 128 | 422 invalid_spec |
| Collection requirements per analysis | 128 | 422 invalid_spec |
| Months across all period collection requirements | 1200 | 422 invalid_spec |
A file counts against the retained-file limit until it is deleted or expires. Test files expire 24 hours after upload at the latest (Test mode).
Execution failures
An analysis can also fail after AirCredit has accepted the create request. Reading it then returns
HTTP 200 with status: failed and an error object. Today its code is one of these. New codes
can appear.
| Codes | Cause |
|---|---|
input_unavailable | An input file could not be read, or was deleted or replaced before the analysis ran |
permission_denied | The integration lost the permission to run the analysis |
deadline_exceeded | Processing ran out of time |
document_too_large | A document exceeds the processing limits |
classification_failed, extraction_failed, cross_validation_failed, check_failed | A classification, extraction, cross-validation or check that the analysis needs failed |
processing_failed | AirCredit could not complete the analysis for a reason on its side |
Treat a code you do not know like processing_failed. If processing_failed or deadline_exceeded
persists across new analyses, report the analysis id.
These codes are separate from the HTTP problem codes above and from reason: not_implemented on a
document requirement. A failed check inside a succeeded analysis has its own error
(Checks).
A retry with the same Idempotency-Key does not restart a failed analysis. Fix the cause, then
create a new analysis with a new key.