---
title: "Update an automation"
---

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

# Update an automation

Path: CloudRaker Workspace API › Org Automations

`PATCH /organization/automations/{automationId}`

Patches an automation and recomputes its next fire time — on every write, not only a schedule change, so re-enabling one re-arms it. Pass `threadId: null` to forget the bound thread so the next fire starts a fresh one. Authorization: organization admin (plus `space:contribute` for a new named `spaceId`, for the caller and for the owner).

## Authentication

- `bearerAuth`, http, header `Authorization`

## Path parameters

- `automationId` (`updateAutomation.path.automationId`; string, required)

## Request body

_Required._

- `name` (`updateAutomation.name`; string, optional)
  - minLength 1; maxLength 80; example `"Monday inbox sweep"`
- `description` (`updateAutomation.description`; string, optional)
  - maxLength 400
- `playbookId` (`updateAutomation.playbookId`; string, optional)
  - minLength 1; maxLength 128
- `prompt` (`updateAutomation.prompt`; string, optional) — The user message injected into the thread when the automation fires.
  - minLength 1; maxLength 4000
- `fileIds` (`updateAutomation.fileIds`; array<string>, optional)
  - minLength 1
- `spaceId` (`updateAutomation.spaceId`; string, optional)
  - minLength 1; maxLength 128
- `threadPolicy` (`updateAutomation.threadPolicy`; string, optional)
  - one of `"reuse"`, `"new"`
- `schedule` (`updateAutomation.schedule`; one of, optional)
  - one of:
    - `object`
      - `kind` (`updateAutomation.schedule.1.kind`; string, required)
      - `expression` (`updateAutomation.schedule.1.expression`; string, required)
        - example `"0 9 * * 1-5"`
      - `timezone` (`updateAutomation.schedule.1.timezone`; string, required)
        - example `"Europe/Paris"`
    - `object`
      - `kind` (`updateAutomation.schedule.2.kind`; string, required)
      - `at` (`updateAutomation.schedule.2.at`; 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))$`; example `"2026-08-14T15:00:00.000Z"`
    - `object`
      - `kind` (`updateAutomation.schedule.3.kind`; string, required)
- `enabled` (`updateAutomation.enabled`; boolean, optional)
- `triggerEnabled` (`updateAutomation.triggerEnabled`; boolean, optional)
- `threadId` (`updateAutomation.threadId`; null, optional)

## Example request

```json
{
  "name": "Monday inbox sweep",
  "description": "string",
  "playbookId": "string",
  "prompt": "string",
  "fileIds": [
    "string"
  ],
  "spaceId": "string",
  "threadPolicy": "reuse",
  "schedule": {
    "kind": "cron",
    "expression": "0 9 * * 1-5",
    "timezone": "Europe/Paris"
  },
  "enabled": true,
  "triggerEnabled": true,
  "threadId": null
}
```

## Code samples

### cURL

```bash
curl --request PATCH \
  --url 'https://api.cloudraker.com/organization/automations/<automationId>' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "Monday inbox sweep",
  "description": "string",
  "playbookId": "string",
  "prompt": "string",
  "fileIds": [
    "string"
  ],
  "spaceId": "string",
  "threadPolicy": "reuse",
  "schedule": {
    "kind": "cron",
    "expression": "0 9 * * 1-5",
    "timezone": "Europe/Paris"
  },
  "enabled": true,
  "triggerEnabled": true,
  "threadId": null
}
'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/organization/automations/<automationId>';
const options = {
  method: 'PATCH',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    name: 'Monday inbox sweep',
    description: 'string',
    playbookId: 'string',
    prompt: 'string',
    fileIds: ['string'],
    spaceId: 'string',
    threadPolicy: 'reuse',
    schedule: {kind: 'cron', expression: '0 9 * * 1-5', timezone: 'Europe/Paris'},
    enabled: true,
    triggerEnabled: true,
    threadId: null
  })
};

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/organization/automations/<automationId>"

