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 است و برای non-local peers پاسخ 404 می‌دهد.

پشتیبانی 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

ID های ناشناس

به جای raw personal data، یک internal stable id یا one-way application hash ارسال کنید.

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

Rate Limits

Public service origin-side rate limits را اعمال می‌کند، با limit سخت‌گیرانه‌تر برای /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.