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

# Edit Task with Instruction

> Edits an existing task with a natural language instruction. Creates a new version of the task.



## OpenAPI

````yaml openapi-v0.1.json patch /v0.1/tasks/{id}
openapi: 3.0.0
info:
  title: API Documentation
  description: API description
  version: '0.1'
  contact: {}
servers:
  - url: https://api.promptloop.com/
    description: Production API v0.1
security: []
tags: []
paths:
  /v0.1/tasks/{id}:
    patch:
      tags:
        - Tasks
      summary: Edit Task with Instruction
      description: >-
        Edits an existing task with a natural language instruction. Creates a
        new version of the task.
      operationId: TasksController_editTask
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EditTaskDto'
      responses:
        '200':
          description: Successfully edited task
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EditTaskResponseDto'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
      security:
        - x-api-key: []
components:
  schemas:
    EditTaskDto:
      type: object
      properties:
        instruction:
          type: string
          description: Natural language instruction for how to modify the task
          example: Add a field for the company founding year
      required:
        - instruction
    EditTaskResponseDto:
      type: object
      properties:
        task_id:
          type: string
          description: The ID of the edited task
          example: abc123-def456-...
        version:
          type: number
          description: The new version number
          example: 2
        message:
          type: string
          description: Status message
          example: Task updated successfully
      required:
        - task_id
        - version
        - message
    ErrorResponseDto:
      type: object
      properties:
        status:
          type: string
          enum:
            - success
            - error
          example: error
        data:
          type: object
        message:
          type: string
        error:
          $ref: '#/components/schemas/ErrorDetailsDto'
      required:
        - status
        - data
        - message
    ErrorDetailsDto:
      type: object
      properties:
        code:
          type: number
        details:
          type: string
      required:
        - code
        - details
  securitySchemes:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key

````