REST API Error Response

Structured error response with error code, human-readable message, and a details array for field-level issues.

API ResponsesRESTAPIerror handlingvalidation

Structured error response with error code, human-readable message, and a details array for field-level issues.

Loading editor...

When to use this template

Return this shape whenever an API request fails. The top-level code (e.g. VALIDATION_ERROR) is machine-readable, the message is user-facing, and the details array pinpoints individual field problems. This pattern plays nicely with form libraries that map field-level errors back to inputs.