---
title: "Start a playbook run in a space"
---

> 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 playbook run in a space

Path: CloudRaker Workspace API › Playbooks

`POST /spaces/{spaceId}/playbook-runs`

Starts a new durable agentic run of a playbook in this space. Authorization: requires `space:contribute` on the space (org admins bypass); missing permission → 403. Body: `playbookId` (required — the playbook to run) and `fileScope`, which is either `{ mode: "space" }` (the agent may see all files in the space) or `{ mode: "picked", fileIds: [...] }` (1–200 explicit file ids). Optional `prompt` (1–4000 chars) is the request that founds the run: it is frozen into the run’s immutable snapshot and stays part of the agent’s standing instructions for every turn — use `steer` to say anything after launch. `spaceType` is resolved from the space record server-side and is NOT accepted from the caller. Returns 404 when the space does not exist. On success returns 201 `{ data: PlaybookRun }` — the created run with its immutable snapshot of the playbook captured at launch time.

## Authentication

- `bearerAuth`, http, header `Authorization`

## Path parameters

- `spaceId` (`createPlaybookRun.path.spaceId`; string, required)

## Request body

_Required._

- `playbookId` (`createPlaybookRun.playbookId`; string, required)
  - minLength 1
- `fileScope` (`createPlaybookRun.fileScope`; one of, required)
  - one of:
    - `object`
      - `mode` (`createPlaybookRun.fileScope.1.mode`; string, required)
        - one of `"space"`
    - `object`
      - `mode` (`createPlaybookRun.fileScope.2.mode`; string, required)
        - one of `"picked"`
      - `fileIds` (`createPlaybookRun.fileScope.2.fileIds`; array<string>, required)
        - minLength 1
- `prompt` (`createPlaybookRun.prompt`; string, optional) — The request that founds the run, frozen into its immutable snapshot and kept in the agent’s standing instructions. Use steer for anything after launch.
  - minLength 1; maxLength 4000

## Example request

