<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<!-- generated by https://github.com/cabo/kramdown-rfc version 1.6.17 (Ruby 2.6.4) -->
<?rfc-ext html-pretty-print="prettyprint https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"?>
<rfc xmlns:x="http://purl.org/net/xml2rfc/ext"
      category="std"
      consensus="true"
      docName="draft-ietf-httpapi-rfc7807bis-04"
      ipr="trust200902"
      obsoletes="7807"
      sortRefs="true"
      symRefs="true"
      tocInclude="true">
   <x:feedback template="mailto:httpapi@ietf.org?subject={docname},%20%22{section}%22\&amp;amp;body=%3c{ref}%3e:"/>
   <front>
      <title>Problem Details for HTTP APIs</title>
      <author fullname="Mark Nottingham" initials="M." surname="Nottingham">
         <address>
            <postal>
               <postalLine>Prahran</postalLine>
               <postalLine>Australia</postalLine>
            </postal>
            <email>mnot@mnot.net</email>
            <uri>https://www.mnot.net/</uri>
         </address>
      </author>
      <author fullname="Erik Wilde" initials="E." surname="Wilde">
         <address>
            <email>erik.wilde@dret.net</email>
            <uri>http://dret.net/netdret/</uri>
         </address>
      </author>
      <author fullname="Sanjay Dalal" initials="S." surname="Dalal">
         <address>
            <postal>
               <country>United States of America</country>
            </postal>
            <email>sanjay.dalal@cal.berkeley.edu</email>
            <uri>https://github.com/sdatspun2</uri>
         </address>
      </author>
      <date year="2022" month="September" day="5"/>
      <area>Applications and Real-Time</area>
      <workgroup>HTTPAPI</workgroup>
      <keyword>status</keyword>
      <keyword>HTTP</keyword>
      <keyword>error</keyword>
      <keyword>problem</keyword>
      <keyword>API</keyword>
      <keyword>JSON</keyword>
      <keyword>XML</keyword>
      <abstract>
         <t>This document defines a "problem detail" to carry machine-readable details of errors in HTTP response content and/or fields to avoid the need to define new error response formats for HTTP APIs.</t>
         <t>This document obsoletes RF7807.</t>
      </abstract>
   </front>
   <middle>
      <section anchor="introduction">
         <name>Introduction</name>
         <t>HTTP status codes (<xref section="15" sectionFormat="of" target="HTTP"/>) cannot always convey enough information about errors to be helpful. While humans using Web browsers can often understand an HTML <xref target="HTML5"/> response content, non-human consumers of HTTP APIs have difficulty doing so.</t>
         <t>To address that shortcoming, this specification defines simple JSON <xref target="JSON"/> and XML <xref target="XML"/> document formats and a HTTP field to describe the specifics of problem(s) encountered -- "problem details".</t>
         <t>For example, consider a response indicating that the client's account doesn't have enough credit. The API's designer might decide to use the 403 Forbidden status code to inform HTTP-generic software (such as client libraries, caches, and proxies) of the response's general semantics. API-specific problem details (such as the why the server refused the request and the applicable account balance) can be carried in the response content, so that the client can act upon them appropriately (for example, triggering a transfer of more credit into the account).</t>
         <t>This specification identifies the specific "problem type" (e.g., "out of credit") with a URI <xref target="URI"/>. HTTP APIs can use URIs under their control to identify problems specific to them, or can reuse existing ones to facilitate interoperability and leverage common semantics (see <xref target="registry"/>).</t>
         <t>Problem details can contain other information, such as a URI identifying the problem's specific occurrence (effectively giving an identifier to the concept "The time Joe didn't have enough credit last Thursday"), which can be useful for support or forensic purposes.</t>
         <t>The data model for problem details is a JSON <xref target="JSON"/> object; when serialized as a JSON document, it uses the "application/problem+json" media type. <xref target="xml-syntax"/> defines an equivalent XML format, which uses the "application/problem+xml" media type.</t>
         <t>Note that problem details are (naturally) not the only way to convey the details of a problem in HTTP. If the response is still a representation of a resource, for example, it's often preferable to describe the relevant details in that application's format. Likewise, defined HTTP status codes cover many situations with no need to convey extra detail.</t>
         <t>This specification's aim is to define common error formats for applications that need one so that they aren't required to define their own, or worse, tempted to redefine the semantics of existing HTTP status codes. Even if an application chooses not to use it to convey errors, reviewing its design can help guide the design decisions faced when conveying errors in an existing format.</t>
         <t>See <xref target="changes"/> for a list of changes from RFC7807.</t>
      </section>
      <section anchor="notational-conventions">
         <name>Notational Conventions</name>
         <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 <xref target="RFC2119"/>
            <xref target="RFC8174"/> when, and only when, they appear in all capitals, as shown here.</t>
         <t>This document uses the following terminology from <xref target="STRUCTURED-FIELDS"/> to specify syntax and parsing: Dictionary, String, and Integer.</t>
      </section>
      <section anchor="problem-json">
         <name>The Problem Details JSON Object</name>
         <t>The canonical model for problem details is a JSON <xref target="JSON"/> object. When serialized in a JSON document, that format is identified with the "application/problem+json" media type.</t>
         <t>For example:</t>
         <figure>
            <sourcecode type="http-message">
