> ## Documentation Index
> Fetch the complete documentation index at: https://docs.enginy.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Validate workflow

> Validate a workflow `plan` payload without creating anything. Strict validation (as if publishing). Returns `isValid` with warnings, or errors.

A workflow is a DAG of nodes described by the `plan` object: `{ name?, nodes: [] }`.
Each node has a stable string `id` and a `next` array of node ids it points to (an empty string `""` marks an unwired slot). There are three node `kind`s:

- `BLOCK` — one workflow step. `{ id, kind: "BLOCK", blockId, inputs: {}, next: [] }`. `blockId` comes from `GET /v1/workflows/blocks`; `inputs` are the block's configurable inputs (discover them with `GET /v1/workflows/blocks/{blockId}`). A BLOCK has exactly one `next` slot, except the `WAIT_FOR_APPROVAL` block which has two: `[approvedTargetId, rejectedTargetId]`.
- `CONDITIONAL` — branches the stream. `{ id, kind: "CONDITIONAL", conditions: [], fallbackName?, next: [] }`. Each condition is EITHER a field predicate `{ field, operator, value? }` (lead/company/AI-variable fields — discover them with `GET /v1/workflows/condition-fields`) OR a random-split branch `{ type: "RANDOM_SPLIT", percentage }` (deterministic A/B split; integer 1-100, percentages must sum to ≤ 100 across the node, the remainder falls through to the fallback). `next` has exactly `conditions.length + 1` entries: one target per matched condition (in order) then the fallback target LAST.
- `KING` — dedupes/groups the stream. `{ id, kind: "KING", groupBy, orderBy, checkAnyDomain?, limit?, next: [] }`. `next` is `[leftTargetId, rightTargetId]`.

The first node (the one no other node points to) should be a selector/import entry block. A plan may hold at most 60 nodes and no cycles. An empty plan (`nodes: []`) is valid for a brand-new draft.
Field/entity prefixes used inside conditions: `company.`, `anyLead.`, and `webhookInput.` for webhook-triggered workflows.

    > **Required scope:** `WORKFLOWS_WRITE`
    >
    > **Rate limit:** 30 requests per minute



## OpenAPI

````yaml https://openapi.enginy.ai/definitions.json post /v1/workflows/validate
openapi: 3.1.0
info:
  title: Enginy API
  version: 1.0.0
  description: Public API for Enginy platform
servers:
  - url: https://openapi.enginy.ai
    description: Configured server
security: []
tags:
  - name: AI Variables
    description: >-
      Manage AI variables and discover the entity fields you can reference in
      prompts and entity requests.
  - name: Inbox
    description: >-
      Inbox endpoints for listing contact threads, reading thread messages,
      managing tags, and sending manual replies.
  - name: Workflows
    description: >-
      Build, validate, publish, run, and inspect advanced (graph) workflows,
      plus the block/condition catalog needed to author a workflow plan.
