Skip to main content
When a request fails, Mandate returns a JSON body describing what went wrong. You can rely on the HTTP status code for broad error classification and on the error or detail field for machine-readable error codes that are safe to branch on in your code.

Error response format

Most endpoints return errors in this shape:
Some endpoints — particularly those that raise FastAPI validation errors — return the detail key instead:
Your error-handling code should check both keys.

HTTP status codes

Error codes

Handling errors in code

Check the HTTP status code first, then inspect the error code for precise handling:
TypeScript