oneavatar.
ONEAVATAR / DOCUMENTATION

Avatars, made
easy to use.

A practical guide to profile images and favicons. Start with a URL, add your API key for metered usage, and keep the implementation you already have.

01 — QUICKSTART

Your first avatar

Use a provider slug and profile handle wherever you would normally use an image URL.

<img src="https://oneavatar.dev/github/octocat" alt="Octocat" />

For email addresses, OneAvatar checks Gravatar and then BIMI. For websites, request the domain favicon.

/email/matt@mullenweg.com/domain/google.com
02 — ROUTES

One endpoint for each lookup

All routes return an image by default. URL encode values that contain reserved characters.

RouteUse it forExample
/{platform}/{handle}Supported profile providers/github/octocat
/email/{email}Gravatar, then BIMI lookup/email/hello%40example.com
/domain/{domain}Website favicon/domain/example.com
03 — AUTHENTICATION

One key for your requests

Create one API key in your dashboard. Use that same key in the x-api-key header for server requests, or as ?token=YOUR_API_KEY for browser image embeds. There is no separate browser credential.

curl "https://oneavatar.dev/github/octocat" -H "x-api-key: oa_live_YOUR_KEY"
Free usageNew accounts include 25 uncached requests per rolling 24-hour window. Add billing to continue with pay-as-you-go usage.
04 — IMAGE EMBEDS

Image Embeds (Not Recommended)

While standard HTML <img> elements can utilize your token via the query string parameter token, this approach is not recommended because it exposes your secret key directly in frontend source code.

<img src="https://oneavatar.dev/github/octocat?token=oa_live_YOUR_API_KEY" referrerpolicy="origin" />

Security Risk & Limitations

Exposing a token in a public frontend query string means anyone can see it. This does not keep your secret key hidden; anyone with access can extract it and exploit it from a backend server by simply mimicking your origin headers.

Securing Your Embeds with Domain Allowlists

If you must use image tags, navigate to Dashboard → API keys to configure and enforce strict domain allowlists checked via browser Origin and Referer headers.

Pattern RuleMatching Behavior & Scope
example.comMatches exact root hostname requests only.
*.example.comMatches all recursive subdomains (e.g., app.example.com, docs.example.com); does not match the apex root domain.
app.example.comRestricts usage exclusively to that specific target subdomain.

The Recommended Approach (Server-Side Integration)

To protect your credentials, the recommended best practice is to:

  • Keep your API key safe in server-side environment variables.
  • Fetch avatar URLs or JSON payloads directly on your server using the secure x-api-key header.
  • Pass only the final public image or json down to your frontend template.
Best PracticeAlways handle API credentials securely on your backend server rather than embedding tokens inside public HTML markup.
05 — FALLBACK STYLING

Choose your fallback style

When no profile image is found, OneAvatar creates initials with UI Avatars. These query parameters style that fallback and do not alter an image returned by a provider.

/github/octocat?background=F0EDE6&color=24251F&size=128
ParameterDefaultDescription
fallbackurl(Optional) Fallback avatar URL. If not provided, a lettermark will be shown.
backgroundF0EDE6Fallback background color in hex, without the # sign.
color24251FFallback initials color in hex, without the # sign.
size128Avatar width and height in pixels.
fontSizeProvider defaultInitials text size in pixels. Defaults to the provider value.
lengthProvider defaultNumber of initials to display.
roundedtrueRound the fallback avatar corners.
boldtrueUse bold initials in the fallback.
uppercasetrueConvert fallback initials to uppercase.
formatstringOutput file format, specify either 'svg' or 'png'.

Color values use six-digit hex without #. For example, ?background=F0EDE6&color=24251F&size=128&rounded=true.

06 — JSON RESPONSES

Resolve a URL as JSON

Append .json to a route to return the resolved image URL in a JSON object.

GET /github/octocat.json { "url": "https://avatars.githubusercontent.com/u/583231?v=4" }

The same query parameters can be used to configure the generated fallback.

07 — CACHING & USAGE

Cache friendly by default

Responses follow upstream cache headers. Cloudflare can cache the image route at the edge, keyed by the configured request headers. A response marked no-store by the upstream should not be stored.

Metered usageCached responses are free and excluded from usage. Uncached requests are measured against the free allowance and then billed by usage when billing is enabled.

Usage activity for authenticated API requests appears in your dashboard.

08 — PROVIDERS

Provider types, descriptions, and identifiers

Every lookup uses the provider slug as its route type and the following path segment as its identifier: /{provider}/{id}. Below is the comprehensive index of all supported platforms, complete with their expected identifier formats and typed properties.

Route pattern and parameters for every provider