paths:
  /v1/workflows/validate:
    post:
      tags:
        - Workflows
      summary: Validate workflow
      description: >-
        Validate a workflow `plan` payload without creating anything. Strict
        validation (as if publishing). Returns `isValid` with warnings, or
        errors.


        A workflow is a DAG of nodes described by the `plan` object: `{ name?,
        nodes: [] }`.

        Each node has a stable string `id` and a `next` array of node ids it
        points to (an empty string `""` marks an unwired slot). There are three
        node `kind`s:


        - `BLOCK` — one workflow step. `{ id, kind: "BLOCK", blockId, inputs:
        {}, next: [] }`. `blockId` comes from `GET /v1/workflows/blocks`;
        `inputs` are the block's configurable inputs (discover them with `GET
        /v1/workflows/blocks/{blockId}`). A BLOCK has exactly one `next` slot,
        except the `WAIT_FOR_APPROVAL` block which has two: `[approvedTargetId,
        rejectedTargetId]`.

        - `CONDITIONAL` — branches the stream. `{ id, kind: "CONDITIONAL",
        conditions: [], fallbackName?, next: [] }`. Each condition is EITHER a
        field predicate `{ field, operator, value? }` (lead/company/AI-variable
        fields — discover them with `GET /v1/workflows/condition-fields`) OR a
        random-split branch `{ type: "RANDOM_SPLIT", percentage }`
        (deterministic A/B split; integer 1-100, percentages must sum to ≤ 100
        across the node, the remainder falls through to the fallback). `next`
        has exactly `conditions.length + 1` entries: one target per matched
        condition (in order) then the fallback target LAST.

        - `KING` — dedupes/groups the stream. `{ id, kind: "KING", groupBy,
        orderBy, checkAnyDomain?, limit?, next: [] }`. `next` is `[leftTargetId,
        rightTargetId]`.


        The first node (the one no other node points to) should be a
        selector/import entry block. A plan may hold at most 60 nodes and no
        cycles. An empty plan (`nodes: []`) is valid for a brand-new draft.

        Field/entity prefixes used inside conditions: `company.`, `anyLead.`,
        and `webhookInput.` for webhook-triggered workflows.

            > **Required scope:** `WORKFLOWS_WRITE`
            >
            > **Rate limit:** 30 requests per minute
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 120
                  description: Workflow name.
                plan:
                  type: object
                  properties:
                    name:
                      type: string
                      minLength: 1
                      maxLength: 120
                    nodes:
                      type: array
                      items:
                        oneOf:
                          - type: object
                            properties:
                              id:
                                type: string
                                minLength: 1
                                maxLength: 128
                                description: Stable node id (any non-empty string).
                              kind:
                                type: string
                                enum:
                                  - BLOCK
                              blockId:
                                type: string
                                minLength: 1
                                description: Block id from `GET /v1/workflows/blocks`.
                              inputs:
                                type: object
                                additionalProperties: {}
                                description: Configured inputs for the block.
                              next:
                                type: array
                                items:
                                  type: string
                                maxItems: 2
                                description: >-
                                  Outgoing node ids. One slot, or two
                                  `[approved, rejected]` for WAIT_FOR_APPROVAL.
                                  `""` = unwired.
                            required:
                              - id
                              - kind
                              - blockId
                              - inputs
                              - next
                            additionalProperties: false
                            title: BLOCK
                          - type: object
                            properties:
                              id:
                                type: string
                                minLength: 1
                                maxLength: 128
                              kind:
                                type: string
                                enum:
                                  - CONDITIONAL
                              conditions:
                                type: array
                                items:
                                  anyOf:
                                    - type: object
                                      properties:
                                        field:
                                          type: string
                                          description: >-
                                            Condition field id/name. See `GET
                                            /v1/workflows/condition-fields`.
                                        operator:
                                          type: string
                                          description: >-
                                            Condition operator id. See `GET
                                            /v1/workflows/condition-fields`.
                                        name:
                                          type: string
                                        value:
                                          anyOf:
                                            - type: string
                                            - type: number
                                            - type: boolean
                                            - type: array
                                              items:
                                                type: string
                                            - type: array
                                              items:
                                                type: number
                                          description: >-
                                            Comparison value. Omitted for emptiness
                                            operators (IS_EMPTY / IS_NOT_EMPTY).
                                      required:
                                        - field
                                        - operator
                                      additionalProperties: false
                                      title: FieldCondition
                                    - type: object
                                      properties:
                                        type:
                                          type: string
                                          enum:
                                            - RANDOM_SPLIT
                                        percentage:
                                          type: integer
                                          minimum: 1
                                          maximum: 100
                                          description: >-
                                            Share of entities (integer 1-100)
                                            deterministically routed to this branch.
                                            Sibling split percentages must sum to ≤
                                            100; the remainder falls through to the
                                            fallback branch.
                                        name:
                                          type: string
                                      required:
                                        - type
                                        - percentage
                                      additionalProperties: false
                                      title: RandomSplitCondition
                                minItems: 1
                                maxItems: 20
                              fallbackName:
                                type: string
                                maxLength: 120
                              next:
                                type: array
                                items:
                                  type: string
                                description: >-
                                  One target per condition (in order) then the
                                  fallback LAST. Length = conditions.length + 1.
                            required:
                              - id
                              - kind
                              - conditions
                              - next
                            additionalProperties: false
                            title: CONDITIONAL
                          - type: object
                            properties:
                              id:
                                type: string
                                minLength: 1
                                maxLength: 128
                              kind:
                                type: string
                                enum:
                                  - KING
                              groupBy:
                                type: string
                                minLength: 1
                              orderBy:
                                type: number
                              checkAnyDomain:
                                type: boolean
                              limit:
                                type:
                                  - number
                                  - 'null'
                              next:
                                type: array
                                items:
                                  type: string
                                maxItems: 2
                                description: '`[leftTargetId, rightTargetId]`.'
                            required:
                              - id
                              - kind
                              - groupBy
                              - orderBy
                              - next
                            additionalProperties: false
                            title: KING
                      maxItems: 60
                      description: At most 60 nodes; no cycles.
                  required:
                    - nodes
                  additionalProperties: false
                  title: WorkflowPlan
                  description: >-
                    The workflow DAG. See the endpoint description for the plan
                    format.
                trigger:
                  oneOf:
                    - type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - MANUAL
                        entity:
                          type: string
                          enum:
                            - LEAD
                            - COMPANY
                      required:
                        - type
                      additionalProperties: false
                    - type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - WEBHOOK
                        inputs:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                                minLength: 1
                                maxLength: 64
                              type:
                                type: string
                                enum:
                                  - leadIds
                                  - companyIds
                                  - messageTemplate
                                  - urlTemplate
                                  - exportAssociatedObject
                                  - taskType
                                  - title
                                  - description
                                  - leadsSearchUrl
                                  - companiesSearchUrl
                                  - maxCount
                                  - leadProperties
                                  - skipCompanyScrape
                                  - enrichFromLinkedIn
                                  - maxTimeToWait
                                  - fullResync
                                  - stopType
                                  - selectedAiFields
                                  - selectedFunctionFields
                                  - postUrl
                                  - eventUrl
                                  - jobsUrl
                                  - pollUrl
                                  - maxLeadsToImport
                                  - postImportType
                                  - query
                                  - maxCompaniesToImport
                                  - maxJobPostings
                                  - importCompaniesPermanentlyClosed
                                  - importCompaniesWithNoDomain
                                  - matchOnlySimilarName
                                  - matchOnlyExactName
                                  - matchOnlyExactDomain
                                  - keyword
                                  - onlyIncludeIfCompanyUrnMatch
                                  - excludeContactedLeads
                                  - campaignId
                                  - celebrationMessage
                                  - importOnlyNewContacts
                                  - selectedContactUrns
                                  - activity
                                  - hubspotCompanyListId
                                  - salesforceCompanyListId
                                  - dynamicsCompanyListId
                                  - zohoCompanyListId
                                  - hubspotLeadListId
                                  - salesforceLeadListId
                                  - salesforceLeadReportId
                                  - dynamicsLeadListId
                                  - zohoLeadListId
                                  - storeLeadsSelectedDomains
                                  - websiteVisitorConfigId
                                  - maxContactsToImport
                                  - maxInvestorsToImport
                                  - emptyFieldId
                                  - createNewList
                                  - newListName
                                  - profileUrl
                                  - contactPayload
                                  - companyPayload
                                  - dateRange
                                  - agentPrompt
                                  - selectedMcpTools
                                  - agentModel
                                  - waitMode
                                  - waitDuration
                                  - waitDateField
                                  - httpMethod
                                  - httpUrl
                                  - httpBody
                                  - slackChannelId
                                  - slackMessageTemplate
                                  - slackMentionUserIds
                              label:
                                type: string
                                minLength: 1
                                maxLength: 120
                            required:
                              - key
                              - type
                            additionalProperties: false
                          maxItems: 20
                      required:
                        - type
                      additionalProperties: false
                    - type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - INTENT
                        signal:
                          oneOf:
                            - type: object
                              properties:
                                kind:
                                  type: string
                                  enum:
                                    - CONVERSATION_REPLY
                                tagIds:
                                  type: array
                                  items:
                                    type: integer
                                    exclusiveMinimum: 0
                                identityIds:
                                  type: array
                                  items:
                                    type: integer
                                    exclusiveMinimum: 0
                              required:
                                - kind
                              additionalProperties: false
                            - type: object
                              properties:
                                kind:
                                  type: string
                                  enum:
                                    - WEBSITE_VISITOR
                                minConfidence:
                                  type: string
                                  enum:
                                    - LOW
                                    - MEDIUM
                                    - HIGH
                                    - VERY_HIGH
                              required:
                                - kind
                              additionalProperties: false
                            - type: object
                              properties:
                                kind:
                                  type: string
                                  enum:
                                    - LEAD_CREATED
                              required:
                                - kind
                              additionalProperties: false
                            - type: object
                              properties:
                                kind:
                                  type: string
                                  enum:
                                    - COMPANY_CREATED
                              required:
                                - kind
                              additionalProperties: false
                            - type: object
                              properties:
                                kind:
                                  type: string
                                  enum:
                                    - LEAD_PROPERTY_UPDATED
                                fields:
                                  type: array
                                  items:
                                    type: string
                                    minLength: 1
                                  minItems: 1
                              required:
                                - kind
                                - fields
                              additionalProperties: false
                            - type: object
                              properties:
                                kind:
                                  type: string
                                  enum:
                                    - COMPANY_PROPERTY_UPDATED
                                fields:
                                  type: array
                                  items:
                                    type: string
                                    minLength: 1
                                  minItems: 1
                              required:
                                - kind
                                - fields
                              additionalProperties: false
                            - type: object
                              properties:
                                kind:
                                  type: string
                                  enum:
                                    - LEAD_ADDED_TO_LIST
                                listIds:
                                  type: array
                                  items:
                                    type: integer
                                    exclusiveMinimum: 0
                                  minItems: 1
                              required:
                                - kind
                                - listIds
                              additionalProperties: false
                            - type: object
                              properties:
                                kind:
                                  type: string
                                  enum:
                                    - COMPANY_ADDED_TO_LIST
                                listIds:
                                  type: array
                                  items:
                                    type: integer
                                    exclusiveMinimum: 0
                                  minItems: 1
                              required:
                                - kind
                                - listIds
                              additionalProperties: false
                      required:
                        - type
                        - signal
                      additionalProperties: false
                    - type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - SCHEDULE
                        definition:
                          type: string
                          enum:
                            - DAILY
                            - WEEKLY
                            - BI_WEEKLY
                            - MONTHLY
                            - QUARTERLY
                            - YEARLY
                        recurrence:
                          oneOf:
                            - type: object
                              properties:
                                version:
                                  type: number
                                  enum:
                                    - 1
                                  default: 1
                                interval:
                                  type: integer
                                  minimum: 1
                                end:
                                  oneOf:
                                    - type: object
                                      properties:
                                        kind:
                                          type: string
                                          enum:
                                            - NEVER
                                      required:
                                        - kind
                                      additionalProperties: false
                                    - type: object
                                      properties:
                                        kind:
                                          type: string
                                          enum:
                                            - ON_DATE
                                        until:
                                          type: string
                                          minLength: 1
                                      required:
                                        - kind
                                        - until
                                      additionalProperties: false
                                    - type: object
                                      properties:
                                        kind:
                                          type: string
                                          enum:
                                            - AFTER_OCCURRENCES
                                        count:
                                          type: integer
                                          minimum: 1
                                      required:
                                        - kind
                                        - count
                                      additionalProperties: false
                                  default:
                                    kind: NEVER
                                frequency:
                                  type: string
                                  enum:
                                    - DAILY
                              required:
                                - interval
                                - frequency
                              additionalProperties: false
                            - type: object
                              properties:
                                version:
                                  type: number
                                  enum:
                                    - 1
                                  default: 1
                                interval:
                                  type: integer
                                  minimum: 1
                                end:
                                  oneOf:
                                    - type: object
                                      properties:
                                        kind:
                                          type: string
                                          enum:
                                            - NEVER
                                      required:
                                        - kind
                                      additionalProperties: false
                                    - type: object
                                      properties:
                                        kind:
                                          type: string
                                          enum:
                                            - ON_DATE
                                        until:
                                          type: string
                                          minLength: 1
                                      required:
                                        - kind
                                        - until
                                      additionalProperties: false
                                    - type: object
                                      properties:
                                        kind:
                                          type: string
                                          enum:
                                            - AFTER_OCCURRENCES
                                        count:
                                          type: integer
                                          minimum: 1
                                      required:
                                        - kind
                                        - count
                                      additionalProperties: false
                                  default:
                                    kind: NEVER
                                frequency:
                                  type: string
                                  enum:
                                    - WEEKLY
                                byWeekday:
                                  type: array
                                  items:
                                    anyOf:
                                      - type: number
                                        enum:
                                          - 0
                                      - type: number
                                        enum:
                                          - 1
                                      - type: number
                                        enum:
                                          - 2
                                      - type: number
                                        enum:
                                          - 3
                                      - type: number
                                        enum:
                                          - 4
                                      - type: number
                                        enum:
                                          - 5
                                      - type: number
                                        enum:
                                          - 6
                                  minItems: 1
                                  maxItems: 7
                              required:
                                - interval
                                - frequency
                                - byWeekday
                              additionalProperties: false
                            - type: object
                              properties:
                                version:
                                  type: number
                                  enum:
                                    - 1
                                  default: 1
                                interval:
                                  type: integer
                                  minimum: 1
                                end:
                                  oneOf:
                                    - type: object
                                      properties:
                                        kind:
                                          type: string
                                          enum:
                                            - NEVER
                                      required:
                                        - kind
                                      additionalProperties: false
                                    - type: object
                                      properties:
                                        kind:
                                          type: string
                                          enum:
                                            - ON_DATE
                                        until:
                                          type: string
                                          minLength: 1
                                      required:
                                        - kind
                                        - until
                                      additionalProperties: false
                                    - type: object
                                      properties:
                                        kind:
                                          type: string
                                          enum:
                                            - AFTER_OCCURRENCES
                                        count:
                                          type: integer
                                          minimum: 1
                                      required:
                                        - kind
                                        - count
                                      additionalProperties: false
                                  default:
                                    kind: NEVER
                                frequency:
                                  type: string
                                  enum:
                                    - MONTHLY
                                monthly:
                                  oneOf:
                                    - type: object
                                      properties:
                                        kind:
                                          type: string
                                          enum:
                                            - DAY_OF_MONTH
                                        day:
                                          type: integer
                                          minimum: 1
                                          maximum: 31
                                      required:
                                        - kind
                                        - day
                                      additionalProperties: false
                                    - type: object
                                      properties:
                                        kind:
                                          type: string
                                          enum:
                                            - NTH_WEEKDAY
                                        weekday:
                                          anyOf:
                                            - type: number
                                              enum:
                                                - 0
                                            - type: number
                                              enum:
                                                - 1
                                            - type: number
                                              enum:
                                                - 2
                                            - type: number
                                              enum:
                                                - 3
                                            - type: number
                                              enum:
                                                - 4
                                            - type: number
                                              enum:
                                                - 5
                                            - type: number
                                              enum:
                                                - 6
                                        ordinal:
                                          anyOf:
                                            - type: number
                                              enum:
                                                - 1
                                            - type: number
                                              enum:
                                                - 2
                                            - type: number
                                              enum:
                                                - 3
                                            - type: number
                                              enum:
                                                - 4
                                      required:
                                        - kind
                                        - weekday
                                        - ordinal
                                      additionalProperties: false
                              required:
                                - interval
                                - frequency
                                - monthly
                              additionalProperties: false
                            - type: object
                              properties:
                                version:
                                  type: number
                                  enum:
                                    - 1
                                  default: 1
                                interval:
                                  type: integer
                                  minimum: 1
                                end:
                                  oneOf:
                                    - type: object
                                      properties:
                                        kind:
                                          type: string
                                          enum:
                                            - NEVER
                                      required:
                                        - kind
                                      additionalProperties: false
                                    - type: object
                                      properties:
                                        kind:
                                          type: string
                                          enum:
                                            - ON_DATE
                                        until:
                                          type: string
                                          minLength: 1
                                      required:
                                        - kind
                                        - until
                                      additionalProperties: false
                                    - type: object
                                      properties:
                                        kind:
                                          type: string
                                          enum:
                                            - AFTER_OCCURRENCES
                                        count:
                                          type: integer
                                          minimum: 1
                                      required:
                                        - kind
                                        - count
                                      additionalProperties: false
                                  default:
                                    kind: NEVER
                                frequency:
                                  type: string
                                  enum:
                                    - YEARLY
                              required:
                                - interval
                                - frequency
                              additionalProperties: false
                        startsAt:
                          type: string
                          minLength: 1
                        timezone:
                          type:
                            - string
                            - 'null'
                      required:
                        - type
                        - definition
                        - startsAt
                      additionalProperties: false
                    - type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - API
                        inputSchema: {}
                      required:
                        - type
                      additionalProperties: false
                  description: Trigger config. Defaults to MANUAL.
                  title: WorkflowTrigger
                maxCreditsPerRun:
                  type:
                    - integer
                    - 'null'
                  exclusiveMinimum: 0
                  description: Optional per-run credit ceiling.
              required:
                - name
                - plan
              additionalProperties: false
      responses:
        '200':
          description: Plan is valid
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - success
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      isValid:
                        type: boolean
                      warnings:
                        type: array
                        items:
                          type: string
                        description: Non-blocking validation warnings.
                      errors:
                        type: array
                        items:
                          type: string
                        description: Blocking validation errors when `isValid` is false.
                    required:
                      - isValid
                      - warnings
                required:
                  - status
                  - message
                  - data
        '400':
          description: The plan is structurally invalid (malformed graph).
        '403':
          description: >-
            Advanced workflows are not enabled for this workspace. Ask your
            workspace admin to enable the feature.
        '422':
          description: The plan fails block/config validation.
      security:
        - apiKey: []
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key

````