View as Markdown

Errors

Every error is an RFC 9457 problem details body, with the media type application/problem+json:

{
  "type": "https://oscaraccountant.com/errors/period_locked",
  "title": "The period is locked",
  "status": 409,
  "code": "period_locked",
  "detail": "Period 2026-03 is locked. Reopen it or post in an open period."
}
FieldMeaning
codeStable and machine-readable. Branch on it in your code
statusThe HTTP status, the same as the status of the response
titleA short text for a person. It can change
detailWhat went wrong in this request, for a person. It can change
typeA URL that names the problem: the code after /errors/
errorsOnly for a validation error: one entry for each invalid field

A validation error names each field:

{
  "type": "https://oscaraccountant.com/errors/validation_error",
  "title": "The request is not valid",
  "status": 400,
  "code": "validation_error",
  "detail": "The request has invalid fields.",
  "errors": [
    { "field": "lines.0.amount", "code": "required", "detail": "This field is required." },
    {
      "field": "cursor",
      "code": "invalid_cursor",
      "detail": "The cursor is not a cursor of this list. Start again from the first page."
    }
  ]
}

field is a dotted path into the request (lines.0.amount), or null for an error of the whole request.

Status codes

StatusWhenRetry?
400The request is malformed or not validNo. Fix the request
401No credential, or a credential that is not valid (not_authenticated, authentication_failed)No. Fix the credential
403The caller may not do this (permission_denied, insufficient_scope, human_actor_required)No
404The object does not exist, or the caller cannot see it (not_found)No
409The books are in a state that refuses the changeNot as it is. Read the code
413, 415A body or a file is too large (request_too_large, file_too_large) or of a type we do not take (unsupported_file_type)No
429Too many requests (throttled)Yes, after Retry-After
500An error on our side. The detail never repeats internal textYes, with the same Idempotency-Key
503The books of the company are not available now (books_unavailable)Yes, later

Common codes

CodeStatusMeaning
validation_error400See errors for each field
invalid_payload400The books refused the content of the request
unbalanced_entry400The amounts do not balance
not_authenticated401No credential
authentication_failed401An unknown, revoked or expired API key or token
permission_denied403The role, or the client capabilities of the company, do not allow it
insufficient_scope403The role allows it, the scopes of the credential do not
human_actor_required403A person must make this decision. See Human judgements
not_found404No such object, or not visible to the caller
invalid_state409The object is not in a state that allows this, for example issuing an invoice twice
period_locked409The date is in a closed period. Your accountant decides
no_open_period409No open period covers the date
company_not_ready409The books of the company are still being set up
idempotency_conflict409The Idempotency-Key was used with another request body
idempotency_in_progress409The first request with this Idempotency-Key is still running
request_too_large413A JSON body is larger than 1 MB
throttled429Too many requests
books_unavailable503The books cannot be read now

The API reference lists the codes of each operation. A new code can appear at any time. Handle an unknown code by its status.