---
title: "Validate an automation draft"
description: "Dry-run check of the draft: structure (block kinds, config, wiring, cycles, data paths) and dependency health (templates published, sender domains verified). `POST /api/v1/automations/{id}/validate`"
url: https://www.unitpost.com/docs/automations/post-automations-id-validate
section: "Automations API reference"
updated: 2026-12-01
---
# Validate an automation draft

`POST /api/v1/automations/{id}/validate`

Dry-run check of the draft: structure (block kinds, config, wiring, cycles, data paths) and dependency health (templates published, sender domains verified). `ok: true` means publish would succeed now, and `ok` is false exactly when `errors` isn't empty. Errors carry machine codes, node ids, and config paths so an agent can self-repair; warnings are advisory (readiness repeats them as `heads_up` items). A missing or not-yet-ready template, sender, segment or other reference is an error, under the code publish's 422 uses for it (`dependency_missing`, `dependency_unhealthy`, `dependency_wrong_type`, `condition_ref_missing`). Send a `definition` and/or `policy` to check a proposal instead of the stored draft: nothing is saved. A proposal is authoring, so it also needs `automations:write`.

`errors[].code` and `warnings[].code` are one of `unknown_kind`, `invalid_config`, `trigger_not_trigger`, `node_kind_is_trigger`, `duplicate_node_id`, `duplicate_edge_id`, `edge_unknown_from`, `edge_unknown_to`, `edge_unknown_handle`, `edge_duplicate_handle`, `edge_into_trigger`, `missing_handle_edge`, `orphan_node`, `cycle`, `trigger_disconnected`, `dependency_unavailable`, `path_unknown_scope`, `path_unknown_step`, `path_scope_unavailable`, `sms_quiet_hours`, `sms_variables_unmapped`, `email_variables_unmapped`, `sms_trigger_creates_contacts`, `sms_trigger_marketing_reply`, `wait_until_past`, `wait_until_contact_timezone`, `wait_too_long`, `path_outlives_run`, `run_lifetime_too_long`, `path_over_action_limit`, `webhook_secret_regenerate`, `event_data_secret`, `condition_ref_missing`, `wait_until_not_a_date`, `wait_until_field_unknown`, `template_type_mismatch`, `marketing_template_fixed_recipient`, `topic_needs_marketing_template` (and the reference codes above); each issue carries `node_id`, `edge_id`, `path` (the config field) and `handle` where they apply. `readiness` is the pre-publish checklist in plain words: `items[]` with `severity` (`blocker`, `needs_input`: it can go live but nothing happens until someone provides something, such as the event their backend hasn't sent yet or a number to send texts from, `heads_up`) and `owner` (`user`, `developer`, `agent`), plus `journey` (the graph in words with timings) and `testing`. Publish when `ok` and `readiness.ready` are both true. Requires the `automations:read` capability.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | — |

## Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `definition` | object | no | A proposed graph (`{ schemaVersion: 1, trigger, nodes, edges }`) to check instead of the stored draft. Nothing is saved. |
| `policy` | object | no | Proposed settings to check with it, read as PATCH would store them (an omitted `reEntry` takes the trigger's default). Defaults to the stored policy. |

## Response fields (200)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `object` | string | yes | — |
| `ok` | boolean | yes | true when publish would succeed right now; false exactly when `errors` isn't empty. |
| `errors` | object[] | yes | What refuses a publish, each with its `node_id` and `path`: graph errors, and a template, sender, segment or other reference that is missing or not ready yet. |
| `warnings` | object[] | yes | Things that don't block a publish; readiness repeats them as `heads_up` items. |
| `dependencies` | object[] | yes | — |
| `readiness` | object \| null | yes | — |

## Responses

| Status | Description |
| --- | --- |
| 200 | The validation result. |
| 400 | The body isn't JSON. |
| 401 | Missing or invalid API key. |
| 403 | Insufficient scope. |
| 404 | Automation not found. |
| 409 | The automation has no graph to validate. |
| 422 | Invalid proposed `policy`, or an unknown key. |

## Example request

```bash
curl -X POST 'https://www.unitpost.com/api/v1/automations/atm_123/validate' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0' \
  -H 'Content-Type: application/json' \
  -d '{}'
```

## Example response (200)

```json
{
  "object": "automation_validation",
  "ok": false,
  "errors": [
    {
      "code": "string",
      "message": "string",
      "node_id": "node_123",
      "edge_id": "edge_123",
      "path": [
        "string"
      ],
      "handle": "string"
    }
  ],
  "warnings": [
    {
      "code": "string",
      "message": "string",
      "node_id": "node_123",
      "edge_id": "edge_123",
      "path": [
        "string"
      ],
      "handle": "string"
    }
  ],
  "dependencies": [
    {
      "resource_type": "string",
      "resource_id": "resource_123",
      "node_ids": [
        "string"
      ]
    }
  ],
  "readiness": {
    "ready": false,
    "summary": "string",
    "items": [
      {
        "code": "graph_error",
        "severity": "blocker",
        "owner": "user",
        "node_id": "node_123",
        "warning_code": "string",
        "message": "string",
        "fix": "string"
      }
    ],
    "verified": [
      "string"
    ],
    "journey": "string",
    "testing": [
      "string"
    ]
  }
}
```

## Links

- HTML reference (with Node.js, Python, Ruby, PHP, Laravel, Go, Java, Rust, .NET and CLI examples): https://www.unitpost.com/docs/automations/post-automations-id-validate
- OpenAPI 3.1 (full schemas): https://www.unitpost.com/api/v1/openapi.json
