Generate beautiful, unique avatars with a simple HTTP request
A high-performance JSON API that generates unique, deterministic SVG avatars based on a name input. Perfect for user profiles, comments, and any application needing consistent, personalized avatars.
GET /avatars/api/generate-avatar?name=John%20Doe&type=avatar&size=200
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
name |
String | Optional | "User" | Name used to generate the avatar. Same name always produces the same avatar. |
type |
String | Optional | "avatar" | Avatar style. See available types below. |
size |
Integer | Optional | 100 | Size of the avatar in pixels (width and height). |
color |
String | Optional | Auto | Hex color code (e.g., #FF5733). If not provided, color is generated from name. |
All examples use the name "Alex Morgan" for consistency. Each type generates a unique, deterministic design.
Classic circular avatar with initials
type=avatar
GitHub-style identicon
type=gravatar
Retro dithered plasma effect
type=dither
Procedural ASCII robot
type=ascii
LED dot matrix display
type=dotmatrix
Retro terminal block text
type=terminal
Geometric Bauhaus design
type=bauhaus
Gradient ring pattern
type=ring
Connected network nodes
type=beam
Marble texture effect
type=marble
Cyberpunk glitch effect
type=glitch
Procedural sunset scene
type=sunset
Minimalist face with expressions
type=smile
Circuit board pattern
type=circuit
Isometric pixel art cube
type=pixel
Real constellation star maps
type=constellation
<img src="/avatars/api/generate-avatar?name=Jane%20Smith&type=avatar&size=100" alt="Avatar">
<img src="/avatars/api/generate-avatar?name=John&type=gravatar&color=%23FF5733" alt="Avatar">
<img src="/avatars/api/generate-avatar?name=Sarah&type=dotmatrix&size=500" alt="Avatar">
fetch('/avatars/api/generate-avatar?name=Bob%20Johnson&type=beam')
.then(response => response.text())
.then(svg => {
document.getElementById('avatar').innerHTML = svg;
});
All avatars are returned as SVG (Scalable Vector Graphics) with the content type:
| Code | Description |
|---|---|
200 OK |
Request successful, avatar returned |
400 Bad Request |
Invalid avatar type specified |
429 Too Many Requests |
Rate limit exceeded (100 req/min) |
500 Internal Server Error |
Server-side error occurred |
When no color is specified, avatars use the OKLCH color space for perceptually uniform, accessible colors. The algorithm: