Errors
Errors
Error responses use the Problem Details format (RFC 9457).
When a call fails, the API returns an HTTP status code and a body in the standard Problem Details format (RFC 9457). The content type is application/problem+json.
HTTP/1.1 422 Unprocessable Content
Content-Type: application/problem+json
X-Request-Id: 01JD3W6Y7P4T
{
"type": "https://docs.ajour.dk/errors/date-range-too-long",
"title": "Date range is too long",
"status": 422,
"detail": "Sales lines allow at most 92 days. You asked for 120.",
"requestId": "01JD3W6Y7P4T",
"errors": { "to": ["Must be at most 92 days after from."] }
}| Field | Meaning |
|---|---|
type | A link to a page that explains the error. Use it in your code to tell errors apart. It does not change. |
title | A short summary of the error type. |
status | The HTTP status code. |
detail | What went wrong in this request. The text can change. Do not use it in your code. |
requestId | The same id as the X-Request-Id header. Send it to Ajour support when you report a problem. |
errors | Only for invalid parameters: messages per parameter. |
Error types
| Status | Type | When |
|---|---|---|
400 | invalid-parameter | A parameter has the wrong format or an unknown value. |
400 | impersonation-not-allowed | The request has the Impersonation-Company-Id header. |
400 | key-in-url | An API key was found in the URL. |
401 | unauthorized | The key is missing, wrong, revoked or expired. |
403 | missing-scope | The key does not have the scope the call needs. |
403 | company-inactive | The company's Ajour account is not active. |
403 | report-needs-all-locations | The report needs a key for all locations. |
404 | not-found | The item does not exist, or the location is outside the key. |
422 | validation-failed | to is before from. |
422 | date-range-too-long | The period is longer than the endpoint allows. |
422 | location-required | A key for several locations must name one locationId for a report. |
429 | rate-limited | Too many requests. Wait for Retry-After seconds. |
503 | report-timeout | A report took longer than 90 seconds. |
Which errors to retry
- Retry
429after theRetry-Afterseconds. - Retry
503with a shorter period. - Retry network errors and other
5xxerrors with a growing wait, for example 1, 2, 4 and 8 seconds. - Do not retry
400,401,403,404or422. Fix the request first.