> This page is for Paperwork API.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.cloudraker.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.cloudraker.com/_mcp/server.

# Post a message to a work session

POST https://api.cloudraker.com/v1/work-sessions/{id}/entries
Content-Type: application/json

Writes your message onto the timeline and starts one turn per agent you mention.

`mentions` takes agent handles or ids. A handle that resolves to no published agent is returned in `unresolvedMentions` and starts nothing — it is never an error; an agent whose turn the platform could not start is returned in `failedMentions`, so you can retry that one. `startedTurnIds` names the turns this message began; a mention of an agent that is already working steers its live turn instead and is not listed. Files in `fileIds` join the session's working set for good.

Turns start before the message is written, so a `turn_started` entry holds a lower `seq` than the message that caused it; the message names the turns it started.

**Learn more:** [Work sessions](https://docs.cloudraker.com/paperwork/api/overview)

Reference: https://docs.cloudraker.com/paperwork/api/work-sessions/append-work-session-entry

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `id` (string, required)

### Body (application/json)

This endpoint expects an AppendWorkSessionEntryBody.

- `text` (string, required)
- `mentions` (list of string, optional, default: [])
- `fileIds` (list of string, optional, default: [])

## Response

### 201

The appended entry and the turns it started.

- `data` (AppendWorkSessionEntryResultData, required)

## Errors

### 400 Bad Request Error

Validation Error

- `success` (boolean, required)
- `error` (list of any, required)
- `data` (any, required)

### 401 Unauthorized Error

Missing or invalid credential.

- `any`

### 403 Forbidden Error

The credential may not use the /v1 API.

- `any`

### 404 Not Found Error

Unknown session id, or an attached file you may not read.

- `any`

### 409 Conflict Error

`session_has_no_space` — the session has no space to run a turn in.

- `any`

### 429 Too Many Requests Error

Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.

- `code` (enum, required)
  - Allowed values: `rate_limited`
- `message` (string, required)
- `retryable` (boolean, required)
- `requestId` (string, required)
- `docUrl` (string, optional)

### 503 Service Unavailable Error

`turn_start_failed` — no mentioned agent could be started. Retry.

- `any`

## Types

### AppendWorkSessionEntryResultData

- `entry` (WorkSessionEntry, required)
- `startedTurnIds` (list of string, required)
- `unresolvedMentions` (list of string, required)
- `failedMentions` (list of string, required)

### WorkSessionEntry

- `seq` (integer, required)
- `id` (string, required)
- `kind` (enum, required)
  - Allowed values: `comment`, `system`, `turn_started`, `turn_finished`, `turn_message`, `approval`, `task`, `question`, `artifact`, `commit`, `handoff`, `trigger`
- `at` (datetime, required)
- `role` (enum, required)
  - Allowed values: `user`, `assistant`, `system`
- `author` (WorkSessionSender, required)
- `threadId` (string, required, nullable)
- `turnId` (string, required, nullable)
- `parts` (list of map from string to any, required)
- `startedTurnIds` (list of string, required)
- `updatedSeq` (integer, required, nullable)

### WorkSessionSender

- `kind` (enum, required)
  - Allowed values: `user`, `agent`, `api_key`, `trigger`, `external`
- `id` (string, required)
- `name` (string, required)
- `avatarUrl` (string, optional)
- `source` (enum, optional)
  - Allowed values: `web`, `desktop`, `api`, `email`, `webhook`, `schedule`, `slack`, `assistant`, `manual`, `trigger`

## Examples

**Request**

```json
{
  "text": "string"
}
```

**Response**

```json
{
  "data": {
    "entry": {
      "seq": 1,
      "id": "string",
      "kind": "comment",
      "at": "2024-01-15T09:30:00Z",
      "role": "user",
      "author": {
        "kind": "user",
        "id": "string",
        "name": "string",
        "avatarUrl": "string",
        "source": "web"
      },
      "threadId": "string",
      "turnId": "string",
      "parts": [
        {}
      ],
      "startedTurnIds": [
        "string"
      ],
      "updatedSeq": 1
    },
    "startedTurnIds": [
      "string"
    ],
    "unresolvedMentions": [
      "string"
    ],
    "failedMentions": [
      "string"
    ]
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.cloudraker.com/v1/work-sessions/id/entries"

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

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

print(response.json())
```

```javascript
const url = 'https://api.cloudraker.com/v1/work-sessions/id/entries';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"text":"string"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.cloudraker.com/v1/work-sessions/id/entries"

	payload := strings.NewReader("{\n  \"text\": \"string\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.cloudraker.com/v1/work-sessions/id/entries")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"text\": \"string\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.cloudraker.com/v1/work-sessions/id/entries")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"text\": \"string\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.cloudraker.com/v1/work-sessions/id/entries', [
  'body' => '{
  "text": "string"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.cloudraker.com/v1/work-sessions/id/entries");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"text\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["text": "string"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.cloudraker.com/v1/work-sessions/id/entries")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```