ਮਦਦ
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 ਲਈ ਲਾਗੂ ਹੁੰਦੇ ਹਨ। Object-style families ਜਿਵੇਂ planet, rocket, paws, mushroom, cactus, cupcake, pizza, icecream, diamond, coffee-cup ਅਤੇ shield ਨੂੰ 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