POST /purchase HTTP/1.1
Host: store.example.com
Content-Type: application/json
Accept: application/json, application/problem+json

{
  "item": 123456,
  "quantity": 2
}
</sourcecode>
         </figure>
         <figure>
            <sourcecode type="http-message">
HTTP/1.1 403 Forbidden
Content-Type: application/problem+json
Content-Language: en

{
 "type": "https://example.com/probs/out-of-credit",
 "title": "You do not have enough credit.",
 "detail": "Your current balance is 30, but that costs 50.",
 "instance": "/account/12345/msgs/abc",
 "balance": 30,
 "accounts": ["/account/12345",
              "/account/67890"]
}
</sourcecode>
         </figure>
         <t>Here, the out-of-credit problem (identified by its type) indicates the reason for the 403 in "title", identifies the specific problem occurrence with "instance", gives occurrence-specific details in "detail", and adds two extensions: "balance" conveys the account's balance, and "accounts" lists links where the account can be topped up.</t>
         <t>When designed to accommodate it, problem-specific extensions can convey more than one instance of the same problem type. For example:</t>
         <figure>
            <sourcecode type="http-message">
POST /details HTTP/1.1
Host: account.example.com
Accept: application/json

{
  "age": 42.3,
  "profile": {
    "color": "yellow"
  }
}
</sourcecode>
         </figure>
         <figure>
            <sourcecode type="http-message">
HTTP/1.1 400 Bad Request
Content-Type: application/problem+json
Content-Language: en

{
 "type": "https://example.net/validation-error",
 "title": "Your request is not valid.",
 "errors": [
             {
               "detail": "must be a positive integer",
               "pointer": "#/age"
             },
             {
               "detail": "must be 'green', 'red' or 'blue'",
               "pointer": "#/profile/color"
             }
          ]
  }
</sourcecode>
         </figure>
         <t>The fictional problem type here defines the "errors" extension, an array that describes the details of each validation error. Each member is an object containing "detail" to describe the issue, and "pointer" to locate the problem within the request's content using a JSON Pointer <xref target="JSON-POINTER"/>.</t>
         <t>When an API encounters multiple problems that do not share the same type, it is RECOMMENDED that the most relevant or urgent problem be represented in the response. While it is possible to create generic "batch" problem types that convey multiple, disparate types, they do not map well into HTTP semantics.</t>
         <t>Note also that the API has responded with the application/problem+json type, even though the client did not list it in Accept, as is allowed by HTTP (see <xref section="12.5.1" sectionFormat="of" target="HTTP"/>).</t>
         <section anchor="members">
            <name>Members of a Problem Details Object</name>
            <t>Problem detail objects can have the following members. If a member's value type does not match the specified type, the member MUST be ignored -- i.e., processing will continue as if the member had not been present.</t>
            <section anchor="type">
               <name>"type"</name>
               <t>The "type" member is a JSON string containing a URI reference <xref target="URI"/> that identifies the problem type. Consumers MUST use the "type" URI (after resolution, if necessary) as the problem type's primary identifier.</t>
               <t>When this member is not present, its value is assumed to be "about:blank".</t>
               <t>If the type URI is a locator (e.g., those with a "http" or "https" scheme), dereferencing it SHOULD provide human-readable documentation for the problem type (e.g., using HTML <xref target="HTML5"/>). However, consumers SHOULD NOT automatically dereference the type URI, unless they do so when providing information to developers (e.g., when a debugging tool is in use).</t>
               <t>When "type" contains a relative URI, it is resolved relative to the document's base URI, as per <xref section="5" sectionFormat="comma" target="URI"/>. However, using relative URIs can cause confusion, and they might not be handled correctly by all implementations.</t>
               <t>For example, if the two resources "https://api.example.org/foo/bar/123" and "https://api.example.org/widget/456" both respond with a "type" equal to the relative URI reference "example-problem", when resolved they will identify different resources ("https://api.example.org/foo/bar/example-problem" and "https://api.example.org/widget/example-problem" respectively). As a result, it is RECOMMENDED that absolute URIs be used in "type" when possible, and that when relative URIs are used, they include the full path (e.g., "/types/123").</t>
               <t>The type URI can also be a non-resolvable URI. For example, the tag URI scheme <xref target="TAG"/> can be used to uniquely identify problem types:</t>
               <figure>
                  <artwork>
