Generate structured errors
Generate consistent, structured response bodies on errors. Include a
machine-readable error id
, a human-readable error message
, and
optionally a url
pointing the client to further information about the
error and how to resolve it, e.g.:
HTTP/1.1 429 Too Many Requests
{
"id": "rate_limit",
"message": "Account reached its API rate limit.",
"url": "https://docs.service.com/rate-limits"
}
Document your error format and the possible error id
s that clients may
encounter.