Skip to main content

Errors

The Lilury API uses standard HTTP status codes and returns a consistent error body on every failure. Understanding the error format lets you handle failures gracefully without guessing.

HTTP status codes

Note that domain-level “not found” errors (e.g. looking up a journal that does not exist) return 400, not 404. The error body’s code field tells you exactly what went wrong.

Error response schema

All errors return a JSON body with this shape:

Error object

Each item in the errors array has:

Error codes

The code field tells you the category of the error so you can handle it programmatically, independently of the reason message (which may be translated).

Validation errors vs. business errors

There are two distinct kinds of 400 errors. Validation errors occur when the request body itself is malformed — a required field is missing, a string is too long, a date is invalid, etc. They are caught before any business logic runs. The name field identifies the specific field that failed:
Business errors occur when the request is structurally valid but violates a domain rule — for example, trying to post a journal that is already posted. The name field is always "generalErrors":

Authentication errors

A 401 response means the request was not authenticated. This happens when:
  • The Authorization header is missing
  • The access token has expired
  • The API key has been revoked or expired
When you receive a 401 with a user token, use your refresh token to get a new access token and retry the request. See Authentication for details.

Permission errors

A 403 response means you are authenticated but the token or API key does not have the required permission for this endpoint.
Check that the permission required by the endpoint is included in your token’s company permissions or your API key’s permission list.

Conflict errors

A 409 response has two distinct causes. Idempotency conflict — a request with the same Idempotency-Key is currently being processed. Wait briefly and retry; once the first request completes, a retry with the same key will return the original response instead of re-executing the operation.
If the first request completed successfully and you retry with the same Idempotency-Key, you will receive the original 200 response without the operation being executed again. See Idempotency for details. Version conflict — the resource was modified by another request between your read and your write. Re-fetch the resource to get the current version and retry.
See Concurrency for details on how to use the version field.

Rate limit errors

A 429 response means your client IP has exceeded 25 requests per second. Slow down and retry after a brief pause. The response body is empty — no error object is returned.

Server errors

A 500 response means something went wrong on our end. The body will be empty. Record the request’s traceId from a preceding error response if available, and contact support.