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

# Validate a workflow definition

> Checks a workflow definition and tells you what is wrong with it, without saving anything.

Call this before [Create a workflow (not imported apps)](/api-reference/create-a-workflow-not-imported-apps) or [Update workflow (not imported apps)](/api-reference/update-workflow-not-imported-apps) to catch problems while you still have the definition in hand. An invalid definition doesn't fail the call. It comes back with `valid` set to `false` and the problems listed in `errors`, so branch on `valid` rather than on whether the call succeeded.

Send the `trigger` you plan to create the workflow with to check it too. Its type must be available for this app, its `condition` must be valid jq that is simple enough to run on every event, and a hook's steps must follow the hook rules. A trigger that create would refuse for these reasons comes back here with the same `code` and `message`. The trigger is checked as part of a new workflow: a condition that an existing workflow already uses passes [Update workflow](/api-reference/update-workflow) until you edit it, but is refused here. This call doesn't check the trigger against the app's current state, such as whether its entity exists, so create can still refuse a trigger that passes here.



## OpenAPI

````yaml /developers/references/app-management/app-management-openapi.json post /api/apps/{app_id}/workflows/validate-definition
openapi: 3.1.0
info:
  title: Base44 App Management API
  version: 1.0.0
servers:
  - url: https://app.base44.com
security:
  - PersonalAccessTokenAuth: []
paths:
  /api/apps/{app_id}/workflows/validate-definition:
    post:
      summary: Validate a workflow definition
      description: >-
        Checks a workflow definition and tells you what is wrong with it,
        without saving anything.


        Call this before [Create a workflow (not imported
        apps)](/api-reference/create-a-workflow-not-imported-apps) or [Update
        workflow (not imported
        apps)](/api-reference/update-workflow-not-imported-apps) to catch
        problems while you still have the definition in hand. An invalid
        definition doesn't fail the call. It comes back with `valid` set to
        `false` and the problems listed in `errors`, so branch on `valid` rather
        than on whether the call succeeded.


        Send the `trigger` you plan to create the workflow with to check it too.
        Its type must be available for this app, its `condition` must be valid
        jq that is simple enough to run on every event, and a hook's steps must
        follow the hook rules. A trigger that create would refuse for these
        reasons comes back here with the same `code` and `message`. The trigger
        is checked as part of a new workflow: a condition that an existing
        workflow already uses passes [Update
        workflow](/api-reference/update-workflow) until you edit it, but is
        refused here. This call doesn't check the trigger against the app's
        current state, such as whether its entity exists, so create can still
        refuse a trigger that passes here.
      operationId: validate_definition_api_apps__app_id__workflows_validate_definition_post
      parameters:
        - name: app_id
          in: path
          required: true
          schema:
            type: string
            description: ID of the app whose workflows you want to work with.
            title: App Id
          description: ID of the app whose workflows you want to work with.
          example: 6820f3a4e7b91d003c45a1f2
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ValidateDefinitionRequest'
      responses:
        '200':
          description: The verdict. Check `valid`, not the status code.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationResponse'
        '401':
          description: Missing or invalid credentials.
        '402':
          description: >-
            This workspace's plan does not include workflows. Upgrade to Builder
            or above.
        '403':
          description: >-
            You don't have access to this app, the app does not exist, or the
            app still runs the older automations engine instead of workflows. A
            missing app and an app you cannot reach are deliberately the same
            answer.
        '404':
          description: >-
            The trigger is a hook, and hooks are not available to you. The code
            is `hook_not_found`.
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: >-
            Rate limit exceeded. The base limit is 30 requests per minute. See
            [Rate
            limits](/developers/references/apps-api/get-started/rate-limits) for
            the multiplier your plan gets.
        '503':
          description: >-
            Database temporarily unavailable (`database_unavailable`): the data
            cluster did not answer in time. Retry after the `Retry-After`
            seconds.
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StandardErrorEnvelope'
              examples:
                database_unavailable:
                  summary: database_unavailable
                  value:
                    error:
                      code: database_unavailable
                      message: Database temporarily unavailable, please retry
                      details: {}
      security:
        - PersonalAccessTokenAuth:
            - full_access
        - WorkspaceApiKeyAuth:
            - full_access
        - WorkspaceApiKeyBearerAuth:
            - full_access
