# Golden Engine documentation # 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. --- # Introduction Golden Engine gives your product a talking AI avatar that listens and responds in real time. Golden Engine is an API for conversational AI avatars. You create an avatar — either a ready-made stock avatar or one trained from your own video — give it documents to answer from, and start conversations against it. In a live session the avatar listens to your user's microphone, thinks, and answers out loud with synchronized lip movement. Everything is under `/v1/` and authenticated with a developer API key. To put a live session in front of your own users, create a conversation on your server and iframe the `conversation_url` it returns. See [Embed an avatar](/guides/embed-avatar). ## How it works A conversation runs as a continuous loop. Each turn passes through four stages: Audio from the user's microphone is streamed to a speech-to-text engine, which transcribes it as they speak. The transcript is sent to the avatar's language model, along with its system prompt and what it [remembers](/core-concepts/memory) about this end user from earlier conversations. Documents are not pasted into the prompt: when a question needs them, the model searches the [knowledge bank](/core-concepts/knowledge-bank) through a tool, and, if the avatar has web search enabled (the default), it can search the web the same way. The reply is synthesized into audio using the avatar's configured voice. A neural model generates video frames matched to the synthesized audio, so the avatar's mouth moves with the words. Audio and video stream back over one connection. Everything after the initial setup happens over one connection, which is what keeps latency low enough to feel like a conversation rather than a series of requests. ## What you build with | Concept | What it is | |---|---| | [Avatars](/core-concepts/avatars) | The persona: appearance, voice, language model, and system prompt | | [Conversations](/core-concepts/conversations) | A single session with an avatar, including its transcript and recording | | [Knowledge bank](/core-concepts/knowledge-bank) | Documents the avatar can draw on when answering | | [Memory](/core-concepts/memory) | What an avatar has learned about each end user, which you can read and delete | | [Models](/core-concepts/models) | The language, speech-to-text, and text-to-speech engines available | Every endpoint is documented under the **API Reference** tab, with an interactive playground you can call with your own token. ## Use cases **Customer support.** Attach your help articles to the knowledge bank and put an avatar on your support page. It answers common questions out loud and hands off transcripts for review. There is a [full walkthrough](/guides/customer-support-bot) for this. **Sales and product demos.** An avatar that walks a prospect through your product and answers objections, available at any hour. **Education and training.** A tutor that explains a topic conversationally and adapts to questions, backed by your course material. **Entertainment and brand presence.** A recognizable character trained from video that speaks with a specific voice and personality. ## Get started Go from zero to a live conversation. Create a key and send it on every request. Create conversations and read transcripts back. Give your avatar documents to answer from. --- # Quickstart Create a key, pick a stock avatar, and start your first conversation. By the end of this page you will have an API key that works, a stock avatar chosen, and a conversation created against it. The examples call `https://backend.goldenengine.ai`, which is the API host for every environment. It is also written into the [API reference](/api-reference), so the playground there sends requests to the same place these snippets do. Each example reads the key from `GOLDENENGINE_API_KEY`, so set it once and the snippets below run as written: ```bash export GOLDENENGINE_API_KEY="" ``` In the Golden Engine dashboard, open **API** and create a key. The full secret is shown once — copy it now, because it cannot be retrieved later. Confirm it works: ```bash title="cURL" curl -s "https://backend.goldenengine.ai/v1/me" \ -H "X-Api-Key: $GOLDENENGINE_API_KEY" ``` ```python title="Python" import os import requests BASE = "https://backend.goldenengine.ai" HEADERS = {"X-Api-Key": os.environ["GOLDENENGINE_API_KEY"]} print(requests.get(f"{BASE}/v1/me", headers=HEADERS).json()) ``` ```javascript title="Node.js" const BASE = "https://backend.goldenengine.ai"; const headers = { "X-Api-Key": process.env.GOLDENENGINE_API_KEY }; console.log(await (await fetch(`${BASE}/v1/me`, { headers })).json()); ``` ```json { "user_id": "9c4e8d21-6f3a-4b8e-9d21-1f2a3b4c5d6e", "email": "you@example.com" } ``` A `401` with `"code": "invalid_api_key"` means the key is wrong or revoked. Stock avatars are trained and ready, so you can skip training entirely. ```bash title="cURL" curl -s "https://backend.goldenengine.ai/v1/avatars/stock?limit=5" \ -H "X-Api-Key: $GOLDENENGINE_API_KEY" ``` ```python title="Python" avatars = requests.get( f"{BASE}/v1/avatars/stock", headers=HEADERS, params={"limit": 5}, ).json() # The list is not filtered by status — take the first one that is ready. avatar_id = next(a["id"] for a in avatars["items"] if a["status"] == "ready") ``` ```javascript title="Node.js" const avatars = await ( await fetch(`${BASE}/v1/avatars/stock?limit=5`, { headers }) ).json(); // The list is not filtered by status — take the first one that is ready. const avatarId = avatars.items.find((a) => a.status === "ready").id; ``` The response is a page — `{ items, total, skip, limit }`. The list is not filtered by status, so take the `id` of an avatar whose `status` is `"ready"` — any other status makes the next step return `404`: ```bash export AVATAR_ID="" ``` To use an avatar of your own instead, list yours with `GET /v1/avatars` — only avatars whose status is `ready` can hold a conversation. See [Avatars](/core-concepts/avatars) for the training path. ```bash title="cURL" curl -s "https://backend.goldenengine.ai/v1/conversations" \ -H "X-Api-Key: $GOLDENENGINE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "avatar_id": "'"$AVATAR_ID"'", "title": "My first conversation", "greeting": "Hi there, how can I help?" }' ``` ```python title="Python" conversation = requests.post( f"{BASE}/v1/conversations", headers=HEADERS, json={ "avatar_id": avatar_id, "title": "My first conversation", "greeting": "Hi there, how can I help?", }, ).json() ``` ```javascript title="Node.js" const conversation = await ( await fetch(`${BASE}/v1/conversations`, { method: "POST", headers: { ...headers, "Content-Type": "application/json" }, body: JSON.stringify({ avatar_id: avatarId, title: "My first conversation", greeting: "Hi there, how can I help?", }), }) ).json(); ``` ```json { "conversation_id": "3f8b1c02-7d4e-4a19-b0c3-5e6f7a8b9c0d", "end_user_id": "anon:3f8b1c02-7d4e-4a19-b0c3-5e6f7a8b9c0d", "conversation_url": "https://www.goldenengine.ai/embed/c/3f8b1c02-7d4e-4a19-b0c3-5e6f7a8b9c0d?token=eyJhbGci...", "status": "active", "expires_at": "2026-08-17T16:42:00Z" } ``` The token inside `conversation_url` is valid for **60 minutes**. `expires_at` tells you when it lapses; create another conversation to get a fresh one. `end_user_id` is the conversation's memory scope. You sent none, so this session keeps its memory to itself. When you build for real, pass a stable ID per person so the avatar remembers them — see [Memory and end users](/core-concepts/conversations#memory-and-end-users), and [Memory](/core-concepts/memory) for reading back or deleting what it learned. The conversation is a durable record you can query, close, and pull a transcript from: ```bash title="cURL" export CONVERSATION_ID="" curl -s "https://backend.goldenengine.ai/v1/conversations/$CONVERSATION_ID" \ -H "X-Api-Key: $GOLDENENGINE_API_KEY" # Closing also queues memory compaction. curl -s -X PATCH "https://backend.goldenengine.ai/v1/conversations/$CONVERSATION_ID" \ -H "X-Api-Key: $GOLDENENGINE_API_KEY" ``` ```python title="Python" cid = conversation["conversation_id"] print(requests.get(f"{BASE}/v1/conversations/{cid}", headers=HEADERS).json()) # Closing also queues memory compaction. print(requests.patch(f"{BASE}/v1/conversations/{cid}", headers=HEADERS).json()) ``` ```javascript title="Node.js" const cid = conversation.conversation_id; console.log(await (await fetch(`${BASE}/v1/conversations/${cid}`, { headers })).json()); // Closing also queues memory compaction. console.log( await ( await fetch(`${BASE}/v1/conversations/${cid}`, { method: "PATCH", headers }) ).json(), ); ``` `conversation_url` from step 3 is a complete, embeddable page. Drop it in an iframe and the session runs there — no client library, no WebSocket handling of your own: ```html ``` `microphone` is required — without it the avatar cannot hear anything, and the visitor sees a "Microphone Required" screen instead of a session. `camera` is there because the embed turns the camera on when the visitor presses Start and sends the avatar a frame about every 10 seconds; leave it out and the camera fails while the voice session carries on. Mint the URL server-side when a visitor is about to start: it carries a session token that expires in 60 minutes, so it cannot be baked into a page you cache. See [Embed an avatar](/guides/embed-avatar) for the full flow, including closing the session and reading the transcript back. ## What to do next Key handling, rate limits, and the error envelope. Train an avatar from your own video. Give an avatar documents to answer from. Every code the API returns, and what to do about each. --- # Authentication Every request carries your developer API key in the X-Api-Key header. The Golden Engine API authenticates with a developer API key sent as the `X-Api-Key` header. There is no login step and no token to refresh. Every endpoint lives under `https://backend.goldenengine.ai/v1/`. That is the API host for every environment, and the same one the [API reference](/api-reference) playground sends to. ```bash curl "https://backend.goldenengine.ai/v1/me" \ -H "X-Api-Key: " ``` ```json { "user_id": "9c4e8d21-6f3a-4b8e-9d21-1f2a3b4c5d6e", "email": "you@example.com" } ``` `GET /v1/me` is the cheapest way to check a key: a `200` means the key is live and has not been revoked. ## Create a key Keys are created in the Golden Engine dashboard, under **API**. Creating one returns the full secret **once** — it is stored hashed and cannot be retrieved again. Copy it before you close the dialog; if you lose it, revoke the key and create another. Each key belongs to one environment, which sets its prefix: | Prefix | Environment | |---|---| | `sk_live_` | Live | | `sk_test_` | Test | Both are real credentials against the same API. The prefix tells you which key you are looking at in logs and in the dashboard; it does not sandbox anything. Keep keys server-side. A key in browser JavaScript, a mobile bundle, or a public repository is compromised the moment it ships — anyone holding it can create avatars and conversations billed to your account. Revoke a leaked key in the dashboard; revocation takes effect immediately. ## Every request Send the header on every `/v1/` call. Nothing else is required. ```bash title="cURL" curl "https://backend.goldenengine.ai/v1/avatars" \ -H "X-Api-Key: " ``` ```python title="Python" requests.get( "https://backend.goldenengine.ai/v1/avatars", headers={"X-Api-Key": os.environ["GOLDENENGINE_API_KEY"]}, ) ``` ```javascript title="Node.js" await fetch("https://backend.goldenengine.ai/v1/avatars", { headers: { "X-Api-Key": process.env.GOLDENENGINE_API_KEY }, }); ``` ## When authentication fails Every error a `/v1/` endpoint returns uses the same envelope, so you can branch on `error.code` and never parse message text: ```json { "error": { "code": "invalid_api_key", "message": "Invalid or revoked API key" } } ``` The one exception is a request that never reaches an endpoint: a path that does not exist, or a method the path does not accept, gets the framework's plain `{"detail": "Not Found"}` (`404`) or `{"detail": "Method Not Allowed"}` (`405`). A `404` with no `error.code` means the URL is wrong, not that a resource is missing. The header is missing, the key does not exist, or it has been revoked. A revoked key fails on its next request — there is no grace period. Check the header name is exactly `X-Api-Key` and that you copied the whole secret. You have exceeded **100 requests per minute** for that key. The window is a fixed 60 seconds that starts at the key's first request, not a rolling one, and only requests that authenticate count against it. The limit is per key, so splitting work across keys raises your total throughput. The wait is in the envelope as `error.retry_after_seconds` — there is no `Retry-After` header — so wait that long before retrying. Keys are scoped to the account that created them. An avatar or conversation belonging to a different account reads as missing rather than forbidden, so a `404` here usually means the key belongs to the wrong account. ## Rotating a key Create the new key first, deploy it, then revoke the old one. Revocation is immediate and cannot be undone, so revoking before the new key is live will drop requests in between. The dashboard also signs you in with an email and password, and older versions of these docs described that flow. Those session tokens belong to the dashboard and are not accepted on `/v1/`. API keys are the only way to call the API. Make your first authenticated call. Every status and envelope code the API returns. --- # Avatars An avatar is the persona your users talk to — its face, voice, model, and instructions. An avatar bundles everything that defines a conversational persona: the appearance it was trained on, the voice it speaks with, the language model behind it, and the system prompt that shapes how it behaves. ## Stock and custom avatars **Stock avatars** are pre-trained and shared across all accounts. They are `ready` the moment you find them, which makes them the right choice for prototyping and for any use case where a generic presenter is fine. **Custom avatars** are trained from video you supply, so they look and sound like a specific person. Training takes time; see [Train a custom avatar](/guides/custom-avatar-training). ### Listing them There are two listing endpoints and they return different sets. Mixing them up is the most common early mistake: | Endpoint | Returns | |---|---| | `GET /v1/avatars` | Only avatars you created. **Excludes stock avatars.** | | `GET /v1/avatars/stock` | Only stock avatars | There is no combined listing on `/v1/` — call both and merge them if you need one list. Each is paginated with `skip` and `limit` (max 100) and returns `{ items, total, skip, limit }`. ```bash title="cURL" curl -s "https://backend.goldenengine.ai/v1/avatars?limit=20" \ -H "X-Api-Key: $GOLDENENGINE_API_KEY" ``` ```python title="Python" BASE = "https://backend.goldenengine.ai" HEADERS = {"X-Api-Key": os.environ["GOLDENENGINE_API_KEY"]} page = requests.get(f"{BASE}/v1/avatars", headers=HEADERS, params={"limit": 20}).json() for avatar in page["items"]: print(avatar["id"], avatar["name"], avatar["status"], avatar["is_stock"]) ``` ```javascript title="Node.js" const BASE = "https://backend.goldenengine.ai"; const headers = { "X-Api-Key": process.env.GOLDENENGINE_API_KEY }; const page = await (await fetch(`${BASE}/v1/avatars?limit=20`, { headers })).json(); for (const avatar of page.items) { console.log(avatar.id, avatar.name, avatar.status, avatar.is_stock); } ``` The `is_stock` boolean on each avatar tells you which kind you are looking at. `GET /v1/avatars/{avatar_id}` fetches one avatar — yours or a stock one — and `GET /v1/avatars/stock/{avatar_id}` fetches a stock avatar only, returning `404` for anything else. ## Training lifecycle A custom avatar moves through five states: ``` pending → queued → training → ready ↘ failed ``` | Status | Meaning | |---|---| | `pending` | The avatar record exists; training has not been submitted | | `queued` | The training job was accepted into the queue | | `training` | A worker is actively training the model | | `ready` | The checkpoint is saved — the avatar can hold conversations | | `failed` | Training errored, timed out, or was cancelled; see `error_message` on the avatar | Only a `ready` avatar can start a conversation. Creating one against an avatar in any other state returns `404`. Poll `GET /v1/avatars/{avatar_id}/status` while you wait. It reports `status`, `progress_percent` (0–100 through the current run — a completion figure, not a time estimate), and `error_message` when a run ends in `failed`. `GET /v1/avatars/{avatar_id}/training-jobs` lists the individual job attempts, each with its own status (`pending`, `running`, `completed`, `failed`, `cancelled`). Training-job status and avatar status are different fields with different vocabularies. A job that reaches `completed` is what moves its avatar to `ready`; a cancelled run leaves the job `cancelled` and the avatar `failed`. ### Managing a custom avatar | Endpoint | What it does | |---|---| | `POST /v1/avatars/{avatar_id}/retrain` | Re-runs training from the original source video. Returns `202` with the avatar back at `pending`; `409` while a run is `queued` or `training` | | `POST /v1/avatars/{avatar_id}/cancel` | Stops a `queued` or `training` run. The avatar ends `failed` with an `error_message` saying it was cancelled; `409` in any other state | | `DELETE /v1/avatars/{avatar_id}` | Deletes the avatar, its source video, and its training artifacts, aborting any active run first. Returns `204`. Documents attached to it are deleted too | ## Video requirements Custom avatars are only as good as the source footage. Recording conditions — framing, lighting, background, how much the subject moves — matter more than camera quality. A separate **video recording guide** covers the full requirements and a pre-shoot checklist. Ask your Golden Engine contact for the current copy. To review the footage an avatar was trained from, `GET /v1/avatars/{avatar_id}/video-url` returns a signed link to it. The URL is short-lived — `expires_in` says how long — so fetch it when you need it rather than storing it. ## Configuration Every avatar carries the settings that shape its behavior. The ones you will set most often: | Field | What it controls | Default | |---|---|---| | `name`, `bio` | Identity, and the background the model is given | Required | | `awards_achievements` | Free-text credentials the avatar may mention | None | | `known_for`, `personality_traits`, `interaction_guardrails` | Persona shaping used to build the prompt, from fixed lists | None | | `primary_goal` | What the avatar is for, in one line | None | | `llm_model` | Which language model answers | `gpt-4o` | | `web_search_enabled` | Whether the avatar may search the web for current facts | `true` | | `guardrail_level`, `guardrail_fallback_line`, `guardrail_blocked_words` | How strictly its speech is checked before it is spoken — see [Guardrails](#guardrails) | `normal`, the default line, none | | `tts_provider`, `voice_id`, `tts_speed` | The synthesized voice and its pace | `elevenlabs`, the provider's default voice, `1.0` | | `stt_engine`, `stt_speed` | How speech is transcribed | `deepgram-flux`, `1.0` | | `primary_language`, `ai_languages` | The language it opens in, and those it can use | `"English (US)"`, none | | `knowledge_base_ids` | Account bank documents attached to this avatar | None | See [Models](/core-concepts/models) for the available engines and voices. The accepted values for the list fields are listed on the request body in the [API reference](/api-reference). Languages are labels, not codes — `"English (US)"`, `"French"`, `"Mandarin Chinese"` — and anything outside the list is rejected with `422`. `tts_speed` and `stt_speed` must be greater than zero. The system prompt is not a field you set. It is generated from the persona fields and returned read-only as `system_prompt`; sending `system_prompt` on create or update is rejected with `422`, as is any other unknown field. Update an avatar with `PATCH /v1/avatars/{avatar_id}`, sending only the fields you are changing. A few changes do more than they appear to: - Editing `name`, `bio`, `awards_achievements`, `known_for`, `personality_traits` or `interaction_guardrails` regenerates the system prompt through a model call, so the change is to the brief, not to the wording — and the request can fail with `502` if that call does. `primary_goal` and the language fields are stored without regenerating it. - Changing `tts_provider` without also sending `voice_id` resets the voice to that provider's default. `voice_id` is not checked against the provider or the catalog, so a mismatched or mistyped voice is accepted — confirm it in `GET /v1/models` first. - `knowledge_base_ids` replaces the avatar's full set of documents; see [Knowledge bank](/core-concepts/knowledge-bank#attaching-to-an-avatar). `web_search_enabled` lets the avatar look up current facts — news, weather, prices — when a question needs them. How the search runs depends on the model; see [Models](/core-concepts/models#web-search). Set it to `false` to keep an avatar to its prompt and documents. Stock avatars cannot be updated, retrained, or deleted — you do not own them, and there is no public endpoint for overriding their prompt. Create your own avatar when you need a persona of your own. You can still give a stock avatar documents: the knowledge endpoints below work on stock avatars, and what you attach is visible only to your account. ## Guardrails Every sentence an avatar is about to say is checked before it is spoken. What fails the check is never heard and never reaches the transcript — the saved transcript holds only what was actually spoken. The check runs in layers: 1. **Profanity filter.** Swear words — including disguised spellings like `f*ck`, leetspeak and spaced-out letters — are removed from the sentence. This runs at every level, `off` included, and also removes anything in the avatar's `guardrail_blocked_words`. 2. **Content classifier.** The sentence is scored for toxicity. A rude sentence is rewritten into a polite one and checked again; a sentence that is sexual, hateful, threatening or harmful stops the reply, and the avatar says its fallback line instead. If the very first sentence of a reply is flagged, the avatar goes straight to the fallback line. Three fields control it, on an avatar you own (stock avatars keep the settings they ship with): | Field | Values | Default | |---|---|---| | `guardrail_level` | `off`, `relaxed`, `normal`, `strict` | `normal` | | `guardrail_fallback_line` | Up to 300 characters, one line of plain text | Empty — *"Sorry, I can't help with that. Is there something else I can do for you?"* | | `guardrail_blocked_words` | Up to 200 words or short phrases, 1–50 characters each | None | `guardrail_level` sets how readily the classifier acts: `strict` rewrites and stops at lower scores than `normal`, `relaxed` at higher ones, and `off` skips the classifier entirely — the profanity filter still runs. Blocked words are matched as whole words, case-insensitively, on top of the built-in list; duplicates are removed. ```bash title="cURL" curl -s -X PATCH "https://backend.goldenengine.ai/v1/avatars/$AVATAR_ID" \ -H "X-Api-Key: $GOLDENENGINE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "guardrail_level": "strict", "guardrail_fallback_line": "I can only help with questions about your account.", "guardrail_blocked_words": ["competitor name", "refund guarantee"] }' ``` ```python title="Python" requests.patch( f"{BASE}/v1/avatars/{avatar_id}", headers=HEADERS, json={ "guardrail_level": "strict", "guardrail_fallback_line": "I can only help with questions about your account.", "guardrail_blocked_words": ["competitor name", "refund guarantee"], }, ) ``` ```javascript title="Node.js" await fetch(`${BASE}/v1/avatars/${avatarId}`, { method: "PATCH", headers: { ...headers, "Content-Type": "application/json" }, body: JSON.stringify({ guardrail_level: "strict", guardrail_fallback_line: "I can only help with questions about your account.", guardrail_blocked_words: ["competitor name", "refund guarantee"], }), }); ``` Changing these fields does not regenerate the system prompt. `guardrail_blocked_words` replaces the whole list; send `[]` to clear it. These are not the same as `interaction_guardrails`. That field is persona guidance written into the prompt — it shapes what the model *tries* to say. The guardrail fields act on what it *actually* says, after the model has written it. The classifier is English-only, and it misses some harmful content that uses no explicit words — veiled threats, euphemism, harmful advice. Treat it as a safety net, not as the only control: say what the avatar must not discuss in its persona fields too. ## Attaching knowledge Avatars answer from their prompt plus the documents uploaded or attached to them. A document left unattached in your account's knowledge bank is used by no avatar. Uploading to an avatar attaches the document to it alone: ```bash title="cURL" curl -s "https://backend.goldenengine.ai/v1/avatars/$AVATAR_ID/knowledge" \ -H "X-Api-Key: $GOLDENENGINE_API_KEY" \ -F "file=@handbook.pdf" ``` ```python title="Python" with open("handbook.pdf", "rb") as document: requests.post( f"{BASE}/v1/avatars/{avatar_id}/knowledge", headers=HEADERS, files={"file": document}, ) ``` ```javascript title="Node.js" const form = new FormData(); form.set( "file", new Blob([await readFile("handbook.pdf")], { type: "application/pdf" }), "handbook.pdf", ); await fetch(`${BASE}/v1/avatars/${avatarId}/knowledge`, { method: "POST", headers, body: form, }); ``` `GET /v1/avatars/{avatar_id}/knowledge` lists what is attached, and `DELETE /v1/avatars/{avatar_id}/knowledge/{knowledge_id}` deletes a document outright — it does not return it to the bank. See [Knowledge bank](/core-concepts/knowledge-bank) for how scoping and retrieval work, and [Memory](/core-concepts/memory) for what an avatar keeps from past conversations. ## Preloading The first conversation with an avatar that is not already loaded on the engine waits a few seconds while it cold-loads. `POST /v1/avatars/{avatar_id}/preload` starts that load early and returns `202`; call it as soon as you know a session is coming, such as when a user opens the page. Then poll `GET /v1/avatars/{avatar_id}/preload-status` and connect once `status` is `ready`: | `status` | Meaning | |---|---| | `ready` | Loaded — connect now | | `loading` | Load in progress; keep polling | | `cold` or `error` | Not loaded; send the preload request again | | `unknown` | The engine could not be reached; keep polling | Both endpoints return `409` for an avatar that is not `ready`, and work on stock avatars as well as your own. Preloading is best-effort: if it fails, the conversation cold-loads as it would have anyway. --- # Conversations A conversation is one session with an avatar, from connection through transcript. A conversation is a durable record of one session with an avatar: you create it over REST, and read its messages, transcript and recording back over REST. To put a session in front of a user, iframe the `conversation_url` returned when you create the conversation — see [Embed an avatar](/guides/embed-avatar). The `websocket_url` field on `GET /v1/conversations/{id}` is always `null` on `/v1/`; the raw socket is the dashboard's own internal path, not a supported contract. ## Creating a conversation ```bash title="cURL" curl -s "https://backend.goldenengine.ai/v1/conversations" \ -H "X-Api-Key: $GOLDENENGINE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "avatar_id": "'"$AVATAR_ID"'", "end_user_id": "cust-42", "title": "Support session", "greeting": "Hi, what can I help you with today?" }' ``` ```python title="Python" BASE = "https://backend.goldenengine.ai" HEADERS = {"X-Api-Key": os.environ["GOLDENENGINE_API_KEY"]} conversation = requests.post( f"{BASE}/v1/conversations", headers=HEADERS, json={ "avatar_id": avatar_id, "end_user_id": "cust-42", "title": "Support session", "greeting": "Hi, what can I help you with today?", }, ).json() ``` ```javascript title="Node.js" const BASE = "https://backend.goldenengine.ai"; const headers = { "X-Api-Key": process.env.GOLDENENGINE_API_KEY }; const conversation = await ( await fetch(`${BASE}/v1/conversations`, { method: "POST", headers: { ...headers, "Content-Type": "application/json" }, body: JSON.stringify({ avatar_id: avatarId, end_user_id: "cust-42", title: "Support session", greeting: "Hi, what can I help you with today?", }), }) ).json(); ``` | Field | Required | Purpose | |---|---|---| | `avatar_id` | Yes | Which avatar to talk to. Must be `ready` | | `end_user_id` | No | Who is talking, as an ID from your own system. Conversations with the same avatar that share one share memory — see [below](#memory-and-end-users) | | `title` | No | Up to 255 characters. The embed shows it to the visitor as the avatar's name, so set it to the name they should see. Defaults to `{avatar name} - {date}` | | `greeting` | No | Up to 5,000 characters, spoken verbatim as soon as the session is ready, before the user speaks. It cannot be interrupted — the user speaking over it does not cut it off — and it is recorded in the transcript and not repeated when the embed reconnects | The response is the conversation's ID, the memory scope it was stored under, its embed URL, and when that URL expires: ```json { "conversation_id": "9c4e8d21-6f3a-4b8e-9d21-1f2a3b4c5d6e", "end_user_id": "cust-42", "conversation_url": "https://www.goldenengine.ai/embed/c/9c4e8d21-...?token=eyJhbGci...", "status": "active", "expires_at": "2026-08-17T16:42:00Z" } ``` If the avatar does not exist, is not `ready`, or is neither yours nor a stock avatar, you get a `404`. ## The session token `conversation_url` carries a session token scoped to this one conversation. It is not your API key and cannot be used in place of one. **The session token is valid for 60 minutes**, as given by `expires_at`. Create the conversation when the user is about to talk rather than far ahead of time, and mint one URL per visitor — there is no refresh endpoint. ## Memory and end users When a conversation ends, the avatar learns from it: facts about the person and a summary of what was said. The next conversation in the same scope starts with that memory in the avatar's prompt, which is how an avatar picks up where it left off. Knowledge-bank retrieval is separate and is never scoped this way. The scope is your account, the avatar and the `end_user_id`. Send the same value for the same person — a user ID, a hashed email, a ticket number, whatever your system already has — and their conversations with that avatar share memory across sessions. Send nothing and the conversation is scoped to itself: it starts with no memory, and no memory is written from it. | You send | Stored as | Memory | |---|---|---| | `"cust-42"` | `cust-42` | Shared with every conversation with this avatar created with `cust-42` | | Nothing, `null`, or blank | `anon:` | None — this scope is never written to | **Omitting `end_user_id` isolates the conversation.** Before this field existed, API conversations shared one memory across everyone who talked to the avatar. If you relied on that, pass a stable `end_user_id` per person — or one fixed value for everyone, if shared memory is what you want. **Memory is not instant.** It is written in the background after a conversation ends, and each session loads memory once, when it starts. Close a conversation with `PATCH` as soon as the visitor leaves; `pending_conversations` on the end user's memory tells you when the write has landed. [Memory](/core-concepts/memory) covers when memory is written, how to read and delete it, and how to pin facts of your own. The value is opaque to Golden Engine and limited to 128 characters after trimming. Control characters are rejected and the `anon:` prefix is reserved; either fails with `422`. The response echoes the value actually stored, so trimming and the `anon:` fallback are visible. Every conversation record reports its `end_user_id`. It is empty for sessions started from the dashboard and for conversations created before the field existed. ## Lifecycle Over the API a conversation is either open or closed. Only the create response carries a `status`, and it is `active`; every conversation record carries `started_at` and `ended_at`, which stays `null` until the conversation is closed with [`PATCH`](#managing-conversations). Inside a live session the embed moves through connection stages as the turn-taking loop runs: ``` connecting → ready → listening ⇄ thinking ⇄ speaking ``` | Stage | What is happening | |---|---| | `connecting` | The socket is opening and the avatar is loading on the engine | | `ready` | Connected and initialized, not yet listening | | `listening` | Capturing and transcribing the user's microphone | | `thinking` | The language model is producing a reply | | `speaking` | Synthesized audio and lip-synced video are streaming back | These stages exist only in the client — they are not fields on the conversation, and no endpoint returns them. The embed shows them for you; the [realtime protocol](/guides/realtime-integration) describes the messages that carry them. ## Reading a conversation back ```bash title="cURL" # The conversation record curl -s "https://backend.goldenengine.ai/v1/conversations/$CONVERSATION_ID" \ -H "X-Api-Key: $GOLDENENGINE_API_KEY" # Paginated message history curl -s "https://backend.goldenengine.ai/v1/conversations/$CONVERSATION_ID/messages" \ -H "X-Api-Key: $GOLDENENGINE_API_KEY" ``` ```python title="Python" # The conversation record record = requests.get(f"{BASE}/v1/conversations/{cid}", headers=HEADERS).json() # Paginated message history messages = requests.get( f"{BASE}/v1/conversations/{cid}/messages", headers=HEADERS ).json() ``` ```javascript title="Node.js" // The conversation record const record = await ( await fetch(`${BASE}/v1/conversations/${cid}`, { headers }) ).json(); // Paginated message history const messages = await ( await fetch(`${BASE}/v1/conversations/${cid}/messages`, { headers }) ).json(); ``` `GET /v1/conversations` lists your conversations, most recently started first, paginated with `skip` and `limit` (default 10, at most 100). Add `end_user_id` to list one person's history; `total` then counts that scope rather than the whole account. `GET /v1/conversations/{id}/messages` pages the same way, with a default `limit` of 100 and a maximum of 500. ### Transcripts ```bash title="cURL" curl -s "https://backend.goldenengine.ai/v1/conversations/$CONVERSATION_ID/transcript" \ -H "X-Api-Key: $GOLDENENGINE_API_KEY" ``` ```python title="Python" transcript = requests.get( f"{BASE}/v1/conversations/{cid}/transcript", headers=HEADERS ).json() ``` ```javascript title="Node.js" const transcript = await ( await fetch(`${BASE}/v1/conversations/${cid}/transcript`, { headers }) ).json(); ``` ```json { "conversation_id": "9c4e8d21-...", "messages": [ { "role": "avatar", "content": "Hi, what can I help you with today?", "timestamp_offset": 0.0 }, { "role": "user", "content": "I need to reset my password.", "timestamp_offset": 3.42 } ] } ``` `role` is `user` or `avatar` here; the messages endpoints label the same speaker `assistant`. `timestamp_offset` is seconds from the start of the session, which lets you line the transcript up against the recording. It restarts at `0` each time the embed reconnects, so a conversation that dropped and reconnected has offsets that go back to zero partway through — and because the transcript is ordered by that offset, the two sessions' lines interleave. The messages endpoints order by the wall-clock `timestamp` instead. ### Recordings ```bash title="cURL" curl -s "https://backend.goldenengine.ai/v1/conversations/$CONVERSATION_ID/recording" \ -H "X-Api-Key: $GOLDENENGINE_API_KEY" ``` ```python title="Python" recording = requests.get( f"{BASE}/v1/conversations/{cid}/recording", headers=HEADERS ).json() ``` ```javascript title="Node.js" const recording = await ( await fetch(`${BASE}/v1/conversations/${cid}/recording`, { headers }) ).json(); ``` Check `recording_status` on the conversation before fetching: | Status | Meaning | |---|---| | `none` | No recording was captured | | `processing` | Still being assembled — retry shortly | | `ready` | Available at `recording_url` | | `failed` | Recording did not complete | `recording_url` is time-limited. Fetch it when you need it rather than storing the URL. ## Managing conversations `PATCH /v1/conversations/{conversation_id}` closes the conversation: it stamps `ended_at` and queues the session for [memory](/core-concepts/memory). It takes no request body, and there is no way to rename a conversation after it is created. Call it from your server when the visitor leaves — the embed's own end button does not close the conversation over the API. The session disconnecting also queues the memory write, and a background sweep picks up any conversation that has been quiet for about 15 minutes, but `ended_at` stays `null` until you close it. `DELETE /v1/conversations/{conversation_id}` removes the conversation, its messages, its recording and the memory summary written from it. Facts the avatar learned from it, and the timeline and rolled-up summaries that already include it, remain — use the [memory endpoints](/core-concepts/memory#forgetting) to forget those. `POST /v1/conversations/{conversation_id}/messages` is deprecated. It rejects anything that is not a line of speech — a pasted transcript, a notes block — with `422`, and nothing reads the rows it adds back into a call. To give the avatar facts about a person ahead of time, [pin a memory](/core-concepts/memory#pinned-memories) instead. --- # Memory What an avatar remembers about each of your end users, and how to read, correct, pin and forget it. Memory is what an avatar knows about a person from earlier conversations. After each conversation ends, the avatar learns from it: **facts** about the person, a **summary** of what was said, and — as conversations add up — a **timeline** of weeks and months and a rolling summary of older history. Alongside that are **pinned memories**, facts you write yourself from your own records. The next conversation in the same scope starts with all of it in the avatar's prompt, which is how an avatar picks up where it left off. ## Scope Memory is kept per account, per avatar, per `end_user_id` — the ID you pass when you [create a conversation](/core-concepts/conversations#memory-and-end-users). Two avatars never share memory, and neither do two of your end users. | Scope | Where it comes from | |---|---| | `cust-42` | Conversations created with `"end_user_id": "cust-42"` | | `anon:` | A conversation created without an `end_user_id`. Nothing is ever learned in it | | Empty string | Your own scope: sessions you start from the dashboard | ## When memory is written Learning happens in the background, after a conversation ends — never during it. The write is queued when you close the conversation with `PATCH /v1/conversations/{id}` or when the session disconnects, and a background sweep catches any conversation that has been quiet for about 15 minutes. It usually lands a few seconds after the end. Each session loads memory once, when it starts, so a conversation that begins seconds after the previous one ended may not see it yet. To check, read the end user's memory: `pending_conversations` counts conversations whose memory is still being written. Nothing is learned from a conversation when: - it is in an `anon:` scope; - it has fewer than two messages; or - the person said fewer than four words of substance — greetings and filler such as "hi", "okay" or "thanks" do not count — unless they introduced themselves ("Hi, I'm Ada"). Learned memory can be read and deleted, but not edited. To correct something, delete it and, if the avatar should still know it, pin the right version. ## Reading memory ```bash title="cURL" curl -s "https://backend.goldenengine.ai/v1/avatars/$AVATAR_ID/memory?end_user_id=cust-42" \ -H "X-Api-Key: $GOLDENENGINE_API_KEY" ``` ```python title="Python" BASE = "https://backend.goldenengine.ai" HEADERS = {"X-Api-Key": os.environ["GOLDENENGINE_API_KEY"]} memory = requests.get( f"{BASE}/v1/avatars/{avatar_id}/memory", headers=HEADERS, params={"end_user_id": "cust-42"}, ).json() ``` ```javascript title="Node.js" const BASE = "https://backend.goldenengine.ai"; const headers = { "X-Api-Key": process.env.GOLDENENGINE_API_KEY }; const params = new URLSearchParams({ end_user_id: "cust-42" }); const memory = await ( await fetch(`${BASE}/v1/avatars/${avatarId}/memory?${params}`, { headers }) ).json(); ``` ```json { "avatar_id": "5b2e7c10-...", "end_user_id": "cust-42", "pinned": [ { "id": "a41f...", "end_user_id": "cust-42", "memory": "Premium plan since 2024", "created_at": "...", "updated_at": "..." } ], "facts": [ { "key": "pet", "value": "Rocky", "updated_at": "2026-09-20T14:03:11Z", "conversation_id": "9c4e8d21-..." } ], "timeline": { "aggregate": null, "months": [], "weeks": [], "summaries": [ { "id": "e07c...", "conversation_id": "9c4e8d21-...", "summary": "Asked how to reset a password...", "created_at": "...", "in_aggregate": false } ] }, "pending_conversations": 0 } ``` `end_user_id` is a required query parameter, because it can contain characters that do not belong in a path. Send it empty (`?end_user_id=`) to read your own scope. Add `type=facts` or `type=timeline` to return only one half; `pinned` is always included. The request is `404` when the scope holds nothing and nothing is pending, and when the avatar is neither yours nor a stock avatar. `GET /v1/avatars/{avatar_id}/memory/scopes` lists every end user the avatar remembers, most recently updated first, with counts of facts, summaries and pins. It pages with `skip` and `limit` (default 10, at most 100), takes `search` to match part of an `end_user_id`, and leaves `anon:` scopes out unless you pass `include_anonymous=true`. ## Forgetting Every delete takes the same `end_user_id` query parameter. None of them delete conversations, transcripts or recordings. | Request | What it forgets | |---|---| | `DELETE /v1/avatars/{avatar_id}/memory` | Everything about the end user: facts, summaries, timeline, the rolling summary and pinned memories | | `DELETE …/memory/facts/{key}` | One fact. A later conversation can learn it again if the person says it again | | `DELETE …/memory/summaries/{summary_id}` | One conversation's summary | | `DELETE …/memory/timeline/{entry_id}` | One week or month, together with the summaries it was built from | | `DELETE …/memory/aggregate` | The rolling summary of older conversations, which is then rebuilt from the summaries that remain | Deleting a summary that is already folded into the rolling summary (`in_aggregate: true`) removes that too and rebuilds it without the deleted conversation. Those two requests return `aggregate_rebuild`: `queued`, `not_needed`, or `unavailable` when the rebuild could not be queued — it then happens after the end user's next conversation. ```bash title="cURL" curl -s -X DELETE "https://backend.goldenengine.ai/v1/avatars/$AVATAR_ID/memory?end_user_id=cust-42" \ -H "X-Api-Key: $GOLDENENGINE_API_KEY" ``` ```python title="Python" requests.delete( f"{BASE}/v1/avatars/{avatar_id}/memory", headers=HEADERS, params={"end_user_id": "cust-42"}, ) ``` ```javascript title="Node.js" await fetch(`${BASE}/v1/avatars/${avatarId}/memory?${params}`, { method: "DELETE", headers, }); ``` A conversation that ended moments ago can still land its memory after you forget an end user. Check that `pending_conversations` is `0` first if that matters. **Forgetting is not erasing.** To honour a deletion request, delete the person's conversations as well: list them with `GET /v1/conversations?end_user_id=…` and `DELETE /v1/conversations/{id}` each one, which also removes its messages and recording. Then `DELETE` their memory, so nothing still pending can land afterwards. ## Pinned memories A pinned memory is a statement about an end user that you supply — from your CRM, a sign-up form, a support ticket. The avatar sees pinned memories ahead of what it learned, as background from you; if the person later says something newer about themselves, the avatar goes with the person. Learning never changes or removes a pin. Pins are stored immediately and are read at the start of the next session. You can add them before a person's first conversation. ```bash title="cURL" curl -s "https://backend.goldenengine.ai/v1/avatars/$AVATAR_ID/memory/pinned" \ -H "X-Api-Key: $GOLDENENGINE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "end_user_id": "cust-42", "memory": "Prefers short, direct answers" }' ``` ```python title="Python" pin = requests.post( f"{BASE}/v1/avatars/{avatar_id}/memory/pinned", headers=HEADERS, json={"end_user_id": "cust-42", "memory": "Prefers short, direct answers"}, ).json() ``` ```javascript title="Node.js" const pin = await ( await fetch(`${BASE}/v1/avatars/${avatarId}/memory/pinned`, { method: "POST", headers: { ...headers, "Content-Type": "application/json" }, body: JSON.stringify({ end_user_id: "cust-42", memory: "Prefers short, direct answers", }), }) ).json(); ``` | Request | Purpose | |---|---| | `POST …/memory/pinned` | Pin one memory. Body: `end_user_id` and `memory` | | `POST …/memory/pinned/batch` | Pin several at once. Body: `end_user_id` and a `memories` list. All or nothing | | `GET …/memory/pinned?end_user_id=…` | List an end user's pins, oldest first — the order the avatar sees them in. Default `limit` 30, at most 100 | | `PATCH …/memory/pinned/{pinned_id}` | Replace a pin's text, keeping its ID. Body: `memory` | | `DELETE …/memory/pinned/{pinned_id}` | Remove a pin | Each pin is one plain statement on a single line, up to 500 characters; a pasted transcript or notes block is rejected with `422`. An end user can have at most 30 pins, and a create that would go past that fails with `400` — for a batch, none of it is added. In the body, `end_user_id` is required: send `""` for your own scope. The `anon:` prefix is reserved. Every endpoint, with its full request and response schema, is in the [API reference](/api-reference). --- # Knowledge bank Documents your avatar can search when a question goes beyond its prompt. The knowledge bank is where you put the documents an avatar should be able to answer from — a product manual, a policy handbook, a course reader. Uploaded documents are split into chunks and indexed, and the avatar searches them during a conversation when it needs to. Documents are separate from what an avatar remembers about the people it talks to — that is [Memory](/core-concepts/memory). ## Uploading a document ```bash title="cURL" curl -s "https://backend.goldenengine.ai/v1/knowledge-bank/upload" \ -H "X-Api-Key: $GOLDENENGINE_API_KEY" \ -F "file=@handbook.pdf" ``` ```python title="Python" BASE = "https://backend.goldenengine.ai" HEADERS = {"X-Api-Key": os.environ["GOLDENENGINE_API_KEY"]} with open("handbook.pdf", "rb") as document: item = requests.post( f"{BASE}/v1/knowledge-bank/upload", headers=HEADERS, files={"file": document}, ).json() ``` ```javascript title="Node.js" const BASE = "https://backend.goldenengine.ai"; const headers = { "X-Api-Key": process.env.GOLDENENGINE_API_KEY }; const form = new FormData(); form.set( "file", new Blob([await readFile("handbook.pdf")], { type: "application/pdf" }), "handbook.pdf", ); const item = await ( await fetch(`${BASE}/v1/knowledge-bank/upload`, { method: "POST", headers, body: form }) ).json(); ``` | Constraint | Value | |---|---| | Formats | PDF and DOCX only | | Maximum size | 50 MB per file | The filename must end in `.pdf` or `.docx`, and if the file part carries a content type it must be `application/pdf` or `application/vnd.openxmlformats-officedocument.wordprocessingml.document`. Anything else — including the generic `application/octet-stream` that many HTTP clients send by default — is rejected with `400`. In Node.js, give the `Blob` a `type`, as in the sample above. To load several documents in one request, post up to five of them as repeated `files` fields to `/v1/knowledge-bank/upload/batch`. Every file is checked — type, extension, empty, size, and a count of 1 to 5 — before any is stored, so one bad file fails the whole request with `400` and nothing is queued. Otherwise the response lists one result per file, in the order you sent them — `201` when all were queued, `207` when some were not. The [upload guide](/guides/knowledge-bank-upload#upload-several-at-once) shows how to read it. ## Processing Extraction is asynchronous — the upload returns before the document is searchable. ``` uploaded → processing → completed ↘ failed ``` | Status | Meaning | |---|---| | `uploaded` | Stored, extraction not started | | `processing` | Being parsed and chunked | | `completed` | Indexed and searchable | | `failed` | Extraction errored, or the queue was unavailable; see `error_message` | Poll `GET /v1/knowledge-bank/{item_id}` until it reaches `completed`. A finished item reports `chunk_count` and `total_tokens`, which tell you how much text was actually extracted. A scanned PDF with no text layer ends in `failed` with `error_message` set to `"Document contains no extractable text"` — run it through OCR and upload it again. A `completed` item with a surprisingly low `total_tokens` usually means only part of the file had a text layer. `GET /v1/knowledge-bank` lists the documents in the account bank — the ones not attached to any avatar — and `DELETE /v1/knowledge-bank/{item_id}` removes one. Both `GET` and `DELETE` on `/v1/knowledge-bank/{item_id}` return `404` for a document that is attached to an avatar; use the avatar's knowledge endpoints below for those. ## Which avatars see a document Where a document sits decides who can search it: | Where the document is | Who can use it | |---|---| | In the account bank, unattached | **No avatar** | | Uploaded or attached to one of your avatars | That avatar only | | Attached to a stock avatar | That stock avatar, in your account's conversations | A document answers only for the avatar it was uploaded or attached to. An upload to `/v1/knowledge-bank/upload` lands in the account bank and is used by no avatar until you attach it — upload straight to the avatar instead if you already know which one it is for. Stock avatars draw on two sources: their own built-in documents, and documents you have attached to that stock avatar from your account. Attaching to a stock avatar is recorded per account and leaves the document in your bank, so the same bank document can be attached to several stock avatars. ## Attaching to an avatar Upload straight to an avatar to scope a document to it from the start: ```bash title="cURL" curl -s "https://backend.goldenengine.ai/v1/avatars/$AVATAR_ID/knowledge" \ -H "X-Api-Key: $GOLDENENGINE_API_KEY" \ -F "file=@handbook.pdf" ``` ```python title="Python" with open("handbook.pdf", "rb") as document: requests.post( f"{BASE}/v1/avatars/{avatar_id}/knowledge", headers=HEADERS, files={"file": document}, ) ``` ```javascript title="Node.js" const form = new FormData(); form.set( "file", new Blob([await readFile("handbook.pdf")], { type: "application/pdf" }), "handbook.pdf", ); await fetch(`${BASE}/v1/avatars/${avatarId}/knowledge`, { method: "POST", headers, body: form, }); ``` This uploads and attaches in one step; `POST /v1/avatars/{avatar_id}/knowledge/batch` does the same for up to five files. To attach a document that is already in the bank, send its id to `POST /v1/avatars/{avatar_id}/knowledge/attach`; that returns `409` if the document has not finished extracting or is already attached to another of your avatars. `GET /v1/avatars/{avatar_id}/knowledge` lists what is attached. `PATCH /v1/avatars/{avatar_id}` with `knowledge_base_ids` sets the avatar's documents in one go. It replaces the whole set: documents you leave out go back to the account bank (where no avatar uses them), and documents you list are moved to this avatar. It does **not** make the checks `/attach` makes — it will move a document that is still processing, or take one away from another avatar, without an error. An id the account does not own is rejected with `422`. `DELETE /v1/avatars/{avatar_id}/knowledge/{knowledge_id}` **deletes the document and its stored file** — it does not return it to the bank. To detach without deleting, `PATCH` the avatar with a `knowledge_base_ids` list that leaves the document out. Deleting an avatar also deletes every document attached to it. **A document belongs to at most one of your avatars.** To give several of your avatars the same material, upload a copy to each of them. A document left unattached in the account bank is not shared — no avatar can search it. ## How retrieval works Retrieval is decided by the language model, not applied to every message. The avatar is given a `search_knowledge_base` tool and instructed to call it before answering any question that its documents might cover. Greetings and acknowledgements skip the search. When the tool fires: 1. The model issues a search query derived from what the user asked. 2. The query is embedded and matched against the chunks of every document the avatar can see — the documents uploaded or attached to it. Weak matches are dropped and duplicate passages removed, and if nothing matches by meaning a keyword pass looks for names the transcription may have garbled. 3. Matching chunks are returned to the model, which answers from them. Two consequences worth designing around. First, an avatar that never calls the tool will answer from the model's own knowledge — if answers look generic, the documents are usually attached to a different avatar, still processing, or empty of extractable text. Second, retrieval adds latency to the turn where it happens, so turns that trigger a search are slower than ordinary conversation. ## Testing retrieval `POST /v1/knowledge-bank/search` runs a similarity search over the account bank without starting a conversation. Use it to check that a document's text was extracted and chunked the way you expect: ```bash title="cURL" curl -s "https://backend.goldenengine.ai/v1/knowledge-bank/search" \ -H "X-Api-Key: $GOLDENENGINE_API_KEY" \ -H "Content-Type: application/json" \ -d '{"query": "how do I reset my password", "limit": 5}' ``` ```python title="Python" results = requests.post( f"{BASE}/v1/knowledge-bank/search", headers=HEADERS, json={"query": "how do I reset my password", "limit": 5}, ).json() ``` ```javascript title="Node.js" const results = await ( await fetch(`${BASE}/v1/knowledge-bank/search`, { method: "POST", headers: { ...headers, "Content-Type": "application/json" }, body: JSON.stringify({ query: "how do I reset my password", limit: 5 }), }) ).json(); ``` ```json { "chunks": [ { "knowledge_base_item_id": "b71f...", "filename": "handbook.pdf", "chunk_index": 42, "content": "To reset your password, visit...", "page_number": 7, "token_count": 118 } ] } ``` `limit` defaults to 5 and caps at 20. This is not the avatar's own search. It covers only documents in the account bank — the ones no avatar uses until you attach them — and anything already attached to one of your avatars is invisible to it. Use it to check a document before you attach it. It returns the nearest chunks as they are, with no similarity threshold, no de-duplication, and no keyword fallback. Good results here tell you the text is in the index; they do not guarantee the avatar will retrieve the same passage. If a question fails in conversation, empty or off-topic results here point at the documents; good results that the avatar still ignores point at the prompt. --- # Models and voices The language, speech, and voice engines an avatar can be configured with. Every avatar is configured with three engines: a language model that decides what to say, a text-to-speech provider that says it, and a speech-to-text engine that hears the user. This page describes the catalog at the time of writing. `GET /v1/models` is the source of truth — call it to see what is currently available. Like every `/v1/` endpoint it needs your API key. ```bash title="cURL" curl -s "https://backend.goldenengine.ai/v1/models" \ -H "X-Api-Key: $GOLDENENGINE_API_KEY" ``` ```python title="Python" catalog = requests.get( "https://backend.goldenengine.ai/v1/models", headers={"X-Api-Key": os.environ["GOLDENENGINE_API_KEY"]}, ).json() ``` ```javascript title="Node.js" const catalog = await ( await fetch("https://backend.goldenengine.ai/v1/models", { headers: { "X-Api-Key": process.env.GOLDENENGINE_API_KEY }, }) ).json(); ``` ## Language models Set with `llm_model` on the avatar. | Model | When to use it | |---|---| | `gpt-4o` | **Recommended default.** Balanced quality and latency for most conversations | | `gpt-4.1` | Complex dialogue that needs more reasoning, at higher latency | | `gpt-4o-mini` | Lower cost, good quality for straightforward conversation | | `gpt-4.1-mini` | Fast and low cost with strong conversational quality | | `gpt-4.1-nano` | Ultra-fast and low cost; simple, narrow conversations | | `openai/gpt-oss-120b` | Open-weight model on Groq. Very low latency and cost | | `claude-haiku-4-5` | Anthropic's fastest model; low-latency responses | | `gemini-3.5-flash-lite` | Google's fastest tier. Low latency and cost, and it accepts images | | `gpt-5.4-nano` | Fastest model in the catalog (~0.56s to first token), and the lowest cost | | `gpt-5.4-mini` | Low-cost GPT-5.4 with strong conversational quality (~0.84s) | | `gpt-5.4` | Full-size GPT-5.4. Higher reasoning quality (~0.71s) | | `gpt-5.5` | Newer full-size model for more demanding dialogue (~0.99s) | | `gpt-5.6-luna` | Newest generation; the fastest of the three GPT-5.6 variants (~0.58s) | | `gpt-5.6-terra` | Newest generation, balanced (~0.91s) | | `gpt-5.6-sol` | Newest generation; the slowest of the three (~1.15s) | | `gpt-6-luna` | GPT-6 generation, fast variant (~0.84s) | | `gpt-5.1` | First GPT-5 revision, with low-latency replies (~0.70s) | | `gpt-5.2` | GPT-5.2 conversational model (~1.02s) | | `gpt-5-mini` | Original GPT-5 mini, superseded by `gpt-5.4-mini` (~1.24s) | | `gpt-5-nano` | Original GPT-5 nano, superseded by `gpt-5.4-nano` (~1.09s) | | `openrouter/google/gemma-4-31b-it` | Gemma 4 31B on OpenRouter. Accepts images; fast (~0.31s) | | `openrouter/google/gemma-4-26b-a4b-it` | Gemma 4 26B mixture-of-experts. Fastest in the catalog (~0.26s), slightly weaker knowledge-base recall | | `openrouter/mistralai/mistral-medium-3.1` | Mistral Medium 3.1. Accepts images; larger, fuller replies (~0.54s) | | `openrouter/qwen/qwen3.8-27b` | Qwen3.8 27B. Accepts images; thinks before answering — the most reliable with the knowledge base, but slower (~1.3s) | | `openrouter/google/gemini-3.5-flash-lite` | Gemini 3.5 Flash-Lite through OpenRouter (~0.73s) | The times in brackets are median time to first token from the catalog's own measurements — a rough guide to relative speed, not a benchmark. Any other value for `llm_model` is rejected with `422`; `meta-llama/llama-4-scout-17b-16e-instruct` has been retired, and an avatar that still carries it is answered by `openai/gpt-oss-120b` instead. Choosing is mostly a latency-versus-depth trade. In a spoken conversation, a pause is more noticeable than it is in chat, so start at `gpt-4o` and move to a smaller model if turns feel slow, or to `gpt-4.1` if answers feel shallow. If a visitor turns on their camera during an embedded session, frames are passed to the language model as image content — so the model has to accept images for it to mean anything. Test your chosen model with the camera before relying on it. See [Embed an avatar](/guides/embed-avatar) for the control that switches it on. ### Web search Avatars have web search on by default (`web_search_enabled` on the avatar; see [Avatars](/core-concepts/avatars#configuration)). The model decides when a question needs current facts, and how the search runs depends on the model: | Model | How it searches | |---|---| | OpenAI `gpt-*` models, except the `nano` ones | OpenAI's built-in web search | | `openrouter/google/gemini-3.5-flash-lite` | Google's own search, through OpenRouter | | Everything else — the `nano` models, `openai/gpt-oss-120b`, `claude-haiku-4-5`, `gemini-3.5-flash-lite`, and the other `openrouter/` models | A `search_web` tool backed by a third-party search API, when the server has one configured; otherwise no web search | Only a turn where the model actually searches pays for it — typically a second or two, and on the tool path a second model pass. ## Text to speech Set with `tts_provider` (default `elevenlabs`), plus `voice_id` and `tts_speed` (default `1.0`, must be above zero). | Provider | Notes | |---|---| | `elevenlabs` | **Default.** Large voice catalog | | `cartesia` | Low-latency synthesis | | `fish` | Fish Audio | | `csm` | Your account's own custom voices — see below | ### Voices The catalog carries several hundred voices across the providers. Each entry includes `provider`, `name`, `language`, `gender`, `accent`, and `category`, so you can filter to what you need. The providers label gender differently — Cartesia uses `feminine` and `masculine`, ElevenLabs and Fish Audio `female` and `male` — so match both: ```bash title="cURL" curl -s "https://backend.goldenengine.ai/v1/models" \ -H "X-Api-Key: $GOLDENENGINE_API_KEY" ``` ```python title="Python" catalog = requests.get( "https://backend.goldenengine.ai/v1/models", headers={"X-Api-Key": os.environ["GOLDENENGINE_API_KEY"]}, ).json() # Cartesia labels voices "feminine"/"masculine"; ElevenLabs and Fish Audio use "female"/"male". english_female = [ voice for voice in catalog["supported_voices"] if voice["language"] == "en" and voice["gender"] in ("female", "feminine") ] for voice in english_female[:5]: print(voice["id"], voice["provider"], voice["name"], voice["accent"]) ``` ```javascript title="Node.js" const catalog = await ( await fetch("https://backend.goldenengine.ai/v1/models", { headers: { "X-Api-Key": process.env.GOLDENENGINE_API_KEY }, }) ).json(); // Cartesia labels voices "feminine"/"masculine"; ElevenLabs and Fish Audio use "female"/"male". const englishFemale = catalog.supported_voices.filter( (voice) => voice.language === "en" && ["female", "feminine"].includes(voice.gender), ); for (const voice of englishFemale.slice(0, 5)) { console.log(voice.id, voice.provider, voice.name, voice.accent); } ``` Set the chosen voice's `id` as the avatar's `voice_id`, and make sure `tts_provider` matches that voice's `provider` — a voice ID from one provider will not work with another. For `cartesia`, `elevenlabs` and `fish` the API does not check the pairing for you. Changing `tts_provider` without sending a `voice_id` resets the avatar to that provider's default voice. ### Custom voices `csm` voices are cloned from a recording you upload in the dashboard; they cannot be created through `/v1/`. Once one is ready it appears in `GET /v1/models` with `provider: "csm"` and `category: "custom"` — only to your account. Unlike the other providers, `csm` is checked: an avatar with `tts_provider: "csm"` must send a `voice_id` (there is no default voice), and it must be one of your account's voices that has finished processing, or the request is rejected with `422`. A stock avatar cannot use a custom voice. `tts_speed` adjusts the pace of delivery. ## Speech to text Set with `stt_engine` (default `deepgram-flux`), plus `stt_speed`. The avatar also reports an `stt_model`, but that is read-only — it is derived from `stt_engine`, and sending it is rejected with `422`. | Engine | Notes | |---|---| | `deepgram` | General-purpose streaming transcription | | `deepgram-flux` | Deepgram's lower-latency variant | | `cartesia` | Streaming transcription from Cartesia | | `whisper` | Whisper-based transcription | | `whisper-smartturn` | Self-hosted Whisper with a turn-detection model that decides when the user has finished speaking. English and Spanish, from the avatar's `primary_language` | Speech-to-text sits at the front of every turn, so its latency is added to every response the user waits for. If conversations feel sluggish before the avatar even begins thinking, this is the first thing to change. ## Persona options Several avatar fields accept values from fixed lists rather than free text: `known_for`, `personality_traits`, `interaction_guardrails`, `primary_language` and `ai_languages`. The accepted values are published in the spec, on the request bodies that use them: open **Create an avatar** in the [API reference](/api-reference) and each of these fields carries its full list. Sending a value outside the list is rejected with `422`. --- # Embed an avatar Mint a conversation URL on your server and iframe it into your page. By the end of this page a visitor to your site can hold a live conversation with your avatar, inside an iframe you control. The flow has two halves, and the split matters: your **server** creates the conversation and gets back a short-lived URL, and your **page** renders that URL in an iframe. The API key never reaches the browser. You need an avatar whose status is `ready` and an API key. If you have neither yet, start with the [Quickstart](/quickstart). `POST /v1/conversations` returns `conversation_url` — a page that renders the live avatar session and is meant to be iframed. ```bash title="cURL" curl -s "https://backend.goldenengine.ai/v1/conversations" \ -H "X-Api-Key: $GOLDENENGINE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "avatar_id": "'"$AVATAR_ID"'", "end_user_id": "user-8f3a", "title": "Product demo", "greeting": "Hi there, what would you like to know?" }' ``` ```python title="Python" import os import requests BASE = "https://backend.goldenengine.ai" HEADERS = {"X-Api-Key": os.environ["GOLDENENGINE_API_KEY"]} conversation = requests.post( f"{BASE}/v1/conversations", headers=HEADERS, json={ "avatar_id": os.environ["AVATAR_ID"], "end_user_id": visitor_id, "title": "Product demo", "greeting": "Hi there, what would you like to know?", }, ).json() ``` ```javascript title="Node.js" const BASE = "https://backend.goldenengine.ai"; const headers = { "X-Api-Key": process.env.GOLDENENGINE_API_KEY }; const conversation = await ( await fetch(`${BASE}/v1/conversations`, { method: "POST", headers: { ...headers, "Content-Type": "application/json" }, body: JSON.stringify({ avatar_id: process.env.AVATAR_ID, end_user_id: visitorId, title: "Product demo", greeting: "Hi there, what would you like to know?", }), }) ).json(); ``` ```json { "conversation_id": "3f8b1c02-7d4e-4a19-b0c3-5e6f7a8b9c0d", "end_user_id": "user-8f3a", "conversation_url": "https://www.goldenengine.ai/embed/c/3f8b1c02-7d4e-4a19-b0c3-5e6f7a8b9c0d?token=eyJhbGci...", "status": "active", "expires_at": "2026-08-18T16:42:00Z" } ``` `avatar_id` is the only required field. `end_user_id` is your own ID for the signed-in visitor: their conversations with this avatar share memory, so the avatar can pick up where it left off with that person. Leave it out for an anonymous visitor and the session starts with no memory and leaves none behind — see [Memory and end users](/core-concepts/conversations#memory-and-end-users). `greeting` is what the avatar says first. `title` is shown to the visitor as the avatar's name while the session connects, so set it to the name they should see — left out, it defaults to the avatar's name followed by the date and time. **The host above is illustrative.** `conversation_url` is built from the API's own configuration, so the embed lives on whatever domain that deployment points at — not necessarily `www.goldenengine.ai`, and not the host you just called. Read the URL out of the response and pass it through whole. Rebuilding it around a hard-coded host is the most common way this integration breaks. Pass `conversation_url` to your page and use it as the iframe `src`. Grant these `allow` entries: - **`microphone`** — required. The session captures the visitor's speech. Without it the avatar never hears anything. - **`autoplay`** — required. The avatar's video and audio start on their own once connected. - **`camera`** — the embed turns the visitor's camera on when they press Start, shows it as a picture-in-picture preview, and sends a still frame to the avatar's language model about a second later and then every 10 seconds, so the avatar can see what the visitor shows it. Without `camera` the browser refuses the camera, the visitor sees a "could not access camera" notice, and the conversation carries on without it. The visitor can switch the camera off from the preview or the control bar; `hide_controls` hides the control bar but does not stop the capture. The avatar can only use the frames if its language model accepts images — see [Models and voices](/core-concepts/models). - **`fullscreen`** — lets the control bar's fullscreen button take the embed truly fullscreen. Without it the button falls back to filling the iframe. ```html title="HTML" ``` ```jsx title="React" export function AvatarSession({ conversationUrl }) { return ( ``` `theme` styles the chrome, not the video. The live session itself stays on a dark backdrop in both themes, because that is what avatar footage is composited against — so `theme=light` blends the surrounding screens into a light page without changing how the avatar looks. The embed opens on its own **Ready to talk?** screen with a **Start Session** button. Nothing connects, and the browser asks for no microphone or camera access, until the visitor presses it — that click is the user gesture browsers require for microphone access and unmuted audio. You can render the iframe on page load. Mounting it behind a button of your own is optional. It is worth doing when you would rather not create a conversation, or load the embed, for visitors who never open it: ```jsx title="React" import { useState } from "react"; export function StartSession({ getConversationUrl }) { const [conversationUrl, setConversationUrl] = useState(null); if (!conversationUrl) { return ( ); } return (