tag:mnot@mnot.net,2021-09-17:OutOfLuck
</artwork>
               </figure>
               <t>Non-resolvable URIs ought not be used when there is some future possibility that it might become desirable to do so. For example, if an API designer used the URI above and later adopted a tool that resolves type URIs to discover information about the error, taking advantage of that capability would require switching to a resolvable URI, creating a new identity for the problem type and thus introducing a breaking change.</t>
            </section>
            <section anchor="status">
               <name>"status"</name>
               <t>The "status" member is a JSON number indicating the HTTP status code (<xref section="15" sectionFormat="comma" target="HTTP"/>) generated by the origin server for this occurrence of the problem.</t>
               <t>The "status" member, if present, is only advisory; it conveys the HTTP status code used for the convenience of the consumer. Generators MUST use the same status code in the actual HTTP response, to assure that generic HTTP software that does not understand this format still behaves correctly. See <xref target="security-considerations"/> for further caveats regarding its use.</t>
               <t>Consumers can use the status member to determine what the original status code used by the generator was when it has been changed (e.g., by an intermediary or cache), and when a message's content is persisted without HTTP information. Generic HTTP software will still use the HTTP status code.</t>
            </section>
            <section anchor="title">
               <name>"title"</name>
               <t>The "title" member is a JSON string containing a short, human-readable summary of the problem type.</t>
               <t>It SHOULD NOT change from occurrence to occurrence of the problem, except for localization (e.g., using proactive content negotiation; see <xref section="12.1" sectionFormat="comma" target="HTTP"/>).</t>
               <t>The "title" string is advisory, and is included only for users who both are not aware of and cannot discover the semantics of the type URI (e.g., during offline log analysis).</t>
            </section>
            <section anchor="detail">
               <name>"detail"</name>
               <t>The "detail" member is a JSON string containing a human-readable explanation specific to this occurrence of the problem.</t>
               <t>The "detail" string, if present, ought to focus on helping the client correct the problem, rather than giving debugging information.</t>
               <t>Consumers SHOULD NOT parse the "detail" member for information; extensions are more suitable and less error-prone ways to obtain such information.</t>
            </section>
            <section anchor="instance">
               <name>"instance"</name>
               <t>The "instance" member is a JSON string containing a URI reference that identifies the specific occurrence of the problem.</t>
               <t>When the "instance" URI is dereferenceable, the problem details object can be fetched from it. It might also return information about the problem occurrence in other formats through use of proactive content negotiation (see <xref section="12.5.1" sectionFormat="comma" target="HTTP"/>).</t>
               <t>When the "instance" URI is not dereferenceable, it serves as a unique identifier for the problem occurrence that may be of significance to the server, but is opaque to the client.</t>
               <t>When "instance" contains a relative URI, it is resolved relative to the document's base URI, as per <xref section="5" sectionFormat="comma" target="URI"/>. However, using relative URIs can cause confusion, and they might not be handled correctly by all implementations.</t>
               <t>For example, if the two resources "https://api.example.org/foo/bar/123" and "https://api.example.org/widget/456" both respond with an "instance" equal to the relative URI reference "example-instance", when resolved they will identify different resources ("https://api.example.org/foo/bar/example-instance" and "https://api.example.org/widget/example-instance" respectively). As a result, it is RECOMMENDED that absolute URIs be used in "instance" when possible, and that when relative URIs are used, they include the full path (e.g., "/instances/123").</t>
            </section>
         </section>
         <section anchor="extension">
            <name>Extension Members</name>
            <t>Problem type definitions MAY extend the problem details object with additional members that are specific to that problem type.</t>
            <t>For example, our "out of credit" problem above defines two such extensions -- "balance" and "accounts" to convey additional, problem-specific information.</t>
            <t>Similarly, the "validation error" example defines a "errors" extension that contains a list of individual error occurrences found, with details and a pointer to the location of each.</t>
            <t>Clients consuming problem details MUST ignore any such extensions that they don't recognize; this allows problem types to evolve and include additional information in the future.</t>
            <t>Future updates to this specification might define additional members that are available to all problem types, distinguished by a name starting with "*". To avoid conflicts, extension member names SHOULD NOT start with the "*" character.</t>
            <t>When creating extensions, problem type authors should choose their names carefully. To be used in the XML format (see <xref target="xml-syntax"/>), they will need to conform to the Name rule in <xref relative="#NT-Name"
                      section="2.3"
                      sectionFormat="of"
                      target="XML"/>. To be used in the HTTP field (see <xref target="field"/>), they will need to conform to the Dictionary key syntax defined in <xref section="3.2" sectionFormat="of" target="STRUCTURED-FIELDS"/>.</t>
            <t>Problem type authors that wish their extensions to be usable in the Problem HTTP field (see <xref target="field"/>) will also need to define the Structured Type(s) that their values are mapped to.</t>
         </section>
      </section>
      <section anchor="field">
         <name>The Problem HTTP Field</name>
         <t>Some problems might best be conveyed in a HTTP header or trailer field, rather than in the message content. For example, when a problem does not prevent a successful response from being generated, or when the problem's details are useful to software that does not inspect the response content.</t>
         <t>The Problem HTTP field allows a limited expression of a problem object in HTTP headers or trailers. It is a Dictionary Structured Field (<xref section="3.2" sectionFormat="of" target="STRUCTURED-FIELDS"/>) that can contain the following keys, whose semantics and related requirements are inherited from problem objects:</t>
         <dl>
            <dt>type:</dt>
            <dd>
               <t>the type value (see <xref target="type"/>), as a String</t>
            </dd>
            <dt>status:</dt>
            <dd>
               <t>the status value (see <xref target="status"/>), as an Integer</t>
            </dd>
            <dt>title:</dt>
            <dd>
               <t>The title value (see <xref target="title"/>), as a String</t>
            </dd>
            <dt>detail:</dt>
            <dd>
               <t>The detail value (see <xref target="detail"/>), as a String</t>
            </dd>
            <dt>instance:</dt>
            <dd>
               <t>The instance value (see <xref target="instance"/>), as a String</t>
            </dd>
         </dl>
         <t>The title and detail values MUST NOT be serialized in the Problem field if they contain characters that are not allowed by String; see <xref section="3.3.3" sectionFormat="of" target="STRUCTURED-FIELDS"/>. Practically, this has the effect of limiting them to ASCII strings.</t>
         <t>An extension member (see <xref target="extension"/>) MAY occur in the Problem field if its name is compatible with the syntax of Dictionary keys (see <xref section="3.2" sectionFormat="of" target="STRUCTURED-FIELDS"/>) and if the defining problem type specifies a Structured Type to serialize the value into.</t>
         <t>For example:</t>
         <figure>
            <sourcecode type="http-message">
