> ## Documentation Index
> Fetch the complete documentation index at: https://task-social.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Update a task

> Updates a task owned by the authenticated user.



## OpenAPI

````yaml /openapi-bundled.yaml put /api/v1/tasks/{id}
openapi: 3.1.0
info:
  title: TaskSocial API
  version: 1.0.0
  description: REST API for TaskSocial, a social accountability application.
servers:
  - url: https://tasksocial-production.up.railway.app
    description: TaskSocial production API
security: []
tags:
  - name: Authentication
    description: User registration and authentication
  - name: Tasks
    description: Task creation and management
paths:
  /api/v1/tasks/{id}:
    parameters:
      - $ref: '#/components/parameters/TaskIdParameter'
    put:
      tags:
        - Tasks
      summary: Update a task
      description: Updates a task owned by the authenticated user.
      operationId: updateTask
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                title:
                  type: string
                description:
                  type: string
                status:
                  type: string
                  enum:
                    - pending
                    - completed
            example:
              title: Finish API documentation
              description: Document and validate the API
              status: completed
      responses:
        '200':
          description: Task updated successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  task:
                    $ref: '#/components/schemas/Task'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: The authenticated user does not own the task.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Task not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          $ref: '#/components/responses/ServerError'
      security:
        - cookieAuth: []
components:
  parameters:
    TaskIdParameter:
      name: id
      in: path
      required: true
      description: MongoDB ObjectId of the task.
      schema:
        type: string
  schemas:
    Task:
      type: object
      required:
        - title
        - description
        - author
      properties:
        title:
          type: string
        description:
          type: string
        status:
          type: string
          enum:
            - pending
            - completed
          default: pending
        author:
          type: string
          description: MongoDB ObjectId of the task owner.
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        message:
          type: string
  responses:
    Unauthorized:
      description: Authentication is required or the authentication token is invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ServerError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    cookieAuth:
      type: apiKey
      in: cookie
      name: tokenName
      description: >
        JWT authentication cookie. The server sets this cookie after a
        successful login. You do not need to generate or provide an API key
        manually. Use the login endpoint first, then the browser or HTTP client
        sends this cookie with protected requests.

````