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

# Create Or Update Controller

> Create or update a controller.

If controller exists as a package (folder), updates the file inside.
Otherwise creates/updates as a single file.

Args:
    controller_type: Type of controller to create/update
    controller_name: Name of the controller (from URL path)
    controller: Controller object with content (and optional type for validation)

Returns:
    Success message when controller is saved

Raises:
    HTTPException: 400 if controller type mismatch or save error



## OpenAPI

````yaml /api-reference/openapi.json post /controllers/{controller_type}/{controller_name}
openapi: 3.1.0
info:
  title: Hummingbot API
  description: API for managing Hummingbot trading instances
  version: 1.0.1
servers:
  - url: http://localhost:8000
    description: Local development server
security: []
paths:
  /controllers/{controller_type}/{controller_name}:
    post:
      tags:
        - Controllers
      summary: Create Or Update Controller
      description: |-
        Create or update a controller.

        If controller exists as a package (folder), updates the file inside.
        Otherwise creates/updates as a single file.

        Args:
            controller_type: Type of controller to create/update
            controller_name: Name of the controller (from URL path)
            controller: Controller object with content (and optional type for validation)

        Returns:
            Success message when controller is saved

        Raises:
            HTTPException: 400 if controller type mismatch or save error
      operationId: >-
        create_or_update_controller_controllers__controller_type___controller_name__post
      parameters:
        - name: controller_type
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/ControllerType'
        - name: controller_name
          in: path
          required: true
          schema:
            type: string
            title: Controller Name
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Controller'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBasic: []
components:
  schemas:
    ControllerType:
      type: string
      enum:
        - directional_trading
        - market_making
        - generic
      title: ControllerType
      description: Types of controllers available
    Controller:
      properties:
        content:
          type: string
          title: Content
          description: Controller source code
        type:
          anyOf:
            - $ref: '#/components/schemas/ControllerType'
            - type: 'null'
          description: Controller type (optional for flexibility)
      type: object
      required:
        - content
      title: Controller
      description: Controller file content
    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:
    HTTPBasic:
      type: http
      scheme: basic

````