HTTP/1.1 200 OK
Content-Type: application/json
Problem: type="https://example.net/problems/almost-out",
   title="you're almost out of credit", credit_left=20
</sourcecode>
         </figure>
      </section>
      <section anchor="defining">
         <name>Defining New Problem Types</name>
         <t>When an HTTP API needs to define a response that indicates an error condition, it might be appropriate to do so by defining a new problem type.</t>
         <t>Before doing so, it's important to understand what they are good for, and what's better left to other mechanisms.</t>
         <t>Problem details are not a debugging tool for the underlying implementation; rather, they are a way to expose greater detail about the HTTP interface itself. Designers of new problem types need to carefully take into account the Security Considerations (<xref target="security-considerations"/>), in particular, the risk of exposing attack vectors by exposing implementation internals through error messages.</t>
         <t>Likewise, truly generic problems -- i.e., conditions that might apply to any resource on the Web -- are usually better expressed as plain status codes. For example, a "write access disallowed" problem is probably unnecessary, since a 403 Forbidden status code in response to a PUT request is self-explanatory.</t>
         <t>Finally, an application might have a more appropriate way to carry an error in a format that it already defines. Problem details are intended to avoid the necessity of establishing new "fault" or "error" document formats, not to replace existing domain-specific formats.</t>
         <t>That said, it is possible to add support for problem details to existing HTTP APIs using HTTP content negotiation (e.g., using the Accept request header to indicate a preference for this format; see <xref section="12.5.1" sectionFormat="comma" target="HTTP"/>).</t>
         <t>New problem type definitions MUST document:</t>
         <t>
            <list style="numbers">
               <t>a type URI (typically, with the "http" or "https" scheme),</t>
               <t>a title that appropriately describes it (think short), and</t>
               <t>the HTTP status code for it to be used with.</t>
            </list>
         </t>
         <t>Problem type definitions MAY specify the use of the Retry-After response header (<xref section="10.2.3" sectionFormat="comma" target="HTTP"/>) in appropriate circumstances.</t>
         <t>A problem's type URI SHOULD resolve to HTML <xref target="HTML5"/> documentation that explains how to resolve the problem.</t>
         <t>A problem type definition MAY specify additional members on the problem details object. For example, an extension might use typed links <xref target="WEB-LINKING"/> to another resource that machines can use to resolve the problem.</t>
         <t>If such additional members are defined, their names SHOULD start with a letter (ALPHA, as per <xref section="B.1" sectionFormat="comma" target="ABNF"/>) and SHOULD comprise characters from ALPHA, DIGIT (<xref section="B.1" sectionFormat="comma" target="ABNF"/>), and "_" (so that it can be serialized in formats other than JSON), and they SHOULD be three characters or longer.</t>
         <section anchor="example">
            <name>Example</name>
            <t>For example, if you are publishing an HTTP API to your online shopping cart, you might need to indicate that the user is out of credit (our example from above), and therefore cannot make the purchase.</t>
            <t>If you already have an application-specific format that can accommodate this information, it's probably best to do that. However, if you don't, you might use one of the problem details formats -- JSON if your API is JSON-based, or XML if it uses that format.</t>
            <t>To do so, you might look in the registry (<xref target="registry"/>) for an already-defined type URI that suits your purposes. If one is available, you can reuse that URI.</t>
            <t>If one isn't available, you could mint and document a new type URI (which ought to be under your control and stable over time), an appropriate title and the HTTP status code that it will be used with, along with what it means and how it should be handled.</t>
         </section>
         <section anchor="registry">
            <name>Registered Problem Types</name>
            <t>This specification defines the HTTP Problem Type registry for common, widely-used problem type URIs, to promote reuse.</t>
            <t>The policy for this registry is Specification Required, per <xref section="4.5" sectionFormat="comma" target="RFC8126"/>.</t>
            <t>When evaluating requests, the Expert(s) should consider community feedback, how well-defined the problem type is, and this specification's requirements. Vendor-specific, application-specific, and deployment-specific values are not registrable. Specification documents should be published in a stable, freely available manner (ideally located with a URL), but need not be standards.</t>
            <t>Registrations MAY use the prefix "https://iana.org/assignments/http-problem-types#" for the type URI.</t>
            <t>Registration requests should use the following template:</t>
            <t>
               <list style="symbols">
                  <t>Type URI: [a URI for the problem type]</t>
                  <t>Title: [a short description of the problem type]</t>
                  <t>Recommended HTTP status code: [what status code is most appropriate to use with the type]</t>
                  <t>Reference: [to a specification defining the type]</t>
               </list>
            </t>
            <t>See the registry at <eref target="https://iana.org/assignments/http-problem-types">https://iana.org/assignments/http-problem-types</eref> for details on where to send registration requests.</t>
            <section anchor="blank">
               <name>about:blank</name>
               <t>This specification registers one Problem Type, "about:blank".</t>
               <t>
                  <list style="symbols">
                     <t>Type URI: about:blank</t>
                     <t>Title: See HTTP Status Code</t>
                     <t>Recommended HTTP status code: N/A</t>
                     <t>Reference: [this document]</t>
                  </list>
               </t>
               <t>The "about:blank" URI <xref target="ABOUT"/>, when used as a problem type, indicates that the problem has no additional semantics beyond that of the HTTP status code.</t>
               <t>When "about:blank" is used, the title SHOULD be the same as the recommended HTTP status phrase for that code (e.g., "Not Found" for 404, and so on), although it MAY be localized to suit client preferences (expressed with the Accept-Language request header).</t>
               <t>Please note that according to how the "type" member is defined (<xref target="members"/>), the "about:blank" URI is the default value for that member. Consequently, any problem details object not carrying an explicit "type" member implicitly uses this URI.</t>
            </section>
         </section>
      </section>
      <section anchor="security-considerations">
         <name>Security Considerations</name>
         <t>When defining a new problem type, the information included must be carefully vetted. Likewise, when actually generating a problem -- however it is serialized -- the details given must also be scrutinized.</t>
         <t>Risks include leaking information that can be exploited to compromise the system, access to the system, or the privacy of users of the system.</t>
         <t>Generators providing links to occurrence information are encouraged to avoid making implementation details such as a stack dump available through the HTTP interface, since this can expose sensitive details of the server implementation, its data, and so on.</t>
         <t>The "status" member duplicates the information available in the HTTP status code itself, bringing the possibility of disagreement between the two. Their relative precedence is not clear, since a disagreement might indicate that (for example) an intermediary has changed the HTTP status code in transit (e.g., by a proxy or cache). Generic HTTP software (such as proxies, load balancers, firewalls, and virus scanners) are unlikely to know of or respect the status code conveyed in this member.</t>
      </section>
      <section anchor="iana-considerations">
         <name>IANA Considerations</name>
         <t>Please update the "application/problem+json" and "application/problem+xml" registrations in the "Media Types" registry to refer to this document.</t>
         <t>Please create the "HTTP Problem Types Registry" as specified in <xref target="registry"/>, and populate it with "about:blank" as per <xref target="blank"/>.</t>
         <t>Please register the following entry into the "Hypertext Transfer Protocol (HTTP) Field Name Registry":</t>
         <dl>
            <dt>Field Name:</dt>
            <dd>
               <t>Problem</t>
            </dd>
            <dt>Status:</dt>
            <dd>
               <t>Permanent</t>
            </dd>
            <dt>Reference:</dt>
            <dd>
               <t>RFC nnnn</t>
            </dd>
         </dl>
      </section>
   </middle>
   <back>
      <references title="Normative References">
         <reference anchor="RFC2119">
            <front>
               <title>Key words for use in RFCs to Indicate Requirement Levels</title>
               <author fullname="S. Bradner" initials="S." surname="Bradner"/>
               <date month="March" year="1997"/>
            </front>
            <seriesInfo name="BCP" value="14"/>
            <seriesInfo name="RFC" value="2119"/>
            <seriesInfo name="DOI" value="10.17487/RFC2119"/>
         </reference>
         <reference anchor="URI">
            <front>
               <title>Uniform Resource Identifier (URI): Generic Syntax</title>
               <author fullname="T. Berners-Lee" initials="T." surname="Berners-Lee"/>
               <author fullname="R. Fielding" initials="R." surname="Fielding"/>
               <author fullname="L. Masinter" initials="L." surname="Masinter"/>
               <date month="January" year="2005"/>
            </front>
            <seriesInfo name="STD" value="66"/>
            <seriesInfo name="RFC" value="3986"/>
            <seriesInfo name="DOI" value="10.17487/RFC3986"/>
         </reference>
         <reference anchor="ABNF">
            <front>
               <title>Augmented BNF for Syntax Specifications: ABNF</title>
               <author fullname="D. Crocker"
                        initials="D."
                        role="editor"
                        surname="Crocker"/>
               <author fullname="P. Overell" initials="P." surname="Overell"/>
               <date month="January" year="2008"/>
            </front>
            <seriesInfo name="STD" value="68"/>
            <seriesInfo name="RFC" value="5234"/>
            <seriesInfo name="DOI" value="10.17487/RFC5234"/>
         </reference>
         <reference anchor="RFC8126">
            <front>
               <title>Guidelines for Writing an IANA Considerations Section in RFCs</title>
               <author fullname="M. Cotton" initials="M." surname="Cotton"/>
               <author fullname="B. Leiba" initials="B." surname="Leiba"/>
               <author fullname="T. Narten" initials="T." surname="Narten"/>
               <date month="June" year="2017"/>
            </front>
            <seriesInfo name="BCP" value="26"/>
            <seriesInfo name="RFC" value="8126"/>
            <seriesInfo name="DOI" value="10.17487/RFC8126"/>
         </reference>
         <reference anchor="JSON">
            <front>
               <title>The JavaScript Object Notation (JSON) Data Interchange Format</title>
               <author fullname="T. Bray" initials="T." role="editor" surname="Bray"/>
               <date month="December" year="2017"/>
            </front>
            <seriesInfo name="STD" value="90"/>
            <seriesInfo name="RFC" value="8259"/>
            <seriesInfo name="DOI" value="10.17487/RFC8259"/>
         </reference>
         <reference anchor="HTTP">
            <front>
               <title>HTTP Semantics</title>
               <author fullname="R. Fielding"
                        initials="R."
                        role="editor"
                        surname="Fielding"/>
               <author fullname="M. Nottingham"
                        initials="M."
                        role="editor"
                        surname="Nottingham"/>
               <author fullname="J. Reschke"
                        initials="J."
                        role="editor"
                        surname="Reschke"/>
               <date month="June" year="2022"/>
            </front>
            <seriesInfo name="STD" value="97"/>
            <seriesInfo name="RFC" value="9110"/>
            <seriesInfo name="DOI" value="10.17487/RFC9110"/>
         </reference>
         <reference anchor="STRUCTURED-FIELDS">
            <front>
               <title>Structured Field Values for HTTP</title>
               <author fullname="M. Nottingham" initials="M." surname="Nottingham"/>
               <author fullname="P-H. Kamp" initials="P-H." surname="Kamp"/>
               <date month="February" year="2021"/>
            </front>
            <seriesInfo name="RFC" value="8941"/>
            <seriesInfo name="DOI" value="10.17487/RFC8941"/>
         </reference>
         <reference anchor="XML" target="https://www.w3.org/TR/2008/REC-xml-20081126/">
            <front>
               <title>Extensible Markup Language (XML) 1.0 (Fifth Edition)</title>
               <author fullname="Eve Maler" role="editor"/>
               <author fullname="François Yergeau" role="editor"/>
               <author fullname="Jean Paoli" role="editor"/>
               <author fullname="Michael Sperberg-McQueen" role="editor"/>
               <author fullname="Tim Bray" role="editor"/>
               <date day="26" month="November" year="2008"/>
            </front>
            <seriesInfo name="W3C REC" value="REC-xml-20081126"/>
            <seriesInfo name="W3C" value="REC-xml-20081126"/>
         </reference>
         <reference anchor="RFC8174">
            <front>
               <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
               <author fullname="B. Leiba" initials="B." surname="Leiba"/>
               <date month="May" year="2017"/>
            </front>
            <seriesInfo name="BCP" value="14"/>
            <seriesInfo name="RFC" value="8174"/>
            <seriesInfo name="DOI" value="10.17487/RFC8174"/>
         </reference>
      </references>
      <references title="Informative References">
         <reference anchor="WEB-LINKING">
            <front>
               <title>Web Linking</title>
               <author fullname="M. Nottingham" initials="M." surname="Nottingham"/>
               <date month="October" year="2017"/>
            </front>
            <seriesInfo name="RFC" value="8288"/>
            <seriesInfo name="DOI" value="10.17487/RFC8288"/>
         </reference>
         <reference anchor="ABOUT">
            <front>
               <title>The "about" URI Scheme</title>
               <author fullname="S. Moonesamy"
                        initials="S."
                        role="editor"
                        surname="Moonesamy"/>
               <date month="August" year="2012"/>
            </front>
            <seriesInfo name="RFC" value="6694"/>
            <seriesInfo name="DOI" value="10.17487/RFC6694"/>
         </reference>
         <reference anchor="TAG">
            <front>
               <title>The 'tag' URI Scheme</title>
               <author fullname="T. Kindberg" initials="T." surname="Kindberg"/>
               <author fullname="S. Hawke" initials="S." surname="Hawke"/>
               <date month="October" year="2005"/>
            </front>
            <seriesInfo name="RFC" value="4151"/>
            <seriesInfo name="DOI" value="10.17487/RFC4151"/>
         </reference>
         <reference anchor="JSON-POINTER">
            <front>
               <title>JavaScript Object Notation (JSON) Pointer</title>
               <author fullname="P. Bryan" initials="P." role="editor" surname="Bryan"/>
               <author fullname="K. Zyp" initials="K." surname="Zyp"/>
               <author fullname="M. Nottingham"
                        initials="M."
                        role="editor"
                        surname="Nottingham"/>
               <date month="April" year="2013"/>
            </front>
            <seriesInfo name="RFC" value="6901"/>
            <seriesInfo name="DOI" value="10.17487/RFC6901"/>
         </reference>
         <reference anchor="JSON-SCHEMA">
            <front>
               <title>JSON Schema: A Media Type for Describing JSON Documents</title>
               <author fullname="Austin Wright"/>
               <author fullname="Henry Andrews"/>
               <author fullname="Ben Hutton">
                  <organization>Postman</organization>
               </author>
               <author fullname="Greg Dennis"/>
               <date day="10" month="June" year="2022"/>
            </front>
            <seriesInfo name="Internet-Draft" value="draft-bhutton-json-schema-01"/>
         </reference>
         <reference anchor="ISO-19757-2">
            <front>
               <title>Information Technology -- Document Schema Definition Languages (DSDL) -- Part 2: Grammar-based Validation -- RELAX NG</title>
               <author>
                  <organization>International Organization for Standardization</organization>
               </author>
               <date year="2003"/>
            </front>
            <seriesInfo name="ISO/IEC" value="19757-2"/>
         </reference>
         <reference anchor="HTML5" target="https://html.spec.whatwg.org">
            <front>
               <title>HTML - Living Standard</title>
               <author>
                  <organization>WHATWG</organization>
               </author>
               <date year="n.d."/>
            </front>
         </reference>
         <reference anchor="RDFA"
                     target="https://www.w3.org/TR/2015/REC-rdfa-core-20150317/">
            <front>
               <title>RDFa Core 1.1 - Third Edition</title>
               <author fullname="Ben Adida" role="editor"/>
               <author fullname="Ivan Herman" role="editor"/>
               <author fullname="Mark Birbeck" role="editor"/>
               <author fullname="Shane McCarron" role="editor"/>
               <date day="17" month="March" year="2015"/>
            </front>
            <seriesInfo name="W3C REC" value="REC-rdfa-core-20150317"/>
            <seriesInfo name="W3C" value="REC-rdfa-core-20150317"/>
         </reference>
         <reference anchor="XSLT"
                     target="https://www.w3.org/TR/2010/REC-xml-stylesheet-20101028/">
            <front>
               <title>Associating Style Sheets with XML documents 1.0 (Second Edition)</title>
               <author fullname="Henry Thompson" role="editor"/>
               <author fullname="James Clark" role="editor"/>
               <author fullname="Simon Pieters" role="editor"/>
               <date day="28" month="October" year="2010"/>
            </front>
            <seriesInfo name="W3C REC" value="REC-xml-stylesheet-20101028"/>
            <seriesInfo name="W3C" value="REC-xml-stylesheet-20101028"/>
         </reference>
      </references>
      <section anchor="json-schema">
         <name>JSON Schema for HTTP Problems</name>
         <t>This section presents a non-normative JSON Schema <xref target="JSON-SCHEMA"/> for HTTP Problem Details. If there is any disagreement between it and the text of the specification, the latter prevails.</t>
         <figure>
            <sourcecode type="json">
