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

# Approve plan

> Approve a completed plan and start implementation.

Use this endpoint after a task run in `mode: "plan"` finishes with `planOutcome: "READY"`.


## OpenAPI

````yaml /openapi.json POST /tasks/{taskIdOrSlug}/approve-plan
openapi: 3.0.3
info:
  title: Twill API
  version: 1.0.0
  description: Programmatically create and manage Twill tasks via REST API.
servers:
  - url: https://twill.ai/api/v1
security:
  - bearerAuth: []
tags:
  - name: Tasks
    description: Create and manage tasks.
paths:
  /tasks/{taskIdOrSlug}/approve-plan:
    post:
      tags:
        - Tasks
      summary: Approve plan
      description: >-
        Approve the latest completed plan (with outcome READY) and start
        implementation.
      operationId: approvePlan
      parameters:
        - name: taskIdOrSlug
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Plan approved
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApprovePlanResponse'
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          $ref: '#/components/responses/NotFoundError'
        '429':
          $ref: '#/components/responses/RateLimitedError'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    ApprovePlanResponse:
      type: object
      required:
        - success
        - job
      properties:
        success:
          type: boolean
        job:
          $ref: '#/components/schemas/JobSummary'
    JobSummary:
      type: object
      required:
        - id
        - status
      properties:
        id:
          type: string
        status:
          $ref: '#/components/schemas/JobStatus'
    ApiErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            details: {}
    JobStatus:
      type: string
      enum:
        - PENDING
        - IN_PROGRESS
        - COMPLETED
        - FAILED
        - CANCELLED
  responses:
    ValidationError:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          examples:
            invalidBody:
              value:
                error:
                  code: validation_error
                  message: Invalid request body
                  details:
                    issues:
                      - field: command
                        message: command is required
    UnauthorizedError:
      description: Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          example:
            error:
              code: unauthorized
              message: Invalid or missing API key
    NotFoundError:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          example:
            error:
              code: not_found
              message: Task not found
    RateLimitedError:
      description: Too many requests
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          example:
            error:
              code: rate_limited
              message: Rate limit exceeded. Max 100 requests per minute.
    InternalError:
      description: Server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          example:
            error:
              code: internal_error
              message: Server error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````