---
eip: 8495
title: Token Metadata JSON Schema and Processing
description: Defines the JSON document that token URIs resolve to and how clients resolve, fetch, read, and safely display it.
author: Devin Finzer (@dfinzer), Alex Atallah (@alexanderatallah), Ryan Ghods (@ryanio)
discussions-to: https://ethereum-magicians.org/t/erc-8495-token-metadata-json-schema/30339
status: Draft
type: Standards Track
category: ERC
created: 2026-10-26
requires: 721, 1155, 4804, 4906, 6909
---

## Abstract

This proposal specifies the JSON document that `tokenURI` ([ERC-721](./eip-721.md), [ERC-6909](./eip-6909.md)) and `uri` ([ERC-1155](./eip-1155.md)) resolve to. It covers the display fields, the `attributes` array of traits, which URI schemes clients resolve, how clients treat malformed values, and how other proposals add fields. It writes down the format most deployed tokens already use.

## Motivation

ERC-721 defines `name`, `description`, and `image`, and ERC-1155 adds `decimals`, `properties`, and `localization`. Everything else wallets and marketplaces show, including video, HTML, and traits, follows a format OpenSea documented in 2018 that was never specified. Clients fill the gaps differently: whether a trait value can be a boolean or a quoted number, whether dates are in seconds or milliseconds, which URI schemes to resolve, and how to isolate HTML.

Proposals that add metadata fields, such as [ERC-5625](./eip-5625.md), have no base document to require and no rules for naming fields or for what older clients show. This proposal gives them both.

