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

# Create a new flow

> Create a new API flow



## OpenAPI

````yaml openapi.json post /api/v1/flows
openapi: 3.0.0
info:
  description: Dualship backend API for workflow automation and API management.
  title: Dualship API
  termsOfService: https://dualship.run/terms
  contact:
    name: Dualship Support
    url: https://dualship.run/support
    email: support@dualship.run
  version: '1.0'
servers:
  - url: https://api.dualship.run
security: []
paths:
  /api/v1/flows:
    post:
      tags:
        - flows
      summary: Create a new flow
      description: Create a new API flow
      parameters:
        - description: Workspace ID
          name: X-Workspace-Id
          in: header
          required: true
          schema:
            type: string
        - description: Project ID (uses default if not specified)
          name: project_id
          in: query
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/internal_api_handler.CreateFlowRequest'
        description: Flow configuration
        required: true
      responses:
        '201':
          description: Flow created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/internal_api_handler.FlowResponse'
        '400':
          description: Invalid request or validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/internal_api_handler.BadRequestError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/internal_api_handler.UnauthorizedError'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/internal_api_handler.InternalServerError'
      security:
        - BearerAuth: []
components:
  schemas:
    internal_api_handler.CreateFlowRequest:
      type: object
      required:
        - name
        - slug
        - trigger
      properties:
        description:
          type: string
        edges:
          type: array
          items:
            type: integer
        metadata:
          type: array
          items:
            type: integer
        name:
          type: string
        nodes:
          type: array
          items:
            type: integer
        slug:
          type: string
        trigger:
          type: object
          required:
            - type
          properties:
            config:
              type: array
              items:
                type: integer
            type:
              type: string
    internal_api_handler.FlowResponse:
      type: object
      properties:
        created_at:
          type: string
          example: '2024-01-15T10:30:00Z'
        description:
          type: string
          example: Handles user registration and welcome email
        edges:
          type: array
          items:
            type: integer
        id:
          type: string
          example: 550e8400-e29b-41d4-a716-446655440000
        metadata:
          type: array
          items:
            type: integer
        name:
          type: string
          example: User Registration Flow
        nodes:
          type: array
          items:
            type: integer
        project_id:
          type: string
          example: 550e8400-e29b-41d4-a716-446655440001
        slug:
          type: string
          example: user-registration
        status:
          type: string
          example: active
        trigger_config:
          type: array
          items:
            type: integer
        trigger_type_id:
          type: string
          example: 550e8400-e29b-41d4-a716-446655440002
        updated_at:
          type: string
          example: '2024-01-15T10:30:00Z'
    internal_api_handler.BadRequestError:
      description: Bad request error
      type: object
      properties:
        code:
          type: string
          example: BAD_REQUEST
        error:
          type: string
          example: invalid request parameters
    internal_api_handler.UnauthorizedError:
      description: Unauthorized error
      type: object
      properties:
        code:
          type: string
          example: UNAUTHORIZED
        error:
          type: string
          example: unauthorized
    internal_api_handler.InternalServerError:
      description: Internal server error
      type: object
      properties:
        code:
          type: string
          example: INTERNAL_ERROR
        error:
          type: string
          example: internal server error
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT Bearer token authentication

````