Skip to main content

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.

Creating a conversation​

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?"
}'
FieldRequiredPurpose
avatar_idYesWhich avatar to talk to. Must be ready
end_user_idNoWho is talking, as an ID from your own system. Conversations with the same avatar that share one share memory — see below
titleNoUp 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}
greetingNoUp 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:

{
"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.

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 sendStored asMemory
"cust-42"cust-42Shared with every conversation with this avatar created with cust-42
Nothing, null, or blankanon:<conversation_id>None — this scope is never written to

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.

Inside a live session the embed moves through connection stages as the turn-taking loop runs:

connecting → ready → listening ⇄ thinking ⇄ speaking
StageWhat is happening
connectingThe socket is opening and the avatar is loading on the engine
readyConnected and initialized, not yet listening
listeningCapturing and transcribing the user's microphone
thinkingThe language model is producing a reply
speakingSynthesized 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 describes the messages that carry them.

Reading a conversation back​

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"

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​

cURL
curl -s "https://backend.goldenengine.ai/v1/conversations/$CONVERSATION_ID/transcript" \
-H "X-Api-Key: $GOLDENENGINE_API_KEY"
{
"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​

cURL
curl -s "https://backend.goldenengine.ai/v1/conversations/$CONVERSATION_ID/recording" \
-H "X-Api-Key: $GOLDENENGINE_API_KEY"

Check recording_status on the conversation before fetching:

StatusMeaning
noneNo recording was captured
processingStill being assembled — retry shortly
readyAvailable at recording_url
failedRecording 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. 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 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 instead.