Integration guide

मदद

hashavatar.app को browser, frontend या backend से सीधे इस्तेमाल करें। हर avatar URL deterministic है, इसलिए वही identifier और options हमेशा वही result देते हैं।

Basic URL

जब आपको simple 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

अगर आप cleaner embed URLs पसंद करते हैं, path form इस्तेमाल करें।

https://hashavatar.app/avatar/fox/[email protected]/webp

HTML example

<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 example

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 hash
  • tenant: optional namespace partition for multi-tenant apps
  • style_version: optional style namespace such as v2
  • algorithm: identity hash mode; only sha512 is supported
  • kind: any public hashavatar family, including cat, dog, robot, planet, rocket, frog, panda, cupcake, pizza, octopus, knight, bear, penguin, dragon, ninja, astronaut, diamond, coffee-cup, and shield
  • background: themed, white, black, dark, light, transparent, polka-dot, striped, checkerboard, grid, sunrise, ocean, or starry
  • accessory: none, glasses, hat, headphones, crown, bowtie, eyepatch, scarf, halo, or horns
  • color: default, neon-mint, pastel-pink, crimson, gold, or deep-sea-blue
  • expression: default, happy, grumpy, surprised, sleepy, winking, cool, or crying
  • shape: square, circle, squircle, hexagon, or octagon
  • format: output format; only webp is supported
  • size: from 64 up to 1024

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 signed-link metadata response headers में expose नहीं करते।

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 पर प्रकाशित है। रिपॉज़िटरी · crates.io