Back

Blog details

ERC-721 Metadata JSON: Fields, Images and ipfs:// URIs

AIOZ Network
8 min readDecember 02, 2026
aioz-pin
AIOZ Pin cover image with the headline ERC721 Metadata JSON, Fields and IPFS URIs

ERC-721 metadata JSON is the file a token's tokenURI points to: a small JSON object whose name, description and image fields tell wallets what the NFT is. The standard defines only those three, and everything else you see on a marketplace comes from conventions built on top.

TL;DR:

  • EIP-721's optional metadata extension adds name(), symbol() and tokenURI(), and its JSON schema has only three fields.
  • Traits, media and links (attributes, animation_url, external_url) come from OpenSea's metadata standards.
  • Store ipfs:// URIs and build gateway URLs only for display. On November 4, 2026, ipfs.io answered our curl request with HTTP 429.
  • Collections point every token at one folder CID, such as ipfs://<folder CID>/1.

What is ERC-721 metadata JSON?

The ERC-721 standard, EIP-721, splits an NFT into ownership and description. The contract tracks who owns each token ID, and an optional metadata extension lets anyone ask what a token represents. That extension adds name() and symbol() for the collection and tokenURI(uint256) for a single token. A contract advertises it through ERC-165 by returning true for interface ID 0x5b5e139f.

