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

# Feedback

> Sets or clears the caller's rating/comment on a routed request. Send an
all-empty body to clear existing feedback. The operation is idempotent.


<div className="endpoint-signature"><span className="endpoint-method endpoint-method-post">POST</span><code>/v1/usage/requests/\{request\_id}/feedback</code></div>


## OpenAPI

````yaml /openapi/usage.yaml post /v1/usage/requests/{request_id}/feedback
openapi: 3.1.0
info:
  title: Tokenless Cost and Usage API
  version: 1.0.0
  description: |
    Account credit, routed-request cost, usage history, and session aggregate
    endpoints. Monetary amounts are integer USD nanos:
    1,000,000,000 nanos equals US $1.00.
servers:
  - url: https://api.usetokenless.com
security:
  - bearerAuth: []
paths:
  /v1/usage/requests/{request_id}/feedback:
    post:
      summary: Feedback
      description: |
        Sets or clears the caller's rating/comment on a routed request. Send an
        all-empty body to clear existing feedback. The operation is idempotent.
      operationId: setUsageFeedback
      parameters:
        - $ref: '#/components/parameters/RequestID'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FeedbackInput'
      responses:
        '200':
          description: Updated routed-request record.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FeedEvent'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  parameters:
    RequestID:
      name: request_id
      in: path
      required: true
      schema:
        type: string
  schemas:
    FeedbackInput:
      type: object
      properties:
        rating:
          type:
            - integer
            - 'null'
          enum:
            - -1
            - 1
            - null
        comment:
          type:
            - string
            - 'null'
          maxLength: 2000
        kind:
          type:
            - string
            - 'null'
          enum:
            - bug
            - feedback
            - null
        reason:
          type:
            - string
            - 'null'
          enum:
            - too_expensive
            - too_slow
            - great_value
            - stronger_model_needed
            - wrong_model
            - bad_tool_call
            - null
    FeedEvent:
      type: object
      required:
        - request_id
        - created_at
        - prompt_preview
        - response_preview
        - provider_ranks
        - total_cost_nanos
        - total_input_tokens
        - total_output_tokens
      properties:
        request_id:
          type: string
        created_at:
          type: string
          format: date-time
        prompt_preview:
          type: string
        response_preview:
          type: string
        selected_model_id:
          type: string
        provider_ranks:
          type: array
          items:
            type: object
            required:
              - model_id
              - rank
            properties:
              model_id:
                type: string
              rank:
                type: integer
        total_cost_nanos:
          type: integer
          format: int64
        total_input_tokens:
          type: integer
          format: int64
        total_output_tokens:
          type: integer
          format: int64
        byok:
          type: boolean
        routing_mode:
          type: string
          enum:
            - pro
            - max
            - ultra_saver
        session_id:
          type: string
        agent_id:
          type: string
        parent_agent_id:
          type: string
        session_source:
          type: string
        credential_name:
          type: string
        feedback:
          $ref: '#/components/schemas/Feedback'
    Feedback:
      type: object
      properties:
        rating:
          type: integer
          enum:
            - -1
            - 1
        comment:
          type: string
        kind:
          type: string
          enum:
            - bug
            - feedback
        reason:
          type: string
  responses:
    BadRequest:
      description: The request is malformed or incomplete.
    Unauthorized:
      description: Missing or invalid authentication.
    NotFound:
      description: The resource does not exist or is not owned by the caller.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Tokenless API key, Clerk JWT, or tkl CLI session

````