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

# Approve an AI chat plan and execute its steps



## OpenAPI

````yaml https://platform.ankra.app/openapi.json post /chat/plans/{plan_id}/approve
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://platform.ankra.app
security: []
paths:
  /chat/plans/{plan_id}/approve:
    post:
      tags:
        - chat
      summary: Approve an AI chat plan and execute its steps
      operationId: approve_chat_plan_chat_plans__plan_id__approve_post
      parameters:
        - in: path
          name: plan_id
          required: true
          schema:
            format: uuid
            title: Plan Id
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApprovePlanRequest'
        required: false
      responses:
        '200':
          content:
            text/event-stream:
              schema:
                type: string
          description: >-
            Server-sent event stream of the approval outcome (plan_complete on a
            session-bound guided run, plan_step_result / plan_complete
            otherwise, plan_error on a refusal).
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlanAcknowledgementRequiredError'
          description: An irreversible or high-risk step was not acknowledged
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractDetailError'
          description: Permission or CSRF check failed
        '410':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractDetailError'
          description: The plan predates the platform upgrade and can no longer be executed
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
components:
  schemas:
    ApprovePlanRequest:
      properties:
        acknowledged_step_orders:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          description: >-
            step_order values the user explicitly acknowledged. Every step
            listed in the plan proposal's acknowledgement_required_step_orders
            (irreversible or high-risk) must appear here, or the approval is
            refused with 400 PLAN_ACKNOWLEDGEMENT_REQUIRED.
          title: Acknowledged Step Orders
      title: ApprovePlanRequest
      type: object
    PlanAcknowledgementRequiredError:
      properties:
        error_code:
          enum:
            - PLAN_ACKNOWLEDGEMENT_REQUIRED
          title: Error Code
          type: string
        payload:
          properties:
            plan_id:
              format: uuid
              title: Plan Id
              type: string
            unacknowledged_steps:
              items:
                $ref: '#/components/schemas/PlanAcknowledgementStep'
              title: Unacknowledged Steps
              type: array
          required:
            - plan_id
            - unacknowledged_steps
          title: Payload
          type: object
        detail:
          type: string
          title: Detail
      required:
        - error_code
        - payload
        - detail
      title: PlanAcknowledgementRequiredError
      type: object
    ContractDetailError:
      example:
        detail: Cluster not found
      properties:
        detail:
          oneOf:
            - type: string
            - additionalProperties: true
              properties: {}
              type: object
      required:
        - detail
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    PlanAcknowledgementStep:
      properties:
        step_order:
          title: Step Order
          type: integer
        tool_name:
          title: Tool Name
          type: string
        description:
          title: Description
          type: string
        risk_level:
          title: Risk Level
          type: string
        reversible:
          title: Reversible
          type: boolean
        reason:
          description: Why the step needs acknowledgement.
          enum:
            - irreversible
            - high_risk
          title: Reason
          type: string
      required:
        - step_order
        - tool_name
        - description
        - risk_level
        - reversible
        - reason
      title: PlanAcknowledgementStep
      type: object
    ValidationError:
      properties:
        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

````