Skip to main content
SiGMA World Rome · booth H7-7129 →
§ Voice · API

Put an AI voice agent inside your own app.

One POST puts an AI agent into a LiveKit room you already run: it greets the caller, holds the conversation, and leaves a transcript. No SDK, no media re-routing.

Start freeno card · cancel anytime
Calleryour userYour roomyour LiveKit serverDialogBrainagent · STT · LLM · TTSPOST /v1/voice/bridgetranscripts + webhooks
§ Quickstart

Everything below is a real request against api.dialogbrain.com. One API key authenticates you; the X-Workspace-Id header says which of your customers a call belongs to.

  1. 01

    Give the customer a workspace, credits and an agent

    Done once per end customer. Their agents, conversations and balance stay theirs — a request carrying somebody else’s workspace id gets a 404, not a peek at their data.

    # 1. a workspace for your end customer
    curl -X POST https://api.dialogbrain.com/v1/workspaces \
      -H "X-API-Key: $DIALOGBRAIN_KEY" -H "Idempotency-Key: ws-5512" \
      -d '{"name": "Acme Coffee", "external_id": "acme-5512"}'
    # -> {"id": 4821, ...}
    
    # 2. move credits from your balance into theirs
    curl -X POST https://api.dialogbrain.com/v1/workspaces/4821/credits \
      -H "X-API-Key: $DIALOGBRAIN_KEY" -H "Idempotency-Key: top-5512" \
      -d '{"amount_usd": "25.00"}'
    
    # 3. their agent, created inside their workspace
    curl -X POST https://api.dialogbrain.com/v1/agents \
      -H "X-API-Key: $DIALOGBRAIN_KEY" -H "X-Workspace-Id: 4821" \
      -H "Idempotency-Key: ag-5512" \
      -d '{"name": "Front desk", "prompt_text": "You answer calls for Acme Coffee."}'
    # -> {"id": 118, ...}
  2. 02

    Mint a guest token for our participant

    Your LiveKit keys never leave your side. The token is scoped to the one room and is the only access we get.

    from livekit import api  # pip install livekit-api
    
    # A guest token for OUR participant, scoped to the one room.
    token = (
        api.AccessToken(LIVEKIT_KEY, LIVEKIT_SECRET)
        .with_identity("dialogbrain-agent")
        .with_grants(api.VideoGrants(
            room_join=True,
            room="call-9f21c7",
            can_publish=True,
            can_subscribe=True,
        ))
        .to_jwt()
    )
  3. 03

    Bridge the call

    Send the room, the token, and which agent should take it. You get a call_id back immediately and the agent is in the room within a second or two.

    curl -X POST https://api.dialogbrain.com/v1/voice/bridge \
      -H "X-API-Key: $DIALOGBRAIN_KEY" \
      -H "X-Workspace-Id: 4821" \
      -H "Idempotency-Key: call-9f21c7" \
      -H "Content-Type: application/json" \
      -d '{
        "livekit_url": "wss://livekit.your-app.com",
        "room": "call-9f21c7",
        "token": "<guest token you minted for our participant>",
        "agent_id": 118,
        "caller_external_identity": "user-5512",
        "answer_delay_s": 0
      }'
  4. 04

    Or paste this into your server and be done

    The whole integration in one file: mint the token, bridge the call, handle the events. Swap the environment variables for yours.

    // npm i express livekit-server-sdk
    import express from 'express'
    import { AccessToken } from 'livekit-server-sdk'
    
    const app = express()
    app.use(express.json())
    
    /** Call this when a call starts in your app. */
    async function sendAgentIn({ room, caller, workspaceId, agentId,
                                 delaySeconds = 0, owner }) {
      const at = new AccessToken(process.env.LIVEKIT_KEY,
                                 process.env.LIVEKIT_SECRET,
                                 { identity: 'dialogbrain-agent', ttl: '10m' })
      at.addGrant({ roomJoin: true, room, canPublish: true, canSubscribe: true })
    
      const res = await fetch('https://api.dialogbrain.com/v1/voice/bridge', {
        method: 'POST',
        headers: {
          'X-API-Key': process.env.DIALOGBRAIN_KEY,
          'X-Workspace-Id': String(workspaceId),
          'Idempotency-Key': room,          // retries never double-book the room
          'Content-Type': 'application/json',
        },
        body: JSON.stringify({
          livekit_url: process.env.LIVEKIT_URL,
          room,
          token: await at.toJwt(),
          agent_id: agentId,
          caller_external_identity: caller,
          owner_identity: owner,            // omit for a pure concierge
          answer_delay_s: delaySeconds,     // 0 = answer now, 20 = ring first
        }),
      })
      if (!res.ok) throw new Error(`bridge failed: ${res.status} ${await res.text()}`)
      return res.json()                     // { call_id, room, status }
    }
    
    app.post('/hooks/dialogbrain', (req, res) => {
      const { event, data } = req.body
      if (event === 'transcript.turn') saveTurn(data)
      if (event === 'call.ended') closeCall(data.call_id, data.outcome,
                                            data.duration_seconds)
      res.sendStatus(200)
    })
  5. 05

    Receive events, read the transcript

    Register one URL per customer workspace. Deliveries are signed with a secret returned once at creation.

    curl -X POST https://api.dialogbrain.com/v1/webhooks \
      -H "X-API-Key: $DIALOGBRAIN_KEY" -H "X-Workspace-Id: 4821" \
      -H "Idempotency-Key: wh-5512" \
      -d '{
        "url": "https://your-app.com/hooks/dialogbrain",
        "event_types": ["call.started", "transcript.turn",
                        "call.ended", "transcript.ready"]
      }'
    # The signing secret is in the response. It is shown once.