# NOTE: '\' line wrapping per RFC 8792
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "A problem object RFC 7807bis",
  "type": "object",
  "properties": {
    "type": {
      "type": "string",
      "format": "uri-reference",
      "description": "A URI reference RFC3986 that identifies the \
problem type."
    },
    "title": {
      "type": "string",
      "description": "A short, human-readable summary of the \
problem type. It SHOULD NOT change from occurrence to occurrence \
of the problem, except for purposes of localization (e.g., using \
proactive content negotiation; see RFC7231, Section 3.4)"
    },
    "status": {
      "type": "integer",
      "description": "The HTTP status code (RFC7231, Section 6) \
generated by the origin server for this occurrence of the problem.",
      "minimum": 100,
      "maximum": 599
    },
    "detail": {
      "type": "string",
      "description": "A human-readable explanation specific to \
this occurrence of the problem."
    },
    "instance": {
      "type": "string",
      "format": "uri-reference",
      "description": "A URI reference that identifies the \
specific occurrence of the problem. It may or may not yield \
further information if dereferenced."
    }
  }
}
</sourcecode>
         </figure>
      </section>
      <section anchor="xml-syntax">
         <name>HTTP Problems and XML</name>
         <t>HTTP-based APIs that use XML <xref target="XML"/> can express problem details using the format defined in this appendix.</t>
         <t>The RELAX NG schema <xref target="ISO-19757-2"/> for the XML format is:</t>
         <figure>
            <sourcecode type="relax-ng-compact-syntax">
   default namespace ns = "urn:ietf:rfc:7807"

   start = problem

   problem =
     element problem {
       (  element  type            { xsd:anyURI }?
        &amp; element  title           { xsd:string }?
        &amp; element  detail          { xsd:string }?
        &amp; element  status          { xsd:positiveInteger }?
        &amp; element  instance        { xsd:anyURI }? ),
       anyNsElement
     }

   anyNsElement =
     (  element    ns:*  { anyNsElement | text }
      | attribute  *     { text })*
