What is the RFC 7807 Problem Details format for REST API errors?

Answer

RFC 7807 Problem Details defines a standardized JSON format for HTTP API error responses, avoiding inconsistent error structures across APIs. The media type is application/problem+json. A Problem Details response looks like: { "type": "https://example.com/errors/validation-error", "title": "Validation Failed", "status": 422, "detail": "The 'email' field must be a valid email address.", "instance": "/api/users" }. Fields: type (URI identifying the problem type, links to documentation), title (human-readable summary), status (HTTP status code), detail (human-readable explanation of the specific occurrence), instance (URI of the specific request). Additional fields can be added for machine-readable error details (field-level validation errors, error codes). Standardizing error formats dramatically reduces client-side error handling complexity.