# Golden Engine > Golden Engine is an API for conversational AI avatars. You create an avatar — a ready-made stock avatar or one trained from your own video — give it documents to answer from, and start conversations against it. The public API is `/v1/`, authenticated with a developer API key. A live conversation turn runs: microphone audio → speech-to-text → language model (optionally searching the avatar's documents, searching the web, and drawing on what it remembers about this end user) → text-to-speech → lip-synced video frames. Page links below are site-relative: resolve them against the host serving this file. The canonical host is docs.goldenengine.ai, but relative links stay correct across the move from the old domain and on preview deployments, where an absolute host would not. Important facts that are easy to get wrong: - **Authentication is an API key in the `X-Api-Key` header.** There is no login call, no bearer token and nothing to refresh on the public API. Keys are created in the dashboard under **API**, are shown in full exactly once, and are prefixed `sk_live_` or `sk_test_` by environment. Both prefixes are real credentials against the same API; `sk_test_` does not sandbox anything. - **Every public endpoint lives under `/v1/`.** Paths without that prefix (`/auth/login`, `/avatars`, `/conversations`, `/knowledge-bank`) belong to the dashboard's own API. They are undocumented, not a supported contract, and reject API keys — never advise calling them. - **The API-key management endpoints are not part of the public API.** Create and revoke keys in the dashboard UI, not over HTTP. - **Embedding a live session means iframing `conversation_url`.** This is the supported realtime path and it is live. `POST /v1/conversations` returns the URL; create the conversation server-side and use it as an iframe `src` with `allow="microphone; camera; autoplay"`. The page shows its own Start Session overlay; nothing is requested until the visitor presses it. The microphone is required (refusing it shows a "Microphone Required" screen). The camera turns on automatically at Start and sends the avatar a frame about every 10 seconds; without `camera` in `allow` the visitor sees an error notice and the voice session carries on. `hide_controls` does not stop capture. Add `fullscreen` to `allow` for the fullscreen button. The conversation's `title` is shown to the visitor as the avatar's name. Besides `token` the page reads these parameters: `theme` (`dark` default, or `light` — it styles the start, error and ended screens, not the video), `hide_controls=true` (hides the whole control bar), `thumbnail_url` (loading-screen image, used only when the conversation carries none), and five overlay switches that take the literal words `true`/`false` and are independent of `hide_controls`: `show_timer`, `show_resolution` and `show_signal` are on by default (set `false` to hide the elapsed-time clock, the video-quality badge, the network signal bars; the badge shows the current adaptive video size, such as 540p, amber while reduced, and the bars show round-trip time, not video quality); `show_status` and `show_live` are off by default (set `true` for the listening/thinking/speaking pill and a Live/Connecting/Offline badge). The host comes from the API's own configuration and is not fixed — pass the URL through unmodified instead of rebuilding it. `GET /v1/conversations/{id}` also includes a `websocket_url` field that is **always null** on `/v1/`: the raw socket is the dashboard's internal path, so never advise opening it. - **Rate limit is 100 requests per minute per key**, returning `429` with `"code": "rate_limit_exceeded"` and `error.retry_after_seconds` (inside the envelope; there is no `Retry-After` header). The window is a fixed 60 seconds from the key's first request, and only authenticated requests count. - **`/v1/` errors use one envelope:** `{"error": {"code", "message"}}`. The exception is an unknown path or wrong method, which returns a plain `{"detail": "Not Found"}` 404 or `{"detail": "Method Not Allowed"}` 405 — a 404 without `error.code` means a wrong URL. Codes are stable: `invalid_request`, `invalid_api_key`, `not_found`, `conflict`, `validation_error`, `rate_limit_exceeded`, `internal_error`, `upstream_error`. Branch on the code, never on message text. - **`GET /v1/avatars` returns only the key owner's avatars.** Stock avatars come from `GET /v1/avatars/stock`. - Avatar training status is `pending`, `queued`, `training`, `ready` or `failed`. Only a `ready` avatar can hold a conversation, and `GET /v1/avatars/stock` does not filter by status. Cancelling training also leaves the avatar `failed`. Training *jobs* have their own values: `pending`, `running`, `completed`, `failed`, `cancelled`. Training videos upload up to 2 GB (`413 file_too_large` beyond) and may be at most 15 minutes long; a longer one is accepted at upload and fails when training starts, with the reason in the avatar's `error_message`. - Conversation `status` appears only on the create response (`active`). Records carry `ended_at` instead; there is no `idle`. - **Memory is scoped by `end_user_id`.** `POST /v1/conversations` takes an optional `end_user_id`: your own stable ID for the person talking (≤128 characters, trimmed, no control characters, the `anon:` prefix is reserved). Memory is scoped per (account, avatar, `end_user_id`): conversations with the same avatar and the same ID share memory; the same ID on a different avatar shares nothing. Omit it and the conversation is stored as `anon:` and no memory is written for it. The create response and every conversation record echo the stored value (empty for dashboard sessions), and `GET /v1/conversations?end_user_id=` lists one person's history. Memory is written by a background job after a conversation ends (or after about 15 quiet minutes if nobody closes it) and loaded once at session start. `GET /v1/avatars/{avatar_id}/memory?end_user_id=` reads it and reports `pending_conversations` still being written. The memory API can also delete a fact, a summary, a timeline entry or a whole end user, and holds pinned memories you write yourself (applied immediately). Learned memory cannot be edited. Knowledge-bank retrieval is not scoped by end user. - The session token inside `conversation_url` lasts 60 minutes. Mint a fresh URL per visitor. - Most list endpoints are paginated as `{items, total, skip, limit}`, with `limit` capped at 100 (`/messages` allows 500). `GET /v1/knowledge-bank` and `GET /v1/avatars/{avatar_id}/knowledge` return bare arrays. - **Every sentence an avatar says is checked before it is spoken.** `guardrail_level` (`off`, `relaxed`, `normal` default, `strict`) sets how readily a content classifier rewrites a rude sentence or stops a harmful reply; a stopped reply speaks `guardrail_fallback_line` (≤ 300 chars; empty uses a default line). A profanity filter runs at every level including `off`, and also removes `guardrail_blocked_words` (≤ 200 entries, 1–50 chars each). Only spoken text reaches the transcript. The classifier is English-only. These are distinct from `interaction_guardrails`, which is persona guidance written into the prompt. - `tts_provider` defaults to `elevenlabs`; the others are `cartesia`, `fish` (Fish Audio) and `csm` (the account's own custom voices, created only in the dashboard). A `csm` avatar must name a ready custom voice of the account in `voice_id`, or it is rejected with `422`; stock avatars cannot use one. For the other providers `voice_id` is not checked against `tts_provider`. `GET /v1/models` lists every model, voice and STT engine, including `whisper-smartturn`. - **Avatars have `web_search_enabled`, on by default.** Turn it off on an avatar you own for an assistant that must answer only from its documents. `system_prompt` is read-only — it is generated from the persona fields — and stock avatars cannot be updated. - `POST /v1/conversations/{id}/messages` is deprecated: it rejects anything that is not speech with `422`, and nothing reads those rows back into a call. Use pinned memories to give an avatar facts about an end user. - The knowledge bank accepts PDF and DOCX only, 50 MB per file. **A document answers only for the avatar it is uploaded or attached to; one left unattached in the account bank is used by no avatar.** A document belongs to at most one of your own avatars (attaching moves it out of the bank; upload a copy per avatar to share), while one bank document can be attached to several stock avatars and stays in the bank. Deleting a document through `DELETE /v1/avatars/{avatar_id}/knowledge/{id}` deletes the document itself, not just the link. `POST /v1/knowledge-bank/search` searches only documents in the account bank, so use it to check a document before attaching it. Send the file's real content type (`application/pdf` or the DOCX type); `application/octet-stream` is rejected. `POST /v1/knowledge-bank/upload/batch` and `POST /v1/avatars/{avatar_id}/knowledge/batch` take one to five files as repeated `files` fields. One invalid file fails the whole request with `400` and uploads nothing; `207` means some files were not queued for a server-side reason (`queue_unavailable`, `upload_failed`) — read `results[].error` (one entry per file, in request order) and retry those files. ## Get started - [Introduction](/introduction): What Golden Engine is, how a conversation turn runs, and what works on the public API today. - [Quickstart](/quickstart): Create a key, verify it, pick a stock avatar and start a conversation with curl. - [Authentication](/authentication): The X-Api-Key header, creating and rotating keys, rate limits, and the error envelope. ## Core concepts - [Avatars](/core-concepts/avatars): Stock versus custom avatars, the two listing endpoints, training lifecycle and configuration fields. - [Conversations](/core-concepts/conversations): Creating conversations, `end_user_id`, the 60-minute session token, closing, transcripts and recordings. - [Memory](/core-concepts/memory): What an avatar remembers about each end user, and the API to read, pin, correct and forget it. - [Knowledge bank](/core-concepts/knowledge-bank): Uploading documents, account-wide versus attached documents, and how tool-based retrieval works. - [Models and voices](/core-concepts/models): Available language models, text-to-speech providers and voices, and speech-to-text engines. ## Guides - [Embed an avatar](/guides/embed-avatar): The supported way to put a live avatar on a page. Mint `conversation_url` server-side, iframe it with the right `allow` attributes, close it from your server. Start here for anything realtime. - [Build with an AI assistant](/guides/ai-assistant): A copy-paste prompt template carrying the base URL, auth header, endpoint list and the four rules assistants get wrong (key server-side, one URL per visitor, iframe allow attributes, branch on error code). Point a coding assistant here before it invents an SDK. - [Build a customer support bot](/guides/customer-support-bot): End-to-end recipe from stock avatar to transcript review. - [Train a custom avatar from video](/guides/custom-avatar-training): Uploading video, starting training, monitoring progress, and handling failure. - [Upload documents for context-aware conversations](/guides/knowledge-bank-upload): Formats, limits, batch uploads, verifying extraction, and testing retrieval. - [Realtime protocol](/guides/realtime-integration): Reference only. The WebSocket handshake, binary wire protocol, audio format, adaptive video quality and failure modes, described for debugging and background. The engine sizes the video to the connection (720p → 540p → 480p → 360p on 1080×1920 footage, fewer steps on smaller footage; JPEG quality 75; a session starts one step down; it climbs after about 15 s clean, 20 s while speaking; below the bottom step it drops to 8 fps). A `wire_tier` text message reports each size, and frames change size mid-session. Audio is never reduced. There is no public entry point — `websocket_url` is always null on /v1 — so never advise building a client against it; point at the embed guide instead. ## Support - [Error codes](/support/error-codes): The /v1 error envelope, every stable error code, rate limits and troubleshooting. - [FAQ](/support/faq): Common questions about authentication, avatars, documents, and conversations.