Integration Guide

Hulp

Gebruik hashavatar.app direk vanaf jou browser, frontend, of backend. Elke avatar URL is deterministic, dus gee dieselfde identifier en options altyd dieselfde output.

Basic URL

Gebruik die query endpoint wanneer jy 'n eenvoudige public image URL nodig het.

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

Gebruik die path form as jy skoner embed URLs verkies.

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

HTML Voorbeeld

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

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 en expression layers word op character-style families toegepas. Object-style families soos planet, rocket, paws, mushroom, cactus, cupcake, pizza, icecream, diamond, coffee-cup, en shield word na accessory=none en expression=default genormaliseer.

Signed Storage Links

As hierdie deployment object storage configured het, vra 'n presigned storage link vanaf /v1/avatar/link. Die endpoint store die generated object en gee JSON terug met 'n signed URL, object key, en hashed cache key. Standard avatar responses wys nie signed-link metadata in response headers nie.

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

Die public site source is in die API repository en die reusable avatar renderer is op crates.io gepublish. Repository · crates.io