```json
{
  "playbookId": "string",
  "fileScope": {
    "mode": "space"
  },
  "prompt": "string"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.cloudraker.com/spaces/<spaceId>/playbook-runs' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "playbookId": "string",
  "fileScope": {
    "mode": "space"
  },
  "prompt": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/spaces/<spaceId>/playbook-runs';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({playbookId: 'string', fileScope: {mode: 'space'}, prompt: '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/spaces/<spaceId>/playbook-runs"

payload = {
    "playbookId": "string",
    "fileScope": { "mode": "space" },
    "prompt": "string"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 201

The created playbook run.

#### Example

```json
{
  "data": {
    "id": "string",
    "spaceId": "string",
    "playbookId": "string",
    "playbookVersion": -9007199254740991,
    "playbookName": "string",
    "status": "running",
    "fileScope": {
      "mode": "space"
    },
    "taskProgress": {
      "total": -9007199254740991,
      "completed": -9007199254740991
    },
    "pendingApproval": {
      "id": "string",
      "kind": "pre",
      "actionName": "string",
      "requestedAt": "2019-08-24T14:15:22Z"
    },
    "result": "string",
    "error": "string",
    "startedBy": "string",
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "finishedAt": "2019-08-24T14:15:22Z",
    "currentActivity": "string",
    "snapshot": {
      "playbookId": "string",
      "version": -9007199254740991,
      "name": "string",
      "description": "string",
      "tasks": [
        {
          "id": "string",
          "title": "string",
          "instructions": "string",
          "dependsOn": [
            "string"
          ],
          "executor": "agent",
          "assignee": "string",
          "status": "pending",
          "claimedBy": "string",
          "summary": "string",
          "completedBy": "string",
          "note": "string",
          "fileIds": [
            "string"
          ],
          "completedAt": "2019-08-24T14:15:22Z"
        }
      ],
      "actions": [
        {
          "installedActionId": "string",
          "preApproval": true,
          "postApproval": true,
          "dependsOn": [
            "string"
          ],
          "actionSlug": "string",
          "actionName": "string",
          "trigger": "agent",
          "browserSession": {
            "status": "pairing",
            "createdAt": "2019-08-24T14:15:22Z"
          }
        }
      ],
      "fileScope": {
        "mode": "space"
      }
    }
  }
}
```

- `data` (`createPlaybookRun.response.201.data`; object, required)
  - `id` (`createPlaybookRun.response.201.data.id`; string, required)
  - `spaceId` (`createPlaybookRun.response.201.data.spaceId`; string, required)
  - `playbookId` (`createPlaybookRun.response.201.data.playbookId`; string, required)
  - `playbookVersion` (`createPlaybookRun.response.201.data.playbookVersion`; integer, required)
    - min -9007199254740991; max 9007199254740991
  - `playbookName` (`createPlaybookRun.response.201.data.playbookName`; string, required)
  - `status` (`createPlaybookRun.response.201.data.status`; string, required)
    - one of `"running"`, `"waiting_approval"`, `"waiting_action"`, `"waiting_user"`, `"paused"`, `"completed"`, `"failed"`, `"cancelled"`
  - `fileScope` (`createPlaybookRun.response.201.data.fileScope`; PlaybookFileScope, required)
    - one of:
      - `object`
        - `mode` (`createPlaybookRun.response.201.data.fileScope.1.mode`; string, required)
      - `object`
        - `mode` (`createPlaybookRun.response.201.data.fileScope.2.mode`; string, required)
        - `fileIds` (`createPlaybookRun.response.201.data.fileScope.2.fileIds`; array<string>, required)
          - minLength 1
  - `taskProgress` (`createPlaybookRun.response.201.data.taskProgress`; object, required)
    - `total` (`createPlaybookRun.response.201.data.taskProgress.total`; integer, required)
      - min -9007199254740991; max 9007199254740991
    - `completed` (`createPlaybookRun.response.201.data.taskProgress.completed`; integer, required)
      - min -9007199254740991; max 9007199254740991
  - `pendingApproval` (`createPlaybookRun.response.201.data.pendingApproval`; any of, required)
    - any of:
      - `object`
        - `id` (`createPlaybookRun.response.201.data.pendingApproval.1.id`; string, required)
        - `kind` (`createPlaybookRun.response.201.data.pendingApproval.1.kind`; string, required)
          - one of `"pre"`, `"post"`
        - `actionName` (`createPlaybookRun.response.201.data.pendingApproval.1.actionName`; string, required)
        - `requestedAt` (`createPlaybookRun.response.201.data.pendingApproval.1.requestedAt`; string, required)
          - format `date-time`; pattern `^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$`
      - `null`
  - `result` (`createPlaybookRun.response.201.data.result`; string | null, required)
  - `error` (`createPlaybookRun.response.201.data.error`; string | null, required)
  - `startedBy` (`createPlaybookRun.response.201.data.startedBy`; string, required)
  - `createdAt` (`createPlaybookRun.response.201.data.createdAt`; string, required)
    - format `date-time`; pattern `^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$`
  - `updatedAt` (`createPlaybookRun.response.201.data.updatedAt`; string, required)
    - format `date-time`; pattern `^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$`
  - `finishedAt` (`createPlaybookRun.response.201.data.finishedAt`; any of, required)
    - any of: `string`, `null`
  - `currentActivity` (`createPlaybookRun.response.201.data.currentActivity`; string | null, required)
  - `snapshot` (`createPlaybookRun.response.201.data.snapshot`; object, required) — The playbook as captured at launch. Later edits never affect a run.
    - `playbookId` (`createPlaybookRun.response.201.data.snapshot.playbookId`; string, required)
    - `version` (`createPlaybookRun.response.201.data.snapshot.version`; integer, required)
      - min -9007199254740991; max 9007199254740991
    - `name` (`createPlaybookRun.response.201.data.snapshot.name`; string, required)
    - `description` (`createPlaybookRun.response.201.data.snapshot.description`; string, required)
    - `tasks` (`createPlaybookRun.response.201.data.snapshot.tasks`; array<object>, required)
      - `id` (`createPlaybookRun.response.201.data.snapshot.tasks.id`; string, required)
      - `title` (`createPlaybookRun.response.201.data.snapshot.tasks.title`; string, required)
      - `dependsOn` (`createPlaybookRun.response.201.data.snapshot.tasks.dependsOn`; array<string>, required)
      - `status` (`createPlaybookRun.response.201.data.snapshot.tasks.status`; string, required)
        - one of `"pending"`, `"ready"`, `"in_progress"`, `"completed"`, `"skipped"`
      - `summary` (`createPlaybookRun.response.201.data.snapshot.tasks.summary`; string | null, required)
      - `completedAt` (`createPlaybookRun.response.201.data.snapshot.tasks.completedAt`; any of, required)
        - any of: `string`, `null`
      - `instructions` (`createPlaybookRun.response.201.data.snapshot.tasks.instructions`; string | null, optional)
      - `executor` (`createPlaybookRun.response.201.data.snapshot.tasks.executor`; string, optional)
        - one of `"agent"`, `"human"`
      - `assignee` (`createPlaybookRun.response.201.data.snapshot.tasks.assignee`; string | null, optional)
      - `claimedBy` (`createPlaybookRun.response.201.data.snapshot.tasks.claimedBy`; string | null, optional)
      - `completedBy` (`createPlaybookRun.response.201.data.snapshot.tasks.completedBy`; string | null, optional)
      - `note` (`createPlaybookRun.response.201.data.snapshot.tasks.note`; string | null, optional)
      - `fileIds` (`createPlaybookRun.response.201.data.snapshot.tasks.fileIds`; array<string>, optional)
    - `actions` (`createPlaybookRun.response.201.data.snapshot.actions`; array<object>, required)
      - `installedActionId` (`createPlaybookRun.response.201.data.snapshot.actions.installedActionId`; string, required)
      - `preApproval` (`createPlaybookRun.response.201.data.snapshot.actions.preApproval`; boolean, required)
      - `postApproval` (`createPlaybookRun.response.201.data.snapshot.actions.postApproval`; boolean, required)
      - `dependsOn` (`createPlaybookRun.response.201.data.snapshot.actions.dependsOn`; array<string>, required)
      - `actionSlug` (`createPlaybookRun.response.201.data.snapshot.actions.actionSlug`; string, required)
      - `actionName` (`createPlaybookRun.response.201.data.snapshot.actions.actionName`; string, required)
      - `trigger` (`createPlaybookRun.response.201.data.snapshot.actions.trigger`; string, required)
        - one of `"agent"`, `"user"`
      - `browserSession` (`createPlaybookRun.response.201.data.snapshot.actions.browserSession`; any of, required)
        - any of:
          - `object`
            - `status` (`createPlaybookRun.response.201.data.snapshot.actions.browserSession.1.status`; string, required)
              - one of `"pairing"`, `"live"`, `"ended"`, `"expired"`
            - `createdAt` (`createPlaybookRun.response.201.data.snapshot.actions.browserSession.1.createdAt`; string, required)
              - format `date-time`; pattern `^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$`
          - `null`
    - `fileScope` (`createPlaybookRun.response.201.data.snapshot.fileScope`; PlaybookFileScope, required)
      - one of:
        - `object`
          - `mode` (`createPlaybookRun.response.201.data.snapshot.fileScope.1.mode`; string, required)
        - `object`
          - `mode` (`createPlaybookRun.response.201.data.snapshot.fileScope.2.mode`; string, required)
          - `fileIds` (`createPlaybookRun.response.201.data.snapshot.fileScope.2.fileIds`; array<string>, required)
            - minLength 1

### 404

Space not found


Source: https://docs.cloudraker.com/workspace/api/playbooks/create-playbook-run/index.md
