Skip to main content
POST
https://jwhite.tail8bf327.ts.net
/
api
/
v1
/
sessions
Create Session
curl --request POST \
  --url https://jwhite.tail8bf327.ts.net/api/v1/sessions \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "agent_id": 123,
  "session_type": "<string>",
  "metadata": {}
}
'
{
  "success": true,
  "session": {
    "session_id": 456,
    "agent_id": 123,
    "agent_name": "Sales Support Agent",
    "session_type": "agent_voice",
    "status": "active",
    "started_at": "2024-01-15T10:30:00Z",
    "metadata": {
      "source": "web_app",
      "device": "desktop"
    },
    "avatar_id": 1,
    "avatar_name": "Professional Avatar",
    "avatar_url": "https://example.com/avatar.jpg",
    "voice_id": "21m00Tcm4TlvDq8ikWAM"
  },
  "message": "Session started successfully"
}

Authentication

Requires API key authentication (x-api-key header).
x-api-key: ah_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxx

Request Body

agent_id
integer
required
The ID of the agent to start a session in
session_type
string
default:"voice"
Type of session: ‘agent_voice’, ‘agent_video’, ‘agent_chat’ or ‘webrtc_video’
metadata
object
Optional metadata for the session

Request

POST https://jwhite.tail8bf327.ts.net/api/v1/sessions
x-api-key: ah_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Content-Type: application/json

{
  "agent_id": 123,
  "session_type": "agent_voice",
  "metadata": {
    "source": "web_app",
    "device": "desktop"
  }
}

Response

{
  "success": true,
  "session": {
    "session_id": 456,
    "agent_id": 123,
    "agent_name": "Sales Support Agent",
    "session_type": "agent_voice",
    "status": "active",
    "started_at": "2024-01-15T10:30:00Z",
    "metadata": {
      "source": "web_app",
      "device": "desktop"
    },
    "avatar_id": 1,
    "avatar_name": "Professional Avatar",
    "avatar_url": "https://example.com/avatar.jpg",
    "voice_id": "21m00Tcm4TlvDq8ikWAM"
  },
  "message": "Session started successfully"
}
{
  "success": false,
  "error": "Agent not found or access denied"
}

Session Lifecycle

  1. Create Session: Call this endpoint to initiate a new session within a agent
  2. Send Messages: Use the Send Message endpoint to communicate
  3. End Session: Use the End Session endpoint to properly close the session