Design JSON Errors That Help the Caller Recover
Design a JSON error response that tells callers what failed and what to do next.
The error payload is a recovery interface. If your JSON endpoint returns only bad request, the caller has to reverse-engineer your rules. That wastes support time and encourages guess-and-retry behavior. What machines need Machines need stable fields they can branch on: status, type or reason, field path, and sometimes retryability. These fields should not change casually because client code may depend on them. What people need People need a specific explanation without internal noise. Field /employees/17/tax_id must match 9 digits is useful. ValidationException at PayrollController line 83 is not. What support needs Support needs correlation. A request ID, import ID,…
Sign up free — one personalized lesson every day, matched to your role and goals.
Already have an account? Sign in