> ## 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.

# Generate flow from prompt

> Use AI to generate a flow from natural language



## OpenAPI

````yaml openapi.json post /api/v1/ai/prompt
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/ai/prompt:
    post:
      tags:
        - ai
      summary: Generate flow from prompt
      description: Use AI to generate a flow from natural language
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/github_com_dualship_dualship-be_internal_api_rules.AIPromptRequest
        description: Prompt request
        required: true
      responses:
        '200':
          description: Generated flow
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/internal_api_handler.PromptFlowResponse'
        '400':
          description: Invalid request
          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'
        '503':
          description: AI service not configured
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/internal_api_handler.ServiceUnavailableError
      security:
        - BearerAuth: []
components:
  schemas:
    github_com_dualship_dualship-be_internal_api_rules.AIPromptRequest:
      type: object
      required:
        - prompt
        - workspace_id
      properties:
        prompt:
          type: string
          maxLength: 10000
          minLength: 1
        workspace_id:
          type: string
    internal_api_handler.PromptFlowResponse:
      description: AI-generated flow response
      type: object
      properties:
        flow:
          type: object
          additionalProperties: {}
    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.ServiceUnavailableError:
      description: Service unavailable error
      type: object
      properties:
        code:
          type: string
          example: SERVICE_UNAVAILABLE
        error:
          type: string
          example: service unavailable
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT Bearer token authentication

````