Integration Guide

Көмек

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