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.

API key auth
Authorization: Bearer ak_live_xxxxxxxxxxxxxxxxxxxx
Firebase JWT auth (dashboard only)
Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6...

Generate API keys at dashboard.avatarium.ai/api-keys. Test keys use the prefix ak_test_.

Avatars

GET/v1/avatarsPublic

List all public avatars available on the platform.

Response
{
  "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" }
}
fetch example
const res = await fetch('https://api.avatarium.ai/v1/avatars');
const { data } = await res.json();
console.log(data[0].name); // "Max"
GET/v1/avatars/:idPublic

Get details for a single avatar by ID.

Path parameters

ParameterTypeRequiredDescription
idstringYesAvatar ID
Response
{
  "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" }
}
GET/v1/avatars/:id/modelPublic

Get the 3D model URL for an avatar. Supports quality tiers.

Path parameters

ParameterTypeRequiredDescription
idstringYesAvatar ID

Query parameters

ParameterTypeRequiredDescription
quality"low" | "medium" | "high"NoModel quality tier. Defaults to "medium".
Response
{
  "data": {
    "modelUrl": "https://cdn.avatarium.ai/models/avatar_01abc/model-medium.glb",
    "quality": "medium"
  },
  "meta": { "requestId": "uuid" }
}

Conversations

POST/v1/conversationsAPI key

Create a new conversation session. Returns a conversation ID and WebSocket URL for real-time interaction.

Request body

ParameterTypeRequiredDescription
avatarIdstringNoAvatar to use for this conversation.
systemPromptstringNoOverride the avatar's default system prompt.
provider"groq" | "openai" | "anthropic" | "gemini"NoAI provider. Defaults to "groq".
byokAI.providerstringNoBYOK: your AI provider ("groq" | "openai" | "anthropic" | "gemini").
byokAI.apiKeystringNoBYOK: your own API key for the AI provider.
byokAI.modelstringNoBYOK: model override (e.g. "gpt-4o").
Request
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
Response
{
  "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" }
}
GET/v1/conversations/:idAPI key

Get conversation details including message history and duration.

Path parameters

ParameterTypeRequiredDescription
idstringYesConversation ID returned from POST /v1/conversations.
POST/v1/conversations/:id/messagesAPI key

Send a message to an active conversation and receive an AI response.

Request body

ParameterTypeRequiredDescription
messagestringYesUser message to send.
ttsbooleanNoWhether to synthesize the AI response to audio. Default: true.
ttsProviderstringNoTTS provider for this message ("groq" | "elevenlabs" | "deepgram").
Response
{
  "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" }
}
POST/v1/conversations/:id/endAPI key

End a conversation and finalize usage tracking.

Path parameters

ParameterTypeRequiredDescription
idstringYesConversation ID to end.
Response
{
  "data": { "ended": true, "durationSeconds": 142 },
  "meta": { "requestId": "uuid" }
}
WS/v1/conversations/:id/wsAPI key

Real-time WebSocket connection for streaming AI responses and blendshapes. Use the wsUrl returned from POST /v1/conversations.

WebSocket example
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

POST/v1/ttsAPI key

Synthesize speech from text. Returns raw audio binary (WAV or MP3 depending on provider).

Request body

ParameterTypeRequiredDescription
textstringYesText to synthesize. Max 5,000 characters.
provider"groq" | "elevenlabs" | "deepgram" | "google"NoTTS provider. Defaults to "groq".
voicestringNoVoice ID. See GET /v1/tts/voices for available voices.
Request
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 file

Groq voices support vocal direction tags: [cheerful] [excited] [sad] [whisper] and more.

GET/v1/tts/voicesPublic

List available voices for a TTS provider.

Query parameters

ParameterTypeRequiredDescription
provider"groq" | "elevenlabs" | "deepgram"NoFilter voices by provider. Defaults to "groq".
all"true"NoFetch extended voice list from provider API.
Response
{
  "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" }
}
POST/v1/tts/previewAPI key

Generate a short TTS preview clip for voice selection UIs. Rate-limited per user.

Request body

ParameterTypeRequiredDescription
textstringYesPreview text (max 200 characters).
providerstringYesTTS provider.
voicestringYesVoice ID to preview.

AI

GET/v1/ai/providersAPI key

List available AI providers and their models.

Response
{
  "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" }
}
POST/v1/ai/chatAPI key

Send a chat completion request to an AI provider. Supports BYOK (bring your own key).

Request body

ParameterTypeRequiredDescription
messagesMessage[]YesArray of { role, content } messages.
providerstringNoAI provider. Defaults to "groq".
modelstringNoModel override.
systemPromptstringNoSystem prompt prepended to the conversation.
byokAIobjectNoBYOK config: { provider, apiKey, model?, baseUrl? }.
Request
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).

GET/v1/keysFirebase JWT

List all API keys for the authenticated user. Key values are never returned after creation โ€” only the prefix and hint.

Response
{
  "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" }
}
POST/v1/keysFirebase JWT

Create a new API key. The full key value is returned only once โ€” store it securely.

Request body

ParameterTypeRequiredDescription
namestringYesFriendly label for this key (e.g. "Production").
isTestbooleanNoCreate a test key (prefix: ak_test_). Defaults to false.
permissionsstring[]NoScopes: ["read", "write"]. Defaults to both.
Response
{
  "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" }
}
DELETE/v1/keys/:idFirebase JWT

Permanently revoke an API key. All requests using this key will immediately return 401.

Path parameters

ParameterTypeRequiredDescription
idstringYesKey ID (from GET /v1/keys).
Response
{
  "success": true,
  "meta": { "requestId": "uuid" }
}

Usage

GET/v1/usageFirebase JWT

Get free voice minutes used/remaining and credit balance for the current and previous month.

Response
{
  "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 StatusError CodeDescription
400BAD_REQUESTMissing or invalid request body parameters.
400VALIDATION_ERRORInput failed schema validation.
400INVALID_BYOK_CONFIGBYOK AI configuration is invalid.
401UNAUTHORIZEDMissing or invalid authentication credentials.
403FORBIDDENValid credentials but insufficient permissions.
404NOT_FOUNDThe requested resource does not exist.
429RATE_LIMITEDToo many requests. Back off and retry.
402INSUFFICIENT_CREDITSFree minutes used and credit balance is empty. Top up to continue.
500INTERNAL_ERRORUnexpected server error. Retry with exponential backoff.
500TTS_ERRORTTS provider failed to synthesize speech.
Error response
{
  "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.

Ready to ship embodied AI?

Deploy a real-time talking avatar that handles interruptions and fits your product.