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

> ## Agent Instructions
> Krun API base URL: https://api.krun.ai. Authenticate server-side with `Authorization: Bearer $KRUN_API_KEY`; never put a Krun API key in browser code.
> Prefer the Python SDK in examples: `pip install krun-ai`, `from krun import Krun`. The TypeScript SDK `@krun-ai/sdk` is not published on npm yet: do not tell users to `npm install` it.
> The only question type is `choice`. `confidence` is the top-1 minus top-2 probability margin, not the probability that the answer is correct. `choice` is null when `abstain` is true.
> Usage reports `input_tokens` only. There are no output tokens.

# Feedback

> Report whether one answer of a previous decision was correct. `request_id` is the `X-Request-ID` of a `/v1/decide` call made by the same project, and `question_id` names the answer being reviewed.



## OpenAPI

````yaml https://api.krun.ai/openapi.json post /v1/feedback
openapi: 3.1.0
info:
  title: Krun API
  description: >-
    Krun decision API. Authenticate with `Authorization: Bearer krun_live_...`
    from your server.
  version: 1.0.0-beta
servers:
  - url: https://api.krun.ai
    description: Production
security: []
tags:
  - name: decisions
    description: Pick one option for a context
  - name: feedback
    description: Report whether a decision was correct
  - name: models
    description: Available models
  - name: health
    description: Liveness and readiness
paths:
  /v1/feedback:
    post:
      tags:
        - feedback
      summary: Feedback
      description: >-
        Report whether one answer of a previous decision was correct.
        `request_id` is the `X-Request-ID` of a `/v1/decide` call made by the
        same project, and `question_id` names the answer being reviewed.
      operationId: create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FeedbackRequest'
        required: true
      responses:
        '201':
          description: Feedback stored
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FeedbackResponse'
        '400':
          description: INVALID_REQUEST
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '401':
          description: UNAUTHORIZED
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '404':
          description: 'NOT_FOUND: no decision with this request_id in this project'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '429':
          description: RATE_LIMITED
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
      security:
        - api_key: []
      x-codeSamples:
        - lang: python
          label: Python SDK
          source: |
            from krun import Krun

            client = Krun()

            client.feedback(
                request_id="req_0cf5441281f640ffbf0111c5a3ed9e50",
                question_id="department",
                correct=False,
                expected_decision="billing",
            )
components:
  schemas:
    FeedbackRequest:
      type: object
      required:
        - request_id
        - question_id
        - correct
      properties:
        request_id:
          type: string
          description: '`X-Request-ID` of a `/v1/decide` call made by the same project.'
        question_id:
          type: string
          description: >-
            Key of the answer being reviewed (the question id from the request).
            Always required, also for single-question

            requests, so every feedback row names exactly one answer.
        correct:
          type: boolean
          description: Whether the decision was right.
        expected_decision:
          type:
            - string
            - 'null'
          description: >-
            The option id that should have been chosen for that question (≤ 200
            characters).
        metadata:
          type:
            - object
            - 'null'
          description: >-
            Optional JSON object (≤ 8 KiB serialized). Do not put personal data
            here.
      additionalProperties: false
      example:
        request_id: req_0b7f7c5e9a3d4a8c9f1e2d3c4b5a6978
        question_id: department
        correct: false
        expected_decision: billing
    FeedbackResponse:
      type: object
      required:
        - id
        - object
        - request_id
        - question_id
        - created_at
      properties:
        id:
          type: string
        object:
          type: string
          description: Always `feedback`.
        request_id:
          type: string
        question_id:
          type: string
        created_at:
          type: string
          format: date-time
    ErrorBody:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
    ErrorDetail:
      type: object
      required:
        - code
        - message
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
          description: Stable machine-readable code.
        message:
          type: string
        request_id:
          type:
            - string
            - 'null'
          example: req_0b7f7c5e9a3d4a8c9f1e2d3c4b5a6978
    ErrorCode:
      type: string
      enum:
        - INVALID_REQUEST
        - INVALID_OPTIONS
        - PAYLOAD_TOO_LARGE
        - UNAUTHORIZED
        - NOT_FOUND
        - RATE_LIMITED
        - QUOTA_EXCEEDED
        - UPSTREAM_TIMEOUT
        - UPSTREAM_UNAVAILABLE
        - INFERENCE_FAILED
        - INTERNAL_ERROR
  securitySchemes:
    api_key:
      type: http
      scheme: bearer
      bearerFormat: krun_live_...

````