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

# Create a workflow for an agent



## OpenAPI

````yaml post /api/workflows/{agent_name}
openapi: 3.1.0
info:
  title: Apigene
  description: Apigene API
  version: 1.0.0
  contact:
    name: Apigene Support
    url: https://app.apigene.ai
    email: support@apigene.ai
servers:
  - url: https://app.apigene.ai
security:
  - BearerAuth: []
paths:
  /api/workflows/{agent_name}:
    post:
      tags:
        - Workflows
      summary: Create a workflow for an agent
      operationId: workflow_create
      parameters:
        - name: agent_name
          in: path
          required: true
          schema:
            type: string
            title: Agent Name
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkflowCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    WorkflowCreate:
      properties:
        workflow_id:
          type: string
          minLength: 1
          title: Workflow Id
          description: Client-provided unique workflow id
        description:
          type: string
          minLength: 1
          title: Description
          description: Human-readable description (required)
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
          description: Optional workflow display name
        nodes:
          items:
            additionalProperties: true
            type: object
          type: array
          minItems: 1
          title: Nodes
          description: n8n-shaped nodes
        connections:
          additionalProperties: true
          type: object
          title: Connections
          description: n8n-shaped connections map
        inputs:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Inputs
          description: Optional default inputs ($workflow.inputs)
      type: object
      required:
        - workflow_id
        - description
        - nodes
      title: WorkflowCreate
    WorkflowResponse:
      properties:
        id:
          type: string
          title: Id
        agent_name:
          type: string
          title: Agent Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        nodes:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Nodes
        connections:
          additionalProperties: true
          type: object
          title: Connections
        inputs:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Inputs
        created_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Created By
        created_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Created At
        updated_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Updated At
      type: object
      required:
        - id
        - agent_name
        - nodes
        - connections
      title: WorkflowResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT Authorization header using the Bearer scheme. Example:
        'Authorization: Bearer {token}'

````