උදව්
hashavatar.app browser, frontend, හෝ backend එකෙන් කෙලින්ම භාවිතා කරන්න. සෑම avatar URL එකක්ම deterministic බැවින් එකම identifier සහ options සෑම විටම එකම output ලබා දෙයි.
Basic URL
සරල public image URL එකක් අවශ්ය විට query endpoint භාවිතා කරන්න.
https://hashavatar.app/v1/[email protected]&algorithm=sha512&kind=robot&background=white&accessory=glasses&color=gold&expression=happy&shape=circle&format=webp&size=256
Path Style URL
වඩා පිරිසිදු embed URLs අවශ්ය නම් path form භාවිතා කරන්න.
https://hashavatar.app/avatar/fox/[email protected]/webp
HTML උදාහරණය
<img
src="https://hashavatar.app/v1/[email protected]&algorithm=sha512&kind=monster&background=themed&accessory=horns&color=crimson&expression=grumpy&shape=hexagon&format=webp&size=256"
alt="Generated monster avatar"
/>
JavaScript උදාහරණය
const avatarUrl = new URL("https://hashavatar.app/v1/avatar");
avatarUrl.search = new URLSearchParams({
id: user.email,
algorithm: "sha512",
kind: "robot",
background: "white",
accessory: "glasses",
color: "gold",
expression: "happy",
shape: "circle",
format: "webp",
size: "256",
}).toString();
Supported Parameters
id: any stable identifier such as an email, username, internal user id, or one-way hashtenant: optional namespace partition for multi-tenant appsstyle_version: optional style namespace such asv2algorithm: identity hash mode; onlysha512is supportedkind: any public hashavatar family, includingcat,dog,robot,planet,rocket,frog,panda,cupcake,pizza,octopus,knight,bear,penguin,dragon,ninja,astronaut,diamond,coffee-cup, andshieldbackground:themed,white,black,dark,light,transparent,polka-dot,striped,checkerboard,grid,sunrise,ocean, orstarryaccessory:none,glasses,hat,headphones,crown,bowtie,eyepatch,scarf,halo, orhornscolor:default,neon-mint,pastel-pink,crimson,gold, ordeep-sea-blueexpression:default,happy,grumpy,surprised,sleepy,winking,cool, orcryingshape:square,circle,squircle,hexagon, oroctagonformat: output format; onlywebpis supportedsize: from64up to1024
Accessory සහ expression layers character-style families සඳහා භාවිතා වේ. planet, rocket, paws, mushroom, cactus, cupcake, pizza, icecream, diamond, coffee-cup, shield වැනි Object-style families accessory=none සහ expression=default ලෙස normalize වේ.
Signed Storage Links
මෙම deployment එකට object storage configured නම් /v1/avatar/link වෙතින් presigned storage link ඉල්ලන්න. එම endpoint generated object store කර signed URL, object key, hashed cache key සහිත JSON ලබා දෙයි. Standard avatar responses response headers තුළ signed-link metadata නොපෙන්වයි.
GET https://hashavatar.app/v1/avatar/[email protected]&algorithm=sha512&kind=robot&background=white&accessory=glasses&color=gold&expression=happy&shape=circle&format=webp&size=256
Open Source
Public site source API repository තුළ ඇත, reusable avatar renderer crates.io හි publish කර ඇත. Repository · crates.io