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

Public site source በ API repository ውስጥ አለ፣ reusable avatar renderer ደግሞ በ crates.io ታትሟል። Repository · crates.io