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

# Toggle task completion

> Toggles the isCompleted status of an existing task. If pending, marks as completed; if completed, marks as pending. Use for existing tasks only — to log new completed work, create a task with isCompleted set to true instead.



## OpenAPI

````yaml https://znift.com/api/v1/openapi.json post /api/v1/tasks/{taskId}/toggle
openapi: 3.1.0
info:
  title: Znift Tasks API
  version: 1.0.0
  description: >-
    Public REST API for managing Znift tasks. Designed for AI agents, CLI tools,
    and automation. Authenticate with an API key via the x-api-key header.
servers:
  - url: https://znift.com
    description: Znift Production API
security:
  - apiKey: []
paths:
  /api/v1/tasks/{taskId}/toggle:
    post:
      summary: Toggle task completion
      description: >-
        Toggles the isCompleted status of an existing task. If pending, marks as
        completed; if completed, marks as pending. Use for existing tasks only —
        to log new completed work, create a task with isCompleted set to true
        instead.
      operationId: toggleTask
      parameters:
        - name: taskId
          in: path
          required: true
          schema:
            type: string
          description: Task ID
      responses:
        '200':
          description: Toggle task completion successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Success'
        '401':
          description: Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Task not found
components:
  schemas:
    Success:
      type: object
      properties:
        success:
          type: boolean
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
          required:
            - code
            - message
      required:
        - error
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: API key with znift_ prefix. Create one in Profile > API Keys.

````