Live sessions API

List live sessions

GET/v1/agent/sessions

Returns

200 with the fields below.

sessionsarray<object>required

Your organization's calls that are live right now.

6 properties
session_idstringrequired

The live session's id. It is also the call's id.

agent_idstringrequired

The agent on the call.

statusstringrequired

`active` while the call is live, `ended` after.

started_atstringrequired

ISO 8601 time the session started.

conversationarray<object>required

The conversation so far, in order. Each entry has `role`, `content` and a `timestamp`.

transcriptstringrequired

The conversation so far as plain text.

countintegerrequired

How many sessions are listed.

curl "https://api.dialgem.com/v1/agent/sessions" \
  -H "X-API-Key: $DIALGEM_API_KEY"
Response 200
{
  "sessions": [
    {
      "session_id": "session_123",
      "agent_id": "agent_123",
      "status": "string",
      "started_at": "string",
      "conversation": [
        {}
      ],
      "transcript": "string"
    }
  ],
  "count": 0
}

Update live session

PATCH/v1/agent/sessions/{session_id}

Change a live call's prompt and/or variables. It applies from the agent's **next turn**.

Path parameters

session_idstringrequired

Request body application/json

system_promptstring
dynamic_variablesobject

Returns

200 with the fields below.

session_idstringrequired

The live session that was changed.

statusstringrequired

The session's state, `active` while the call is live.

updatedarray<string>required

Which settings changed: `system_prompt`, `dynamic_variables`, or both.

applies_fromstringrequired

When the change takes effect. Always `next_turn`.

curl -X PATCH "https://api.dialgem.com/v1/agent/sessions/SESSION_ID" \
  -H "X-API-Key: $DIALGEM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "system_prompt": "string"
  }'
Response 200
{
  "session_id": "session_123",
  "status": "string",
  "updated": [
    "string"
  ],
  "applies_from": "string"
}

Make the agent say something

POST/v1/agent/sessions/{session_id}/say

Make the agent say `text` on the live call, in its own voice. Answers at once with `status: speaking`.

Path parameters

session_idstringrequired

Request body application/json

textstringrequired
interruptboolean

Default false

Returns

200 with the fields below.

statusstringrequired

Always `speaking`: the agent has been told to say the line.

curl -X POST "https://api.dialgem.com/v1/agent/sessions/SESSION_ID/say" \
  -H "X-API-Key: $DIALGEM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "string"
  }'
Response 200
{
  "status": "string"
}

Release live session

POST/v1/agent/sessions/{session_id}/release

Hand a taken-over call back to the agent, whoever has it (for when the socket that took it is gone).

Path parameters

session_idstringrequired

Returns

200 with the fields below.

statusstringrequired

`handed_back` when the call went back to the agent, or `not_taken_over` when nobody had it.

reasonstring

Why the call was handed back. Present only with `handed_back`.

curl -X POST "https://api.dialgem.com/v1/agent/sessions/SESSION_ID/release" \
  -H "X-API-Key: $DIALGEM_API_KEY"
Response 200
{
  "status": "string",
  "reason": "string"
}