Validate an automation draft

Validate an automation draft

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

POST /automations/{id}/validate
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 '{}'
Response · 200
{
  "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"
    ]
  }
}

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.

Parameters1 field
FieldTypeDescription
idrequiredstring · path—
Request body2 fields
FieldTypeDescription
definitionobjectA proposed graph (`{ schemaVersion: 1, trigger, nodes, edges }`) to check instead of the stored draft. Nothing is saved.
policyobjectProposed 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 · 200 fields6 fields
FieldTypeDescription
objectrequiredstring—
okrequiredbooleantrue when publish would succeed right now; false exactly when `errors` isn't empty.
errorsrequiredobject[]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.
warningsrequiredobject[]Things that don't block a publish; readiness repeats them as `heads_up` items.
dependenciesrequiredobject[]—
readinessrequiredobject | null—
200400401403404409422

Search docs and guides

Search the docs and product guides.