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/jsonThe 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:
ratingisgood.memorizeis the JSON booleantrue.memory_contentis non-empty.- Runtime resolves a custom-model ID.
Custom-model resolution order
Runtime tries, in order:
custom_model_idorcustomModelId, currently treated as a direct ID.- The accessible custom model identified by the
modelslug. - The
customModelIdin a previous trace identified byrequest_idorrequestId.
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
| Field | Required | Meaning |
|---|---|---|
rating | Yes | good or bad |
model | No | Custom-model slug |
custom_model_id | No | Custom-model ID; customModelId is also accepted |
request_id | No | Previous Runtime request ID; requestId is also accepted |
comment | No | Included in metadata when memory is created; otherwise not stored separately |
memorize | No | Only the exact boolean true attempts memory creation |
memory_content | No | Memory text; memoryContent is also accepted |
Success response
{"success":true,"rating":"good","memorized":true,"memoryId":"memory_xxx"}memorized: truemeans the memory record was created.- An accepted rating without memory still returns
200, withmemorized: falseandmemoryId: null. x-request-ididentifies 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
| Flow | Behavior |
|---|---|
/v1/feedback | API-key authentication; good or bad; only explicit positive memorization creates memory |
| Playground thumbs-up | Session authentication; can create or submit positive memory |
| Playground thumbs-down | Session 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 status | Cause |
|---|---|
400 | Missing rating or a value other than good / bad |
401 | Missing or invalid key |
500 | Unexpected 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_contentcan 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.
Related documentation
Knowledge Base and Feedback APIs
Search an authorized knowledge base from an external service and submit ratings or explicitly authorized feedback memories for a Customize Model.
Billing, Wallets, and Metering
Understand personal and organization wallets, Stripe top-ups, model pricing, reservation settlement, and administrator credit operations.