Skip to main content
This guide explains the shape of a Lerian error response and how to respond to each kind.

What you will receive


An application/problem+json response is an RFC 9457 problem details object. Any other media type is not, and the shape it carries differs between APIs. Your API reference carries an Error handling page that names the shape that API answers.
Field definitions In the problem details object:
  • type – A URI reference that identifies the error type.
  • title – A short summary of the problem type.
  • status – The HTTP status code.
  • detail – Guidance specific to this occurrence.
  • code – A stable identifier for the error. Use this field for programmatic handling.
  • errors – Optional list of per-field detail, each entry with a location and a message.
  • instance – Optional URI reference for this specific occurrence.
Plain envelopes differ between APIs. They differ in the field names, in whether the error sits at the top level, and in which field carries the machine-readable token. Read your API reference’s Error handling page before you write a parser.
Where an API publishes a stable code, branch on it rather than on the title or the message. Titles and messages change to improve clarity. Not every API publishes a code, and its Error handling page says whether it does.

Error codes


Code shape varies by API. You will meet a prefixed <PREFIX>-<NNNN>, a bare number, a lowercase token, and a code that a rail’s counterparty assigned. Midaz core uses bare numbers such as 0002 and 0009. Your API reference carries an Error handling page that names the shape that API uses and lists the codes it emits.

HTTP status codes


These are the status codes you will meet most often. An API can answer others, and its own Error handling page lists them.

Retry guidance


You should not retry every error. The following table helps you decide:
A failed command can have an unknown outcome. For commands, follow that API’s Error handling page for the idempotency key to use. Some APIs require the original key, while others reject or discard it after an uncertain provider outcome.

Exponential backoff strategy

For retryable errors, use exponential backoff to avoid overwhelming the service:
  1. First retry: Wait 1 second
  2. Second retry: Wait 2 seconds
  3. Third retry: Wait 4 seconds
  4. Maximum retries: Stop after 3–5 attempts
  5. Jitter: Add a small random delay (0–500ms) to each wait to prevent thundering herd
Do not repeat a 400, a 403 or a 422 unchanged. Each one names a problem in the request, so fix the request first. A 401 is worth one retry after you refresh the token, and no more.

Troubleshooting by category


Missing or invalid fields (400)

A 400 response can carry field-level detail that names the fields at fault. Common causes:
  • Required field omitted from the request body
  • Field value does not match the expected type (e.g., string instead of UUID)
  • Field value exceeds maximum length
  • Unexpected extra fields in the request body
Resolution steps:
  1. Read the field-level detail in the error response
  2. Compare your request against the API reference for that endpoint

Authentication and authorization (401/403)

Common causes:
  • Missing Authorization header
  • Expired or revoked token
  • Token does not grant access to the requested endpoint
Resolution steps:
  1. Confirm that your environment has Access Manager enabled
  2. Verify the token is present in the Authorization header
  3. Request a new token if the current one has expired
  4. Check that the token’s scope includes the required permissions

Resource not found (404)

Common causes:
  • Incorrect resource ID in the URL path
  • Resource was soft-deleted
  • Resource belongs to a different organization or ledger
Resolution steps:
  1. Verify the resource ID in the URL path
  2. List resources to confirm the ID exists
  3. Check that you use the correct organizationId and ledgerId path parameters

Conflict errors (409)

Common causes:
  • Creating a resource with a name that already exists (e.g., duplicate ledger name, duplicate rule name)
  • Attempting an operation that is already complete (e.g., duplicate transaction)
Resolution steps:
  1. Read the error message to identify which field caused the conflict
  2. Use a different value (e.g., rename) or retrieve the existing resource instead
  3. For idempotent operations, verify the existing resource matches your intent

Rate limiting (429)

Common causes:
  • Too many requests in a short period
Resolution steps:
  1. Implement exponential backoff with jitter
  2. Reduce the frequency of API calls
  3. Batch operations where possible

Server and timeout errors (500/502/503/504)

Common causes:
  • Temporary service disruption
  • High load on the platform
  • Upstream dependency unavailable
Resolution steps:
  1. Retry reads with exponential backoff (1s, 2s, 4s). Reconcile commands before retrying them, because the original outcome can be unknown.
  2. If the error persists after 3–5 retries, contact support
  3. Log a redacted error response for support escalation

Service-specific error lists


Every API reference carries an Error handling page. Use it to look up a code you received. Products Brazil Rails The SPI error list documents the native SPI rail contract. It is not the Pix Lerian v1.0.0 integration lane: use the Pix Lerian error list for the application plugin and mock-provider integration/testing surface. The native SPI connector is not available for use in this release. Interfaces Platform

Best practices


1. Use error codes for programmatic handling

Error codes are stable identifiers for automation. Map specific codes to resolution paths in your integration:

2. Log errors with context

Log the operation, timestamp, status, stable error code, and a redacted response. Do not log credentials, bearer tokens, personal data, or sensitive request fields. This keeps support context useful without copying secrets or PII into logs.

3. Handle field-level errors

When the response carries field-level detail, surface those messages to your users rather than a generic error. The member that carries it differs by API. Each error list page names the member its API sends.

4. Implement circuit breakers for integrations

If you receive repeated 500, 502, or 503 errors, use a circuit breaker pattern to temporarily stop calling the failing service and prevent cascading failures.

5. Stay updated

Review the error list pages periodically. New error codes can appear as services evolve.