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

# Create workflow (agent)

> Create a new agent/workflow with name, tools, system prompt, and model. Can be triggered manually or by schedules/webhooks.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/workflow/manager/create
openapi: 3.0.0
info:
  title: Flowra API (API Key Endpoints)
  description: >-
    **Flowra** is an AI-powered platform for building agents, workflows, and
    integrations.


    ### Capabilities

    - **Tools & Toolkits** – Define and group tools for agents and workflows.

    - **Workflows** – Orchestrate steps and automate processes.

    - **Triggers** – Schedule or event-based execution.

    - **Auth & Connections** – OAuth, API keys, and connected accounts.

    - **MCP** – Model Context Protocol server integration.

    - **Knowledge / RAG** – Add files and URLs for retrieval-augmented
    generation.


    ### Authentication

    Use the **x-api-key** header with a project API key to access endpoints that
    support API Key auth. Create and manage API keys in the dashboard under your
    project settings.


    Only endpoints that support API Key authentication via the @ApiKeyEnabled()
    decorator.


    Send x-api-key (required). On multi-tenant endpoints, optionally send
    x-username to act as an external user.


    Only endpoints that support API Key authentication via the @ApiKeyEnabled()
    decorator.


    Send x-api-key (required). On multi-tenant endpoints, optionally send
    x-username (defaults to the project’s default external user).
  version: '1.0'
  contact:
    name: Flowra
    url: https://flowra.dev
servers:
  - url: https://flowra.dev
    description: Flowra API
security: []
tags:
  - name: Users
    description: User profile
  - name: External Users
    description: End-user identities inside a project (x-username)
  - name: Auth Configs
    description: OAuth and API key configs for toolkits
  - name: Connected Accounts
    description: OAuth connected accounts and link creation
  - name: Toolkits
    description: List and search toolkits
  - name: Tools
    description: List, execute, and manage tools
  - name: Skills
    description: Browse, create, import, and install skills
  - name: Workflow & Agent
    description: Create, run, and inspect workflows and agents
  - name: Triggers
    description: Schedule and event-based trigger instances
  - name: Chat
    description: Threads and streaming agent runs
  - name: File
    description: Upload, list, and download files
  - name: Knowledge
    description: RAG knowledge collections
  - name: Table
    description: Collections and documents
  - name: Sandbox
    description: Ephemeral and durable code sandboxes
  - name: Browser
    description: Live browser sessions and view
  - name: LLM
    description: List AI models and generate completions
  - name: MCP
    description: MCP server management
paths:
  /api/v1/workflow/manager/create:
    post:
      tags:
        - Workflow & Agent
      summary: Create workflow (agent)
      description: >-
        Create a new agent/workflow with name, tools, system prompt, and model.
        Can be triggered manually or by schedules/webhooks.
      operationId: WorkflowManagerController_create
      parameters:
        - name: x-username
          in: header
          required: false
          description: >-
            External user (end user) to act as. Optional — if omitted, Flowra
            uses the project’s default external user. Send a stable username
            (e.g. customer_alice) only when you need another end-user context.
          schema:
            type: string
            default: (project default user)
          example: customer_alice
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAgentDto'
      responses:
        '200':
          description: Agent created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowResponseDto'
        '201':
          description: ''
      security:
        - x-api-key: []
        - x-api-key: []
          x-username: []
