What is the ProblemDetails format (RFC 7807 / RFC 9457)?
Quick Answer
ProblemDetails is a standard JSON shape for HTTP error responses: { type, title, status, detail, instance } with a content type of application/problem+json. ASP.NET Core produces it automatically for [ApiController] validation failures (as ValidationProblemDetails) and you can return it from your own error handling for a consistent client experience.
ProblemDetails is an RFC standard for what an error response body should look like — a JSON object with type, title, status, detail and instance, served as application/problem+json. ASP.NET Core already returns it for model validation errors when you use [ApiController], and I make my exception handler return the same shape so every error from the API looks identical. I extend it with a trace id so support can find the log line, and an errors dictionary for field-level validation. The point is the client writes one error handler.
type— a URI identifying the error category;title— short human summary;status— the HTTP code;detail— specifics for this occurrence;instance— which request.- Extend it with your own members — a
traceId, anerrorsdictionary for field validation, an error code. - Enable app-wide with
AddProblemDetails()and the exception handler; customise viaCustomizeProblemDetails. - Consistent errors mean clients write one error handler instead of parsing five different shapes.