</sourcecode>
         </figure>
         <t>Note that this schema is only intended as documentation, and not as a normative schema that captures all constraints of the XML format. It is possible to use other XML schema languages to define a similar set of constraints (depending on the features of the chosen schema language).</t>
         <t>The media type for this format is "application/problem+xml".</t>
         <t>Extension arrays and objects are serialized into the XML format by considering an element containing a child or children to represent an object, except for elements that contain only child element(s) named 'i', which are considered arrays. For example, the example above appears in XML as follows:</t>
         <figure>
            <sourcecode type="http-message">
HTTP/1.1 403 Forbidden
Content-Type: application/problem+xml
Content-Language: en

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;problem xmlns="urn:ietf:rfc:7807"&gt;
  &lt;type&gt;https://example.com/probs/out-of-credit&lt;/type&gt;
  &lt;title&gt;You do not have enough credit.&lt;/title&gt;
  &lt;detail&gt;Your current balance is 30, but that costs 50.&lt;/detail&gt;
  &lt;instance&gt;https://example.net/account/12345/msgs/abc&lt;/instance&gt;
  &lt;balance&gt;30&lt;/balance&gt;
  &lt;accounts&gt;
    &lt;i&gt;https://example.net/account/12345&lt;/i&gt;
    &lt;i&gt;https://example.net/account/67890&lt;/i&gt;
  &lt;/accounts&gt;
