> This page is for Workspace app.

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

# Comment on a work session, waking any agent it mentions

POST https://api.cloudraker.com/workspace/sessions/{sessionId}/entries
Content-Type: application/json

Starts one turn per mentioned agent, then appends the caller’s `comment` entry to the timeline — in that order, so `turn_started` holds the lower `seq`. The comment is appended WHATEVER the turns answer: a human’s message is always an entry (spec §5.4). An agent that refuses is named in `refused` with its reason, and a `system` entry below the comment says so on the timeline; the call still answers 201, with `turns` carrying only the turns that started (`[]` when none did). A refused agent still joins the session’s roster, so it shows in the right rail. A turn is scoped to the SESSION’s working set plus whatever this comment attaches in `fileIds`, so a caller never re-sends the session’s own files. An attachment JOINS that working set for good — it appears in the session’s `files`, in the right rail and in every later turn’s scope, instead of living for one turn and vanishing (R9-05). A session file that was deleted is left out of the turn’s scope but stays in the session’s `files`; a `system` entry names the agents that work without it. The appended `comment` carries `startedTurnIds` naming every turn it started, because those turns are written first and therefore hold a LOWER `seq` — that field is the causal link a timeline reader orders by. Every id in `fileIds` must exist and be readable by the caller (`space:read` on the space it lives in), otherwise 404. A mention of an agent that is still working steers its live turn when the scope is unchanged, and starts a SECOND turn (its own frozen snapshot) when it adds a file. **Authorization:** `work_session:comment` on the session, OR `space:contribute` on one of its linked spaces; a desk session is writable only by its owner. Any denial is 404. `mentions` mixes agent ids, agent handles and member user ids, and each is RESOLVED: a member (confirmed against the org directory) gets an inbox row, a published agent takes a turn whose capability belt (space type, creatable space types, delegable agents, resolved connectors) is resolved HERE as the caller and frozen into that turn’s run snapshot — one grant per turn. A mention that is neither is dropped and returned in `unresolvedMentions` so the composer can flag an unknown `@name`; a mention of a real but unpublished or archived agent is 422 `agent_not_published`. Responds 201 `{ data: { entry, turns, unresolvedMentions, refused } }`.

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

## Authentication

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

## Request

### Path parameters

- `sessionId` (string, required)

### Body (application/json)

This endpoint expects an AppendWorkspaceEntryBody.

- `text` (string, required)
- `requestId` (string, optional)
- `threadId` (string, optional)
- `mentions` (list of string, optional, default: [])
- `fileIds` (list of string, optional) — Files this comment ATTACHES. The turn runs on the session’s working set plus these, so re-sending the session’s own files is never necessary; a file that is new to the session widens the scope and starts a successor turn instead of steering the live one.

## Response

### 201

The appended entry and the turns it started.

- `data` (AppendWorkspaceEntryResultData, required)

## Errors

### 400 Bad Request Error

`cannot_share_desk` — a desk session is private by identity, so a human mention on one cannot take effect. Relink it to a shared space first.

- `any`

### 404 Not Found Error

No such session, the caller may not write it, or an attached file does not exist or cannot be read by the caller.

- `any`

### 409 Conflict Error

`session_has_no_space` — the session is linked to no space, so a mentioned agent has nowhere to run; relink it first. `session_archived` — the session is archived, so it takes no new work; reopen it with `PATCH { archive: false }` first.

- `any`

### 422 Unprocessable Entity Error

`agent_not_published` — a mentioned agent is unpublished or archived.

- `any`

## Types

### AppendWorkspaceEntryResultData

- `entry` (WorkSessionEntry, required)
- `turns` (list of WorkSessionTurn, required)
- `unresolvedMentions` (list of string, required)
- `refused` (list of AppendWorkspaceEntryResultDataRefusedItems, 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)

### WorkSessionTurn

- `id` (string, required)
- `sessionId` (string, required)
- `agentId` (string, required)
- `agentVersionId` (string, required)
- `harness` (enum, required)
  - Allowed values: `native`, `sandbox`
- `status` (enum, required)
  - Allowed values: `running`, `waiting_approval`, `waiting_action`, `waiting_user`, `paused`, `completed`, `failed`, `cancelled`
- `startedBy` (WorkSessionSender, required)
- `reason` (enum, required)
  - Allowed values: `mention`, `trigger`, `handoff`, `steer`, `assistant`
- `threadId` (string, required, nullable)
- `parentTurnId` (string, required, nullable)
- `nativeRunId` (string, required, nullable)
- `nativeSpaceId` (string, required, nullable)
- `sandboxId` (string, required, nullable)
- `startedAt` (datetime, required)
- `finishedAt` (string, required, nullable)
- `summary` (string, required, nullable)
- `error` (string, required, nullable)
- `outcome` ("incomplete", optional, nullable)
- `waitingReason` (enum, optional, nullable)
  - Allowed values: `sandbox_capacity`, `sandbox_provisioning`, `budget_exceeded`
- `fileIds` (list of string, optional)

### AppendWorkspaceEntryResultDataRefusedItems

- `agentId` (string, required)
- `handle` (string, required)
- `reason` (string, required)

### 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
    },
    "turns": [
      {
        "id": "string",
        "sessionId": "string",
        "agentId": "string",
        "agentVersionId": "string",
        "harness": "native",
        "status": "running",
        "startedBy": {
          "kind": "user",
          "id": "string",
          "name": "string",
          "avatarUrl": "string",
          "source": "web"
        },
        "reason": "mention",
        "threadId": "string",
        "parentTurnId": "string",
        "nativeRunId": "string",
        "nativeSpaceId": "string",
        "sandboxId": "string",
        "startedAt": "2024-01-15T09:30:00Z",
        "finishedAt": "string",
        "summary": "string",
        "error": "string",
        "outcome": "string",
        "waitingReason": "sandbox_capacity",
        "fileIds": [
          "string"
        ]
      }
    ],
    "unresolvedMentions": [
      "string"
    ],
    "refused": [
      {
        "agentId": "string",
        "handle": "string",
        "reason": "string"
      }
    ]
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.cloudraker.com/workspace/sessions/sessionId/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/workspace/sessions/sessionId/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/workspace/sessions/sessionId/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/workspace/sessions/sessionId/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/workspace/sessions/sessionId/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/workspace/sessions/sessionId/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/workspace/sessions/sessionId/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/workspace/sessions/sessionId/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()
```