payload = {
    "name": "Monday inbox sweep",
    "description": "string",
    "playbookId": "string",
    "prompt": "string",
    "fileIds": ["string"],
    "spaceId": "string",
    "threadPolicy": "reuse",
    "schedule": {
        "kind": "cron",
        "expression": "0 9 * * 1-5",
        "timezone": "Europe/Paris"
    },
    "enabled": True,
    "triggerEnabled": True,
    "threadId": None
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 200

The updated automation.

#### Example

```json
{
  "automation": {
    "_id": "string",
    "name": "string",
    "description": "string",
    "kind": "agent_task",
    "enabled": true,
    "playbookId": "string",
    "prompt": "string",
    "fileIds": [
      "string"
    ],
    "spaceId": "string",
    "threadId": "string",
    "threadPolicy": "reuse",
    "runAs": "string",
    "createdBy": "string",
    "organizationId": "string",
    "schedule": {
      "kind": "cron",
      "expression": "0 9 * * 1-5",
      "timezone": "Europe/Paris"
    },
    "nextRunAt": "string",
    "lastFiredAt": "string",
    "lastRunStatus": "started",
    "lastRunId": "string",
    "trigger": {
      "enabled": true,
      "secretPreview": "whsec_…9f3a",
      "secretRotatedAt": "string"
    },
    "originThreadId": "string",
    "createdAt": "string",
    "updatedAt": "string",
    "runtimeStatus": "idle",
    "cadence": "string",
    "triggerRef": "string"
  }
}
```

- `automation` (`updateAutomation.response.200.automation`; object, required)
  - `_id` (`updateAutomation.response.200.automation._id`; string, required)
  - `name` (`updateAutomation.response.200.automation.name`; string, required)
  - `kind` (`updateAutomation.response.200.automation.kind`; string, required)
    - one of `"agent_task"`
  - `enabled` (`updateAutomation.response.200.automation.enabled`; boolean, required)
  - `playbookId` (`updateAutomation.response.200.automation.playbookId`; string, required)
  - `prompt` (`updateAutomation.response.200.automation.prompt`; string, required)
  - `spaceId` (`updateAutomation.response.200.automation.spaceId`; string, required)
  - `threadPolicy` (`updateAutomation.response.200.automation.threadPolicy`; string, required)
    - one of `"reuse"`, `"new"`
  - `runAs` (`updateAutomation.response.200.automation.runAs`; string, required)
  - `createdBy` (`updateAutomation.response.200.automation.createdBy`; string, required)
  - `organizationId` (`updateAutomation.response.200.automation.organizationId`; string, required)
  - `schedule` (`updateAutomation.response.200.automation.schedule`; one of, required)
    - one of:
      - `object`
        - `kind` (`updateAutomation.response.200.automation.schedule.1.kind`; string, required)
        - `expression` (`updateAutomation.response.200.automation.schedule.1.expression`; string, required)
          - example `"0 9 * * 1-5"`
        - `timezone` (`updateAutomation.response.200.automation.schedule.1.timezone`; string, required)
          - example `"Europe/Paris"`
      - `object`
        - `kind` (`updateAutomation.response.200.automation.schedule.2.kind`; string, required)
        - `at` (`updateAutomation.response.200.automation.schedule.2.at`; 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))$`; example `"2026-08-14T15:00:00.000Z"`
      - `object`
        - `kind` (`updateAutomation.response.200.automation.schedule.3.kind`; string, required)
  - `nextRunAt` (`updateAutomation.response.200.automation.nextRunAt`; string | null, required)
  - `trigger` (`updateAutomation.response.200.automation.trigger`; object, required)
    - `enabled` (`updateAutomation.response.200.automation.trigger.enabled`; boolean, required)
    - `secretPreview` (`updateAutomation.response.200.automation.trigger.secretPreview`; string, required)
      - example `"whsec_…9f3a"`
    - `secretRotatedAt` (`updateAutomation.response.200.automation.trigger.secretRotatedAt`; string, optional)
  - `createdAt` (`updateAutomation.response.200.automation.createdAt`; string, required)
  - `updatedAt` (`updateAutomation.response.200.automation.updatedAt`; string, required)
  - `runtimeStatus` (`updateAutomation.response.200.automation.runtimeStatus`; string, required)
    - one of `"idle"`, `"disabled"`, `"needs_input"`, `"blocked"`, `"error"`
  - `cadence` (`updateAutomation.response.200.automation.cadence`; string, required)
  - `triggerRef` (`updateAutomation.response.200.automation.triggerRef`; string, required)
  - `description` (`updateAutomation.response.200.automation.description`; string, optional)
  - `fileIds` (`updateAutomation.response.200.automation.fileIds`; array<string>, optional)
  - `threadId` (`updateAutomation.response.200.automation.threadId`; string, optional)
  - `lastFiredAt` (`updateAutomation.response.200.automation.lastFiredAt`; string, optional)
  - `lastRunStatus` (`updateAutomation.response.200.automation.lastRunStatus`; string, optional)
    - one of `"started"`, `"success"`, `"busy"`, `"needs_input"`, `"blocked"`, `"error"`
  - `lastRunId` (`updateAutomation.response.200.automation.lastRunId`; string, optional)
  - `originThreadId` (`updateAutomation.response.200.automation.originThreadId`; string, optional)

### 400

Validation Error

#### Example

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

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

### 404

Agents disabled, unknown automation, or space not contributable.


Source: https://docs.cloudraker.com/workspace/api/org-automations/update-automation/index.md