&lt;/problem&gt;
</sourcecode>
         </figure>
         <t>This format uses an XML namespace, primarily to allow embedding it into other XML-based formats; it does not imply that it can or should be extended with elements or attributes in other namespaces. The RELAX NG schema explicitly only allows elements from the one namespace used in the XML format. Any extension arrays and objects MUST be serialized into XML markup using only that namespace.</t>
         <t>When using the XML format, it is possible to embed an XML processing instruction in the XML that instructs clients to transform the XML, using the referenced XSLT code <xref target="XSLT"/>. If this code is transforming the XML into (X)HTML, then it is possible to serve the XML format, and yet have clients capable of performing the transformation display human-friendly (X)HTML that is rendered and displayed at the client. Note that when using this method, it is advisable to use XSLT 1.0 in order to maximize the number of clients capable of executing the XSLT code.</t>
      </section>
      <section anchor="using-problem-details-with-other-formats">
         <name>Using Problem Details with Other Formats</name>
         <t>In some situations, it can be advantageous to embed problem details in formats other than those described here. For example, an API that uses HTML <xref target="HTML5"/> might want to also use HTML for expressing its problem details.</t>
         <t>Problem details can be embedded in other formats either by encapsulating one of the existing serializations (JSON or XML) into that format or by translating the model of a problem detail (as specified in <xref target="problem-json"/>) into the format's conventions.</t>
         <t>For example, in HTML, a problem could be embedded by encapsulating JSON in a script tag:</t>
         <figure>
            <sourcecode type="html">
