> ## 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.

# Task Update

> Endpoint to update an existing task by its ID.
Only the original creator of the task is authorized to perform the update.

Args:
    task_id (str): The unique identifier of the task to update.
    task_update (TaskCreate): The updated task data submitted by the user.

Returns:
    dict: A success message indicating the task was updated.

Raises:
    HTTPException 403: If the current user is not the task creator.
    HTTPException 404: If the task is not found.
    HTTPException 500: If an internal error occurs during update.



## OpenAPI

````yaml put /api/task/{task_id}
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/task/{task_id}:
    put:
      tags:
        - Task
      summary: Task Update
      description: >-
        Endpoint to update an existing task by its ID.

        Only the original creator of the task is authorized to perform the
        update.


        Args:
            task_id (str): The unique identifier of the task to update.
            task_update (TaskCreate): The updated task data submitted by the user.

        Returns:
            dict: A success message indicating the task was updated.

        Raises:
            HTTPException 403: If the current user is not the task creator.
            HTTPException 404: If the task is not found.
            HTTPException 500: If an internal error occurs during update.
      operationId: task_update
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
            title: Task Id
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TaskCreate-Input'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    TaskCreate-Input:
      properties:
        name:
          type: string
          title: Name
          description: The Task name.
        actions:
          items:
            $ref: '#/components/schemas/TaskAction'
          type: array
          title: Actions
        visibility:
          $ref: '#/components/schemas/Visibility'
          description: 'Task visibility: ''private'' (default) or ''public'''
          default: private
        initial_input:
          type: string
          title: Initial Input
          description: The initial user input for the task, default is None
        schedule:
          $ref: '#/components/schemas/Schedule'
          description: Optional schedule information for the task
          default:
            frequency: manual
            hour: '00:00'
            day: Monday
        state:
          $ref: '#/components/schemas/TaskState'
          description: 'Task state: ''enabled'' (default) or ''disabled'''
          default: enabled
        category:
          type: string
          title: Category
          description: Task category
          default: Other
      type: object
      required:
        - name
        - actions
      title: TaskCreate
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    TaskAction:
      properties:
        api_name:
          type: string
          title: Api Name
          description: Name of the API.
        domain_url:
          type: string
          title: Domain Url
          description: API domain URL.
          default: ''
        user_input:
          type: string
          title: User Input
          description: User input data.
      type: object
      required:
        - api_name
        - user_input
      title: TaskAction
    Visibility:
      type: string
      enum:
        - private
        - public
      title: Visibility
    Schedule:
      properties:
        frequency:
          $ref: '#/components/schemas/ScheduleFrequency'
          description: 'Schedule frequency: ''daily'' or ''weekly'''
        hour:
          type: string
          title: Hour
          description: Hour of the day in 4 digit format to run the task
          default: '00:00'
        day:
          type: string
          title: Day
          description: Day of the week to run the task
          default: Monday
      type: object
      required:
        - frequency
      title: Schedule
    TaskState:
      type: string
      enum:
        - disabled
        - enabled
      title: TaskState
    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
    ScheduleFrequency:
      type: string
      enum:
        - manual
        - daily
        - weekly
      title: ScheduleFrequency
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT Authorization header using the Bearer scheme. Example:
        'Authorization: Bearer {token}'

````