# Validate a plan

> Dry-run a plan: the problems it has. Nothing is saved.

Source: https://docs.mycrmsim.com/docs/automations/validate-workflow-plan

```http
POST https://backend.mysmsgateway.app/api/v1/ext/workflows/validate
```

- Category: myCRMSIM Automations / Automations
- Auth: Bearer access token
- Scope: `automations.read`

A plan is a list of named steps. Each step has a unique `name`, a `type` from the Node catalog, optional `data` (only the fields you want to set — the rest take the type's defaults), and points at the next step by name: `next` for a single path, `branches` for a step that splits (`ifElse`: `true` / `false`; `findContact`: `found` / `notFound`).

A plan may start with one trigger of each type (several triggers must all point at the same first step), or with none — then contacts enter only through Add contacts to a workflow.

`envelope` is optional: `name`, `stopOnReply`, `allowReEntry`, `executionWindow`. Its `status` is ignored; a new workflow is always a draft.

Each issue names the `step` it is about. A plan with no issues is what Create workflow accepts.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `plan` | body | object | yes | `{ steps: [...], envelope?: {...} }` — at most 200 steps. |

## Request body

```json
{
  "plan": {
    "steps": [
      {
        "name": "contactCreated",
        "type": "contactCreated",
        "next": "welcome"
      },
      {
        "name": "welcome",
        "type": "sendSMS",
        "data": {
          "message": "Hi {{contact.first_name}}, thanks for signing up!"
        },
        "next": "wait1"
      },
      {
        "name": "wait1",
        "type": "wait",
        "data": {
          "waitType": "duration",
          "delay": 86400000,
          "delayValue": 1,
          "delayUnit": "days"
        },
        "next": "tag"
      },
      {
        "name": "tag",
        "type": "addTag",
        "data": {
          "tags": [
            "welcomed"
          ]
        },
        "next": null
      }
    ],
    "envelope": {
      "name": "Welcome new contacts",
      "stopOnReply": true
    }
  }
}
```

## Response 200

Valid

```json
{
  "success": true,
  "data": {
    "valid": true,
    "issues": [],
    "step_count": 4
  }
}
```

## Response 200

Has problems

```json
{
  "success": true,
  "data": {
    "valid": false,
    "issues": [
      {
        "step": "welcome",
        "type": "sendSMS",
        "message": "The SMS message is empty."
      }
    ],
    "step_count": 4
  }
}
```

## Response 400

Not a plan

```json
{
  "success": false,
  "message": "every plan step needs a name and a type"
}
```

## Response 401

Missing or invalid token

```json
{
  "success": false,
  "message": "Invalid or expired access token."
}
```

## Response 403

Missing scope

```json
{
  "success": false,
  "message": "Missing scope(s): automations.read. This integration was granted: …"
}
```