components:
  schemas:
    CreateAgentDto:
      $ref: '#/components/schemas/CreateAgentDto'
      type: object
      properties:
        name:
          type: string
          description: Agent name
          default: New Agent
        description:
          type: string
          description: Agent description
        agentPrompt:
          type: string
          description: System prompt / instructions for the agent
        modelSettings:
          description: Model and generation settings
          allOf:
            - $ref: '#/components/schemas/CreateAgentModelSettingsDto'
        toolSlugs:
          description: Tool slugs to attach to the agent
          type: array
          items:
            type: string
        allowedKnowledgeCollectionIds:
          description: >-
            Knowledge collection IDs this agent can access (from
            RAG_LIST_COLLECTIONS). If set, RAG tools are restricted to these
            collections only.
          type: array
          items:
            type: string
        allowedDatabaseCollectionIds:
          description: >-
            Database collection IDs (from DATABASE_LIST_COLLECTIONS) this agent
            can access. If set, DATABASE_* tools are restricted to these
            collections only.
          type: array
          items:
            type: string
        databaseAccessPolicies:
          type: object
          description: >-
            Per-collection end-user access policies (keyed by collectionId).
            Controls which operations, row scope (own/all), and columns end
            users may use through this agent.
          additionalProperties: true
        isPublic:
          type: boolean
          description: >-
            Whether this agent is public (visible in other projects’ agent
            select)
          default: false
        externalMcpConfigs:
          description: >-
            External MCP configs: [{ name, url, headers?, tools }]. tools =
            selected tool slugs from that MCP.
          type: array
          items:
            $ref: '#/components/schemas/CreateAgentExternalMcpConfigDto'
        agentCapabilities:
          description: >-
            User-facing agent capabilities (advanced planning, summarization,
            retry, approval, etc.). These are mapped server-side to runtime
            selection and middleware.
          allOf:
            - $ref: '#/components/schemas/CreateAgentCapabilitiesDto'
        toolsMode:
          enum:
            - NORMAL
            - SMART
          type: string
          description: >-
            Agent tools: NORMAL = explicit list, SMART = meta + discovery
            filters (same as MCP owner toolsMode).
        discoveryToolsWhitelist:
          type: boolean
          description: >-
            When toolsMode is SMART: true = discovery limited to pinned toolkit
            slugs; false = exclude those slugs from discovery.
        subAgentIds:
          description: >-
            Child agent workflow IDs for multi-agent coordination (one level).
            Platform enables deeper planning automatically.
          type: array
          items:
            type: string
        skillIds:
          description: >-
            Skill IDs to attach as playbooks. Platform enables deeper planning
            automatically. Skills do not merge tools into toolSlugs.
          type: array
          items:
            type: string
        starterPrompts:
          description: >-
            Suggested starter prompts shown in chat empty state (max 8, each max
            200 chars).
          type: array
          items:
            type: string
            maxLength: 200
        avatarUrl:
          type: string
          maxLength: 500
          description: >-
            Optional agent avatar. Use `file:<uuid>` from file upload
            (toolkit_logo / agent_avatar) or an https image URL.
          example: file:019f0000-0000-7000-8000-000000000001
        triggers:
          description: >-
            Optional cron / channel event triggers (0..N). Dashboard chat is
            always available and must not be listed. kind must be cron or
            trigger_tool.
          type: array
          items:
            $ref: '#/components/schemas/CreateAgentTriggerDto'
        outputSchema:
          type: object
          description: >-
            Optional structured shape for the agent final answer (API /
            integrations). Map of field name → { type, required?, description?
            }.
        connectionCallbackUrl:
          type: string
          maxLength: 2048
    WorkflowResponseDto:
      $ref: '#/components/schemas/WorkflowResponseDto'
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type: string
        projectId:
          type: string
        nodes:
          type: array
          items:
            $ref: '#/components/schemas/WorkflowNodeResponseDto'
        edges:
          type: array
          items:
            $ref: '#/components/schemas/WorkflowEdgeResponseDto'
        triggers:
          type: array
          items:
            $ref: '#/components/schemas/WorkflowTriggerResponseDto'
        workflowType:
          type: string
          enum:
            - static
            - agent
        inputSchema:
          type: object
        outputSchema:
          type: object
        isActive:
          type: boolean
        isPublic:
          type: boolean
          description: Whether this workflow (agent) is public for select in other projects
        version:
          type: string
          description: >-
            Version in form 1.0.x; incremented on each update (for marketplace
            update check)
        clonedFromWorkflowId:
          type: string
          nullable: true
          description: 'If cloned from marketplace: source workflow id'
        clonedFromVersion:
          type: string
          nullable: true
          description: Source workflow version at clone time (e.g. 1.0.1)
        executionCount:
          type: number
        successfulExecutionCount:
          type: number
        failedExecutionCount:
          type: number
        lastExecutedAt:
          type: string
        metadata:
          $ref: '#/components/schemas/WorkflowMetadata'
        connections:
          type: array
          items:
            $ref: '#/components/schemas/WorkflowConnectionDto'
        tools:
          type: array
          items:
            $ref: '#/components/schemas/WorkflowToolDetailDto'
        createdAt:
          format: date-time
          type: string
        updatedAt:
          format: date-time
          type: string
        sourceVersionLatest:
          type: string
          example: 1.0.2
        toolsMode:
          type: string
          enum:
            - NORMAL
            - SMART
        discoveryToolsWhitelist:
          type: boolean
        connectionCallbackUrl:
          type: string
          nullable: true
      required:
        - id
        - name
        - projectId
        - nodes
        - edges
        - triggers
        - workflowType
        - isActive
        - isPublic
        - version
        - executionCount
        - successfulExecutionCount
        - failedExecutionCount
        - connections
        - tools
        - createdAt
        - updatedAt
  securitySchemes:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Project API key. Create and manage keys in the dashboard under Project →
        API Keys. Send as header: x-api-key: <your-key>
    x-username:
      type: apiKey
      in: header
      name: x-username
      description: >-
        Optional. External user username. If omitted, Flowra uses the project’s
        default external user. Send as header: x-username: <username>

````