Skip to content
moxon home

Avatar Generation

The /avatar endpoint generates deterministic avatar images from a seed string. The same seed always produces the same image, making it useful for consistent user representations.

gethttps://api.moxon.dev/v5/avatar
Try itget/v5/avatar

Parameters

  • seedstringoptional

    Default: random UUID.

    Seed string for deterministic generation — same seed, same image

  • type"identicon" | "pixel"optional

    Default: identicon.

    Avatar type: identicon (5×5 symmetric grid) or pixel (8×8 grid)

  • format"png" | "svg"optional

    Default: png.

    Output format: png or svg

  • sizenumberoptional

    Default: 200.

    Image size in pixels (50–2000)

  • bgstringoptional

    Default: #f0f0f0.

    Background color in hexadecimal (e.g. f0f0f0)

Response

By default (format=png), the endpoint returns a direct PNG image (Content-Type: image/png), usable in an <img> tag:

<img src="https://api.moxon.dev/v5/avatar?seed=alice" alt="Avatar" />

With format=svg, the response is an inline SVG (Content-Type: image/svg+xml):

<img src="https://api.moxon.dev/v5/avatar?seed=alice&format=svg" alt="Avatar" />

Code Examples

Error Handling

  • 400Size must be between 50 and 2000The size parameter is out of the allowed range
  • 400Please provide a valid size (&size={50-2000})The size parameter is not a valid number
  • 400Type must be one of: identicon, pixelThe type value is not valid
  • 400Format must be one of: png, svgThe format value is not valid
  • 400Invalid color (use hex like ff6600)The bg color is not a valid hexadecimal value