Integration guide

உதவி

Browser, frontend அல்லது backend-இல் இருந்து hashavatar.app-ஐ நேரடியாக பயன்படுத்துங்கள். ஒவ்வொரு avatar URL-மும் deterministic, எனவே அதே identifier மற்றும் options எப்போதும் அதே result தரும்.

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 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-ல் வெளியிடப்பட்டுள்ளது. Repository · crates.io