Skip to main content

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, 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:

export GOLDENENGINE_API_KEY="<YOUR_API_KEY>"
  1. Create an 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:

    cURL
    curl -s "https://backend.goldenengine.ai/v1/me" \
    -H "X-Api-Key: $GOLDENENGINE_API_KEY"
    {
    "user_id": "9c4e8d21-6f3a-4b8e-9d21-1f2a3b4c5d6e",
    "email": "[email protected]"
    }

    A 401 with "code": "invalid_api_key" means the key is wrong or revoked.

  2. Pick a stock avatar

    Stock avatars are trained and ready, so you can skip training entirely.

    cURL
    curl -s "https://backend.goldenengine.ai/v1/avatars/stock?limit=5" \
    -H "X-Api-Key: $GOLDENENGINE_API_KEY"

    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:

    export AVATAR_ID="<id from the response>"

    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 for the training path.

  3. Start 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"'",
    "title": "My first conversation",
    "greeting": "Hi there, how can I help?"
    }'
    {
    "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, and Memory for reading back or deleting what it learned.

  4. Read it back

    The conversation is a durable record you can query, close, and pull a transcript from:

    cURL
    export CONVERSATION_ID="<conversation_id from the response>"

    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"
  5. Embed it in your page

    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:

    <iframe
    src="PASTE_CONVERSATION_URL_HERE"
    allow="microphone; camera; autoplay"
    style="width: 100%; height: 600px; border: 0"
    ></iframe>

    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 for the full flow, including closing the session and reading the transcript back.

What to do next​