Orofold Labs

Launching soon

Notes Get in touch

Engineering 4 min read Updated

API error responses that clients can act on

In short

Return the status code, then a problem details body with a stable type, a short title, a detail for this request and no internal information.

A client that receives an error has to decide what to do: fix the request, wait, sign in or report the failure. A status code alone rarely tells it enough. RFC 9457 therefore defines a standard error body, called problem details, with a stable type, a short title and a detail for the specific failure. For the codes themselves, see HTTP status codes and what each one tells a client.

The body carries five standard members

RFC 9457 identifies the JSON form of the body with the media type application/problem+json, and defines an XML equivalent, application/problem+xml. The table explains each standard member:

MemberPurpose
typeA URI reference that identifies the kind of problem; the primary identifier for clients
statusThe HTTP status code as a number. It is advisory and must match the code in the response.
titleA short, human-readable summary. It should not change between occurrences, except for translation.
detailA human-readable explanation of this occurrence, meant to help the client fix the problem
instanceA URI reference that identifies this particular occurrence

If a member’s value does not match its specified type, consumers ignore that member.

The type must be stable and specific

RFC 9457 recommends absolute URIs for the type member rather than relative ones. Clients may depend on a published type, so treat it as a contract and do not rename it for cosmetic reasons.

When type is absent, RFC 9457 assumes about:blank. That value means the problem has no meaning beyond the HTTP status code. The IANA registry lists about:blank with the title “See HTTP Status Code” and no recommended status. Types you define yourself should carry your own URIs. New types can be registered under the Specification Required procedure.

Working on something similar in your own product? A few honest sentences are enough – we read every enquiry and reply by email. Apply with your idea

Detail is for the client, not the debugger

The detail member should help the client fix the problem with this request. RFC 9457 says consumers should not parse it, so put machine-readable information in the type or in extension members. Wording for people is covered in the article on error messages that help.

RFC 9457 also states plainly that problem details are not a debugging tool for the underlying implementation. Generators should vet details for leakage that could compromise the system, its access or user privacy, and should not expose a stack dump through the HTTP interface. Intermediaries may change the status code in transit, and the status member can then disagree with the response.

Add extension members with care

A problem type may define extension members beyond the five standard ones. Clients must ignore extensions they do not recognise, which lets the format evolve. An extension could list the fields that failed validation, for example. Define each extension once, document it, and never rename it.

Check these six points before you ship

  1. Return the HTTP status code that matches the problem, and make the status member match that same code.
  2. Publish a stable type URI for each problem your API can report. If the status code alone is enough, use about:blank.
  3. Keep title identical for every occurrence of the same type.
  4. Write detail as a short instruction for this request, with no internal names.
  5. Keep stack traces, query text and identifiers of internal systems in the logs. The article on logging covers what to record and for how long.
  6. Send the media type application/problem+json, and test the body with a client that ignores unknown members.

Problem details are a standard for HTTP APIs. Your own error codes may differ, but document them and keep them stable.

Sources and limits

Common questions

Which media type should an error body use?
RFC 9457 names application/problem+json for the JSON form, and defines application/problem+xml as the XML equivalent.
What happens when the type member is missing?
RFC 9457 assumes about:blank, which means the problem has no meaning beyond the HTTP status code. Clients ignore extension members they do not recognise.
Should an error include a stack trace?
No. RFC 9457 says problem details are not a debugging tool for the underlying implementation, and it discourages exposing a stack dump through the HTTP interface.

Sources

  1. Problem Details for HTTP APIs, IETF (RFC 9457). Accessed 24 November 2026
  2. Hypertext Transfer Protocol (HTTP) Problem Types, IANA. Accessed 24 November 2026
  3. HTTP response status codes, MDN Web Docs. Accessed 24 November 2026

Further reading

Have an idea that should exist? Or a working product that needs more customers, a new website or a complete rework? Bring us anything. Apply with your idea

All notes