The spec says the URI "may point to a JSON file that conforms to the ERC721 Metadata JSON Schema". That schema lists name, description and image, a URI to a resource with an image/* MIME type. It even suggests images 320 to 1080 pixels wide, with aspect ratios between 1.91:1 and 4:5.

No field is marked as required, and there's no field for traits. The standard asks for little, while the apps that display your token expect more. The glossary entry on tokenURI and uri(id) covers how ERC-721 and ERC-1155 name the pointer itself.

Which fields can NFT metadata JSON contain?

The fields beyond the EIP's three come mostly from OpenSea's metadata standards. Protocol Labs' NFT School reference points to them, and Immutable's ERC-721 docs list the same optional fields. The table shows where each field is defined and what it holds, checked on November 4, 2026.

FieldDefined byWhat it holds
nameEIP-721, OpenSeaThe item's name
descriptionEIP-721, OpenSeaReadable text; OpenSea renders Markdown
imageEIP-721, OpenSeaA URI to the image; OpenSea accepts SVG
animation_urlOpenSeaA URI to video, audio, a GLTF or GLB model, or an HTML page
external_urlOpenSeaA link from the item page to your own site
background_colorOpenSeaSix hex characters with no leading #
attributesOpenSeaAn array of traits for display and filtering
image_dataOpenSea, until 2025Raw SVG markup in place of an image URI; no longer listed

A January 2025 snapshot of OpenSea's page also listed image_data ("Raw SVG image data") and youtube_url, but the July 2026 version lists neither. For inline SVG, a contract can put a data: URI in image instead, as our guide to on-chain vs off-chain NFT metadata shows with Loot.

Here's a token file that uses every current field. Keep it valid JSON: no comments, no trailing commas, and numbers without quotes.

{
  "name": "Harbor Lights #42",
  "description": "Night photograph 42 of 500. **Shot on film.**",
  "image": "ipfs://<images-folder-CID>/42.png",
  "animation_url": "ipfs://<media-folder-CID>/42.mp4",
  "external_url": "https://example.com/harbor-lights/42",
  "background_color": "0b1d2a",
  "attributes": [
    { "trait_type": "District", "value": "Old Port" },
    { "display_type": "number", "trait_type": "Exposure seconds", "value": 8, "max_value": 30 },
    { "display_type": "date", "trait_type": "Shot on", "value": 1730419200 },
    { "value": "Black and white" }
  ]
}

Attributes, traits and display types

Each entry in attributes is an object with a value. Add trait_type to label it, and OpenSea groups tokens by that label for filtering. Add display_type when a number or date should render a certain way: number, date in Unix seconds, boost_number or boost_percentage. A numeric trait can carry max_value; without it, OpenSea uses the highest value it has seen for that trait on the contract.

OpenSea's docs say a number wrapped in quotes is treated as a string, so "8" loses its numeric display. An entry with a value and no trait_type shows up as a generic string tag, like the last one above.

AIOZ Pin's NFT docs show traits under properties, while OpenSea reads attributes. The EIP-721 schema doesn't forbid extra keys, so use the key your target marketplace documents.

Should the image field use ipfs:// or a gateway URL?

Use ipfs://. The IPFS docs call it "the canonical representation for an IPFS link" and recommend it both in the contract and inside the metadata. A gateway URL still carries the CID, so anyone can verify the bytes, but it works only while that one host keeps answering.

On November 4, 2026, we requested Doodle #1's image from ipfs.io and dweb.link with curl, and both returned HTTP 429 with a 900-second Retry-After. Our explainer on why the ipfs.io gateway stopped serving scripts covers that change. A token whose JSON says ipfs:// is unaffected, because any app can pick another gateway.

So generate gateway URLs in your display layer, in path form (https://<gateway>/ipfs/<CID>/path) or subdomain form. The IPFS docs also recommend CIDv1 in base32 for new NFT data, and the anatomy of an IPFS CID shows how v0 and v1 differ. For the HTTP side, see how an IPFS gateway serves content.

How folder CIDs work for a whole collection

An ERC-721 contract doesn't need to store 10,000 separate URIs. In OpenZeppelin's ERC721 (v5.6.1), tokenURI joins a base URI and the token ID with string.concat(baseURI, tokenId.toString()). Set the base to ipfs://<folder CID>/, and token 42 resolves to ipfs://<folder CID>/42 with one stored string for the whole collection.

That only works if you add the files as a directory, so one root CID covers every file and each name becomes part of the path, as UnixFS directories explain. Content addressing fixes the order: add the images first, write each JSON with its image URI, then add the JSON folder and use its CID as the base URI. If you change one file afterwards, the folder CID changes too.

File names must match what the contract builds, character for character. If your contract returns .../42 and you uploaded 42.json, every token resolves to a missing file. On November 4, 2026, CryptoCoven's contract returned .../1.json for token 1. Doodles, Azuki and Pudgy Penguins returned a bare .../1, so read your own contract before you upload.

Diagram of Doodle #1: the contract's tokenURI returns ipfs://QmPMc4tc.../1, a file in one folder CID, whose metadata JSON has name, description, image and five attributes, and whose image field points to a 213,113-byte PNG; gateway URLs are built only for display

Reading a real token's metadata with eth_call

You don't need a wallet or an API key for this. The standard-library script below asks a public Ethereum RPC whether the Doodles contract supports the metadata interface, reads name() and tokenURI(1), then fetches the JSON through a public gateway.

import json, urllib.request

RPC = "https://ethereum-rpc.publicnode.com"   # any Ethereum mainnet RPC URL
GATEWAY = "https://gateway.pinata.cloud/ipfs/"  # any public IPFS gateway

def post(url, body):
    req = urllib.request.Request(url, json.dumps(body).encode(),
                                 {"Content-Type": "application/json", "User-Agent": "curl/8"})
    return json.load(urllib.request.urlopen(req, timeout=30))

def call(contract, data):
    r = post(RPC, {"jsonrpc": "2.0", "id": 1, "method": "eth_call",
                   "params": [{"to": contract, "data": data}, "latest"]})
    return bytes.fromhex(r["result"][2:])

def as_string(raw):  # decode an ABI-encoded string return value
    return raw[64:64 + int.from_bytes(raw[32:64], "big")].decode()

def fetch(uri):
    url = GATEWAY + uri[len("ipfs://"):] if uri.startswith("ipfs://") else uri
    req = urllib.request.Request(url, headers={"User-Agent": "curl/8"})
    return json.load(urllib.request.urlopen(req, timeout=60))

contract, token_id = "0x8a90CAb2b38dba80c64b7734e58Ee1dB38B8992e", 1  # Doodles
has_metadata = call(contract, "0x01ffc9a7" + "5b5e139f".ljust(64, "0"))[-1] == 1
name = as_string(call(contract, "0x06fdde03"))                       # name()
uri = as_string(call(contract, "0xc87b56dd" + format(token_id, "064x")))  # tokenURI(1)
meta = fetch(uri)

print("supportsInterface(0x5b5e139f):", has_metadata)
print("name():", name)
print("tokenURI(1):", uri)
print("JSON keys:", ", ".join(meta))
print("image:", meta.get("image"))
print("attributes[0]:", json.dumps(meta.get("attributes", [None])[0]))

We ran it on November 4, 2026 at 09:45 UTC and got this output:

supportsInterface(0x5b5e139f): True
name(): Doodles
tokenURI(1): ipfs://QmPMc4tcBsMqLRuCQtPmPe84bpSjrC3Ky7t3JWuHXYB4aS/1
JSON keys: image, name, description, attributes
image: ipfs://QmTDxnzcvj2p3xBrKcGv1wxoyhAn2yzCQnZZ9LmFjReuH9
attributes[0]: {"trait_type": "face", "value": "holographic beard"}

The token URI is a CIDv0 folder plus /1, with no .json extension. The image is a single-file CID rather than a folder path, which is just as valid. The five traits sit under attributes as plain strings, the OpenSea shape. Our walkthrough on verifying an NFT's CID yourself shows how to prove those bytes haven't changed.

How AIOZ Pin handles it

AIOZ Pin's custom metadata tutorial follows the same order. You pin the assets first, with pinFilesToIPFS for single files or pinFolderToIPFS, which returns the directory CID so you can address each file by name. Then you write the JSON with ipfs://<CID>/<filename> URIs, pin it, and mint on the chain of your choice. The tutorial also warns: "Avoid storing HTTP gateway links in smart contracts or blockchain records."

For one request per token, the NFT API takes the asset file and the metadata JSON together and returns an asset_cid and a metadata_cid. The NFTs docs add that you can pass an existing asset CID as the cid query parameter instead of the file. This call is quoted from the NFT API docs and was not run here:

curl --location --request POST 'https://api.aiozpin.network/api/nft/' \
--header 'pinning_api_key: KEY' \
--header 'pinning_secret_key: SECRET' \
--form 'metadata=@"/sample.json"' \
--form 'file=@"/test.png"'

The full flow is in our guide to storing NFT metadata on IPFS and minting with AIOZ Pin. For batch scripts, see automating NFT pinning with the NFT API. For why the pin must outlive the mint, read what happens when an IPFS pin expires.

What the docs don't cover yet:

  • Whether POST /api/nft/ writes the asset CID into the metadata's image field, or pins the JSON exactly as you send it. Until that's documented, set image yourself.

Next step: read the AIOZ Pin custom metadata tutorial before you pin your first collection.

Frequently Asked Questions

Is the image field required in ERC-721 metadata?

No. The EIP-721 schema doesn't mark name, description or image as required, and the metadata extension itself is optional. OpenSea shows that field as the item's image, though, so treat it as required for anything you plan to list.

Does the metadata file need a .json extension?

No. The path you upload only has to match the URI your contract returns. Doodles serves its JSON at bare token IDs such as /1.

How is ERC-1155 metadata different?

ERC-1155 uses uri(id) instead of tokenURI, and clients replace an {id} placeholder with the token ID as 64 lowercase hex characters. See our guide to ERC-1155 {id} substitution on IPFS.

Can I change NFT metadata after minting?

With ipfs:// URIs, any edit gives you a new CID, so the contract has to point to it. EIP-721 says the URI "MAY be mutable", and ERC-4906 adds MetadataUpdate and BatchMetadataUpdate events so marketplaces know when to refresh.

What is contract-level metadata?

It describes the collection rather than one token, with fields such as name, description and image. ERC-7572, still a Draft, standardizes a contractURI() function for it.

References

We only send updates when meaningful changes ship, and you can unsubscribe anytime

Related Content

blog thumbnail

ENS IPFS Contenthash: Point an .eth Name at a Website

An ENS IPFS contenthash points your .eth name at a site on IPFS. See the byte format, a real encoding, ipfs vs ipns records, gas used, and common mistakes.

7 min readDecember 04, 2026
blog thumbnail

ERC-721 Metadata JSON: Fields, Images and ipfs:// URIs

ERC-721 metadata JSON explained: the three fields EIP-721 defines, OpenSea attributes and animation_url, ipfs:// image links, and folder CIDs for collections.

8 min readDecember 02, 2026
blog thumbnail

Merkle DAG vs Merkle Tree: What IPFS Changes and Why

Merkle DAG vs Merkle tree explained: a tree gives each node one parent and short proofs, while the DAG IPFS uses shares blocks, carries data and links by CID.

8 min readNovember 30, 2026
blog thumbnail

What Is IPNI? How the IPFS Network Indexer Finds Providers

IPNI is the IPFS network indexer behind cid.contact. See how index providers publish signed advertisement chains and how one HTTP query finds providers.

8 min readNovember 27, 2026
blog thumbnail

On-Chain vs Off-Chain NFT Metadata: Where the Data Lives

On-chain vs off-chain NFT metadata: what the contract stores, what lives on IPFS or a web server, what each costs in gas, and how to check any token yourself.

6 min readNovember 25, 2026
blog thumbnail

What Is a Kademlia DHT? The Routing Algorithm Behind IPFS

A Kademlia DHT finds peers by XOR distance. See how k-buckets, k = 20 and iterative lookups let IPFS locate who holds a CID, and how to watch it on Kubo.

6 min readNovember 23, 2026