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.
Mint a conversation URL on your server
POST /v1/conversationsreturnsconversation_url— a page that renders the live avatar session and is meant to be iframed.- cURL
- Python
- Node.js
cURLcurl -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?"}'Pythonimport osimport requestsBASE = "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()Node.jsconst 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();{"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_idis the only required field.end_user_idis 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.greetingis what the avatar says first.titleis 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.Render it in an iframe
Pass
conversation_urlto your page and use it as the iframesrc. Grant theseallowentries: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. Withoutcamerathe 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_controlshides 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.fullscreen— lets the control bar's fullscreen button take the embed truly fullscreen. Without it the button falls back to filling the iframe.
- HTML
- React
HTML<iframesrc="https://www.goldenengine.ai/embed/c/3f8b1c02-...?token=eyJhbGci..."allow="microphone; camera; autoplay; fullscreen"style="width: 100%; height: 640px; border: 0;"title="Talk to our product specialist"></iframe>Reactexport function AvatarSession({ conversationUrl }) {return (<iframesrc={conversationUrl}allow="microphone; camera; autoplay; fullscreen"style={{ width: "100%", height: 640, border: 0 }}title="Talk to our product specialist"/>);}Size the iframe from your own CSS — the embed fills whatever box you give it.
Beyond
token, the URL takes these parameters:Parameter Value Effect themedark(default) orlightColour scheme for the screens around the session — the start overlay, the error screens and the ended screen. hide_controlstrueHides the entire control bar: mute, captions, fullscreen, camera and end-session. The conversation still runs; the visitor just cannot steer it. thumbnail_urlAn image URL Shown on the loading screen while the avatar warms up. Used only as a fallback, when the conversation itself carries no thumbnail. show_statustrueAdds a status pill at the top right that says what the avatar is doing — listening, thinking, speaking. Hidden by default. show_timerfalseHides the elapsed-time clock at the top left. Shown by default, once the session is connected. show_resolutionfalseHides the video-quality badge at the top right. Shown by default, once the session is connected. It shows the current video quality, such as 540p, and turns amber while the quality is below the top step. It reads Auto until the engine reports a size.show_livetrueAdds a connectivity badge at the top left: green Live, amber Connecting, red Offline. Hidden by default. show_signalfalseHides the network signal bars at the top right. Shown by default, once the session is connected. The bars show round-trip time to the engine, not the video quality. The five
show_*switches take the literal wordstrueorfalse; any other value leaves the default in place. They are overlays on the video, independent ofhide_controls, which only affects the control bar.Append them to
conversation_urlrather than rebuilding it — thetokenparameter has to survive intact.<iframesrc="https://www.goldenengine.ai/embed/c/3f8b1c02-...?token=eyJhbGci...&theme=light&hide_controls=true&show_timer=false&show_live=true"allow="microphone; camera; autoplay; fullscreen"style="width: 100%; height: 640px; border: 0;"title="Talk to our product specialist"></iframe>Let the visitor start the session
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:
Reactimport { useState } from "react";export function StartSession({ getConversationUrl }) {const [conversationUrl, setConversationUrl] = useState(null);if (!conversationUrl) {return (<button onClick={async () => setConversationUrl(await getConversationUrl())}>Talk to our avatar</button>);}return (<iframesrc={conversationUrl}allow="microphone; camera; autoplay; fullscreen"style={{ width: "100%", height: 640, border: 0 }}title="Talk to our product specialist"/>);}Here
getConversationUrlcalls your own server, which creates the conversation and returnsconversation_url.Close the session and read it back
Close the conversation from your server when the visitor leaves. The embed's own end button stops the session but does not close the conversation over the API, so
ended_atstaysnulluntil you callPATCH. Closing sets the end time and queues the conversation for memory; if nobody closes it, memory is still written once the session has disconnected or been quiet for about 15 minutes. The transcript and recording are available over REST:- cURL
- Python
- Node.js
cURLCID="3f8b1c02-7d4e-4a19-b0c3-5e6f7a8b9c0d"curl -s -X PATCH "https://backend.goldenengine.ai/v1/conversations/$CID" \-H "X-Api-Key: $GOLDENENGINE_API_KEY"curl -s "https://backend.goldenengine.ai/v1/conversations/$CID/transcript" \-H "X-Api-Key: $GOLDENENGINE_API_KEY"Pythoncid = conversation["conversation_id"]requests.patch(f"{BASE}/v1/conversations/{cid}", headers=HEADERS)transcript = requests.get(f"{BASE}/v1/conversations/{cid}/transcript", headers=HEADERS).json()Node.jsconst cid = conversation.conversation_id;await fetch(`${BASE}/v1/conversations/${cid}`, { method: "PATCH", headers });const transcript = await (await fetch(`${BASE}/v1/conversations/${cid}/transcript`, { headers })).json();GET /v1/conversations/{id}/recordingreturns a downloadurland the seconds until it expires.recording_statuson the conversation tells you whether the recording is ready yet.
The URL is short-lived
The token inside conversation_url is valid for 60 minutes, and expires_at tells
you exactly when. Treat the URL as single-use:
- Mint one per visitor, at the moment they ask to start. Do not cache it, put it in a build artifact, or share it between visitors.
- Do not email or link it — it may have lapsed by the time it is opened, and it works for whoever opens it.
- If a visitor takes longer than 60 minutes to press Start, create another conversation. There is no refresh endpoint.
Anyone holding the URL can join that conversation until the token expires, so hand it to one browser and no further.