UnieAI Studio

Feedback API

Submit good or bad ratings from an external application and explicitly save positive content as custom-model memory.

POST /v1/feedback lets an external application submit a simple rating. When the rating is good and the caller explicitly requests storage, Runtime can also create memory for the corresponding custom model.

This public API is not the same as Playground thumbs-up and thumbs-down. It does not boost knowledge-base chunk ranking, and a bad rating does not create a repair job through this endpoint.

Authentication and endpoint

POST https://your-runtime-domain/v1/feedback
Authorization: Bearer sk-your-api-key
Content-Type: application/json

The key must be valid. Prefer model or a previous request_id, which lets Runtime resolve model access using the key's identity.

Submit a basic rating

curl -X POST https://your-runtime-domain/v1/feedback \
  -H "Authorization: Bearer $UNIEAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "rating": "bad",
    "model": "your-custom-model-slug",
    "request_id": "req_abc123",
    "comment": "The answer did not address the question"
  }'

rating accepts only good or bad, not positive or negative. A validated rating receives a success response, but the current handler does not separately persist a plain rating or comment as queryable model data.

Rate and create memory

{
  "rating": "good",
  "model": "your-custom-model-slug",
  "request_id": "req_abc123",
  "memorize": true,
  "memory_content": "The user prefers concise answers with code examples.",
  "comment": "The answer matched the preference"
}

Memory is created only when all conditions hold:

  1. rating is good.
  2. memorize is the JSON boolean true.
  3. memory_content is non-empty.
  4. Runtime resolves a custom-model ID.

Custom-model resolution order

Runtime tries, in order:

  1. custom_model_id or customModelId, currently treated as a direct ID.
  2. The accessible custom model identified by the model slug.
  3. The customModelId in a previous trace identified by request_id or requestId.

If none resolves, the rating can still succeed without creating memory.

The current handler does not perform another model-access lookup for an explicit custom_model_id. Only a trusted backend should derive this field from its own authorization data; never pass through an arbitrary ID supplied by an end user. Prefer model or request_id for ordinary integrations.

Request fields

FieldRequiredMeaning
ratingYesgood or bad
modelNoCustom-model slug
custom_model_idNoCustom-model ID; customModelId is also accepted
request_idNoPrevious Runtime request ID; requestId is also accepted
commentNoIncluded in metadata when memory is created; otherwise not stored separately
memorizeNoOnly the exact boolean true attempts memory creation
memory_contentNoMemory text; memoryContent is also accepted

Success response

{"success":true,"rating":"good","memorized":true,"memoryId":"memory_xxx"}
  • memorized: true means the memory record was created.
  • An accepted rating without memory still returns 200, with memorized: false and memoryId: null.
  • x-request-id identifies this Feedback request, not necessarily the rated request ID in the body.

Index synchronization is best-effort after record creation. A record can exist even if indexing fails separately. Monitor Runtime logs and verify it under Memory → Memory library for the custom model.

Difference from Playground feedback

FlowBehavior
/v1/feedbackAPI-key authentication; good or bad; only explicit positive memorization creates memory
Playground thumbs-upSession authentication; can create or submit positive memory
Playground thumbs-downSession authentication; can create a feedback repair item and queue a retry

Memory → Feedback shows pending repair items for a custom model. A manager can process or retry them and save corrected content as memory. These records come from Studio's feedback flow, not from a plain bad call to /v1/feedback.

Errors and data safety

HTTP statusCause
400Missing rating or a value other than good / bad
401Missing or invalid key
500Unexpected database or memory-creation failure
  • Proxy calls through a trusted backend instead of placing a long-lived API key in a browser or mobile app.
  • memory_content can be retrieved in later conversations. Remove passwords, keys, personal data, and unapproved content before storage.
  • Deduplicate repeated clicks and retain application feedback events; this endpoint response is not an analytics report.