API Reference

תיעוד

זהו product-facing reference עבור ה-public API. אותו identity, tenant, style version, avatar family, style options, size ו-WebP output אמורים להישאר יציבים לאורך major release.

Core Endpoints

  • GET /v1/avatar: returns an avatar asset directly
  • GET /v1/avatar/link: stores the generated avatar in configured object storage and returns signed-link metadata
  • GET /avatar/<kind>/<identity>/webp: path-style public avatar URL
  • GET /docs/openapi.json: machine-readable API description

Operational Endpoints

GET /healthz ציבורי עבור load balancers ו-uptime checks. GET /metrics הוא loopback-only ומחזיר 404 ל-non-local peers.

תמיכת Namespace

השתמשו ב-tenant וב-style_version כדי להפריד visual identity spaces בין מוצרים או rollout phases.

GET https://hashavatar.app/v1/[email protected]&tenant=acme&style_version=v2&algorithm=sha512&kind=wizard&background=white&accessory=hat&color=deep-sea-blue&expression=cool&shape=squircle&format=webp&size=256

IDs אנונימיים

שלחו internal stable id או one-way application hash במקום raw personal data.

printf '%s' '[email protected]' | sha256sum | cut -d' ' -f1

Rate Limits

ה-public service אוכף origin-side rate limits, עם מגבלות הדוקות יותר עבור /v1/avatar/link, direct avatar requests עם persist=true, ו-/og.png מפני ש-object storage writes ו-Open Graph image rendering יקרים יותר מ-direct rendering.

Timeouts

Avatar generation ו-storage operations מוגבלים על ידי server-side timeouts כדי שבקשות יקרות לא יוכלו לתפוס את ה-origin ללא גבול.

Errors

  • 400: kind לא תקין, algorithm או format לא נתמכים, size, או missing identity
  • 408: generation או storage timeout
  • 429: rate limit exceeded
  • 500: rendering או storage failure

OpenAPI

עבור generated clients או tooling, השתמשו ב /docs/openapi.json.