Developers / API Reference
API Reference
Complete reference for the Avatarium REST API. Base URL: https://api.avatarium.ai/v1
Overview
The Avatarium API is a REST API with JSON request and response bodies. All endpoints are served over HTTPS from https://api.avatarium.ai. Responses follow a consistent envelope:
{
"data": { ... }, // present on success
"error": { // present on failure
"code": "NOT_FOUND",
"message": "Human-readable message"
},
"meta": {
"requestId": "uuid-v4" // always present
}
}Authentication
Most write endpoints require an API key passed in the Authorization header. Dashboard management endpoints (keys, usage) use a Firebase ID token. Public avatar endpoints require no authentication.
Authorization: Bearer ak_live_xxxxxxxxxxxxxxxxxxxxAuthorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6...Generate API keys at dashboard.avatarium.ai/api-keys. Test keys use the prefix ak_test_.
Avatars
/v1/avatarsPublicList all public avatars available on the platform.
{
"data": [
{
"id": "avatar_01abc",
"name": "Max",
"description": "AI assistant",
"shortId": "max",
"modelUrl": "https://cdn.avatarium.ai/...",
"thumbnailUrl": "https://cdn.avatarium.ai/...",
"createdAt": "2026-01-01T00:00:00.000Z"
}
],
"meta": { "requestId": "uuid" }
}const res = await fetch('https://api.avatarium.ai/v1/avatars');
const { data } = await res.json();
console.log(data[0].name); // "Max"/v1/avatars/:idPublicGet details for a single avatar by ID.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | Avatar ID |
{
"data": {
"id": "avatar_01abc",
"name": "Max",
"description": "...",
"defaultSystemPrompt": "You are Max...",
"shortId": "max",
"modelUrl": "https://cdn.avatarium.ai/...",
"thumbnailUrl": "https://cdn.avatarium.ai/...",
"createdAt": "2026-01-01T00:00:00.000Z"
},
"meta": { "requestId": "uuid" }
}/v1/avatars/:id/modelPublicGet the 3D model URL for an avatar. Supports quality tiers.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | Avatar ID |
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| quality | "low" | "medium" | "high" | No | Model quality tier. Defaults to "medium". |
{
"data": {
"modelUrl": "https://cdn.avatarium.ai/models/avatar_01abc/model-medium.glb",
"quality": "medium"
},
"meta": { "requestId": "uuid" }
}Conversations
/v1/conversationsAPI keyCreate a new conversation session. Returns a conversation ID and WebSocket URL for real-time interaction.
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
| avatarId | string | No | Avatar to use for this conversation. |
| systemPrompt | string | No | Override the avatar's default system prompt. |
| provider | "groq" | "openai" | "anthropic" | "gemini" | No | AI provider. Defaults to "groq". |
| byokAI.provider | string | No | BYOK: your AI provider ("groq" | "openai" | "anthropic" | "gemini"). |
| byokAI.apiKey | string | No | BYOK: your own API key for the AI provider. |
| byokAI.model | string | No | BYOK: model override (e.g. "gpt-4o"). |
const res = await fetch('https://api.avatarium.ai/v1/conversations', {
method: 'POST',
headers: {
'Authorization': 'Bearer ak_live_xxxx',
'Content-Type': 'application/json',
},
body: JSON.stringify({
avatarId: 'avatar_01abc',
provider: 'groq',
}),
});
const { data } = await res.json();
// data.wsUrl โ connect via WebSocket{
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"avatarId": "avatar_01abc",
"wsUrl": "wss://api.avatarium.ai/v1/conversations/{id}/ws",
"createdAt": "2026-02-22T00:00:00.000Z",
"byokEnabled": false
},
"meta": { "requestId": "uuid" }
}/v1/conversations/:idAPI keyGet conversation details including message history and duration.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | Conversation ID returned from POST /v1/conversations. |
/v1/conversations/:id/messagesAPI keySend a message to an active conversation and receive an AI response.
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
| message | string | Yes | User message to send. |
| tts | boolean | No | Whether to synthesize the AI response to audio. Default: true. |
| ttsProvider | string | No | TTS provider for this message ("groq" | "elevenlabs" | "deepgram"). |
{
"data": {
"messageId": "uuid",
"role": "assistant",
"content": "Hi! How can I help you today?",
"ttsUrl": "https://api.avatarium.ai/v1/...",
"blendshapes": [ ... ],
"latency": {
"ai": 320,
"tts": 180,
"total": 500
}
},
"meta": { "requestId": "uuid" }
}/v1/conversations/:id/endAPI keyEnd a conversation and finalize usage tracking.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | Conversation ID to end. |
{
"data": { "ended": true, "durationSeconds": 142 },
"meta": { "requestId": "uuid" }
}/v1/conversations/:id/wsAPI keyReal-time WebSocket connection for streaming AI responses and blendshapes. Use the wsUrl returned from POST /v1/conversations.
const ws = new WebSocket(
'wss://api.avatarium.ai/v1/conversations/{id}/ws',
['avatarium-protocol']
);
ws.onopen = () => {
ws.send(JSON.stringify({ type: 'message', text: 'Hello!' }));
};
ws.onmessage = (event) => {
const msg = JSON.parse(event.data);
// msg.type: 'text' | 'audio' | 'blendshapes' | 'done' | 'error'
if (msg.type === 'text') console.log(msg.content);
if (msg.type === 'audio') playAudio(msg.data); // base64 PCM
if (msg.type === 'blendshapes') applyBlendshapes(msg.data);
};Text-to-Speech
/v1/ttsAPI keySynthesize speech from text. Returns raw audio binary (WAV or MP3 depending on provider).
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
| text | string | Yes | Text to synthesize. Max 5,000 characters. |
| provider | "groq" | "elevenlabs" | "deepgram" | "google" | No | TTS provider. Defaults to "groq". |
| voice | string | No | Voice ID. See GET /v1/tts/voices for available voices. |
const res = await fetch('https://api.avatarium.ai/v1/tts', {
method: 'POST',
headers: {
'Authorization': 'Bearer ak_live_xxxx',
'Content-Type': 'application/json',
},
body: JSON.stringify({
text: '[cheerful] Hello, how can I help you today?',
provider: 'groq',
voice: 'hannah',
}),
});
const audioBuffer = await res.arrayBuffer();
// Play with Web Audio API or save to fileGroq voices support vocal direction tags: [cheerful] [excited] [sad] [whisper] and more.
/v1/tts/voicesPublicList available voices for a TTS provider.
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| provider | "groq" | "elevenlabs" | "deepgram" | No | Filter voices by provider. Defaults to "groq". |
| all | "true" | No | Fetch extended voice list from provider API. |
{
"voices": [
{ "id": "hannah", "name": "Hannah", "gender": "female", "category": "groq" },
{ "id": "austin", "name": "Austin", "gender": "male", "category": "groq" },
{ "id": "diana", "name": "Diana", "gender": "female", "category": "groq" },
{ "id": "troy", "name": "Troy", "gender": "male", "category": "groq" },
{ "id": "autumn", "name": "Autumn", "gender": "female", "category": "groq" },
{ "id": "daniel", "name": "Daniel", "gender": "male", "category": "groq" }
],
"meta": { "requestId": "uuid" }
}/v1/tts/previewAPI keyGenerate a short TTS preview clip for voice selection UIs. Rate-limited per user.
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
| text | string | Yes | Preview text (max 200 characters). |
| provider | string | Yes | TTS provider. |
| voice | string | Yes | Voice ID to preview. |
AI
/v1/ai/providersAPI keyList available AI providers and their models.
{
"providers": [
{
"id": "groq",
"name": "Groq",
"models": [
{ "id": "meta-llama/llama-4-scout-17b-16e-instruct", "name": "Llama 4 Scout 17B", "contextWindow": 128000 }
]
},
{ "id": "openai", "name": "OpenAI", "models": [ ... ] },
{ "id": "anthropic", "name": "Anthropic", "models": [ ... ] },
{ "id": "gemini", "name": "Google Gemini", "models": [ ... ] }
],
"meta": { "requestId": "uuid" }
}/v1/ai/chatAPI keySend a chat completion request to an AI provider. Supports BYOK (bring your own key).
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
| messages | Message[] | Yes | Array of { role, content } messages. |
| provider | string | No | AI provider. Defaults to "groq". |
| model | string | No | Model override. |
| systemPrompt | string | No | System prompt prepended to the conversation. |
| byokAI | object | No | BYOK config: { provider, apiKey, model?, baseUrl? }. |
const res = await fetch('https://api.avatarium.ai/v1/ai/chat', {
method: 'POST',
headers: {
'Authorization': 'Bearer ak_live_xxxx',
'Content-Type': 'application/json',
},
body: JSON.stringify({
provider: 'groq',
systemPrompt: 'You are a helpful assistant.',
messages: [{ role: 'user', content: 'What is Avatarium?' }],
}),
});
const { data } = await res.json();
console.log(data.content);API Keys
API key management endpoints use Firebase ID token authentication (dashboard only).
/v1/keysFirebase JWTList all API keys for the authenticated user. Key values are never returned after creation โ only the prefix and hint.
{
"keys": [
{
"id": "uuid",
"name": "Production",
"prefix": "ak_live_xxxx",
"hint": "xxxx",
"permissions": ["read", "write"],
"isTest": false,
"lastUsedAt": "2026-02-20T10:00:00.000Z",
"createdAt": "2026-01-15T00:00:00.000Z"
}
],
"meta": { "requestId": "uuid" }
}/v1/keysFirebase JWTCreate a new API key. The full key value is returned only once โ store it securely.
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Friendly label for this key (e.g. "Production"). |
| isTest | boolean | No | Create a test key (prefix: ak_test_). Defaults to false. |
| permissions | string[] | No | Scopes: ["read", "write"]. Defaults to both. |
{
"id": "uuid",
"name": "Production",
"key": "ak_live_xxxxxxxxxxxxxxxxxxxx", // โ ๏ธ shown once only
"prefix": "ak_live_xxxx",
"hint": "xxxx",
"permissions": ["read", "write"],
"isTest": false,
"createdAt": "2026-02-22T00:00:00.000Z",
"meta": { "requestId": "uuid" }
}/v1/keys/:idFirebase JWTPermanently revoke an API key. All requests using this key will immediately return 401.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | Key ID (from GET /v1/keys). |
{
"success": true,
"meta": { "requestId": "uuid" }
}Usage
/v1/usageFirebase JWTGet free voice minutes used/remaining and credit balance for the current and previous month.
{
"data": {
"freeMinutes": {
"used": 9,
"included": 15,
"remaining": 6,
"resetAt": "2026-07-01T00:00:00.000Z"
},
"credits": {
"balanceCents": 4567,
"totalPurchasedCents": 10000
},
"previousPeriod": {
"voiceMinutes": 241
}
},
"meta": { "requestId": "uuid" }
}Errors
All errors return a JSON body with error.code and error.message.
| HTTP Status | Error Code | Description |
|---|---|---|
| 400 | BAD_REQUEST | Missing or invalid request body parameters. |
| 400 | VALIDATION_ERROR | Input failed schema validation. |
| 400 | INVALID_BYOK_CONFIG | BYOK AI configuration is invalid. |
| 401 | UNAUTHORIZED | Missing or invalid authentication credentials. |
| 403 | FORBIDDEN | Valid credentials but insufficient permissions. |
| 404 | NOT_FOUND | The requested resource does not exist. |
| 429 | RATE_LIMITED | Too many requests. Back off and retry. |
| 402 | INSUFFICIENT_CREDITS | Free minutes used and credit balance is empty. Top up to continue. |
| 500 | INTERNAL_ERROR | Unexpected server error. Retry with exponential backoff. |
| 500 | TTS_ERROR | TTS provider failed to synthesize speech. |
{
"error": {
"code": "RATE_LIMITED",
"message": "Too many requests. Please wait before retrying."
},
"meta": { "requestId": "uuid" }
}Need more detail?
The full API docs at docs.avatarium.ai include extended schemas, SDK code examples, WebSocket event types, and changelog.