Documentation Index
Fetch the complete documentation index at: https://chatbase.co/docs/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Tag conversations with auserId to track per-user chat history. Once a conversation is associated with a user, you can list all of that user’s conversations and continue any of them by passing the conversationId.
Setting a User ID
PassuserId when creating a new conversation. The ID must follow these constraints:
| Constraint | Value |
|---|---|
| Max length | 128 characters |
| Allowed characters | a-z, A-Z, 0-9, ., _, - |
| When applied | Only on conversation creation (no conversationId in request) |
| Mutability | Immutable — cannot be changed or removed after creation |
userId:
Continuing a Conversation
To send follow-up messages in the same conversation, pass theconversationId from a previous response:
If the conversation has ended (e.g. after a human takeover), the API returns a
CHAT_CONVERSATION_NOT_ONGOING error. Start a new conversation instead.Listing a User’s Conversations
Retrieve all conversations for a specific user withGET /api/v2/agents/{agentId}/users/{userId}/conversations.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
agentId | string | The agent ID. |
userId | string | The user ID to list conversations for. |
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
cursor | string | — | Opaque cursor from a previous response. Omit to start from the beginning. |
limit | integer | 20 | Number of items per page. Range: 1–100. |
Response
Response Fields
| Field | Type | Description |
|---|---|---|
id | string | Conversation ID. |
title | string | null | Conversation title. |
createdAt | number | Unix epoch timestamp (seconds). |
updatedAt | number | Unix epoch timestamp (seconds) of last activity. |
userId | string | null | The user ID associated with this conversation. |
status | string | Conversation status: ongoing, ended, or taken_over. |
Pagination Examples
Full Example
Start a conversation with a user ID
Send the first message with a Save the
userId to associate the conversation:conversationId from the finish event.Exporting All Conversations
The Export conversations endpoint returns all conversations with full message history, regardless of source. This is different from the list endpoints above, which only return API-created conversations.Key differences from list endpoints
| List conversations | Export conversations | |
|---|---|---|
| Sources | API-only | All (Widget, WhatsApp, Messenger, API, etc.) |
| Messages | Not included (metadata only) | Full message history included |
| Tool results | Not included (metadata only) | Sanitized — internal data stripped |
| Tool call input | Not included (metadata only) | Omitted (not useful for export consumers) |
Conversation sources
Exported conversations include asource field indicating where the conversation originated:
API, WhatsApp, Messenger, Instagram, Slack, Salesforce, Zendesk, Zendesk Messaging, Widget or Iframe, Iframe, Email, Agent page, Phone, Android SDK, iOS SDK, Chatbase site, Playground, and others.
Message format
Each conversation includes amessages array. Messages contain parts, which can be:
| Part type | Fields | Description |
|---|---|---|
text | type, text | Text content from the user or assistant |
tool-call | type, toolCallId, toolName | A tool invocation by the agent (input is omitted in exports) |
tool-result | type, toolCallId, toolName, output | The sanitized result of a tool invocation |
Tool result output shape
All tool results in the export follow a unified shape, so you can handle them with a singleswitch on status:
| Status | Shape | Description |
|---|---|---|
success | { status: "success", data?: <T> } | Tool completed successfully. data is present when there is a meaningful payload. |
error | { status: "error", error?: string } | Tool encountered an error. |
pending | { status: "pending" } | Tool execution is still in progress. |
ignored | { status: "ignored" } | Tool was skipped by the user. |
Example response
Paginating through all exports
Related
Streaming
Learn about streaming responses and event types.
Pagination
How cursor-based pagination works across all list endpoints.
Export Conversations
Full API reference for the export endpoint.
Client Actions
How tool calls and tool results work in conversations.