API Reference

ਦਸਤਾਵੇਜ਼

ਇਹ public API ਲਈ product-facing reference ਹੈ। ਉਹੀ identity, tenant, style version, avatar family, style options, size ਅਤੇ WebP output major release ਵਿੱਚ stable ਰਹਿਣ ਦੀ ਉਮੀਦ ਹੈ।

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 ਲਈ public ਹੈ। GET /metrics loopback-only ਹੈ ਅਤੇ non-local peers ਲਈ 404 ਵਾਪਸ ਕਰਦਾ ਹੈ।

Namespace Support

Products ਜਾਂ rollout phases ਵਿਚਕਾਰ visual identity spaces ਵੱਖ ਕਰਨ ਲਈ tenant ਅਤੇ style_version ਵਰਤੋ।

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

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 ਲਾਗੂ ਕਰਦੀ ਹੈ, /v1/avatar/link, persist=true ਵਾਲੀਆਂ direct avatar requests ਅਤੇ /og.png ਲਈ ਕੜੇ limits ਨਾਲ, ਕਿਉਂਕਿ object storage writes ਅਤੇ Open Graph image rendering direct rendering ਨਾਲੋਂ ਮਹਿੰਗੇ ਹਨ।

Timeouts

Avatar generation ਅਤੇ storage operations server-side timeouts ਨਾਲ bounded ਹਨ ਤਾਂ ਜੋ ਮਹਿੰਗੀਆਂ 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.