API Reference

ឯកសារ

នេះជា product-facing reference សម្រាប់ public API។ identity, tenant, style version, avatar family, style options, size និង WebP output ដូចគ្នាគួរតែ stable ក្នុង 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 គឺ public សម្រាប់ load balancers និង uptime checks។ GET /metrics គឺ loopback-only ហើយត្រឡប់ 404 សម្រាប់ non-local peers។

Namespace Support

ប្រើ tenant និង style_version ដើម្បីបំបែក visual identity spaces រវាង products ឬ 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

Anonymous 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 ដោយមាន 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 ត្រូវបាន bounded ដោយ server-side timeouts ដើម្បីឱ្យ expensive requests មិនអាចកាន់ origin ដោយគ្មានកំណត់។

Errors

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

OpenAPI

សម្រាប់ generated clients ឬ tooling សូមប្រើ /docs/openapi.json.