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

# Answer a decision

> Answers a question the recovery agent asked during a run (Decision Required). The `agent.decision_requested` webhook carries the question, the `fields` with their ids and options, `free_text`, and `respond_url`, which is this endpoint for that run. This page is the reference for the request body. The first accepted answer resolves the decision, whether it comes from this endpoint, Slack or the dashboard; the run resumes with it and `agent.decision_answered` is sent with `answered_via: api` and `answered_by: api_key:<key id>`.

Send `decision_id` and at least one of `values`, `text` or `directive`. A key can only answer decisions of runs in its own workspace. Once the decision is answered, expired or cancelled, this endpoint returns 404.



## OpenAPI

````yaml run-api/run-api.yaml post /run/{session_id}/decision/respond
openapi: 3.1.0
info:
  title: CloudCruise Run API
  version: 0.1.0
  description: >-
    Endpoints for managing workflow executions, user interactions, and
    retrieving execution results.
servers:
  - url: https://api.cloudcruise.com
    description: CloudCruise Platform Production API Server
security:
  - AuthScheme: []
paths:
  /run/{session_id}/decision/respond:
    post:
      summary: Answer a decision
      description: >-
        Answers a question the recovery agent asked during a run (Decision
        Required). The `agent.decision_requested` webhook carries the question,
        the `fields` with their ids and options, `free_text`, and `respond_url`,
        which is this endpoint for that run. This page is the reference for the
        request body. The first accepted answer resolves the decision, whether
        it comes from this endpoint, Slack or the dashboard; the run resumes
        with it and `agent.decision_answered` is sent with `answered_via: api`
        and `answered_by: api_key:<key id>`.


        Send `decision_id` and at least one of `values`, `text` or `directive`.
        A key can only answer decisions of runs in its own workspace. Once the
        decision is answered, expired or cancelled, this endpoint returns 404.
      operationId: respond_to_decision
      parameters:
        - name: session_id
          in: path
          required: true
          schema:
            type: string
            description: The session that asked the decision (`session_id` in the webhook)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - decision_id
              properties:
                decision_id:
                  type: string
                  description: The `decision_id` from `agent.decision_requested`
                values:
                  type: object
                  additionalProperties: true
                  description: Answers keyed by field id. For choice fields, the option id.
                  example:
                    choice: keep
                text:
                  type: string
                  maxLength: 2000
                  description: A free-text instruction for the agent
                directive:
                  type: string
                  enum:
                    - requeue
                    - add_error_code
                    - fail
                  description: >-
                    Requeue the run, stop it and note that an error code should
                    be added, or fail it
      responses:
        '200':
          description: Answer accepted; the run resumes with it
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - accepted
                  decision_id:
                    type: string
        '400':
          description: >-
            No values, text or directive, or the values do not match the
            decision's fields
        '401':
          description: Missing or invalid authentication token
        '403':
          description: The run belongs to another workspace
        '404':
          description: >-
            Run not found, or no pending decision with this decision_id (already
            answered, expired or cancelled)
        '409':
          description: Another answer claimed the decision at the same moment
components:
  securitySchemes:
    AuthScheme:
      type: apiKey
      name: cc-key
      in: header
      description: >-
        API key-based authentication. Provide your CloudCruise API key in the
        cc-key header.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.