---
title: "Start a thread with the default agent"
---

> 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.

# Start a thread with the default agent

Path: CloudRaker Workspace API › Me

`POST /me/threads`

Starts a new conversation thread: resolves the container, mints a `threadId`, and creates the thread’s first agent run there from the founding `prompt` (1–4000 chars) and optional `fileIds` (1–200). Omit `spaceId` for the caller’s private desk (the default); pass a `spaceId` to start the thread in a space, where every holder of `space:contribute` can read and continue it. Authorization: any real organization member (embed tokens and API keys have no desk → 404); a named space requires `space:contribute` (404 otherwise) and may never be a desk id (400 `cannot_target_desk`). Gated by `AGENTS_ENABLED`; disabled → 404. Returns 201 `{ threadId, runId, steered: false, status, spaceId }`.

## Authentication

- `bearerAuth`, http, header `Authorization`

## Request body

_Required._

- `prompt` (`createThread.prompt`; string, required) — The request that founds the thread (frozen into the first run’s snapshot).
  - minLength 1; maxLength 4000
- `playbookId` (`createThread.playbookId`; string, optional) — The agent the thread talks to. Omit for the default agent. Every run in the thread (including rollover successors) executes this agent.
  - minLength 1; maxLength 128
- `fileIds` (`createThread.fileIds`; array<string>, optional) — Files to attach to the first run. Omit for a prompt-only start.
  - minLength 1
- `spaceId` (`createThread.spaceId`; string, optional) — Start the thread in this space instead of the caller’s private desk — everyone who holds `space:contribute` on it can then read and continue the thread. Requires `space:contribute` (404 otherwise). A desk id (`me:…`) is never a valid target (400 `cannot_target_desk`).
  - minLength 1; example `"9f2c1c3e-…"`

## Example request

```json
{
  "prompt": "string",
  "playbookId": "string",
  "fileIds": [
    "string"
  ],
  "spaceId": "9f2c1c3e-…"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://api.cloudraker.com/me/threads \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "string",
  "playbookId": "string",
  "fileIds": [
    "string"
  ],
  "spaceId": "9f2c1c3e-…"
}
'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/me/threads';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    prompt: 'string',
    playbookId: 'string',
    fileIds: ['string'],
    spaceId: '9f2c1c3e-…'
  })
};

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"

payload = {
    "prompt": "string",
    "playbookId": "string",
    "fileIds": ["string"],
    "spaceId": "9f2c1c3e-…"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 201

The thread’s first run.

#### Example

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

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

### 400

`cannot_target_desk` — a desk is never a named target.

### 404

Agents disabled, no desk, or the space is not contributable.


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