§ Reference

Request fields that decide the behaviour

livekit_url
Your LiveKit server, wss://. We connect out to it as an ordinary participant.
room
The room name the call is already happening in.
token
The guest token you minted for our participant, scoped to that room.
agent_id
Which agent takes the call. Created per customer, with its own prompt and voice.
caller_external_identity
The participant identity of the human caller. We consume only that participant’s audio.
answer_delay_s
0 answers immediately (concierge). 1 to 120 waits that long and answers only if nobody else did.
owner_identity
Optional. If this participant joins, the agent stands down silently and the call is not billed.
end_user_id
Optional. Your own id for the caller, echoed back on every event.

Every POST takes an Idempotency-Key. A retry with the same key returns the original call instead of putting a second agent in the room.

NO INFRASTRUCTURE?

Let us place the call instead

If you have no LiveKit at all, POST /v1/calls with a target and an agent id: a phone number in E.164, a Telegram or WhatsApp target, a Google Meet link. Same transcripts, same webhooks, same per-customer workspaces.

ISOLATION

One key, many customers

You hold a single API key. The workspace header decides whose data a request touches, and the boundary is enforced on reads too: conversations, calls and balances are scoped to that workspace.

LATENCY

The agent is a participant, not a relay

The agent joins your room directly, so media does not take a detour through a third hop. Speech recognition, the model and speech synthesis run behind that one participant.

§ Q & A
How do I add an AI voice agent to my own app?

Create a workspace and an agent for the customer, mint a LiveKit guest token for our participant, then POST /v1/voice/bridge with your LiveKit URL, the room name, that token and the agent id. The agent joins the room and starts talking. No widget or SDK is required.

Can the agent join a LiveKit room I host myself?

Yes. That is what the bridge is for: the agent connects to your own LiveKit server as an ordinary participant, using a token you mint and scope to a single room. Your media path is unchanged.

What if I have no voice infrastructure at all?

Use POST /v1/calls instead. Pass a target — a phone number, a Telegram or WhatsApp target, or a Google Meet link — and the agent places or answers the call on our side, with the same transcripts and webhooks.

Can the agent answer only when the human does not pick up?

Yes. Set answer_delay_s to the seconds to wait, up to 120, and pass owner_identity. If the owner joins within that window the agent stands down silently and the call is not billed.

How do I get the transcript of a call?

Read the conversation the call created through GET /v1/conversations and /v1/conversations/{id}/messages, or subscribe to transcript.turn for live turns and transcript.ready for the finished transcript.

Can each of my customers be billed separately?

Yes. Every customer gets a workspace with its own balance, funded from yours with POST /v1/workspaces/{id}/credits, and their usage is drawn from it. You keep one API key and one integration.