---
title: "Create a built-in Voice AI WebRTC preview session"
description: "Served by the Voice API. Requires a Bearer session for a workspace owner/admin/manager when the V2 flag is enabled. Accepts unsaved turn settings when opted in. Uses automatic WebRTC response control rather than phone bridge control. Returns a short-lived client secret; never log or cache the response. include_api_tools=true additionally requires an owner/admin Bearer JWT and both VOICE_AI_API_TOOLS and VOICE_AI_TELEPHONY_TURN_CONTROL_V2. It advertises enabled saved tools and returns tool_preview.ticket plus names; the signed binding expires after 15 minutes and authorizes real API test actions."
---

> Documentation Index
> Fetch the complete documentation index at: https://developer.channelautomations.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Channel Automation API › Workspaces

`POST /api/workspaces/{workspaceId}/voice-ai/preview/realtime/session`

Served by the Voice API. Requires a Bearer session for a workspace owner/admin/manager when the V2 flag is enabled. Accepts unsaved turn settings when opted in. Uses automatic WebRTC response control rather than phone bridge control. Returns a short-lived client secret; never log or cache the response. include_api_tools=true additionally requires an owner/admin Bearer JWT and both VOICE_AI_API_TOOLS and VOICE_AI_TELEPHONY_TURN_CONTROL_V2. It advertises enabled saved tools and returns tool_preview.ticket plus names; the signed binding expires after 15 minutes and authorizes real API test actions.

## Path parameters

- `workspaceId` (`post/api/workspaces/workspaceId/voice-ai/preview/realtime/session.path.workspaceId`; string, required)

## Request body

- `turn_detection_mode` (`post/api/workspaces/workspaceId/voice-ai/preview/realtime/session.turn_detection_mode`; string, optional)
  - one of `"server_vad"`, `"semantic_vad"`
- `turn_detection_eagerness` (`post/api/workspaces/workspaceId/voice-ai/preview/realtime/session.turn_detection_eagerness`; string, optional)
  - one of `"low"`, `"medium"`, `"high"`, `"auto"`
- `turn_detection_threshold` (`post/api/workspaces/workspaceId/voice-ai/preview/realtime/session.turn_detection_threshold`; number, optional)
  - min 0.35; max 0.85
- `silence_duration_ms` (`post/api/workspaces/workspaceId/voice-ai/preview/realtime/session.silence_duration_ms`; number, optional)
  - min 300; max 1500
- `prefix_padding_ms` (`post/api/workspaces/workspaceId/voice-ai/preview/realtime/session.prefix_padding_ms`; number, optional)
  - min 100; max 1000
- `barge_in_enabled` (`post/api/workspaces/workspaceId/voice-ai/preview/realtime/session.barge_in_enabled`; boolean, optional)
- `include_api_tools` (`post/api/workspaces/workspaceId/voice-ai/preview/realtime/session.include_api_tools`; boolean, optional)
  - default `false`

## Example request

```json
{
  "turn_detection_mode": "server_vad",
  "turn_detection_eagerness": "low",
  "turn_detection_threshold": 0.35,
  "silence_duration_ms": 300,
  "prefix_padding_ms": 100,
  "barge_in_enabled": true,
  "include_api_tools": false
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.channelautomation.com/api/workspaces/<workspaceId>/voice-ai/preview/realtime/session' \
  --header 'Content-Type: application/json' \
  --data '
{
  "turn_detection_mode": "server_vad",
  "turn_detection_eagerness": "low",
  "turn_detection_threshold": 0.35,
  "silence_duration_ms": 300,
  "prefix_padding_ms": 100,
  "barge_in_enabled": true,
  "include_api_tools": false
}
'
```

### TypeScript

```typescript
const url = 'https://api.channelautomation.com/api/workspaces/<workspaceId>/voice-ai/preview/realtime/session';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    turn_detection_mode: 'server_vad',
    turn_detection_eagerness: 'low',
    turn_detection_threshold: 0.35,
    silence_duration_ms: 300,
    prefix_padding_ms: 100,
    barge_in_enabled: true,
    include_api_tools: false
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.channelautomation.com/api/workspaces/<workspaceId>/voice-ai/preview/realtime/session"

payload = {
    "turn_detection_mode": "server_vad",
    "turn_detection_eagerness": "low",
    "turn_detection_threshold": 0.35,
    "silence_duration_ms": 300,
    "prefix_padding_ms": 100,
    "barge_in_enabled": True,
    "include_api_tools": False
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Realtime preview client secret

### 400

Missing provider configuration or invalid turn settings

### 401

Missing or invalid JWT for tool-enabled preview

### 403

Workspace membership or feature requirements not met

### 500

Session creation failed

### 503

Tool preview service unavailable


Source: https://developer.channelautomations.com/api/post-api-workspaces-workspace-id-voice-ai-preview-realtime-session/index.md
