API reference

Feedback

1 operation. Base URL https://api.scarleta.ai. Select an operation to see its parameters, samples and errors.

Jump to an operation
POST/v1/feedback

Send a thumbs up or thumbs down

Free and paid accounts
  • API key required
  • Free and paid accounts
  • No token cost

Records whether a result was good. request_id is the id of the request you are rating, as a UUID (the part of an X-Request-ID header after req_); feedback is thumbs_up or thumbs_down; feedback_text is an optional comment of at most 4096 characters. You can rate only a request your own account made: an id that was never issued, or that belongs to another account, is 404 not_found (the record of a request is written just after its answer is sent, so rate it a moment later, not in the same instant). Sending the same rating twice stores it twice.

Every problem with the body, including text that is not valid JSON, is 400 invalid_request; the message names the field. Only an over-long comment has its own code, feedback_text_too_long. If the rating could not be stored the reply is 503 db_unavailable; send it again.

Cost. Free of charge.

curl -X POST "https://api.scarleta.ai/v1/feedback" \
  -H "Authorization: Bearer $SCARLETA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_id": "4e1b7c9a-2d58-4f03-8a6b-5c0d9e1f2a37",
    "feedback": "thumbs_up",
    "feedback_text": "Great result"
  }'

Request body

NameTypeRequiredDescription
request_idbodystringRequiredThe id of the request you are rating, as a UUID.
feedbackbody"thumbs_up" | "thumbs_down"RequiredYour verdict.
feedback_textbodystringOptionalAn optional comment, at most 4096 characters.
Response fields
FieldTypeDescription
successtrueAlways true: the rating was stored.
request_idstringThe id you sent.
feedback"thumbs_up" | "thumbs_down"The verdict you sent.
messagestringA short confirmation sentence that repeats the verdict and the comment.
Errors
StatusCodeDescription
400invalid_requestThe body is not valid JSON, `request_id` is missing or not a UUID, `feedback` is not one of the two verdicts, or `feedback_text` is not a string (`invalid_request`); `feedback_text` is too long (`feedback_text_too_long`).
401invalid_keyMissing, malformed, unknown or revoked API key.
404not_foundThe id was not issued to your account (it never existed, or another account made it).
429rate_limit_exceededOver the account request budget or the per-minute cap of this route. Wait for the `Retry-After` header, then retry.
503auth_unavailableTemporary platform condition; retry shortly.
Example responses
{
  "data": {
    "success": true,
    "request_id": "4e1b7c9a-2d58-4f03-8a6b-5c0d9e1f2a37",
    "feedback": "thumbs_up",
    "message": "✓ Feedback recorded: thumbs_up - Great result"
  },
  "meta": {
    "request_id": "req_0b7a3c2e-6f1d-4d9a-8e55-3a4b5c6d7e8f"
  }
}
  • 200 The rating is stored.
  • 400 The body is not valid JSON, `request_id` is missing or not a UUID, `feedback` is not one of the two verdicts, or `feedback_text` is not a string (`invalid_request`); `feedback_text` is too long (`feedback_text_too_long`).
  • 401 Missing, malformed, unknown or revoked API key.
  • 404 The id was not issued to your account (it never existed, or another account made it).
  • 429 Over the account request budget or the per-minute cap of this route. Wait for the `Retry-After` header, then retry.
  • 503 Temporary platform condition; retry shortly.

Try it

Sends this request from your browser to https://api.scarleta.ai with your own key. The key stays in this page only (never saved or put in the address) and is cleared when you leave. Revoke any key you have shared.

Other error codes this operation can return: db_unavailable, feedback_text_too_long, invalid_auth_format, invalid_key_format, missing_api_key, missing_auth, rate_limit_unavailable, unauthorized.