Create a conversation for realtime voice and text interactions and background work events.
Realtime is currently in beta. API definitions, event structures, and behavior may change. Monitor documentation updates and validate compatibility before using it in production.
POST /api/v1/forward/realtime/conversations
Headers
| Header | Required | Description |
|---|---|---|
| Authorization | Yes | Bearer <PAT or SAT> |
| Content-Type | Yes | application/json |
| Idempotency-Key | Yes | An application-generated identifier for the create operation. It must be 1–256 bytes with no leading or trailing whitespace; a UUID is recommended. Reuse the same value and request body when retrying the same operation. |
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
| identity_id | string | Yes | ID of an enabled Identity accessible within the current authentication scope. It must be 1–128 characters with no leading or trailing whitespace or control characters. |
| template_id | string | Yes | ID of a Template accessible within the current authentication scope. It must be 1–128 characters with no leading or trailing whitespace or control characters. |
| title | string or null | No | Defaults to null. After trimming, it must contain 1–256 characters and no control characters. |
| metadata | object or null | No | Defaults to {}; null is treated as {}. The normalized stored text must not exceed 16 KiB and must not contain U+0000. |
| config | object | No | Realtime configuration for the conversation. When omitted, the service resolves the default configuration. null is not accepted. |
| config.audio | object | No | Audio configuration. |
| config.audio.output | object | No | Output audio configuration. |
| config.audio.output.voice | string | No | Preset voice identifier. Only the values in the following table are accepted. The value is fixed after creation and cannot be changed. |
Preset voices
| voice | Name |
|---|---|
longanqian | Default |
longanlingxin | Longan Lingxin |
longanlingxi | Longan Lingxi |
longanxiaoxin | Longan Xiaoxin |
longanlufeng | Longan Lufeng |
Example request
Example response
HTTP 201 Created
Response fields
| Field | Type | Description |
|---|---|---|
| id | string | Conversation ID. |
| type | string | Always voice.conversation. |
| status | string | ready when creation succeeds. |
| title | string or null | Conversation title. |
| metadata | object | Business metadata. |
| config | object | Complete effective configuration resolved and persisted by the service. |
| config.audio.output.voice | string | Output voice fixed for the conversation. |
| created_at | string | Creation time in RFC 3339 format. |
| updated_at | string | Update time in RFC 3339 format. |
Idempotent retries
- The same
Idempotency-Keyand request body replay the first create result. - A replayed response includes
Idempotency-Replayed: true. - Using the same
Idempotency-Keywith a different request body returns409 idempotency_conflict. - If the initial request is still being processed, the service returns
409 idempotency_key_in_progress. Use the interval inRetry-Afterbefore retrying.
Errors
| HTTP | Code | Trigger |
|---|---|---|
| 400 | invalid_request, invalid_identity_id, invalid_template_id, invalid_title, invalid_metadata | The request parameters are invalid. |
| 400 | invalid_voice | config.audio.output.voice is not supported. |
| 400 | invalid_idempotency_key | The idempotency header is missing or invalid. |
| 401 | authentication_required, gateway TOKEN_INVALID | The PAT or SAT is invalid or expired, or a Service Account Key was used directly. |
| 403 | permission_error, identity_mismatch | The SAT is not bound to an available Workspace, or an Identity-scoped SAT specifies a different Identity. |
| 404 | identity_not_found | The Identity was not found within the current authentication scope. |
| 409 | idempotency_conflict | The same key cannot be used for different requests. |
| 409 | idempotency_key_in_progress | A request with the same key is still being processed. See Retry-After for the retry interval. |
| 409 | conversation_not_ready, conversation_initialization_conflict | The conversation is not ready or initialization conflicts. |
| 422 | identity_disabled | The Identity is disabled. |
| 422 | conversation_initialization_failed | Conversation initialization failed. |
| 500 | conversation_persistence_error, conversation_state_invalid, template_config_read_failed, internal_error | An internal service error occurred. |
| 502 | forward_unavailable, forward_protocol_error | A dependent service failed. |
| 503 | idempotency_unavailable | The service is temporarily unavailable. |

