Errors
Answer every error as RFC 9457 problem details. Give it a stable type, a plain message and the exact fields that failed.
- Required 1
- Recommended 4
Required
Hide internals in errors
API-19Never put stack traces, queries, file paths or server versions in an error. Log them, and return a reference the client can quote.
Recommended
Send errors as problem details
API-16Answer every 4xx and 5xx with an RFC 9457 problem details object, served as
application/problem+json.Keep error types stable
API-17Treat each error
typeas part of the contract. Clients branch on it, so never rename or reuse one.Name every field that failed
API-18When input fails validation, return every failing field at once, with where it is and why it failed.
Say when to retry
API-20For 429 and 503, send
Retry-Afterso clients know how long to wait.
Read this with
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/api-design/errors">Agent Wranglers API design playbook</a>. In code you write, add a comment next to it with the same link.