## Specification

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 [RFC 2119](https://www.rfc-editor.org/rfc/rfc2119) and [RFC 8174](https://www.rfc-editor.org/rfc/rfc8174).

A *metadata URI* is the string returned by `tokenURI(uint256)` in ERC-721 or ERC-6909, or by `uri(uint256)` in ERC-1155. A *metadata document* is the JSON object it resolves to. A *producer* publishes metadata documents, and a *client*, such as a wallet, marketplace, or indexer, reads them.

This proposal does not define how clients obtain the metadata URI from a contract, the semantics of URI schemes beyond the rules given here, or content that a contract exposes outside the metadata document.

### Resolving URIs

These rules apply to the metadata URI and to every URI-valued field.

Clients MUST resolve `https`, `ipfs` (InterPlanetary File System), `ar` (Arweave), and `data` URIs. Clients MAY resolve other schemes, such as `ipns` or the `web3` scheme of [ERC-4804](./eip-4804.md), and MUST NOT resolve schemes that run code or read local resources, such as `javascript` or `file`.

Producers MUST use absolute URIs, SHOULD use `ipfs`, `ar`, or `data` for content that is not meant to change, and SHOULD NOT use `http`. An `ipfs` URI MUST have the form `ipfs://<cid>`, where `<cid>` is a content identifier, with an optional path. Producers SHOULD NOT write an IPFS gateway URL in place of an `ipfs` URI.

Clients SHOULD read an `https` URL of the form `https://<host>/ipfs/<cid>` or `https://<cid>.ipfs.<host>`, with an optional path, as the `ipfs` URI formed from only the CID and optional path, ignoring any query string or fragment. If no gateway or node serves the content by its CID, clients SHOULD fall back to the original URL, including its query string and fragment. Clients MUST NOT use this fallback when served content fails verification.

Clients MAY fetch `ipfs` and `ar` content through any gateway. Clients that fetch `ipfs` content through a gateway they do not operate SHOULD verify it against the CID, for example by requesting raw blocks or a CAR file from a trustless gateway. Verification starts from the CID in the URI. For a URI with a path, verification also covers every block between that CID and the content the path names.

Producers MUST use `data` URIs that conform to [RFC 2397](https://www.rfc-editor.org/rfc/rfc2397) wherever they use the `data` scheme. For example, in a percent-encoded SVG payload, `%23fff` represents the color `#fff`, while a trailing `#view` on the URI identifies a fragment. An SVG charset parameter is optional. Producers that specify UTF-8 use `data:image/svg+xml;charset=utf-8,`. A bare `;utf8` is invalid even if the payload is percent-encoded. Producers that use a `data` URI for metadata JSON SHOULD use `application/json` and base64 encoding. Clients MUST accept any conforming `data` URI and SHOULD also accept non-conforming ones, such as those with unencoded payloads.

Clients read a `data` URI by parsing it with the URL Standard's URL parser and running the Fetch Standard's `data:` URL processor on it. A `data` URI is base64 for these rules if that processor recognizes its base64 marker. In a media field, such as `image` or `animation_url`, clients MAY replace every `#` with `%23` before loading a non-base64 `data` URI. Clients MUST leave the fragment of a base64 `data` URI intact.

For ERC-1155 tokens, clients MUST apply ERC-1155's `{id}` substitution to the metadata URI and to string values in the document. A producer that returns a `{id}` template MUST serve each document at the hexadecimal form ERC-1155 defines.

### Fetching

A metadata document MUST be a JSON object ([RFC 8259](https://www.rfc-editor.org/rfc/rfc8259)) encoded as UTF-8. Servers SHOULD send an accurate `Content-Type` and `Access-Control-Allow-Origin: *`.

A client that fetches from its own servers, such as an indexer, MUST NOT connect to loopback, private, or link-local addresses. It MUST apply this check to the address each hostname resolves to and to every redirect.

### Processing a metadata URI

Clients MUST obtain the metadata document from a metadata URI by the following steps, or by any steps that produce the same result. Clients skip any part of a step that handles a form they do not accept, such as a form in [Deployed forms](#deployed-forms) or an IPFS gateway URL.

1. Remove leading and trailing ASCII whitespace from the metadata URI.
2. If the result begins with `{` and ends with `}`, it is a JSON document instead of a URI. Clients that accept that form take it as the text and continue at step 7. Other clients treat the document as absent.
3. For an ERC-1155 token, replace `{id}` with the token ID in the hexadecimal form ERC-1155 defines. Then read `ipfs://ipfs/<cid>` as `ipfs://<cid>`, and read an IPFS gateway URL as the `ipfs` URI with the same CID and path, as described in [Resolving URIs](#resolving-uris). Keep the substituted gateway URL for fallback.
4. If the URI is a `data` URI, replace every `#` with `%23` only if the URI is non-base64, then read it as described in [Resolving URIs](#resolving-uris). If the `data:` URL processor returns failure, the document is absent. A client that accepts only `data` URIs conforming to RFC 2397 also treats any other `data` URI as absent. Otherwise take the processor's body as the bytes, whatever media type it reports, and continue at step 6.
5. If the client does not resolve the URI's scheme, the document is absent. Otherwise, fetch the URI according to [Resolving URIs](#resolving-uris), including its gateway fallback rule, and apply the checks in [Fetching](#fetching) to each request. If retrieval fails or verification fails, the document is absent. For HTTP, the document is also absent if the final response after any redirects has a status code outside the 2xx (Successful) class ([RFC 9110](https://www.rfc-editor.org/rfc/rfc9110) Section 15.3). Otherwise take the response body as the bytes, whatever the response's `Content-Type`.
6. Decode the bytes to text with the Encoding Standard's UTF-8 decode.
7. Parse the text as JSON. If parsing fails or the result is not a JSON object, the document is absent. Otherwise the result is the metadata document.
8. If the document is absent for any reason, including a timeout or server error, and step 3 replaced `{id}`, clients that accept the decimal form in [Deployed forms](#deployed-forms) repeat steps 3 to 7 once from the original template, with the decimal token ID in place of the hexadecimal one.

Clients then apply `{id}` substitution to string values in the document, as described in [Resolving URIs](#resolving-uris).

The `data:` URL processor percent-decodes the payload exactly once and leaves an invalid escape, such as a bare `%`, unchanged. The URL parser removes ASCII tab and newline characters, so an unescaped tab or newline inside a JSON string is removed instead of making the document invalid.

### Fields

| Field | Type | Meaning |
| --- | --- | --- |
| `name` | string | Name of the token. |
| `description` | string | Description of the token. |
| `image` | URI | Still image, used in lists and previews. |
| `animation_url` | URI | Video, audio, 3D model, or HTML page, shown in place of `image`. |
| `external_url` | URI | Page about the token on the producer's site. |
| `background_color` | string | Color behind the image. |
| `attributes` | array | Traits of the token. |

Every field is OPTIONAL. Producers SHOULD include `name` and `image`, and SHOULD omit a field rather than set it to `null` or an empty string.

Producers MUST NOT repeat a member name within an object. Clients MUST use the last value of a repeated member.

Clients MUST treat `null` and empty strings as absent and MUST ignore fields they do not recognize. Clients SHOULD ignore a field of the wrong type and read the rest of the document, and MAY truncate or drop values that exceed their own limits.

#### `name` and `description`

`name` is plain text. Clients MUST NOT interpret Markdown or HTML in it.

`description` MAY contain CommonMark Markdown. Clients MUST NOT render raw HTML in it and SHOULD NOT load remote images it references.

#### `image`

Producers SHOULD use a format browsers display natively, such as PNG, JPEG, GIF, WebP, AVIF, or SVG (Scalable Vector Graphics). Clients MUST display SVG without running its scripts, for example in an image element or by rasterizing it. Clients MUST NOT render `image` as a document, such as an HTML page in a frame. Clients SHOULD treat an `image` whose `Content-Type` or `data` URI specifies an HTML media type, such as `text/html` or `application/xhtml+xml`, as absent.

#### `animation_url`

Clients that can render `animation_url` SHOULD show it in the token's detail view in place of `image`, MUST fall back to `image` when they cannot, and SHOULD show `image` as cover art for audio. Producers SHOULD use one of these media types:

| Kind | Media types |
| --- | --- |
| Video | `video/mp4`, `video/x-m4v`, `video/webm`, `video/ogg` |
| Audio | `audio/mpeg`, `audio/wav`, `audio/ogg` |
| 3D model | `model/gltf-binary`, `model/gltf+json` (glTF 2.0) |
| Interactive | `text/html` |

Clients SHOULD take the media type from the `Content-Type` header or the `data` URI, and MAY fall back to the file extension.

A client that renders an HTML page:

- MUST isolate it from the client's origin, for example in an `iframe` sandboxed with `allow-scripts` but not `allow-same-origin`.
- MUST NOT expose a wallet provider or signing interface to it.
- SHOULD block popups and top-level navigation from it.
- SHOULD resolve relative references against the page's own location.

#### `external_url` and `background_color`

Producers SHOULD use `https` for `external_url`.

`background_color` is six hexadecimal digits without a leading `#`, such as `"E0F2FE"`, in either case. Clients SHOULD ignore other formats, and MAY remove a leading `#` first.

#### `attributes`

An array of trait objects:

| Field | Type | Meaning |
| --- | --- | --- |
| `trait_type` | string | Name of the trait. SHOULD be present. |
| `value` | string or number | Value of the trait. REQUIRED. |
| `display_type` | string | How clients present the value. |
| `max_value` | number | Upper bound of a numeric value. |

`value` MUST be a string or a number, so `"5"` is a string trait and `5` is a numeric trait. Clients SHOULD ignore an attribute whose `value` is absent, `null`, an empty string, an object, or an array, and MAY read a boolean as the string `"true"` or `"false"`.

A `trait_type` MAY repeat to give a trait several values, and clients SHOULD keep each value. Clients SHOULD compare trait types and string values exactly after trimming leading and trailing whitespace. Producers SHOULD list attributes in display order. When an attribute conflicts with a value the contract reports through an interface it declares with [ERC-165](./eip-165.md), such as whether the token can be transferred, clients SHOULD show the contract's value.

| `display_type` | `value` | Meaning |
| --- | --- | --- |
| absent | string | Categorical trait. |
| absent | number | Numeric trait. Clients MAY show it relative to `max_value`. |
| `string` or `text` | string | The same as absent. Producers SHOULD write `string`. |
| `number` | number | Numeric stat. |
| `boost_number` | number | Signed bonus, such as `+40`. |
| `boost_percentage` | number | Signed percentage. `10` means `+10%`. |
| `date` | number | Unix time in seconds, which SHOULD be an integer. |

For `number`, `boost_number`, `boost_percentage`, and `date`, `value` MUST be a number, and clients MAY accept a string of a decimal number. Clients MUST treat a `display_type` they do not recognize as absent. `max_value` applies only to numeric traits and MUST be greater than or equal to `value`.

#### Other fields

`decimals`, `properties`, and `localization` have their ERC-1155 meaning for tokens of any standard. Producers SHOULD put traits in `attributes`, not `properties`.

Clients MAY read two legacy fields that producers SHOULD NOT use: `image_data`, raw SVG markup used when `image` is absent, and `youtube_url`, used when `animation_url` is absent.

#### Deployed forms

Clients MAY accept these forms, which producers MUST NOT use:

- `attributes` as an object, such as `{"Background": "Blue"}`.
- Traits in an array named `traits` or `properties` instead of `attributes`.
- `image_url` instead of `image`.
- `ipfs://ipfs/<cid>`, read as `ipfs://<cid>`.
- A URI in `image_data` instead of SVG markup, read as `image` when `image` is absent.
- A metadata URI that is a JSON document instead of a URI, read by step 2 of [Processing a metadata URI](#processing-a-metadata-uri).
- An ERC-1155 `{id}` template whose documents are served only at the decimal token ID, read by the decimal retry in step 8 of [Processing a metadata URI](#processing-a-metadata-uri). If a later refresh resolves the hexadecimal URI, clients SHOULD use that document instead.
- `date` values in milliseconds. Clients SHOULD read a value of `1000000000000` or more as milliseconds, so that every client shows the same date.

### Extensions

An extension is a proposal that adds fields to the metadata document.

1. An extension MUST list this proposal in `requires`.
2. An extension MUST name every top-level field it defines, and SHOULD define a single top-level field whose value is an object.
3. Field names SHOULD use only lowercase ASCII letters, digits, and underscores, and SHOULD begin with a letter.
4. An extension MUST NOT change the meaning or type of a field defined by this proposal or another extension. It MAY define new `display_type` values and new attribute fields.
5. A document that uses an extension MUST still conform to this proposal. An extension SHOULD state which base fields producers fill as a fallback.
6. Clients that do not implement an extension MUST ignore its fields. Clients that do SHOULD prefer its data over the fallback.

Producers MAY add fields that no proposal defines, and SHOULD name them so they are unlikely to collide with an extension, for example by including the project's name.

### Metadata updates

When a document changes, ERC-721 contracts SHOULD emit an [ERC-4906](./eip-4906.md) event. ERC-1155 contracts MAY emit the same `MetadataUpdate` event for one token ID or `BatchMetadataUpdate` for an inclusive range of token IDs. ERC-1155's requirements for emitting `URI` when the URI changes still apply.

Clients that cache documents SHOULD refetch the affected documents on either metadata update event from an ERC-721 or ERC-1155 contract, or on a `URI` event from an ERC-1155 contract. For a batch update, clients SHOULD select cached token IDs from the emitting contract within the inclusive range. The event does not imply that every ID in the range exists. Clients MAY also refetch on their own schedule. Clients that cache media SHOULD also refetch the media a refetched document references, even when its URI is unchanged, unless the URI is content-addressed, such as `ipfs`, `ar`, or `data`.

### JSON Schema

Where this schema differs from the text above, the text applies.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Token Metadata",
  "type": "object",
  "properties": {
    "name": { "type": "string" },
    "description": { "type": "string" },
    "image": { "type": "string", "format": "uri" },
    "animation_url": { "type": "string", "format": "uri" },
    "external_url": { "type": "string", "format": "uri" },
    "background_color": { "type": "string", "pattern": "^[0-9A-Fa-f]{6}$" },
    "attributes": { "type": "array", "items": { "$ref": "#/$defs/attribute" } },
    "decimals": { "type": "integer", "minimum": 0 },
    "properties": { "type": "object" },
    "localization": {
      "type": "object",
      "required": ["uri", "default", "locales"],
      "properties": {
        "uri": { "type": "string" },
        "default": { "type": "string" },
        "locales": { "type": "array", "items": { "type": "string" } }
      }
    },
    "image_data": { "type": "string", "deprecated": true },
    "youtube_url": { "type": "string", "format": "uri", "deprecated": true }
  },
  "$defs": {
    "attribute": {
      "type": "object",
      "required": ["value"],
      "properties": {
        "trait_type": { "type": "string" },
        "value": { "type": ["string", "number"] },
        "display_type": { "type": "string" },
        "max_value": { "type": "number" }
      },
      "if": {
        "required": ["display_type"],
        "properties": {
          "display_type": { "enum": ["number", "boost_number", "boost_percentage", "date"] }
        }
      },
      "then": { "properties": { "value": { "type": "number" } } }
    }
  }
}
```

### Example

```json
{
  "name": "Dave Starbelly",
  "description": "A friendly sea creature that enjoys long swims in the ocean.",
  "image": "ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi/3.png",
  "animation_url": "ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi/3.glb",
  "external_url": "https://example.com/creatures/3",
  "background_color": "E0F2FE",
  "attributes": [
    { "trait_type": "Base", "value": "Starfish" },
    { "trait_type": "Level", "value": 5, "max_value": 10 },
    { "display_type": "boost_percentage", "trait_type": "Stamina Increase", "value": 10 },
    { "display_type": "date", "trait_type": "Birthday", "value": 1546360800 }
  ]
}
```

## Rationale

Figures below come from a survey of metadata from 708 Ethereum and Base contracts in October 2026.

- Field names stay as deployed. `animation_url` holds more than animations, and `external_url` differs from `external_link` in [ERC-7572](./eip-7572.md), but renaming either would break existing documents.
- No field is required, because ERC-721 requires none and deployed documents often omit fields.
- `attributes` is an array because traits repeat, have an order, and carry display hints, and most deployed documents already use one.
- Unknown display types read as absent, so producers and extensions can add new ones without breaking clients. `text` is accepted because more surveyed contracts use it than `string`.
- Dates are in seconds to match `block.timestamp`. The millisecond cutoff of `1000000000000` catches every millisecond date after September 2001 and no date in seconds before the year 33000. A lower cutoff would misread `253402300800` (the year 10000), which some contracts use to mean "never expires".
- Gateway URLs tie content to one server: 113 of the 204 surveyed token URIs written as IPFS gateway URLs failed to load. An `ipfs` URI can be fetched through any gateway or node. A client that reads a gateway URL as an `ipfs` URI can still fetch that content through another gateway or node, and verify it against the CID.
- Producers can store metadata documents, media, or individual field values onchain so clients can retrieve them without relying on a producer-operated server.
- Base64 avoids escaping JSON by hand. A properly percent-encoded payload is also valid. For example, a nested URI's `%23` becomes `%2523` in the outer payload so that a single decoding pass preserves the nested escape.
- Clients keep any `#` in a metadata document's unencoded payload. Onchain SVG embedded in the JSON is full of hex colors such as `fill="#ff0000"`, and a JSON document has no use for a fragment. Cutting at the first `#`, as browsers do, would break tokens that render today.
- Clients read every `data` URI with the Fetch Standard's processor so that existing implementations, such as `fetch`, give every client the same content. Custom decoding fails on deployed payloads: `decodeURIComponent` throws on the bare `%` in SVG markup such as `width='100%'`, and skipping the decoding leaves a double-encoded nested URI unusable.
- Many ERC-1155 `{id}` templates resolve only at the decimal token ID, likely because IPFS directories are uploaded with files named `1`, `2`, `3`. In a sample of Ethereum contracts shared in the discussion, 181 of 323 templates that still responded were served only that way, and trying the hexadecimal form first with one decimal retry resolved 319.
- Unencoded payloads are percent-decoded exactly once, always, because browsers do so when fetching a `data:` URL. Decoding only when a payload fails to parse lets `{"name":"a%22,%22image%22:%22https://x%22}` read as two different documents on two clients. Repeated members resolve to the last value because `JSON.parse` and common JSON libraries already do that, and rejecting the document would break deployed tokens that build JSON by concatenation.
- Extensions are top-level objects because clients already detect optional data by checking whether a field is present. A list of implemented proposals, like the `interop` object in [ERC-1046](./eip-1046.md), or a version field would repeat that and could disagree with it. Names begin with a letter so they are valid identifiers in GraphQL and Protocol Buffers.
- There is no contract interface or [ERC-165](./eip-165.md) identifier, because the document tells a client everything an interface could.
- Attributes are display data that producers can change. Protocols that settle on a trait's value need an onchain source such as [ERC-7496](./eip-7496.md).
- The proposal stops at the metadata document, so that it can describe what deployed tokens already do. Reading a `tokenURI` that needs more gas than one call allows, collection-level metadata such as [ERC-7572](./eip-7572.md), the behavior of schemes other than those named here, and content that contracts return from other functions, such as an onchain HTML renderer, are left to their own proposals. A contract that does any of these still returns a metadata document that conforms to this proposal.

## Backwards Compatibility

Documents that conform to the ERC-721 or ERC-1155 metadata schemas, or follow the 2018 format described in [Motivation](#motivation), conform to this proposal. The forms in [Deployed forms](#deployed-forms) do not conform, but clients may still accept them.

General-purpose `data:` URL parsers, `fetch` included, cut the payload at the first `#`. For example, `fetch('data:application/json,{"name":"Creature #42"}')` returns `{"name":"Creature`. Keeping the `#` departs from [RFC 3986](https://www.rfc-editor.org/rfc/rfc3986) Section 3.5, RFC 2397, the URL Standard, and the Fetch Standard. For non-base64 metadata, step 4 of [Processing a metadata URI](#processing-a-metadata-uri) replaces `#` with `%23` first, so `fetch('data:application/json,{"name":"Creature %2342"}')` returns `{"name":"Creature #42"}`. Clients can use the same replacement for non-base64 media, though an SVG URI can have an intentional fragment. In a base64 URI, `#` starts a fragment and the processor decodes only the payload before it.

## Test Cases

| Metadata URI | Document |
| --- | --- |
| `data:application/json;base64,eyJuYW1lIjoiRXhhbXBsZSJ9` | `{"name":"Example"}` |
| `data:application/json;base64,eyJuYW1lIjoiRXhhbXBsZSJ9#x` | `{"name":"Example"}` |
| `data:application/json,%7B%22name%22%3A%22Example%22%7D` | `{"name":"Example"}` |
| `data:application/json;utf8,{"name":"Example"}` | Not conformant. Read as `{"name":"Example"}` by clients that accept it. |
| `data:application/json;utf8,{"name":"Creature #42"}` | Not conformant. Read as `{"name":"Creature #42"}` by clients that accept it. |
| `{"name":"Example"}` | Not conformant. Read as `{"name":"Example"}` by clients that accept it. |
| `ipfs://ipfs/bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi/1.json` | Not conformant. Read as `ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi/1.json` by clients that accept it. |
| `https://gateway.example/ipfs/bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi/1.json` | Conformant, though producers should write the `ipfs` URI. Read as `ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi/1.json` by clients that read gateway URLs. |
| `https://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi.ipfs.gateway.example/1.json` | Conformant, though producers should write the `ipfs` URI. Read as `ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi/1.json` by clients that read gateway URLs. |
| `data:text/plain,%7B%22name%22%3A%22Example%22%7D` | `{"name":"Example"}` |
| `data:application/json,{"name":"100% done"}` | Not conformant. Read as `{"name":"100% done"}` by clients that accept it. The bare `%` is kept. |
| `data:application/json,{"animation_url":"data%3Atext%2Fhtml%2C%253Cp%253Ehi"}` | Not conformant. Read as `{"animation_url":"data:text/html,%3Cp%3Ehi"}` by clients that accept it. The payload is decoded once, so the nested URI keeps its own encoding. |

For an ERC-1155 token with ID `314592`, `ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi/{id}.json` resolves to `ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi/000000000000000000000000000000000000000000000000000000000004cce0.json`.

| Document | Result |
| --- | --- |
| `{"name": "Example", "image": 42}` | `image` has the wrong type and is ignored. |
| `{"name": "Example", "description": null}` | `description` is absent. |
| `{"name": "Example", "background_color": "#E0F2FE"}` | Not conformant. Read as `E0F2FE` by clients that remove the `#`. |
| `{"name": "Example", "glow": {"color": "gold"}}` | Conformant. `glow` is ignored. |

| Attribute | Result |
| --- | --- |
| `{"trait_type": " Eyes ", "value": "Big "}` | String trait `Eyes` with value `Big`. |
| `{"value": "Happy"}` | String trait with no trait type. |
| `{"trait_type": "Level", "value": "5"}` | String trait. |
| `{"trait_type": "Level", "value": 5, "max_value": 10}` | Numeric trait, 5 out of 10. |
| `{"display_type": "text", "trait_type": "Faction", "value": "Red"}` | String trait. |
| `{"display_type": "sparkle", "trait_type": "Mood", "value": "Calm"}` | String trait, since `sparkle` is unknown. |
| `{"display_type": "date", "trait_type": "Expires", "value": 253402300800}` | `10000-01-01T00:00:00Z`. |
| `{"display_type": "date", "trait_type": "Registered", "value": 1694173211000}` | Not conformant. Read as `2023-09-08T11:40:11Z`. |
| `{"trait_type": "Mood", "value": null}` | Ignored. |

Two attributes with `trait_type` `Accessory` and values `Scarf` and `Glasses` form one trait with both values.

## Security Considerations

- HTML in `animation_url` and SVG images can run scripts. Rendered in the client's origin, they reach its cookies, storage, and connected wallet. The isolation rules above prevent this. An `image` URL can also start serving HTML, for example after its domain lapses, so clients never render `image` as a document.
- Links in `description` and `external_url` can lead to phishing pages. Clients should follow only `https` links and show the destination's domain.
- Indexers fetch URIs that any contract deployer chooses. Without the address checks in [Fetching](#fetching), a URI or redirect can reach internal services such as a cloud instance metadata endpoint.
- Documents and media can be huge, slow, deeply nested, or compressed. Clients should limit size, depth, time, and redirects.
- A producer's server sees every client that fetches from it directly, and can serve moderators different content than users. Clients should fetch through their own cache.
- A document served over `https` can change between a buyer's decision and settlement, so a seller can change a token's attributes to fill a trait offer and then change them back. Content-addressed URIs change only when the contract returns a new one. Protocols that settle on traits should read them onchain.
- A gateway can return content that does not match the requested CID. Content-addressed URIs protect a client only when it verifies what it fetched. For a URI with a path, this includes the blocks that resolve the path. Checking the content against a CID the gateway reports for it is not verification, because the gateway chose both.
- Anyone can copy another collection's name and image. Clients should identify tokens by chain, contract, and token ID, never by metadata.

## Copyright

Copyright and related rights waived via [CC0](../LICENSE.md).
