---
title: "Preview, transfer or archive one legacy channel"
---

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

# Preview, transfer or archive one legacy channel

Path: CloudRaker Workspace API › Workspace Triggers

`POST /triggers/migrate-legacy-channels`

Transfers ONE channel, named by `channelId`. `dryRun: true` reports the outcome without writing. Optional `expectedSourceHash` (64 hex characters) makes the transfer refuse a source that changed since it was read. `archive: true` takes the other exit: it archives a channel the producer REFUSES to transfer, storing that refusal on the row, and is itself refused for a channel that could still migrate.

## Authentication

- `bearerAuth`, http, header `Authorization`

## Request body

_Required._

- `channelId` (`migrateLegacyChannel.channelId`; string, required)
  - minLength 1; maxLength 200
- `dryRun` (`migrateLegacyChannel.dryRun`; boolean, required)
- `expectedSourceHash` (`migrateLegacyChannel.expectedSourceHash`; string, optional)
  - pattern `^[a-f0-9]{64}$`
- `archive` (`migrateLegacyChannel.archive`; boolean, optional)

## Example request

```json
{
  "channelId": "string",
  "dryRun": true,
  "expectedSourceHash": "string",
  "archive": true
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://api.cloudraker.com/triggers/migrate-legacy-channels \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "channelId": "string",
  "dryRun": true,
  "expectedSourceHash": "string",
  "archive": true
}
'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/triggers/migrate-legacy-channels';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({channelId: 'string', dryRun: true, expectedSourceHash: 'string', archive: true})
};

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/triggers/migrate-legacy-channels"

payload = {
    "channelId": "string",
    "dryRun": True,
    "expectedSourceHash": "string",
    "archive": True
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 200

The producer record, proxied unchanged.

#### Example

```json
{
  "data": {
    "channelId": "string",
    "triggerId": "string",
    "status": "ready",
    "sourceHash": "string",
    "message": "string",
    "handoffReady": true,
    "trigger": {
      "name": "string",
      "enabled": true,
      "when": {
        "kind": "schedule",
        "schedule": {
          "kind": "cron",
          "expression": "string",
          "timezone": "string"
        }
      },
      "open": {
        "agentIds": [
          "string"
        ],
        "spaces": [
          {
            "spaceId": "string",
            "access": "read"
          }
        ],
        "instruction": "string",
        "threadPolicy": "new",
        "title": "string",
        "filesFrom": "payload"
      },
      "permissions": {
        "runAsUserId": "string"
      },
      "id": "string",
      "lastRun": {
        "status": "opened",
        "sessionId": "string",
        "message": "string",
        "at": "2019-08-24T14:15:22Z"
      },
      "nextRunAt": "2019-08-24T14:15:22Z",
      "triggerRef": "string",
      "createdAt": "2019-08-24T14:15:22Z",
      "updatedAt": "2019-08-24T14:15:22Z",
      "legacy": {
        "channelId": "string",
        "channelType": "email",
        "automationId": "string"
      }
    }
  }
}
```

- `data` (`migrateLegacyChannel.response.200.data`; object, required)
  - `channelId` (`migrateLegacyChannel.response.200.data.channelId`; string, required)
    - minLength 1; maxLength 200
  - `status` (`migrateLegacyChannel.response.200.data.status`; string, required)
    - one of `"ready"`, `"migrated"`, `"blocked"`, `"archived"`
  - `handoffReady` (`migrateLegacyChannel.response.200.data.handoffReady`; boolean, required)
  - `triggerId` (`migrateLegacyChannel.response.200.data.triggerId`; string, optional)
    - maxLength 128; pattern `^trg_[A-Za-z0-9_-]+$`
  - `sourceHash` (`migrateLegacyChannel.response.200.data.sourceHash`; string, optional)
    - pattern `^[a-f0-9]{64}$`
  - `message` (`migrateLegacyChannel.response.200.data.message`; string, optional)
  - `trigger` (`migrateLegacyChannel.response.200.data.trigger`; object, optional)
    - `name` (`migrateLegacyChannel.response.200.data.trigger.name`; string, required)
      - minLength 1; maxLength 80
    - `when` (`migrateLegacyChannel.response.200.data.trigger.when`; any of, required)
      - any of:
        - `Option 1`
          - one of:
            - `object`
              - `kind` (`migrateLegacyChannel.response.200.data.trigger.when.1.1.kind`; string, required)
                - one of `"schedule"`
              - `schedule` (`migrateLegacyChannel.response.200.data.trigger.when.1.1.schedule`; one of, required)
                - one of:
                  - `object`
                    - `kind` (`migrateLegacyChannel.response.200.data.trigger.when.1.1.schedule.1.kind`; string, required)
                      - one of `"cron"`
                    - `expression` (`migrateLegacyChannel.response.200.data.trigger.when.1.1.schedule.1.expression`; string, required)
                      - minLength 1; maxLength 200
                    - `timezone` (`migrateLegacyChannel.response.200.data.trigger.when.1.1.schedule.1.timezone`; string, required)
                      - minLength 1; maxLength 100
                  - `object`
                    - `kind` (`migrateLegacyChannel.response.200.data.trigger.when.1.1.schedule.2.kind`; string, required)
                      - one of `"once"`
                    - `at` (`migrateLegacyChannel.response.200.data.trigger.when.1.1.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))$`
            - `object`
              - `kind` (`migrateLegacyChannel.response.200.data.trigger.when.1.2.kind`; string, required)
                - one of `"email"`
              - `address` (`migrateLegacyChannel.response.200.data.trigger.when.1.2.address`; string, required)
                - format `email`; maxLength 254; pattern `^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$`
              - `from` (`migrateLegacyChannel.response.200.data.trigger.when.1.2.from`; array<string>, optional)
                - format `email`; pattern `^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$`
            - `object`
              - `kind` (`migrateLegacyChannel.response.200.data.trigger.when.1.3.kind`; string, required)
                - one of `"webhook"`
              - `slug` (`migrateLegacyChannel.response.200.data.trigger.when.1.3.slug`; string, required)
                - pattern `^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$`
            - `object`
              - `kind` (`migrateLegacyChannel.response.200.data.trigger.when.1.4.kind`; string, required)
                - one of `"manual"`
        - `object`
          - `kind` (`migrateLegacyChannel.response.200.data.trigger.when.2.kind`; string, required)
            - one of `"webhook"`
          - `slug` (`migrateLegacyChannel.response.200.data.trigger.when.2.slug`; string, required)
          - `secretPreview` (`migrateLegacyChannel.response.200.data.trigger.when.2.secretPreview`; string, required)
    - `open` (`migrateLegacyChannel.response.200.data.trigger.open`; object, required)
      - `agentIds` (`migrateLegacyChannel.response.200.data.trigger.open.agentIds`; array<string>, required)
        - minLength 1; maxLength 128
      - `spaces` (`migrateLegacyChannel.response.200.data.trigger.open.spaces`; array<object>, required)
        - `spaceId` (`migrateLegacyChannel.response.200.data.trigger.open.spaces.spaceId`; string, required)
          - minLength 1; maxLength 128
        - `access` (`migrateLegacyChannel.response.200.data.trigger.open.spaces.access`; string, required)
          - one of `"read"`, `"commit"`
      - `instruction` (`migrateLegacyChannel.response.200.data.trigger.open.instruction`; string, required)
        - minLength 1; maxLength 4000
      - `threadPolicy` (`migrateLegacyChannel.response.200.data.trigger.open.threadPolicy`; string, required)
        - one of `"new"`, `"reuse"`
      - `filesFrom` (`migrateLegacyChannel.response.200.data.trigger.open.filesFrom`; string, required)
        - one of `"payload"`, `"none"`
      - `title` (`migrateLegacyChannel.response.200.data.trigger.open.title`; string, optional)
        - maxLength 200
    - `permissions` (`migrateLegacyChannel.response.200.data.trigger.permissions`; object, required)
      - `runAsUserId` (`migrateLegacyChannel.response.200.data.trigger.permissions.runAsUserId`; string, required)
        - minLength 1; maxLength 128
    - `id` (`migrateLegacyChannel.response.200.data.trigger.id`; string, required)
      - maxLength 128; pattern `^trg_[A-Za-z0-9_-]+$`
    - `nextRunAt` (`migrateLegacyChannel.response.200.data.trigger.nextRunAt`; string, required, nullable)
      - 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))$`
    - `triggerRef` (`migrateLegacyChannel.response.200.data.trigger.triggerRef`; string, required)
    - `createdAt` (`migrateLegacyChannel.response.200.data.trigger.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` (`migrateLegacyChannel.response.200.data.trigger.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))$`
    - `enabled` (`migrateLegacyChannel.response.200.data.trigger.enabled`; boolean, optional)
      - default `true`
    - `lastRun` (`migrateLegacyChannel.response.200.data.trigger.lastRun`; object, optional)
      - `status` (`migrateLegacyChannel.response.200.data.trigger.lastRun.status`; string, required)
        - one of `"opened"`, `"busy"`, `"needs_input"`, `"blocked"`, `"error"`
      - `at` (`migrateLegacyChannel.response.200.data.trigger.lastRun.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))$`
      - `sessionId` (`migrateLegacyChannel.response.200.data.trigger.lastRun.sessionId`; string, optional)
        - minLength 1; maxLength 128
      - `message` (`migrateLegacyChannel.response.200.data.trigger.lastRun.message`; string, optional)
        - maxLength 1000
    - `legacy` (`migrateLegacyChannel.response.200.data.trigger.legacy`; object, optional)
      - `channelId` (`migrateLegacyChannel.response.200.data.trigger.legacy.channelId`; string, optional)
      - `channelType` (`migrateLegacyChannel.response.200.data.trigger.legacy.channelType`; string, optional)
        - one of `"email"`, `"webhook"`
      - `automationId` (`migrateLegacyChannel.response.200.data.trigger.legacy.automationId`; string, optional)

### 400

`validation_failed`: a request body field is invalid.

#### Example

```json
{
  "error": "string",
  "error_code": "string",
  "issues": [
    {
      "path": "string",
      "code": "string",
      "message": "string"
    }
  ]
}
```

- `error` (`migrateLegacyChannel.response.400.error`; string, required) — The sentence a human reads.
- `error_code` (`migrateLegacyChannel.response.400.error_code`; string, required) — The stable snake_case branch key.
- `issues` (`migrateLegacyChannel.response.400.issues`; array<object>, optional) — Per-field detail, present only on a validation failure.
  - `path` (`migrateLegacyChannel.response.400.issues.path`; string, required)
  - `code` (`migrateLegacyChannel.response.400.issues.code`; string, required)
  - `message` (`migrateLegacyChannel.response.400.issues.message`; string, required)

### 403

`forbidden` — organization administrators only.

#### Example

```json
{
  "error": "string",
  "error_code": "string",
  "issues": [
    {
      "path": "string",
      "code": "string",
      "message": "string"
    }
  ]
}
```

- `error` (`migrateLegacyChannel.response.403.error`; string, required) — The sentence a human reads.
- `error_code` (`migrateLegacyChannel.response.403.error_code`; string, required) — The stable snake_case branch key.
- `issues` (`migrateLegacyChannel.response.403.issues`; array<object>, optional) — Per-field detail, present only on a validation failure.
  - `path` (`migrateLegacyChannel.response.403.issues.path`; string, required)
  - `code` (`migrateLegacyChannel.response.403.issues.code`; string, required)
  - `message` (`migrateLegacyChannel.response.403.issues.message`; string, required)

### 409

`handoff_incomplete` — no readiness record covers this transfer yet.

#### Example

```json
{
  "error": "string",
  "error_code": "string",
  "issues": [
    {
      "path": "string",
      "code": "string",
      "message": "string"
    }
  ]
}
```

- `error` (`migrateLegacyChannel.response.409.error`; string, required) — The sentence a human reads.
- `error_code` (`migrateLegacyChannel.response.409.error_code`; string, required) — The stable snake_case branch key.
- `issues` (`migrateLegacyChannel.response.409.issues`; array<object>, optional) — Per-field detail, present only on a validation failure.
  - `path` (`migrateLegacyChannel.response.409.issues.path`; string, required)
  - `code` (`migrateLegacyChannel.response.409.issues.code`; string, required)
  - `message` (`migrateLegacyChannel.response.409.issues.message`; string, required)

### 422

`source_changed` — the legacy source moved under the expected hash.

#### Example

```json
{
  "error": "string",
  "error_code": "string",
  "issues": [
    {
      "path": "string",
      "code": "string",
      "message": "string"
    }
  ]
}
```

- `error` (`migrateLegacyChannel.response.422.error`; string, required) — The sentence a human reads.
- `error_code` (`migrateLegacyChannel.response.422.error_code`; string, required) — The stable snake_case branch key.
- `issues` (`migrateLegacyChannel.response.422.issues`; array<object>, optional) — Per-field detail, present only on a validation failure.
  - `path` (`migrateLegacyChannel.response.422.issues.path`; string, required)
  - `code` (`migrateLegacyChannel.response.422.issues.code`; string, required)
  - `message` (`migrateLegacyChannel.response.422.issues.message`; string, required)


Source: https://docs.cloudraker.com/workspace/api/workspace-triggers/migrate-legacy-channel/index.md
