<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>

<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-ietf-dispatch-mime-protobuf-07" number="9996" category="info" consensus="true" submissionType="IETF" tocInclude="true" sortRefs="true" symRefs="true" version="3" xml:lang="en" updates="" obsoletes="">

  <front>
    <title abbrev="Media Types for Protocol Buffers">Media Types for Protocol Buffers</title>
    <seriesInfo name="RFC" value="9996"/>
    <author initials="M." surname="Kucherawy" fullname="Murray S. Kucherawy" role="editor">
      <organization/>
      <address>
        <email>superuser@gmail.com</email>
      </address>
    </author>
    <author initials="W." surname="Kumari" fullname="Warren Kumari">
      <organization>Google</organization>
      <address>
        <email>warren@kumari.net</email>
      </address>
    </author>
    <author initials="R." surname="Sloan" fullname="Rob Sloan">
      <organization>Google</organization>
      <address>
        <email>varomodt@gmail.com</email>
      </address>
    </author>
    <date year="2026" month="July"/>

    <area>ART</area>
    <workgroup>dispatch</workgroup>

    <keyword>MIME</keyword>
    <keyword>Protobuf</keyword>
    <keyword>media type</keyword>
    <keyword>application</keyword>

    <abstract>
<t>This document registers media types for Protocol Buffers, a common extensible mechanism for serializing structured data.</t>
    </abstract>

  </front>
  <middle>

    <section anchor="intro">
      <name>Introduction</name>
      <t>Protocol Buffers (also called "Protobuf") were introduced in 2008 as a free, open-source, platform-independent mechanism for transport and storage of structured data.  The use of Protobuf has become increasingly common, and Protobuf implementations exist in many languages (C++, C#, Dart, Go, Java, Kotlin, Objective-C, Python, JavaScript, Ruby, Swift, and perhaps others). See <xref target="Protobuf"/> for more information.</t>
      <t>Protobuf consists of an interface definition language (IDL), wire encoding formats, and language-specific implementations (typically involving a generated API) so that clients and servers can be easily deployed using a common schema.  Protobuf supports two wire formats for interchange: the format in <xref target="Binary"/> (which is optimized for wire efficiency) and the format in <xref target="ProtoJSON"/> (which maps the Protobuf schema onto a JSON structure).</t>
      <t>Serialized objects are occasionally transported within media that make use of media types (see <xref target="RFC2045"/>) to identify payloads. Accordingly,
current and historical media types used for this purpose would benefit from registration. IANA has registered two Protobuf media types; see <xref target="iana"/>.</t>
    </section>
    <section anchor="key-words">
      <name>Key Words</name>
        <t>
    The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
    NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
    "<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as
    described in BCP&nbsp;14 <xref target="RFC2119"/> <xref target="RFC8174"/> 
    when, and only when, they appear in all capitals, as shown here.
        </t>
    </section>
    <section anchor="description">
      <name>Payload Description</name>
      <t>The media types defined in this document are used in the transport of serialized objects only.  The IDL and object definitions, if transported, would be used with any appropriate text media type.
In the three examples below, only the third (depicted in JSON) would ever be used with these media types.</t>
<ol spacing="normal">
  <li>
      <t>An example of using the IDL to specify a "Person" object:</t>
      <sourcecode><![CDATA[
edition = "2023";

message Person {
  string name = 1;
  int32 id = 2;
  string email = 3;
}]]></sourcecode>
  </li>
  <li>
      <t>An example of python code that uses code generated from the IDL definition above to create an instance of a "Person" object:</t>

      <sourcecode type="python"><![CDATA[
person = Person()
person.id = 1234
person.name = "John Doe"
person.email = "jdoe@example.com"]]></sourcecode>
  </li>
  <li>
      <t>An example of the above instance expressed in JSON:</t>

      <sourcecode type="json"><![CDATA[
{
  "name": "John Doe",
  "id": 1234,
  "email": "jdoe@example.com"
}]]></sourcecode>
  </li>
</ol>
    </section>
    <section anchor="encoding">
      <name>Encoding Considerations</name>
      <t>Protobuf supports the formats in <xref target="Binary"/> and <xref target="ProtoJSON"/> for interchange, both of which are platform-independent.
      For binary forms that need to transit non-binary transports, a base64 encoding (e.g., <xref target="RFC4648"/>) is recommended.</t>
      <t>Both of the media types defined in this document include an optional "encoding" parameter indicating which encoding format is to be used with that particular payload.  This is included for future extensibility. Valid values for this parameter are "binary" and "json", and other values <bcp14>MUST</bcp14> be treated as an error.  See <xref target="iana"/> for the defaults for each of the two registered media types. Using "binary" for the JSON type or "json" for the binary type <bcp14>MUST</bcp14> be treated as an error.</t>
    </section>
    <section anchor="versions">
      <name>Versions</name>
      <t><xref target="Proto2"/> was the first public version of the Protobuf schema language; <xref target="Proto3"/>, <xref target="Edition2023"/>, and <xref target="Edition2024"/> came later, with <xref target="Edition2024"/> being current at the time of writing. Future editions of the IDL are expected.</t>
      <t>These versions refer to evolutions of the schema of the IDL, not the wire format. Accordingly, a serialized object generated by any of these is compatible with any other. The media type registrations in <xref target="iana"/> include support for versioning of the wire format, should it ever change, but do not refer to the IDL, which can evolve independently.</t>
      <t>Note that there may be semantic changes implicit in the IDL version, which can affect the interpretation of otherwise compatible bits on the wire. For example, in Proto2, unknown values of an enumeration were interpreted as invalid, whereas in Proto3, they are retained.</t>
      <t>Clients <bcp14>MUST</bcp14> reject payloads with an unsupported version number.</t>
    </section>
    <section anchor="security">
      <name>Security Considerations</name>
      <t>The payload for these media types contains no directly executable code. While it is common for a Protobuf definition to be used as input to a code generator, which then produces something executable, that applies to the schema language, not serializations.</t>
      <t>Protobuf provides no security, privacy, integrity, or compression services. Clients or servers for which this is a concern should avail themselves of solutions that provide such capabilities (e.g., <xref target="RFC8446"/>). Implementations should be careful when processing Protobuf like any binary format; for example, a malformed request to a Protobuf server could be crafted to allocate a very large amount of memory, potentially impacting other operations on that server.</t>
      <t>Protobuf supports embedded content in <tt>string</tt> or <tt>bytes</tt> fields: In both cases, applications should ensure that the format of the content is precisely as expected. Note that UTF-8 validation of <tt>string</tt> fields is optional (see <xref target="ProtoFeatures"/>), and a manual well-formedness check may be necessary. Further, handling Unicode text generally can be quite complex (due to the problems discussed in <xref target="RFC9839"/> and <xref target="RFC8264"/>, for example), so it is best to rely on well-supported internationalization libraries whenever possible.</t>
      <t>In order to safely use Protobuf serializations on the Web, it is important to ensure that they are not interpreted as another document type, such as JavaScript: We recommend base64-encoding binary Protobuf responses whenever possible to prevent parsing as active content. Servers should generally follow the advice of <xref target="RFC9205"/> to prevent content sniffing for all binary formats.</t>
      <t>Further, when using JSON serializations, it is important that it is clear to browsers that the content is pure JSON so that they can inhibit Cross-Site Script Inclusion or side-channel attacks using techniques such as Cross-Origin Read Blocking <xref target="CORB"/>. Per <xref target="RFC6839"/>, pure JSON content is indicated by a <tt>+json</tt> subtype suffix (see also <xref target="MIMESNIFF"/>); thus, when serializing Protobuf content to JSON, users <bcp14>MUST</bcp14> use the <tt>application/protobuf+json</tt> media type. When using JSON, <tt>charset</tt> can prevent certain encoding confusion attacks, so users should specify it for all JSON encodings.</t>
      <t>In the type described in <xref target="Any"/>, there is technically a link that was intended to be dereferenced to obtain schemas for a given type; however, this is not supported by widely used Protobuf implementations.</t>
    </section>
    <section anchor="iana">
      <name>IANA Considerations</name>
      <t>As per the process defined in <xref target="RFC6838"/>, IANA has registered <tt>application/protobuf</tt> and <tt>application/protobuf+json</tt> in the "Media Types" registry. The following are deprecated aliases: <tt>application/x-protobuf</tt>, <tt>application/x-protobuffer</tt>, and <tt>application/x-protobuf+json</tt>.</t>
      <section anchor="registration-for-the-applicationprotobuf-media-type">
        <name>Media Type: <tt>application/protobuf</tt></name>
	<dl spacing="normal" newline="false">
          <dt>Type name:</dt><dd>application</dd>
          <dt>Subtype name:</dt><dd>protobuf</dd>
          <dt>Required parameters:</dt><dd>N/A</dd>
          <dt>Optional parameters:</dt><dd><t><br/></t>
	  <dl spacing="normal" newline="true">
            <dt><tt>encoding</tt></dt><dd>Indicates the type of Protobuf
            encoding and is "binary" by default for
            <tt>application/protobuf</tt>, indicating the format in <xref
            target="Binary"/>. At the time of writing, no other
            encoding can be used for <tt>application/protobuf</tt>, so this
            parameter is for extensibility.</dd>
            <dt><tt>version</tt></dt><dd>Indicates the version of the
            wire encoding specification (not the schema language), with
            a default of <tt>1</tt>. At the time of writing, no Protobuf wire
            encodings are versioned, so this parameter is for
            extensibility. Unversioned wire encodings should be treated as
            having version <tt>1</tt>.</dd>
	  </dl>
	</dd>
        <dt>Encoding considerations:</dt><dd>binary</dd>
        <dt>Security considerations:</dt><dd>See <xref target="security"/> of RFC 9996.</dd>
        <dt>Interoperability considerations:</dt><dd>The Protobuf
        specification <xref target="Protobuf"/> includes versioning provisions to ensure backward
        compatibility when encountering payloads with unknown properties.</dd>
        <dt>Published specification:</dt><dd><xref target="Protobuf"/></dd>
        <dt>Applications that use this media type:</dt><dd>Any application
        with a need to exchange or store structured objects across platforms
        or implementations.</dd>
        <dt>Fragment identifier considerations:</dt><dd>N/A</dd>
        <dt>Additional information:</dt><dd><t><br/></t>

	<dl spacing="compact">
          <dt>Deprecated alias names for this type:</dt><dd><tt>application/x-protobuf</tt>, <tt>application/x-protobuffer</tt></dd>
          <dt>Magic number(s):</dt><dd>N/A</dd>
          <dt>File extension(s):</dt><dd>N/A</dd>
          <dt>Macintosh file type code(s):</dt><dd>N/A</dd>
          </dl>
        </dd>
        <dt>Person &amp; email address to contact for further
        information:</dt><dd>Protobuf Team &lt;protobuf-team@google.com&gt;</dd>
        <dt>Intended usage:</dt><dd>COMMON</dd>
        <dt>Restrictions on usage:</dt><dd>N/A</dd>
        <dt>Author:</dt><dd><t><contact fullname="Rob Sloan"/> &lt;rmsj@google.com&gt;, Protobuf Team &lt;protobuf-team@google.com&gt;</t></dd>
        <dt>Change controller:</dt><dd>IETF</dd>
	</dl>
      </section>
      <section anchor="registration-for-applicationprotobufjson-media-type">
        <name>Media Type: <tt>application/protobuf+json</tt></name>
	<dl spacing="normal" newline="false">
          <dt>Type name:</dt><dd>application</dd>
          <dt>Subtype name:</dt><dd>protobuf+json</dd>
          <dt>Required parameters:</dt><dd><tt>charset</tt>, which must be set to <tt>utf-8</tt> (case-insensitive)</dd>
          <dt>Optional parameters:</dt><dd><t><br/></t>
	  <dl spacing="normal" newline="true">
            <dt><tt>encoding</tt></dt><dd>Indicates the type of
            Protobuf encoding and is <tt>json</tt> by default for
            <tt>application/protobuf+json</tt>, indicating the format in <xref
            target="ProtoJSON"/>. At the time of writing, no other
            encoding can be used for <tt>application/protobuf+json</tt>, so
            this parameter is for extensibility.</dd>
            <dt><tt>version</tt></dt><dd>Indicates the version of the
            wire encoding specification (not the schema language), with a 
            default of <tt>1</tt>. At the time of writing, no protobuf wire
            encodings are versioned, so this parameter is for
            extensibility. Unversioned wire encodings should be treated as
            having version <tt>1</tt>.</dd>
          </dl>
        </dd>
        <dt>Encoding considerations:</dt><dd>Same as encoding considerations
        of <tt>application/json</tt> as specified in <xref target="RFC8259"
        sectionFormat="comma" section="11"/>.</dd>
        <dt>Security considerations:</dt><dd>See <xref target="security"/> of RFC 9996.</dd>
        <dt>Interoperability considerations:</dt><dd>The Protobuf
        specification <xref target="Protobuf"/> includes versioning provisions to ensure backward
        compatibility when encountering payloads with unknown properties.</dd>
        <dt>Published specification:</dt><dd><xref target="Protobuf"/></dd>
        <dt>Applications that use this media type:</dt><dd>Any application
        with a need to exchange or store structured objects across platforms
        or implementations.</dd>
        <dt>Fragment identifier considerations:</dt><dd>N/A</dd>
        <dt>Additional information:</dt><dd><t><br/></t>

	<dl spacing="compact">
	  <dt>Deprecated alias names for this type:</dt><dd>application/x-protobuf+json</dd>
	  <dt>Magic number(s):</dt><dd>N/A</dd>
	  <dt>File extension(s):</dt><dd>N/A</dd>
	  <dt>Macintosh file type code(s):</dt><dd>N/A</dd>
	</dl>
      </dd>
        <dt>Person &amp; email address to contact for further
        information:</dt><dd>Protobuf Team &lt;protobuf-team@google.com&gt;</dd>
        <dt>Intended usage:</dt><dd>COMMON</dd>
        <dt>Restrictions on usage:</dt><dd>N/A</dd>
        <dt>Author:</dt><dd><t><contact fullname="Rob Sloan"/> &lt;rmsj@google.com&gt;, Protobuf Team &lt;protobuf-team@google.com&gt;</t></dd>
        <dt>Change controller:</dt><dd>IETF</dd>
	</dl>
      </section>
    </section>
  </middle>
  <back>
    <displayreference target="RFC9839" to="UniChars"/>
    <references anchor="sec-combined-references">
      <name>References</name>
      <references anchor="sec-normative-references">
        <name>Normative References</name>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2045.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6838.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6839.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4648.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8259.xml"/>
        <reference anchor="Protobuf" target="https://protobuf.dev/">
          <front>
            <title>Protocol Buffers</title>
            <author>
              <organization>Google, LLC</organization>
            </author>
          </front>
        </reference>
      </references>
      <references anchor="sec-informative-references">
        <name>Informative References</name>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8446.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9205.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8264.xml"/>
        <reference anchor="CORB" target="https://www.chromium.org/Home/chromium-security/corb-for-developers">
          <front>
            <title>Cross-Origin Read Blocking for Web Developers</title>
            <author>
              <organization>Chromium</organization>
            </author>
          </front>
        </reference>
        <reference anchor="MIMESNIFF" target="https://mimesniff.spec.whatwg.org/#mime-type-groups">
          <front>
            <title>MIME Sniffing - MIME Type Groups</title>
            <author>
              <organization>WHATWG</organization>
            </author>
          </front>
          <refcontent>WHATWG Living Standard</refcontent>
          <annotation>Commit snapshot: <eref target="https://mimesniff.spec.whatwg.org/commit-snapshots/67bde18bc4f75a5c5b5dfb1217161137ce385124/" brackets="angle"/>.</annotation>
        </reference>
        <reference anchor="Any" target="https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/any.proto">
          <front>
            <title>any.proto Schema Definition</title>
            <author/>
            <date day="12" month="February" year="2026"/>
          </front>
          <refcontent>commit 97921a5</refcontent>
        </reference>
        <reference anchor="Binary" target="https://protobuf.dev/programming-guides/encoding">
          <front>
            <title>Protobuf Binary Wire Encoding Spec</title>
            <author>
              <organization>Google, LLC</organization>
            </author>
          </front>
        </reference>
        <reference anchor="ProtoJSON" target="https://protobuf.dev/programming-guides/json">
          <front>
            <title>Protobuf JSON Wire Encoding Spec</title>
            <author>
              <organization>Google, LLC</organization>
            </author>
          </front>
        </reference>
        <reference anchor="Proto2" target="https://protobuf.dev/reference/protobuf/proto2-spec">
          <front>
            <title>Protocol Buffers Language Specification (Proto2 Syntax)</title>
            <author>
              <organization>Google, LLC</organization>
            </author>
          </front>
        </reference>
        <reference anchor="Proto3" target="https://protobuf.dev/reference/protobuf/proto3-spec">
          <front>
            <title>Protocol Buffers Language Specification (Proto3)</title>
            <author>
              <organization>Google, LLC</organization>
            </author>
          </front>
        </reference>
        <reference anchor="Edition2023" target="https://protobuf.dev/reference/protobuf/edition-2023-spec">
          <front>
            <title>Protocol Buffers Edition 2023 Language Specification</title>
            <author>
              <organization>Google, LLC</organization>
            </author>
          </front>
        </reference>
        <reference anchor="Edition2024" target="https://protobuf.dev/reference/protobuf/edition-2024-spec">
          <front>
            <title>Protocol Buffers Edition 2024 Language Specification</title>
            <author>
              <organization>Google, LLC</organization>
            </author>
          </front>
        </reference>
        <reference anchor="ProtoFeatures" target="https://protobuf.dev/editions/features/">
          <front>
            <title>Protobuf Feature Settings for Editions</title>
            <author>
              <organization>Google, LLC</organization>
            </author>
          </front>
        </reference>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9839.xml"/>
      </references>
    </references>

    <section numbered="false" anchor="acknowledgments">
      <name>Acknowledgments</name>
      <t><contact fullname="Orie Steele"/> provided valuable feedback to this work.</t>
    </section>
  </back>
</rfc>
