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

# Create Workflow

> API key permission: Agents (Admin also opens it).



## OpenAPI

````yaml /api-reference/openapi.json post /workflows/create
openapi: 3.1.0
info:
  title: Neural Factory API
  version: 0.1.0
  description: >-
    The endpoints a program can call with an API key. Exchange the key's secret
    for a token at POST /apikeys/token and send it as a Bearer token.
servers:
  - url: https://api.neuralfactory.ai
    description: SaaS
  - url: https://{apiHost}
    description: 'Enterprise: the API address of your own deployment'
    variables:
      apiHost:
        default: api.example.com
        description: Your deployment's API host
security:
  - bearerAuth: []
tags:
  - name: API keys
  - name: Chat
  - name: Runs
  - name: Agents
  - name: Workflows
  - name: Schedules
  - name: Knowledge bases
  - name: Documents
  - name: Search
  - name: Skills
  - name: Toolkits
  - name: Files
  - name: Interactions
  - name: Usage and billing
  - name: Catalogue
  - name: Browser
  - name: Users
  - name: Groups
  - name: Builds
paths:
  /workflows/create:
    post:
      tags:
        - Workflows
      summary: Create Workflow
      description: 'API key permission: Agents (Admin also opens it).'
      operationId: create_workflow_workflows_create_post
      parameters:
        - name: env
          in: query
          required: false
          schema:
            title: Env
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkflowCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowEntry'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    WorkflowCreate:
      properties:
        blueprint:
          $ref: '#/components/schemas/WorkflowBlueprint'
        publish:
          type: boolean
          title: Publish
          default: true
      type: object
      required:
        - blueprint
      title: WorkflowCreate
    WorkflowEntry:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        description:
          type: string
          title: Description
          default: ''
        version:
          type: string
          title: Version
          default: 1.0.0
        status:
          type: string
          title: Status
          default: active
        step_count:
          type: integer
          title: Step Count
          default: 0
        steps:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Steps
        input_schema:
          additionalProperties: true
          type: object
          title: Input Schema
        output_schema:
          additionalProperties: true
          type: object
          title: Output Schema
        error_handling:
          additionalProperties: true
          type: object
          title: Error Handling
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
        toolkits:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Toolkits
        created_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Created By
        created_by_email:
          anyOf:
            - type: string
            - type: 'null'
          title: Created By Email
        created_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Created At
        updated_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Updated At
        visibility:
          type: string
          title: Visibility
          default: private
        allowed_groups:
          items:
            type: string
          type: array
          title: Allowed Groups
        allowed_user_ids:
          items:
            type: string
          type: array
          title: Allowed User Ids
        revision:
          type: integer
          title: Revision
          default: 1
        edit_seq:
          type: integer
          title: Edit Seq
          default: 0
        published_revision:
          anyOf:
            - type: integer
            - type: 'null'
          title: Published Revision
        from_use_case:
          anyOf:
            - $ref: '#/components/schemas/FromUseCase'
            - type: 'null'
        governance_warnings:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Governance Warnings
        last_run:
          anyOf:
            - $ref: '#/components/schemas/WorkflowLastRun'
            - type: 'null'
        run_count:
          type: integer
          title: Run Count
          default: 0
        pending_approvals:
          type: integer
          title: Pending Approvals
          default: 0
        last_run_execution_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Run Execution Id
        recent_statuses:
          items:
            type: string
          type: array
          title: Recent Statuses
        cost_30d:
          anyOf:
            - type: number
            - type: 'null'
          title: Cost 30D
        tags:
          items:
            type: string
          type: array
          title: Tags
        is_favourite:
          type: boolean
          title: Is Favourite
          default: false
      type: object
      required:
        - id
        - name
      title: WorkflowEntry
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    WorkflowBlueprint:
      properties:
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        name:
          type: string
          title: Name
        description:
          type: string
          title: Description
          default: ''
        version:
          type: string
          title: Version
          default: 1.0.0
        input_schema:
          additionalProperties: true
          type: object
          title: Input Schema
        output_schema:
          additionalProperties: true
          type: object
          title: Output Schema
        steps:
          items:
            $ref: '#/components/schemas/WorkflowStep'
          type: array
          title: Steps
        error_handling:
          $ref: '#/components/schemas/ErrorHandlingConfig'
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
        toolkits:
          items:
            $ref: '#/components/schemas/ToolkitBinding'
          type: array
          title: Toolkits
        visibility:
          type: string
          title: Visibility
          default: private
        allowed_groups:
          items:
            type: string
          type: array
          title: Allowed Groups
        allowed_user_ids:
          items:
            type: string
          type: array
          title: Allowed User Ids
      type: object
      required:
        - name
        - steps
      title: WorkflowBlueprint
    FromUseCase:
      properties:
        id:
          type: string
          title: Id
        version:
          type: integer
          title: Version
      type: object
      required:
        - id
        - version
      title: FromUseCase
      description: >-
        The use case an agent or a workflow was activated from, and the artifact
        version copied.
    WorkflowLastRun:
      properties:
        status:
          type: string
          title: Status
        completed_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Completed At
      type: object
      required:
        - status
      title: WorkflowLastRun
      description: Most recent execution summary shown on the workflows list (B1).
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    WorkflowStep:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        type:
          $ref: '#/components/schemas/StepType'
        config:
          additionalProperties: true
          type: object
          title: Config
        validation:
          items:
            $ref: '#/components/schemas/ValidationRule'
          type: array
          title: Validation
        depends_on:
          items:
            type: string
          type: array
          title: Depends On
        error_handling:
          anyOf:
            - $ref: '#/components/schemas/StepErrorHandling'
            - type: 'null'
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        allowed_tools:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Allowed Tools
        sensitivity:
          $ref: '#/components/schemas/StepSensitivity'
          default: normal
      type: object
      required:
        - id
        - name
        - type
      title: WorkflowStep
    ErrorHandlingConfig:
      properties:
        default_on_error:
          type: string
          title: Default On Error
          default: fail
        default_max_retries:
          type: integer
          title: Default Max Retries
          default: 2
        default_retry_delay_ms:
          type: integer
          title: Default Retry Delay Ms
          default: 1000
      type: object
      title: ErrorHandlingConfig
    ToolkitBinding:
      properties:
        toolkit_id:
          type: string
          title: Toolkit Id
        name:
          type: string
          title: Name
          default: ''
        selected_tools:
          items:
            type: string
          type: array
          title: Selected Tools
      type: object
      required:
        - toolkit_id
      title: ToolkitBinding
    StepType:
      type: string
      enum:
        - llm_task
        - tool_action
        - code_execution
        - condition
        - validation
        - human_approval
        - parallel
        - loop
        - agent_task
        - sub_workflow
      title: StepType
    ValidationRule:
      properties:
        field:
          type: string
          title: Field
        rule:
          $ref: '#/components/schemas/ValidationRuleType'
        params:
          additionalProperties: true
          type: object
          title: Params
        message:
          anyOf:
            - type: string
            - type: 'null'
          title: Message
      type: object
      required:
        - field
        - rule
      title: ValidationRule
    StepErrorHandling:
      properties:
        on_error:
          type: string
          title: On Error
          default: fail
        max_retries:
          type: integer
          title: Max Retries
          default: 0
        retry_delay_ms:
          type: integer
          title: Retry Delay Ms
          default: 1000
        retry_backoff:
          type: string
          title: Retry Backoff
          default: exponential
        fallback_step:
          anyOf:
            - type: string
            - type: 'null'
          title: Fallback Step
      type: object
      title: StepErrorHandling
    StepSensitivity:
      type: string
      enum:
        - normal
        - high
      title: StepSensitivity
      description: >-
        A4: governance marker for a step's blast radius.


        ``high`` flags a step that performs a consequential / side-effecting

        operation (writes, deletes, sends, money movement, ...).
        High-sensitivity

        tool actions are recorded to the security audit log when they execute.
        The

        marker is advisory metadata - it never relaxes any other guard.
    ValidationRuleType:
      type: string
      enum:
        - not_empty
        - is_number
        - is_string
        - is_boolean
        - range
        - regex
        - enum
        - expression
        - schema_valid
        - custom
        - is_list
        - is_object
        - is_integer
      title: ValidationRuleType
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        The access_token returned by POST /apikeys/token for an API key's
        secret.

````

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