Record end-user feedback — a thumbs up/down or a 1–5 rating — against a prior AI request. This is a low-volume, high-value signal for future evals; it is a deliberate database write, not part of the inference hot path.

Authentication

Authenticated with a secret key (rd_sk_…) or a client token. A client token must carry the feedback scope, or the request fails 403 permission_error (insufficient_scope). Feedback is always stamped with the caller’s authenticated tenant (and, for a client token, its end-user subject), so a caller can only ever write into its own tenant.

Request body

Example

Response

200 OK:
comment is present only when one was stored. rating is echoed in the shape you sent ('up' / 'down' or the 1–5 number).
Feedback is idempotent by (request_id, end_user) with last-write-wins: re-submitting overwrites the prior rating. Any Idempotency-Key header is redundant and is ignored. Submitting feedback immediately after a response — before the request’s async log row has landed — is supported; the feedback is accepted and stamped from your authenticated context.

Errors

Failures use the error envelope:
  • 400 invalid_request_error — a malformed body (invalid_request) or metadata over the 4096-byte limit (metadata_too_large, with param: "metadata").
  • 403 permission_error — a client token missing the feedback scope (insufficient_scope).
  • 404 not_found_error — a request_id that belongs to a different project/environment or (for a client token) a different end user (request_not_found, a uniform response that is never an existence oracle).