Skip to main content

Avatar Resolution

Resolve avatar images from ENS records, NFT collections, and social platform profiles with automatic IPFS gateway handling.

Endpointsโ€‹

EndpointDescriptionPrice
GET /api/avatar/{identifier}Universal avatar$0.001
GET /api/avatar/ens/{name}ENS avatar$0.001
GET /api/avatar/nft/{contract}/{tokenId}NFT image$0.001
GET /api/avatar/batchMultiple avatars$0.005

GET /api/avatar/{identifier}โ€‹

Universal avatar resolution. Accepts ENS names, addresses, or Farcaster usernames.

Resolution Priorityโ€‹

  1. ENS avatar record
  2. Primary NFT profile picture
  3. Farcaster PFP (if connected)
  4. Generated identicon fallback

Requestโ€‹

curl https://api.web3identity.com/api/avatar/vitalik.eth

Responseโ€‹

{
"identifier": "vitalik.eth",
"avatar": "https://api.web3identity.com/cdn/avatar/vitalik.eth.png",
"original": "eip155:1/erc721:0xb7f7f6c52f2e2fdb1963eab30438024864c313f6/2430",
"type": "nft",
"source": "ens",
"dimensions": {
"width": 512,
"height": 512
},
"cached": true,
"cacheExpiry": "2026-02-09T04:30:00Z"
}

Avatar Typesโ€‹

TypeDescriptionExample
nftERC-721/1155 tokeneip155:1/erc721:0x.../123
ipfsIPFS hashipfs://Qm...
urlDirect URLhttps://...
dataBase64 data URIdata:image/svg+xml;...
identiconGenerated fallbackAuto-generated

SDKโ€‹

const avatar = await client.getAvatar('vitalik.eth');

// Get as image buffer
const imageBuffer = await client.getAvatarImage('vitalik.eth');

GET /api/avatar/ens/{name}โ€‹

Get avatar specifically from ENS records.

Requestโ€‹

curl https://api.web3identity.com/api/avatar/ens/nick.eth

Responseโ€‹

{
"name": "nick.eth",
"avatar": "https://api.web3identity.com/cdn/avatar/nick.eth.png",
"record": "eip155:1/erc721:0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d/69",
"collection": "Bored Ape Yacht Club",
"tokenId": "69",
"contract": "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d",
"chain": "ethereum"
}

Handle IPFS Avatarsโ€‹

IPFS avatars are automatically resolved through fast gateways:

# Original record: ipfs://QmYxvT...
# Response includes resolved URL
curl https://api.web3identity.com/api/avatar/ens/example.eth
{
"name": "example.eth",
"avatar": "https://api.web3identity.com/cdn/avatar/example.eth.png",
"record": "ipfs://QmYxvTkWE4w...",
"gateway": "https://cloudflare-ipfs.com/ipfs/QmYxvTkWE4w..."
}

GET /api/avatar/nft/{contract}/{tokenId}โ€‹

Get the image for any NFT directly.

Requestโ€‹

curl https://api.web3identity.com/api/avatar/nft/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d/1234

Responseโ€‹

{
"contract": "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d",
"tokenId": "1234",
"collection": "Bored Ape Yacht Club",
"image": "https://api.web3identity.com/cdn/nft/bayc/1234.png",
"originalUri": "ipfs://QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/1234",
"attributes": [
{ "trait_type": "Background", "value": "Blue" },
{ "trait_type": "Fur", "value": "Golden Brown" }
]
}

Query Parametersโ€‹

ParamTypeDefaultDescription
chainstringethereumChain for contract
sizestringmediumsmall, medium, large

Supported Chainsโ€‹

  • ethereum (default)
  • polygon
  • arbitrum
  • optimism
  • base

GET /api/avatar/batchโ€‹

Resolve multiple avatars in a single request.

Requestโ€‹

curl -X POST https://api.web3identity.com/api/avatar/batch \
-H "Content-Type: application/json" \
-d '{"identifiers": ["vitalik.eth", "nick.eth", "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"]}'

Or via GET:

curl "https://api.web3identity.com/api/avatar/batch?identifiers=vitalik.eth,nick.eth,dwr.eth"

Responseโ€‹

{
"avatars": {
"vitalik.eth": {
"avatar": "https://api.web3identity.com/cdn/avatar/vitalik.eth.png",
"type": "nft"
},
"nick.eth": {
"avatar": "https://api.web3identity.com/cdn/avatar/nick.eth.png",
"type": "nft"
},
"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045": {
"avatar": "https://api.web3identity.com/cdn/avatar/vitalik.eth.png",
"type": "nft"
}
},
"count": 3
}

SDKโ€‹

const avatars = await client.batchAvatars([
'vitalik.eth',
'nick.eth',
'dwr.eth'
]);

Image Sizesโ€‹

Request specific sizes via query parameter:

# Small (64x64)
curl "https://api.web3identity.com/api/avatar/vitalik.eth?size=small"

# Medium (256x256) - default
curl "https://api.web3identity.com/api/avatar/vitalik.eth?size=medium"

# Large (512x512)
curl "https://api.web3identity.com/api/avatar/vitalik.eth?size=large"

# Original (uncropped)
curl "https://api.web3identity.com/api/avatar/vitalik.eth?size=original"

Direct Image Endpointโ€‹

For embedding in <img> tags, use the CDN endpoint directly:

<img src="https://api.web3identity.com/cdn/avatar/vitalik.eth.png" alt="vitalik.eth" />

This returns the raw image with proper Content-Type header.


Errorsโ€‹

CodeHTTPDescription
NO_AVATAR404No avatar record found
INVALID_NFT404NFT doesn't exist
IPFS_TIMEOUT504IPFS gateway timeout
INVALID_FORMAT400Unsupported avatar format

Fallback Behaviorโ€‹

When no avatar is found, an identicon is generated:

{
"identifier": "unknown.eth",
"avatar": "https://api.web3identity.com/cdn/identicon/unknown.eth.svg",
"type": "identicon",
"generated": true
}