components:
  schemas:
    ValidateDefinitionRequest:
      properties:
        definition:
          additionalProperties: true
          type: object
          title: Definition
          description: The CNCF Serverless Workflow v1.0 document to check.
          example:
            do: []
            document:
              dsl: 1.0.0
              name: notify
              version: 1.0.0
        trigger_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Trigger Type
          description: >-
            The trigger type the definition will run under, so the save rules
            that depend on it are checked too. Ignored when `trigger` is sent,
            which carries its own `config.trigger_type`.
          example: scheduled
        trigger:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Trigger
          description: >-
            The trigger you plan to create the workflow with, in the same shape
            as `trigger` on [Create workflow](/api-reference/create-workflow).
            When sent, the trigger and its `condition` are checked with the
            rules create applies to a new workflow, and a refusal comes back in
            `errors` with the code and message create would return. Leave it out
            to check only the definition.
          example:
            condition: ${ .trigger.data.status == "open" }
            config:
              entity_name: Task
              events:
                - create
              trigger_type: entity
      type: object
      required:
        - definition
      title: ValidateDefinitionRequest
    ValidationResponse:
      properties:
        valid:
          type: boolean
          title: Valid
          description: >-
            Whether the definition, and the trigger when you sent one, can be
            saved as-is.
          example: true
        warnings:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Warnings
          description: Notices that don't block saving, same shape as `errors`.
          example: []
        errors:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Errors
          description: >-
            What is wrong with the definition or trigger, one entry per problem,
            each with a `code`, a human-readable `message`, and a `location`
            pointing at the problem, empty when the problem has no single place.
            Empty when `valid` is `true`.
          example:
            - code: UNSUPPORTED_TASK_TYPE
              location: do[0].notify
              message: >-
                Task 'notify' has no supported type key. Supported: ['call',
                'switch', 'wait']
        supported_task_types:
          items:
            type: string
          type: array
          title: Supported Task Types
          description: >-
            The fixed set of [task
            types](/developers/references/apps-api/sections/workflows#tasks-and-activities)
            a definition's `do` steps can use, `call`, `switch`, or `wait`. This
            doesn't vary by app.
          example:
            - call
            - switch
            - wait
        available_activities:
          items:
            type: string
          type: array
          title: Available Activities
          description: >-
            The
            [activities](/developers/references/apps-api/sections/workflows#tasks-and-activities)
            a `call` task on this app can invoke. This varies by app.
          example:
            - compute_seconds_until
            - invoke_backend_function
      type: object
      required:
        - valid
      title: ValidationResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    StandardErrorEnvelope:
      properties:
        error:
          $ref: '#/components/schemas/StandardError'
          description: What went wrong.
      type: object
      required:
        - error
      title: StandardErrorEnvelope
      description: The error body returned in the standard envelope.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    StandardError:
      properties:
        code:
          type: string
          title: Code
          description: >-
            Stable machine-readable cause of the failure. Match on this, not on
            `message`.
          example: not_found
        message:
          type: string
          title: Message
          description: Human-readable explanation. It isn't a stable contract.
          example: App not found
        details:
          additionalProperties: true
          type: object
          title: Details
          description: >-
            Structured context for the failure, or an empty object when there's
            none.
          example: {}
      type: object
      required:
        - code
        - message
      title: StandardError
  securitySchemes:
    PersonalAccessTokenAuth:
      type: http
      scheme: bearer
      description: >-
        Personal access token, sent as `Authorization: Bearer <token>`. Each
        operation lists the permission it needs: `read_only` or `full_access`. A
        full-access token can call every operation. A read-only token can call
        only the operations that list `read_only`; anything else returns 403
        `read_only_credential_route_not_allowed`.
    WorkspaceApiKeyAuth:
      type: apiKey
      in: header
      name: api_key
      description: >-
        Workspace API key, sent as `api_key: <key>`. Each operation that accepts
        one lists what the key needs: a permission, `read_only` or
        `full_access`, like a personal access token, or a scope. A key without
        the scope gets 403 `workspace_api_key_scope_required`.
    WorkspaceApiKeyBearerAuth:
      type: http
      scheme: bearer
      description: >-
        Workspace API key, sent as `Authorization: Bearer <key>`. Accepted
        wherever `api_key` is, with the same permission.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.