&lt;script type="application/problem+json"&gt;
  {
   "type": "https://example.com/probs/out-of-credit",
   "title": "You do not have enough credit.",
   "detail": "Your current balance is 30, but that costs 50.",
   "instance": "/account/12345/msgs/abc",
   "balance": 30,
   "accounts": ["/account/12345",
                "/account/67890"]
  }
&lt;/script&gt;
</sourcecode>
         </figure>
         <t>or by inventing a mapping into RDFa <xref target="RDFA"/>.</t>
         <t>This specification does not make specific recommendations regarding embedding problem details in other formats; the appropriate way to embed them depends both upon the format in use and application of that format.</t>
      </section>
      <section anchor="changes">
         <name>Changes from RFC7807</name>
         <t>This revision has made the following changes:</t>
         <t>
            <list style="symbols">
               <t>
                  <xref target="registry"/> introduces a registry of common problem type URIs</t>
               <t>
                  <xref target="problem-json"/> clarifies how multiple problems should be treated</t>
               <t>
                  <xref target="extension"/> reserves a prefix for future standards-defined object members</t>
               <t>
                  <xref target="type"/> provides guidance for using type URIs that cannot be dereferenced</t>
               <t>
                  <xref target="field"/> allows problem details to be communicate in a HTTP header or trailer field</t>
            </list>
         </t>
      </section>
      <section anchor="acknowledgements" numbered="false">
         <name>Acknowledgements</name>
         <t>The authors would like to thank Jan Algermissen, Subbu Allamaraju, Mike Amundsen, Roy Fielding, Eran Hammer, Sam Johnston, Mike McCall, Julian Reschke, and James Snell for review of this specification.</t>
      </section>
   </back>
</rfc>
