מדריך Integration

עזרה

השתמשו ב-hashavatar.app ישירות מה-browser, frontend או backend שלכם. כל avatar URL הוא דטרמיניסטי, כך שאותו identifier ואותן options תמיד יפיקו את אותו פלט.

URL בסיסי

השתמשו ב-query endpoint כשצריך image URL ציבורי ופשוט.

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

השתמשו בצורת path אם אתם מעדיפים embed URLs נקיים יותר.

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();

פרמטרים נתמכים

  • 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 מוחלות על character-style families. Object-style families כמו planet, rocket, paws, mushroom, cactus, cupcake, pizza, icecream, diamond, coffee-cup ו-shield מנורמלות ל-accessory=none ו-expression=default.

קישורי אחסון חתומים

אם ל-deployment הזה מוגדר object storage, בקשו presigned storage link מ-/v1/avatar/link. ה-endpoint שומר את ה-generated object ומחזיר JSON עם signed URL, object key ו-hashed cache key. תגובות avatar רגילות אינן חושפות 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

Source האתר הציבורי נמצא ב-API repository וה-reusable avatar renderer מפורסם ב-crates.io. מאגר · crates.io