Errors
The Invoice AI API signals errors through standard HTTP status codes combined with a structured error body. Every error response uses theapplication/problem+json content type, defined by RFC 7807.
Error Response Format
An error response body always contains these four fields:string
required
A URI that uniquely identifies the error type. Stable across API versions —
safe to branch your error-handling code on. Points to documentation for that
specific error when fetched.
string
required
A short, human-readable summary of the error type. Does not change
between occurrences of the same error. Use
type for programmatic checks;
use title for display.integer
required
The HTTP status code for this occurrence. Matches the response’s HTTP status
line exactly.
string
required
A human-readable explanation specific to this occurrence of the error. May
include the ID of the affected resource or a description of what failed
validation. Suitable for displaying to an operator; not guaranteed to be
stable across releases.
Example
Error responses are not wrapped in a
data envelope. Only successful
responses use { "data": ... }. Check the HTTP status code first; if it is
4xx or 5xx, parse the body as application/problem+json.HTTP Status Codes
400 — Bad Request
The request body failed schema validation. Thedetail field describes which field was invalid. Fix the request body before retrying.
401 — Unauthorized
TheAuthorization header is missing, malformed, or contains a key that does not exist or has been revoked. See the Authentication reference.
403 — Forbidden
The API key is valid but does not have the scope required by this endpoint. Add the missing scope to the key or create a new key. See Scopes.A request for a resource that belongs to a different workspace returns
404 Not Found, not 403 Forbidden. Returning 403 would confirm the resource
exists, enabling enumeration of other workspaces’ IDs.404 — Not Found
The requested resource does not exist, has been deleted, or belongs to another workspace.409 — Conflict
A uniqueness or concurrency constraint was violated. The most common cause is retrying a request with the sameIdempotency-Key but a different request body. Resolve the conflict before retrying: either use a new Idempotency-Key for a genuinely new request, or resend the original body to safely replay the original request.
422 — Unprocessable Entity
The request was syntactically valid and well-formed, but the operation cannot be performed because the resource is in the wrong state. Common examples:- Attempting to finalize an invoice that is already
openorpaid. - Attempting to void an invoice that has already been voided.
- Attempting to add a line item to an invoice that is no longer a
draft.
429 — Too Many Requests
Your API key has exceeded the rate limit. Back off and retry after the interval indicated in theRetry-After response header (in seconds).
500 — Internal Server Error
An unexpected error occurred on the Invoice AI servers. These are rare. If you receive persistent500 errors, check the status page and contact support.
Error Type Reference
Thetype URI carries a machine-stable slug. Use these slugs in your error-handling logic — never branch on the title string, which may be rephrased over time.
Handling Errors
Check the content type
Before parsing an error body, verify the responseContent-Type is application/problem+json. Proxies and CDN edge nodes occasionally return their own HTML error pages for network-level errors.