Documentation
Agent metadata
How registration files are stored, resolved, sanitized, versioned and checked for integrity — and why only onchain files can be integrity-checked.
Where a registration file can live
An ERC-8004 identity points to its registration file through agentURI. AgentID registrations always store the file onchain; other agents in the same registry use whatever their owners chose.
| agentURI | Source | Resolution | Integrity check |
|---|---|---|---|
data:application/json;base64,… | onchain-data-uri | Decoded locally (base64 or percent-encoded, ≤ 64 KB) | PASS |
https://… | https | Fetched with a timeout and a byte cap | NOT CHECKED |
ipfs://… | ipfs | Fetched through a gateway; CID not verified locally | NOT CHECKED |
| (empty) | none | Nothing to resolve — status empty | NOT CHECKED |
http://, ar://, … | — | Not fetched — status unsupported | NOT CHECKED |
Metadata integrity verified passes only when the file is stored onchain: the bytes in the identity are the file. For https and IPFS there is no onchain hash to compare against, so the check is reported as not checked — the report still includes the keccak256 of the bytes that were served, so you can detect later changes yourself.
Resolution statuses
| Status | Meaning |
|---|---|
| ok | Fetched or decoded, and it is a valid registration file |
| pending | Not resolved yet (index only) |
| empty | agentURI is empty — ERC-8004 allows register() without a URI |
| unsupported | A scheme AgentID will not fetch (http://, localhost, bare strings) |
| unavailable | The fetch failed: timeout, DNS, non-200, too large |
| invalid | Content is not a valid registration file (not an object, missing name, malformed JSON) |
Treating metadata as untrusted input
Registration files are written by agent owners and are parsed leniently but defensively. The parser never throws on odd data; it returns the sanitized file plus warnings:
- control characters, bidirectional overrides, zero-width and other invisible characters are stripped; text is NFC-normalized and length-capped;
- links survive only as
https://URLs; images only as https, IPFS, rasterdata:imageor AgentID assets; - an invalid
agentidextension block is ignored rather than failing the file; - AgentID never renders metadata as HTML and never executes or follows instructions found in it.
import { resolveMetadata, normalizeImageUrl, safeExternalUrl } from "@agentid/sdk";
const m = await resolveMetadata(agentURI, { timeoutMs: 10_000 });
m.status; // "ok" | "empty" | "unsupported" | "unavailable" | "invalid"
m.source; // "onchain-data-uri" | "https" | "ipfs" | "none"
m.contentHash; // keccak256 of the exact bytes resolved
m.file; // sanitized registration file (or null)
m.warnings; // what was dropped or truncated, e.g. an unsafe link
// When rendering untrusted values:
normalizeImageUrl(m.file?.image); // https / ipfs gateway / data:image raster only, else null
safeExternalUrl(m.file?.agentid?.links?.website); // https:// only, else nullServer-side fetching#
The SDK's resolveMetadata has no SSRF protection — it is meant for clients. The AgentID server resolves https files through its own SSRF-safe fetcher (private and reserved addresses blocked, DNS pinned, redirects re-validated, byte caps). See the security model.
Versions and updates
The index keeps a version history per agent: version 1 is the URI set at registration and every URIUpdated event adds one. https and IPFS files are re-fetched every 6 hours; new bytes (a new keccak256) become a new version, because the file changed without any onchain event.
Owners update an AgentID file with updateRegistration, which calls setAgentURI with a new data: URI. History: GET /api/v1/agents/…/metadata?history=1.
Back-references and domain verification
A file's registrations[] should point back at the identity that references it. Identity reports check this as Registration file references this identity: PASS when it does, WARN when the entry is missing, FAIL when it points to another agent.
For service endpoints, ERC-8004 defines domain verification: the endpoint's host serves /.well-known/agent-registration.json listing the same identity. The AgentID server checks it when an identity verification asks for endpoint checks.
// https://atlas.example/.well-known/agent-registration.json
{
"registrations": [
{ "agentId": 42, "agentRegistry": "eip155:46630:0x8004A818BFB912233c491871b3d84c89A494BD9e" }
]
}