The Chat API lets you create conversations with assistants, send messages, and receive streamed AI responses in real time via Server-Sent Events (SSE).
List Conversations
Returns conversations for the authenticated user within a workspace. Uses offset-based pagination.
| Parameter | Type | Required | Description |
|---|
assistantId | string | No | Filter conversations by assistant. |
limit | integer | No | Items per page. Default 25, max 100. |
offset | integer | No | Items to skip. Default 0. |
Response 200 OK
Get Conversation
Retrieves a single conversation with metadata.
Delete Conversation
Permanently deletes a conversation and all its messages.
Response 204 No Content
Create Message (Streaming)
Sends a user message and streams the assistant’s response via Server-Sent Events.
| Parameter | Type | Required | Description |
|---|
content | string | Yes | The user’s message text. |
attachments | array | No | List of file attachment objects. See File Attachments below. |
webSearch | boolean | No | Enable web search for this message. Default false. |
If the conversation ID does not exist, the API creates a new conversation automatically.
The streaming response uses the text/event-stream content type. Each event is a JSON object on a data: line.
Event Types
| Type | Description | Fields |
|---|
text-delta | A chunk of the assistant’s text response. | textDelta |
tool-call | The assistant is invoking a tool (e.g., knowledge base search). | toolCallId, toolName, args |
tool-result | The result returned by the tool. | toolCallId, result |
finish | The response is complete. | messageId, usage |
error | An error occurred during generation. | error, code |
Always handle the error event type. Errors can occur mid-stream if the model encounters an issue, the context window is exceeded, or a rate limit is reached.
List Messages
Returns messages in a conversation. Uses cursor-based pagination, ordered from newest to oldest.
Response 200 OK
Get Message
Retrieves a single message by ID.
File Attachments
Messages can include file attachments uploaded via Uploadcare.
| Field | Type | Required | Description |
|---|
name | string | Yes | Original file name. |
url | string | Yes | Uploadcare CDN URL for the file. |
contentType | string | Yes | MIME type of the file. |
Supported file types include PDF, TXT, DOCX, PNG, JPG, and CSV. Maximum file size is 10 MB per attachment and 3 attachments per message.
Web Search
Set webSearch: true on a message to allow the assistant to search the web for current information. When active, the assistant may emit tool-call and tool-result events for the webSearch tool before generating its response.