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

# Create workflow

> Create a new workflow together with its initial version. This route forwards to
workflows-engine, which generates the slug, persists the workflow + version, and
provisions the execution state machine.

Only `name` is required. `definition` is the workflow DSL as an arbitrary JSON
object (steps, input_schema, metadata). Categories, tags, and visibility are not
accepted on this route — workflows-engine applies its defaults (categories
`["general"]`, visibility `private`).




## OpenAPI

````yaml /openapi_specs/models.json post /v1/workflows
openapi: 3.0.3
info:
  title: each::labs Official API v1
  description: >
    Official each::labs API V1.

    This API provides access to our comprehensive AI model catalog and other
    resources.


    ## Public contract notes


    - Public API routes handled by request logging include `X-Request-Id` for
      support and log correlation. Clients may send `X-Request-Id`; otherwise
      api-service generates one. Root, health, and metrics endpoints are excluded.
    - REST error bodies keep the backward-compatible JSON shape used by existing
      clients. Most errors include at least `error`; some shared error paths also
      include `status` and `details`. Use the HTTP status code as the primary
      programmatic signal unless an endpoint documents a richer envelope.
    - Rate-limit and retry headers are endpoint-dependent. If a response
    includes
      `Retry-After`, honor it before retrying; otherwise use bounded exponential
      backoff for retryable 429/5xx responses.
  version: 1.0.0
  contact:
    name: API Support
    email: support@eachlabs.ai
  x-logo:
    url: ./logo-white.svg
    altText: each::labs
servers:
  - url: https://api.eachlabs.ai
    description: Production server
security: []
tags:
  - name: AI Models
    description: Endpoints for listing and retrieving AI models and other resources.
  - name: AI Models Prediction
    description: Endpoints for managing model predictions
  - name: Uploads
    description: Endpoints for uploading files that can be used as model inputs.
  - name: Executions
    description: Endpoints for listing execution history.
  - name: Workflows
    description: >-
      Endpoints for creating workflows and triggering workflow executions
      through api-service.
  - name: OpenAI Compatibility
    description: OpenAI-compatible endpoints for LLM Router requests.
  - name: Webhooks
    description: >
      Endpoints for retrieving webhook information and delivery history.


      **Note:** Currently, webhooks are only supported for Workflows V2. We are
      actively expanding webhook support to other services and will update this
      documentation as new integrations become available.
paths:
  /v1/workflows:
    post:
      tags:
        - Workflows
      summary: Create workflow
      description: >
        Create a new workflow together with its initial version. This route
        forwards to

        workflows-engine, which generates the slug, persists the workflow +
        version, and

        provisions the execution state machine.


        Only `name` is required. `definition` is the workflow DSL as an
        arbitrary JSON

        object (steps, input_schema, metadata). Categories, tags, and visibility
        are not

        accepted on this route — workflows-engine applies its defaults
        (categories

        `["general"]`, visibility `private`).
      operationId: createWorkflow
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkflowCreateRequest'
            example:
              name: My Workflow
              definition:
                version: '1.0'
                steps: []
      responses:
        '201':
          description: Workflow created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowDetailResponse'
              example:
                workflow_id: wf_abc123
                slug: my-workflow
                name: My Workflow
                categories:
                  - general
                tags: []
                status: active
                trigger_count: 0
                clone_count: 0
                is_public: false
                production: false
                created_at: '2026-01-01T00:00:00Z'
                updated_at: '2026-01-01T00:00:00Z'
                versions:
                  - version_id: v1
                    slug: my-workflow
                    published: false
                    locked: false
                    production: false
                    allowed_to_share: false
                    trigger_count: 0
                    created_at: '2026-01-01T00:00:00Z'
                    updated_at: '2026-01-01T00:00:00Z'
                    definition:
                      version: '1.0'
                      steps: []
                    status: active
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '408':
          $ref: '#/components/responses/RequestTimeout'
        '409':
          $ref: '#/components/responses/Conflict'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '502':
          $ref: '#/components/responses/BadGateway'
      security:
        - BearerAuth: []
components:
  schemas:
    WorkflowCreateRequest:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          description: Human-readable workflow name. Required.
          example: My Workflow
        definition:
          type: object
          additionalProperties: true
          description: Workflow DSL (steps, input_schema, metadata) as a JSON object.
          example:
            version: '1.0'
            steps: []
    WorkflowDetailResponse:
      type: object
      description: The created workflow (summary fields + its versions).
      properties:
        workflow_id:
          type: string
          example: wf_abc123
        slug:
          type: string
          example: my-workflow
        name:
          type: string
          example: My Workflow
        categories:
          type: array
          items:
            type: string
          example:
            - general
        tags:
          type: array
          items:
            type: string
          example: []
        status:
          type: string
          example: active
        trigger_count:
          type: integer
          example: 0
        clone_count:
          type: integer
          example: 0
        is_public:
          type: boolean
          example: false
        production:
          type: boolean
          example: false
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        versions:
          type: array
          items:
            $ref: '#/components/schemas/WorkflowVersionDetail'
    WorkflowVersionDetail:
      type: object
      properties:
        version_id:
          type: string
          example: v1
        slug:
          type: string
          example: my-workflow
        published:
          type: boolean
          example: false
        locked:
          type: boolean
          example: false
        production:
          type: boolean
          example: false
        allowed_to_share:
          type: boolean
          example: false
        trigger_count:
          type: integer
          example: 0
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        definition:
          type: object
          additionalProperties: true
          description: The version's workflow DSL.
        status:
          type: string
          example: active
    Error:
      type: object
      description: >
        Backward-compatible REST error body. Endpoint-specific handlers may
        return only

        `error`; shared error paths may also include `status` and `details`.
      properties:
        status:
          type: integer
          description: HTTP status code, when returned by the shared error handler.
          example: 400
        error:
          type: string
          description: Safe user-facing error message.
          example: error message
        details:
          nullable: true
          description: Optional validation or request details for client errors.
      required:
        - error
  responses:
    BadRequest:
      description: Bad request
      headers:
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: slug parameter is required
    Unauthorized:
      description: Authentication required or invalid credentials
      headers:
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Invalid or missing API key
    Forbidden:
      description: Forbidden
      headers:
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: forbidden
    RequestTimeout:
      description: Upstream request timed out
      headers:
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Request timeout
    Conflict:
      description: Conflict with current resource state
      headers:
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: conflict
    InternalServerError:
      description: Internal server error
      headers:
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: 'Failed to fetch models: internal error'
    BadGateway:
      description: Upstream service unavailable
      headers:
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: workflows-engine unavailable
  headers:
    RequestId:
      description: >-
        Request correlation ID. Echoes the incoming `X-Request-Id` header or a
        generated ID.
      schema:
        type: string
      example: 123e4567-e89b-12d3-a456-426614174000
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key passed as an Authorization Bearer token: `Authorization: Bearer
        YOUR_API_KEY`

````