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

# Insert Text

> Inserts text at a specified line number in a file.



## OpenAPI

````yaml api-reference/openapi.json post /api/editor/insert
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: http://localhost:4242/{computer_name}
    description: Local development server
    variables:
      computer_name:
        default: your-computer-name
        description: Computer name
security: []
paths:
  /api/editor/insert:
    post:
      tags:
        - editor
      summary: Insert Text
      description: Inserts text at a specified line number in a file.
      operationId: insertText
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InsertParams'
        required: true
      responses:
        '204':
          description: Successfully inserted text
        '404':
          description: File not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal server error
components:
  schemas:
    InsertParams:
      properties:
        path:
          type: string
          title: Path
          description: File path to modify
          example: /path/to/file.txt
        text:
          type: string
          title: Text
          description: Text to insert
          example: New line of text
        insert_line:
          anyOf:
            - type: integer
            - type: 'null'
          title: Insert Line
          description: Line number to insert at (1-based)
          example: 5
      type: object
      required:
        - path
        - text
      title: InsertParams
      example:
        insert_line: 5
        path: /path/to/file.txt
        text: New line of text
    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
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````