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

# Create Workflow

> Create a new workflow definition.

Example:
```json
{
  "name": "PDF Processing Pipeline",
  "team_id": 1,
  "steps": [
    {
      "step_key": "marker_parse",
      "unique_name": "parse",
      "settings": {"extract_images": true}
    },
    {
      "step_key": "marker_extract",
      "unique_name": "extract",
      "version": "1.0.0",
      "settings": {},
      "depends_on": ["parse"]
    },
    {
      "step_key": "marker_segment",
      "unique_name": "segment",
      "settings": {"method": "auto"},
      "depends_on": ["parse"]
    }
  ]
}
```

This creates a template that can be executed multiple times.
Note:
- version is optional and defaults to the latest active version
- unique_name is required and must be unique within the workflow
- depends_on references other steps by their unique_name



## OpenAPI

````yaml https://www.datalab.to/openapi.json post /api/v1/workflows/workflows
openapi: 3.1.0
info:
  title: Datalab API
  version: 0.0.1
servers:
  - url: https://www.datalab.to
    description: Datalab API
security: []
paths:
  /api/v1/workflows/workflows:
    post:
      summary: Create Workflow
      description: |-
        Create a new workflow definition.

        Example:
        ```json
        {
          "name": "PDF Processing Pipeline",
          "team_id": 1,
          "steps": [
            {
              "step_key": "marker_parse",
              "unique_name": "parse",
              "settings": {"extract_images": true}
            },
            {
              "step_key": "marker_extract",
              "unique_name": "extract",
              "version": "1.0.0",
              "settings": {},
              "depends_on": ["parse"]
            },
            {
              "step_key": "marker_segment",
              "unique_name": "segment",
              "settings": {"method": "auto"},
              "depends_on": ["parse"]
            }
          ]
        }
        ```

        This creates a template that can be executed multiple times.
        Note:
        - version is optional and defaults to the latest active version
        - unique_name is required and must be unique within the workflow
        - depends_on references other steps by their unique_name
      operationId: create_workflow_api_v1_workflows_workflows_post
      parameters:
        - name: wos-session
          in: cookie
          required: false
          schema:
            type: string
            title: Wos-Session
        - name: datalab_active_team
          in: cookie
          required: false
          schema:
            type: string
            title: Datalab Active Team
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWorkflowRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowDefinitionResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    CreateWorkflowRequest:
      properties:
        name:
          type: string
          title: Name
        steps:
          items:
            $ref: '#/components/schemas/WorkflowStepDefinition'
          type: array
          title: Steps
      type: object
      required:
        - name
        - steps
      title: CreateWorkflowRequest
      description: Request to create a new workflow definition.
    WorkflowDefinitionResponse:
      properties:
        id:
          type: integer
          title: Id
        name:
          type: string
          title: Name
        team_id:
          type: integer
          title: Team Id
        steps:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Steps
      type: object
      required:
        - id
        - name
        - team_id
        - steps
      title: WorkflowDefinitionResponse
      description: Response with workflow definition details.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    WorkflowStepDefinition:
      properties:
        step_key:
          type: string
          title: Step Key
        version:
          anyOf:
            - type: string
            - type: 'null'
          title: Version
        unique_name:
          type: string
          title: Unique Name
        settings:
          additionalProperties: true
          type: object
          title: Settings
          default: {}
        depends_on:
          items:
            type: string
          type: array
          title: Depends On
          default: []
      type: object
      required:
        - step_key
        - unique_name
      title: WorkflowStepDefinition
      description: Definition of a single step in a workflow.
    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
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key

````