---
title: "Create 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.

# Create an automation

> **Deprecated.**

Path: CloudRaker Workspace API › Org Automations

`POST /organization/automations`

RETIRED — always answers `409 legacy_create_retired`. Create a trigger (`POST /triggers`) instead. Creates an agent task: a stored prompt plus a cadence (`cron` with an IANA timezone, a `once` instant, or `manual` for trigger-only). When it fires it drops a message into a real thread you can join, nudge and correct — not a hidden pipeline. Omit `spaceId` for your own desk; a named space needs `space:contribute` for you AND for the owner the automation runs as. The inbound trigger secret is returned ONCE, here. Authorization: organization admin.

## Authentication

- `bearerAuth`, http, header `Authorization`

## Request body

_Required._

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

## 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": false,
  "originThreadId": "string"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://api.cloudraker.com/organization/automations \
  --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": false,
  "originThreadId": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/organization/automations';
const options = {
  method: 'POST',
  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: false,
    originThreadId: '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/organization/automations"

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": False,
    "originThreadId": "string"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 201

The automation and its one-time trigger secret.

#### 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"
  },
  "secret": "string"
}
```

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

### 400

`cannot_target_desk` — a desk is never another member’s target.

### 403

`run_as_forbidden` — the owner cannot contribute to that space.

### 404

Agents disabled, or the space is not contributable.

### 409

`legacy_create_retired` — automations have moved to triggers.


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