~/docs/api-reference / messages
Messages
List and send messages via the v1 API.
Messages are the individual exchanges within a chat. Each message has a role (user or assistant), a content body, and a status that tracks its lifecycle.
GET /api/v1/chats/:chatId/messages
List all messages in a chat
shell
curl http://localhost:3000/api/v1/chats/f216fd8d-43b6-48aa-976b-af88227f86c3/messages \
-H "Authorization: Bearer op_api_your_key_here"Response: {"messages": [...]} — each message has:
role: either"user"or"assistant".content: the text of the message.status: tracks the lifecycle ("pending","streaming","complete","error", or"compacted").createdAt: timestamp of when the message was created.
POST /api/v1/chats/:chatId/messages
Send a message and trigger the orchestrator
shell
curl -X POST http://localhost:3000/api/v1/chats/f216fd8d-43b6-48aa-976b-af88227f86c3/messages \
-H "Authorization: Bearer op_api_your_key_here" \
-H "Content-Type: application/json" \
-d '{"content": "Hello!", "mode": "agent"}'| Field | Type | Description |
|---|---|---|
| content | string | Required. The message text. |
| mode | string | agent (default) or chat. |
Flow: This endpoint is asynchronous. It appends the user message, queues the AI orchestrator for processing in the background, and immediately returns the updated chat object with status: "pending". To get the AI's response, you must poll the GET /api/v1/chats/:chatId endpoint until the chat status returns to idle.
json
{
"chat": {
"id": "f216fd8d-...",
"title": "Hello!",
"status": "pending",
"model": "deepseek/deepseek-v3.2",
"createdAt": "2026-06-09T06:48:42.694Z",
"updatedAt": "2026-06-09T06:48:51.907Z"
}
}Error Responses
| Code | Meaning |
|---|---|
| 400 | Missing content or workspaceId. |
| 401 | Invalid or missing API key. |
| 404 | Chat not found. |
| 500 | Internal error — check server logs. |
View chat management endpoints.Chats