Conversations
Read raw conversation messages
API key issued to a Sonzai project. Format: Bearer sk_....
In: header
Path Parameters
Agent UUID or URL-encoded agent name
Query Parameters
End-user identifier
Runtime session identifier
1-based page number
int64Page size. Defaults to 100, capped at 200.
int64Response Body
application/json
application/problem+json
curl -X GET "https://loading/api/v1/agents/string/conversations?user_id=string&session_id=string"{
"$schema": "/api/v1/schemas/GetAgentConversationOutputBody.json",
"agent_id": "string",
"has_more": true,
"messages": [
{
"author": "string",
"content": "string",
"role": "string",
"timestamp": "2019-08-24T14:15:22Z",
"tool_call_id": "string",
"tool_calls": [
{
"function": {
"arguments": "string",
"name": "string"
},
"id": "string",
"type": "string"
}
]
}
],
"page": 0,
"page_size": 0,
"session_id": "string",
"total": 0,
"user_id": "string"
}{
"$schema": "/api/v1/schemas/ErrorModel.json",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "string",
"message": "string",
"value": null
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example"
}List conversations
API key issued to a Sonzai project. Format: Bearer sk_....
In: header
Query Parameters
Project UUID; defaults to authenticated project/default project
Filter by channel type
Filter by agent id
Filter by user id
Filter by controller: agent|human
Filter by status: open|snoozed|closed
Search user, agent, or preview text
Legacy alias for q
Legacy alias for agent_id
Legacy memory-timeline tier filter
Max items (default 50, max 100)
int64Pagination cursor
Response Body
application/json
application/problem+json
curl -X GET "https://loading/api/v1/conversations"{
"$schema": "/api/v1/schemas/ListConversationsOutputBody.json",
"conversations": [
{
"agent": "string",
"agent_name": "string",
"channel": "string",
"controller": "string",
"controller_operator_id": "string",
"cost_usd": 0.1,
"created_at": "2019-08-24T14:15:22Z",
"crm_lead_id": "string",
"crm_owner_id": "string",
"handoffs": [
{
"from": "string",
"to": "string",
"when": "string"
}
],
"id": "string",
"last_activity": "2019-08-24T14:15:22Z",
"last_message": "string",
"model": "string",
"session_id": "string",
"status": "string",
"tags": [
"string"
],
"tier": "string",
"title": "string"
}
],
"has_more": true,
"items": [
{
"agent": "string",
"agent_name": "string",
"channel": "string",
"controller": "string",
"controller_operator_id": "string",
"cost_usd": 0.1,
"created_at": "2019-08-24T14:15:22Z",
"crm_lead_id": "string",
"crm_owner_id": "string",
"handoffs": [
{
"from": "string",
"to": "string",
"when": "string"
}
],
"id": "string",
"last_activity": "2019-08-24T14:15:22Z",
"last_message": "string",
"model": "string",
"session_id": "string",
"status": "string",
"tags": [
"string"
],
"tier": "string",
"title": "string"
}
],
"next_cursor": "string",
"total": 0
}{
"$schema": "/api/v1/schemas/ErrorModel.json",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "string",
"message": "string",
"value": null
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example"
}Push a proactive agent message to a user's connected channel
API key issued to a Sonzai project. Format: Bearer sk_....
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/problem+json
curl -X POST "https://loading/api/v1/conversations/push" \ -H "Content-Type: application/json" \ -d '{ "agent_id": "string", "content": "string", "user_id": "string" }'{
"$schema": "/api/v1/schemas/PushConversationMessageOutputBody.json",
"channel_message_id": "string",
"channel_type": "string",
"conversation_id": "string",
"delivery_status": "string",
"external_id": "string",
"session_id": "string",
"used_template": true
}{
"$schema": "/api/v1/schemas/ErrorModel.json",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "string",
"message": "string",
"value": null
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example"
}Stream conversation events
API key issued to a Sonzai project. Format: Bearer sk_....
In: header
Query Parameters
Project UUID; defaults to authenticated project/default project
Response Body
text/event-stream
application/problem+json
curl -X GET "https://loading/api/v1/conversations/stream"{
"$schema": "/api/v1/schemas/ErrorModel.json",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "string",
"message": "string",
"value": null
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example"
}Get conversation
API key issued to a Sonzai project. Format: Bearer sk_....
In: header
Path Parameters
Conversation UUID
Response Body
application/json
application/problem+json
curl -X GET "https://loading/api/v1/conversations/string"{
"$schema": "/api/v1/schemas/ConversationDetailBody.json",
"conversation": {
"$schema": "/api/v1/schemas/OmnichannelConversationDTO.json",
"agent_id": "string",
"channel_type": "string",
"connection_id": "string",
"controller": "string",
"controller_operator_id": "string",
"conversation_id": "string",
"created_at": "2019-08-24T14:15:22Z",
"handoffs": null,
"last_direction": "string",
"last_message_at": "2019-08-24T14:15:22Z",
"last_message_preview": "string",
"meta": null,
"project_id": "string",
"session_id": "string",
"status": "string",
"takeover_started_at": "2019-08-24T14:15:22Z",
"unread_count": 0,
"updated_at": "2019-08-24T14:15:22Z",
"user_id": "string"
},
"source": "string"
}{
"$schema": "/api/v1/schemas/ErrorModel.json",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "string",
"message": "string",
"value": null
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example"
}Update conversation
API key issued to a Sonzai project. Format: Bearer sk_....
In: header
Path Parameters
Conversation UUID
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/problem+json
curl -X PATCH "https://loading/api/v1/conversations/string" \ -H "Content-Type: application/json" \ -d '{}'{
"$schema": "/api/v1/schemas/OmnichannelConversationDTO.json",
"agent_id": "string",
"channel_type": "string",
"connection_id": "string",
"controller": "string",
"controller_operator_id": "string",
"conversation_id": "string",
"created_at": "2019-08-24T14:15:22Z",
"handoffs": null,
"last_direction": "string",
"last_message_at": "2019-08-24T14:15:22Z",
"last_message_preview": "string",
"meta": null,
"project_id": "string",
"session_id": "string",
"status": "string",
"takeover_started_at": "2019-08-24T14:15:22Z",
"unread_count": 0,
"updated_at": "2019-08-24T14:15:22Z",
"user_id": "string"
}{
"$schema": "/api/v1/schemas/ErrorModel.json",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "string",
"message": "string",
"value": null
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example"
}Permanently delete a conversation and its transcript
API key issued to a Sonzai project. Format: Bearer sk_....
In: header
Path Parameters
Conversation UUID
Response Body
application/json
application/problem+json
curl -X DELETE "https://loading/api/v1/conversations/string"{
"$schema": "/api/v1/schemas/DeleteConversationOutputBody.json",
"conversation_id": "string",
"deleted": true
}{
"$schema": "/api/v1/schemas/ErrorModel.json",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "string",
"message": "string",
"value": null
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example"
}List conversation messages
API key issued to a Sonzai project. Format: Bearer sk_....
In: header
Path Parameters
Conversation UUID
Query Parameters
Max messages (default 50, max 200)
int64Pagination cursor
Response Body
application/json
application/problem+json
curl -X GET "https://loading/api/v1/conversations/string/messages"{
"$schema": "/api/v1/schemas/ListConversationMessagesOutputBody.json",
"has_more": true,
"items": [
{
"attachments": null,
"author_id": "string",
"author_type": "string",
"channel_message_id": "string",
"content": "string",
"conversation_id": "string",
"created_at": "2019-08-24T14:15:22Z",
"delivery_detail": "string",
"delivery_status": "string",
"direction": "string",
"message_id": "string",
"role": "string",
"session_id": "string"
}
],
"messages": [
{
"attachments": null,
"author_id": "string",
"author_type": "string",
"channel_message_id": "string",
"content": "string",
"conversation_id": "string",
"created_at": "2019-08-24T14:15:22Z",
"delivery_detail": "string",
"delivery_status": "string",
"direction": "string",
"message_id": "string",
"role": "string",
"session_id": "string"
}
],
"next_cursor": "string"
}{
"$schema": "/api/v1/schemas/ErrorModel.json",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "string",
"message": "string",
"value": null
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example"
}Send operator message
API key issued to a Sonzai project. Format: Bearer sk_....
In: header
Path Parameters
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/problem+json
curl -X POST "https://loading/api/v1/conversations/string/messages" \ -H "Content-Type: application/json" \ -d '{ "content": "string" }'{
"$schema": "/api/v1/schemas/OmnichannelConversationDTO.json",
"agent_id": "string",
"channel_type": "string",
"connection_id": "string",
"controller": "string",
"controller_operator_id": "string",
"conversation_id": "string",
"created_at": "2019-08-24T14:15:22Z",
"handoffs": null,
"last_direction": "string",
"last_message_at": "2019-08-24T14:15:22Z",
"last_message_preview": "string",
"meta": null,
"project_id": "string",
"session_id": "string",
"status": "string",
"takeover_started_at": "2019-08-24T14:15:22Z",
"unread_count": 0,
"updated_at": "2019-08-24T14:15:22Z",
"user_id": "string"
}{
"$schema": "/api/v1/schemas/ErrorModel.json",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "string",
"message": "string",
"value": null
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example"
}Mark conversation read
API key issued to a Sonzai project. Format: Bearer sk_....
In: header
Path Parameters
Conversation UUID
Response Body
application/json
application/problem+json
curl -X POST "https://loading/api/v1/conversations/string/read"{
"$schema": "/api/v1/schemas/OmnichannelConversationDTO.json",
"agent_id": "string",
"channel_type": "string",
"connection_id": "string",
"controller": "string",
"controller_operator_id": "string",
"conversation_id": "string",
"created_at": "2019-08-24T14:15:22Z",
"handoffs": null,
"last_direction": "string",
"last_message_at": "2019-08-24T14:15:22Z",
"last_message_preview": "string",
"meta": null,
"project_id": "string",
"session_id": "string",
"status": "string",
"takeover_started_at": "2019-08-24T14:15:22Z",
"unread_count": 0,
"updated_at": "2019-08-24T14:15:22Z",
"user_id": "string"
}{
"$schema": "/api/v1/schemas/ErrorModel.json",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "string",
"message": "string",
"value": null
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example"
}Take over conversation
API key issued to a Sonzai project. Format: Bearer sk_....
In: header
Path Parameters
Query Parameters
Response Body
application/json
application/problem+json
curl -X POST "https://loading/api/v1/conversations/string/takeover"{
"$schema": "/api/v1/schemas/OmnichannelConversationDTO.json",
"agent_id": "string",
"channel_type": "string",
"connection_id": "string",
"controller": "string",
"controller_operator_id": "string",
"conversation_id": "string",
"created_at": "2019-08-24T14:15:22Z",
"handoffs": null,
"last_direction": "string",
"last_message_at": "2019-08-24T14:15:22Z",
"last_message_preview": "string",
"meta": null,
"project_id": "string",
"session_id": "string",
"status": "string",
"takeover_started_at": "2019-08-24T14:15:22Z",
"unread_count": 0,
"updated_at": "2019-08-24T14:15:22Z",
"user_id": "string"
}{
"$schema": "/api/v1/schemas/ErrorModel.json",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "string",
"message": "string",
"value": null
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example"
}Release conversation takeover
API key issued to a Sonzai project. Format: Bearer sk_....
In: header
Path Parameters
Response Body
application/json
application/problem+json
curl -X DELETE "https://loading/api/v1/conversations/string/takeover"{
"$schema": "/api/v1/schemas/OmnichannelConversationDTO.json",
"agent_id": "string",
"channel_type": "string",
"connection_id": "string",
"controller": "string",
"controller_operator_id": "string",
"conversation_id": "string",
"created_at": "2019-08-24T14:15:22Z",
"handoffs": null,
"last_direction": "string",
"last_message_at": "2019-08-24T14:15:22Z",
"last_message_preview": "string",
"meta": null,
"project_id": "string",
"session_id": "string",
"status": "string",
"takeover_started_at": "2019-08-24T14:15:22Z",
"unread_count": 0,
"updated_at": "2019-08-24T14:15:22Z",
"user_id": "string"
}{
"$schema": "/api/v1/schemas/ErrorModel.json",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "string",
"message": "string",
"value": null
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example"
}