---
title: "Send a message to a thread"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.cloudraker.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Send a message to a thread

Path: CloudRaker Workspace API › Me

`POST /me/threads/{threadId}/messages`

Adds a turn to a thread. If the latest run in the thread is still live (not terminal, not paused) the message steers it in place; otherwise a successor run is started in the same thread, carrying the previous conversation forward as context (spec §A.4). A thread holds at most one non-terminal run. Authorization: whoever may contribute to the thread’s container — its owner for a desk thread, any holder of `space:contribute` for a thread in a space (everyone else gets 404). Gated by `AGENTS_ENABLED`; disabled → 404. Returns `{ threadId, runId, steered, status, spaceId }` — 200 when steered, 201 for a successor run. 409 `agent_busy` when the run’s steering queue is full: with several participants that is routine, so retry after `retryAfterMs` (default ~3 s) rather than surfacing an error.

## Authentication

- `bearerAuth`, http, header `Authorization`

## Path parameters

- `threadId` (`sendThreadMessage.path.threadId`; string, required)

## Request body

_Required._

- `message` (`sendThreadMessage.message`; string, required)
  - minLength 1; maxLength 4000

## Example request

```json
{
  "message": "string"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.cloudraker.com/me/threads/<threadId>/messages' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "message": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/me/threads/<threadId>/messages';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({message: 'string'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.cloudraker.com/me/threads/<threadId>/messages"

payload = { "message": "string" }
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

The steered run.

#### Example

```json
{
  "threadId": "string",
  "runId": "string",
  "steered": true,
  "status": "string",
  "spaceId": "string"
}
```

- `threadId` (`sendThreadMessage.response.200.threadId`; string, required)
- `runId` (`sendThreadMessage.response.200.runId`; string, required)
- `steered` (`sendThreadMessage.response.200.steered`; boolean, required)
- `status` (`sendThreadMessage.response.200.status`; string, required)
- `spaceId` (`sendThreadMessage.response.200.spaceId`; string, required)

### 201

A new successor run.

#### Example

```json
{
  "threadId": "string",
  "runId": "string",
  "steered": true,
  "status": "string",
  "spaceId": "string"
}
```

- `threadId` (`sendThreadMessage.response.201.threadId`; string, required)
- `runId` (`sendThreadMessage.response.201.runId`; string, required)
- `steered` (`sendThreadMessage.response.201.steered`; boolean, required)
- `status` (`sendThreadMessage.response.201.status`; string, required)
- `spaceId` (`sendThreadMessage.response.201.spaceId`; string, required)

### 400

Validation Error

#### Example

```json
{
  "success": false,
  "error": [
    null
  ],
  "data": null
}
```

- `success` (`sendThreadMessage.response.400.success`; boolean, required)
  - one of `false`
- `error` (`sendThreadMessage.response.400.error`; array<unknown>, required)
- `data` (`sendThreadMessage.response.400.data`; unknown, required)

### 404

Agents disabled, unknown thread, or no access to its container.

### 409

The agent is busy (`agent_busy`, with `queueDepth`/`retryAfterMs`).


Source: https://docs.cloudraker.com/workspace/api/me/send-thread-message/index.md