ProviderRoute PatternIdentifier Description:type
github/github/:idGitHub username -
google/google/:idWebsite hostname or URL -
bimi/bimi/:idDomain name -
stripe/stripe/:idBusiness profile handle -
npm/npm/:idnpm username (with or without @) -
discord/discord/:idDiscord invite code or invite URL -
spotify/spotify/:type/:idSpotify resource IDuser, artist, album, playlist, show, episode, track
youtube/youtube/:id@handle or UC… channel ID -
linkedin/linkedin/:type/:idUser or company sluguser, company
x/x/:idX username -
reddit/reddit/:idReddit username -
twitch/twitch/:idTwitch username -
telegram/telegram/:idTelegram username -
bluesky/bluesky/:idHandle or DID -
stackoverflow/stackoverflow/:idStack Overflow user ID -
steam/steam/:type/:idSteam vanity name or ID (typed forms below)id, profile, group
tiktok/tiktok/:idTikTok username -
facebook/facebook/:idProfile or page slug -
instagram/instagram/:idInstagram username -
pinterest/pinterest/:idPinterest username -
gitlab/gitlab/:idUser or group slug -
gravatar/gravatar/:idEmail address or Gravatar hash -
behance/behance/:idBehance username -
dribbble/dribbble/:idDribbble username -
medium/medium/:idMedium username -
substack/substack/:idPublication subdomain -
patreon/patreon/:idCreator slug -
paypal/paypal/:idPayPal.Me username -
cashapp/cashapp/:idCashtag (with or without $) -
venmo/venmo/:idVenmo username -
wise/wise/:idWise profile username -
dockerhub/dockerhub/:idDocker Hub username -
huggingface/huggingface/:idHugging Face user or organization name -
codepen/codepen/:idCodePen username -
cursor/cursor/:idCursor username (with or without @) -
producthunt/producthunt/:type/:idProduct Hunt username or product slug (typed forms below)user, product
mastodon/mastodon/:idusername@instance.domain -
threads/threads/:idThreads username -
tumblr/tumblr/:idTumblr blog name or hostname -
snapchat/snapchat/:idSnapchat username -
whatsapp/whatsapp/:type/:idPhone number, channel ID, or invite code (typed forms below)phone, channel, chat
vimeo/vimeo/:idVimeo username or ID -
soundcloud/soundcloud/:idSoundCloud username -
deezer/deezer/:type/:idDeezer resource ID (typed forms below)artist, album, playlist, track
tidal/tidal/:type/:idTidal resource ID (typed forms below)artist, album, playlist
strava/strava/:idAthlete ID -
revolut/revolut/:idRevolut profile username -
raycast/raycast/:idRaycast username (with or without @) -
openstreetmap/openstreetmap/:idOpenStreetMap username or numeric user ID -
apple-music/apple-music/:type/:idArtist or song search text (typed forms below)artist, album, song
apple-store/apple-store/:type/:idApp Store numeric ID or app name (typed forms below)id, name
google-play/google-play/:type/:idPackage name or developer ID (typed forms below)app, dev
bilibili/bilibili/:idNumeric Bilibili user ID -
gitee/gitee/:idGitee username -
juejin/juejin/:idJuejin user ID -
kick/kick/:idKick channel username -
ko-fi/ko-fi/:idKo-fi username -
netease-music/netease-music/:idNumeric NetEase Music user ID -
onlyfans/onlyfans/:idOnlyFans username -
printables/printables/:idPrintables handle (with or without @) -
qq/qq/:idNumeric QQ account ID -
weibo/weibo/:idNumeric user ID or screen name -
xboxgamertag/xboxgamertag/:idXbox gamertag -
zhihu/zhihu/:idZhihu member slug -
cults3d/cults3d/:idCults3D username (with or without @) -
deviantart/deviantart/:idDeviantArt username -
duckduckgo/duckduckgo/:idWebsite hostname -
flickr/flickr/:type/:idFlickr user or group ID/name (typed forms below)user, group
hevy/hevy/:idHevy username -
tieba/tieba/:idTieba username -
thingiverse/thingiverse/:idThingiverse username -
buymeacoffee/buymeacoffee/:idBuy Me a Coffee username -
primal/primal/:idPrimal username or public key -

Advanced typed selectors (type:id)

For select platforms supporting granular resource types, separate the entity type and its specific identifier using a colon.

ProviderDefault TypeTypesExample Route
Apple Musicartistartist:term, song:term, album:term/apple-music/song:Daft%20Punk
Apple Storeidid:app-id, name:app-name (with optional country code suffix like @US)/apple-store/name:Pages
Deezerartistartist:id, album:id, playlist:id, track:id/deezer/artist:27
Flickruseruser:handle, group:slug/flickr/group:explore
Google Playappapp:package.name, dev:developer-id/google-play/app:com.example.app
LinkedInuseruser:slug, company:slug/linkedin/company:openai
Product HuntUsernameproduct:slug or raw username string/producthunt/product:linear
Spotifyuseruser:id, artist:id, album:id, playlist:id, track:id/spotify/playlist:37i9dQZF...
Steamidid:name, profile:id, group:name/steam/group:valve
Tidalartistartist:id, album:id, playlist:id/tidal/album:1765857
WhatsAppphonephone:number, channel:id, chat:invite-code/whatsapp/channel:CHANNEL_ID

All supported provider types

These route names map directly to the provider ecosystem. Use the respective identifiers outlined above.

githubgooglebimistripenpmdiscordspotifyyoutubelinkedinxreddittwitchtelegramblueskystackoverflowsteamtiktokfacebookinstagrampinterestgitlabgravatarbehancedribbblemediumsubstackpatreonpaypalcashappvenmowisedockerhubhuggingfacecodepencursorproducthuntmastodonthreadstumblrsnapchatwhatsappvimeosoundclouddeezertidalstravarevolutraycastopenstreetmapapple-musicapple-storegoogle-playbilibiligiteejuejinkickko-finetease-musiconlyfansprintablesqqweiboxboxgamertagzhihucults3ddeviantartduckduckgoflickrhevytiebathingiversebuymeacoffeeprimal
That’s the whole integration.Create an API key ->