API Documentation
Everything you need to integrate Name to Avatar into your application.
POST
/api/v1/avatar
Generate an avatar and demographic inference from a person's name.
Request Body
{
"name": "Yuki Tanaka"
}name string, required — The full name to analyze. 1–200 characters.
Response
{
"name": "Yuki Tanaka",
"avatar_url": "data:image/png;base64,iVBOR...",
"inference": {
"gender": {
"value": "female",
"confidence": 0.82
},
"ethnicity": {
"value": "East Asian",
"confidence": 0.88
},
"country": {
"value": "Japan",
"confidence": 0.79
}
}
}Confidence Threshold
If any inference field has a confidence score below 0.55, its value is automatically set to "unknown". The raw confidence score is always returned.
Example (cURL)
curl -X POST https://nametoavatar.com/api/v1/avatar \
-H "Content-Type: application/json" \
-d '{"name": "Yuki Tanaka"}'Example (JavaScript)
const response = await fetch("/api/v1/avatar", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ name: "Yuki Tanaka" }),
});
const data = await response.json();
console.log(data.avatar_url);
console.log(data.inference);Error Responses
400Bad Request
{
"error": "Invalid request",
"details": [
{
"path": [
"name"
],
"message": "String must contain at least 1 character(s)"
}
]
}500Internal Server Error
{
"error": "Internal server error"
}