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.
Previous
What is CORS and how does a preflight request work?
Next
What is the difference between PUT and PATCH?
More REST API Design Questions
View all →- Intermediate What is HATEOAS and how is it implemented?
- Intermediate What are the main API versioning strategies in REST and what are their tradeoffs?
- Intermediate What are the pagination strategies in REST APIs?
- Intermediate What is rate limiting and how is it communicated in REST APIs?
- Intermediate How does HTTP caching work in REST APIs with ETag and Cache-Control?