API Reference

Dokumentasi

Ini adalah product-facing reference untuk public API. Identity, tenant, style version, avatar family, style options, size, dan WebP output yang sama dimaksudkan tetap stabil dalam 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 bersifat public untuk load balancers dan uptime checks. GET /metrics bersifat loopback-only dan mengembalikan 404 untuk non-local peers.

Dukungan Namespace

Gunakan tenant dan style_version untuk memisahkan visual identity spaces antar produk atau 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 Anonim

Kirim internal stable id atau one-way application hash alih-alih raw personal data.

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

Rate Limits

Public service menerapkan origin-side rate limits, dengan limit lebih ketat pada /v1/avatar/link, direct avatar requests dengan persist=true, dan /og.png karena object storage writes dan Open Graph image rendering lebih mahal daripada direct rendering.

Timeouts

Avatar generation dan storage operations dibatasi oleh server-side timeouts agar request mahal tidak memonopoli origin tanpa batas.

Error

  • 400: kind tidak valid, unsupported algorithm atau format, size, atau missing identity
  • 408: generation atau storage timeout
  • 429: rate limit exceeded
  • 500: rendering atau storage failure

OpenAPI

Untuk generated clients atau tooling, gunakan /docs/openapi.json.