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

# Approve Task Plan

> Mark the current plan version as approved ("Approve plan" CTA).

Records ``plan.approved_version = plan.version`` so the UI can show a
durable "Plan started" state and prevent a second start. Idempotent —
re-approving the same version is a no-op. When a newer revision is
later created, ``version`` moves ahead of ``approved_version`` and the
Approve button re-arms for the newer plan.



## OpenAPI

````yaml /openapi.json post /api/tasks/{task_id}/plan/approve
openapi: 3.1.0
info:
  description: >-
    Public CodeCobra API. Authenticate by sending a personal API key in the
    `Authorization: Bearer <key>` header. Generate keys from Settings → API keys
    in the CodeCobra dashboard.
  title: CodeCobra Public API
  version: 1.0.0
servers: []
security: []
paths:
  /api/tasks/{task_id}/plan/approve:
    post:
      tags:
        - public
      summary: Approve Task Plan
      description: |-
        Mark the current plan version as approved ("Approve plan" CTA).

        Records ``plan.approved_version = plan.version`` so the UI can show a
        durable "Plan started" state and prevent a second start. Idempotent —
        re-approving the same version is a no-op. When a newer revision is
        later created, ``version`` moves ahead of ``approved_version`` and the
        Approve button re-arms for the newer plan.
      operationId: approve_task_plan_api_tasks__task_id__plan_approve_post
      parameters:
        - in: path
          name: task_id
          required: true
          schema:
            format: uuid
            title: Task Id
            type: string
      responses:
        '200':
          content:
            application/json:
              schema: {}
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - HTTPBearer: []
components:
  schemas:
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    HTTPBearer:
      scheme: bearer
      type: http

````