Skip to content

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.

Parameters

ParameterRequiredDefaultDescription
seedNorandom UUIDSeed string for deterministic generation — same seed, same image
typeNoidenticonAvatar type: identicon (5×5 symmetric grid) or pixel (8×8 grid)
formatNopngOutput format: png or svg
sizeNo200Image size in pixels (50–2000)
bgNo#f0f0f0Background 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:

html
<img src="https://api.sylvain.sh/v4/avatar?seed=alice" alt="Avatar" />

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

html
<img src="https://api.sylvain.sh/v4/avatar?seed=alice&format=svg" alt="Avatar" />

Code Examples

curl -X GET \
  "https://api.sylvain.sh/v4/avatar?seed=claude&type=identicon&size=200"

Try It

Error Handling

Error MessageDescription
Size must be between 50 and 2000The size parameter is out of the allowed range
Type must be one of: identicon, pixelThe type value is not valid
Format must be one of: png, svgThe format value is not valid
Invalid color (use hex like ff6600)The bg color is not a valid hexadecimal value