راهنما
از hashavatar.app مستقیم از browser، frontend یا backend خود استفاده کنید. هر avatar URL deterministic است، پس identifier و options یکسان همیشه خروجی یکسان تولید میکنند.
URL پایه
وقتی به یک 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 استفاده کنید.
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();
پارامترهای پشتیبانیشده
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 برای character-style families اعمال میشوند. Object-style families مانند planet، rocket، paws، mushroom، cactus، cupcake، pizza، icecream، diamond، coffee-cup و shield به accessory=none و expression=default نرمال میشوند.
لینکهای ذخیرهسازی امضاشده
اگر این deployment دارای object storage پیکربندیشده باشد، از /v1/avatar/link یک presigned storage link درخواست کنید. این endpoint شیء تولیدشده را ذخیره میکند و JSON شامل signed URL، object key و hashed cache key برمیگرداند. Avatar responses استاندارد signed-link metadata را در response headers نمایش نمیدهند.
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
Source سایت عمومی در API repository است و reusable avatar renderer در crates.io منتشر شده است. مخزن · crates.io