User Feedback API

The User Feedback API allows you to submit feedback for AI model responses. This helps improve model performance and track user satisfaction.

POST/v1/management/reporting/trace/feedback/{trace_id}

Submit Feedback

Submit feedback for a specific AI model response trace. This endpoint allows you to provide feedback with custom value ranges and metadata.

Request Headers

  • Name
    Authorization
    Type
    string
    Description

    Bearer token for authentication. Format: 'Bearer your-token-here'

  • Name
    Content-Type
    Type
    string
    Description

    application/json

  • Name
    Accept
    Type
    string
    Description

    application/json

Path Parameters

  • Name
    trace_id
    Type
    string
    Description

    The unique identifier of the trace/response to provide feedback for

Request Body

  • Name
    value
    Type
    number
    Description

    The feedback value within the specified range (min to max)

  • Name
    metadata
    Type
    string|object
    Description

    Additional context or structured data for the feedback. Can be a string or any valid JSON object.

  • Name
    version
    Type
    string
    Description

    Version identifier for the feedback format

  • Name
    min
    Type
    number
    Description

    Minimum value in the feedback range (default: 0)

  • Name
    max
    Type
    number
    Description

    Maximum value in the feedback range (default: 100)

  • Name
    inverted
    Type
    boolean
    Description

    Whether to invert the value scale (default: false)

Request

POST
/v1/management/reporting/trace/feedback/{trace_id}
curl -X POST https://api.usageguard.com/v1/management/reporting/trace/feedback/e93d8cc0f5c99f411a047573e67fa362 \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "value": 95,
    "metadata": {
      "feedback": "Very helpful response",
      "aspects": ["accuracy", "clarity"]
    },
    "version": "v1",
    "min": 0,
    "max": 100,
    "inverted": false
  }'

200: Success

<Response body is empty>

400: Bad Request

<Response body is empty>

401: Unauthorized

{
  "code": "401",
  "message": "No valid authentication credentials provided, Trace ID 0dfa09f45e6479c19a121d1c0d6a4e8c",
  "stack_trace": null,
  "error_type": "MISSING_AUTHENTICATION"
}

404: Not Found

<Response body is empty>

Note: Traces are eventually consistent, meaning traces may not be immediately available for feedback submission. UsageGuard automatically handles this by retrying failed requests up to 3 times with exponential backoff, ensuring your feedback is eventually processed.

Was this page helpful?