API reference
Feedback
Rate an answer with a thumbs up or down. Optionally provide details on why.
On this page
By allowing shoppers to rate our answers, you can quickly find the answers that need improvement. With our chatbot answer feedback API, a vote is two small calls: record the thumbs up or down the moment the shopper taps it, then, for a thumbs down, add what went wrong if they tell you. All ratings are shown next to the question and answer in AI assistant → Questions log, where the Rated poorly filter shows your team what to fix first.
You can continue to send ratings if your account is past due, so you don’t lose any ratings while billing gets sorted out.
Rate an answer
Records a shopper’s thumbs up or down on an answer. Scope feedback:write, so your Storefront widget key works. Rate limit group feedback: 120 a minute per key.
- Key
Authorization: Bearerwith thefeedback:writescope- Origin
- One of the key’s allowed origins
- Call from
- The browser or your server
- Rate limit
feedbackgroup, 120 a minute- Retries
- Safe with
Idempotency-Key
Headers and parameters
| Field | Description |
|---|---|
Origin
|
Your storefront’s address, which must be one of the key’s allowed origins. Browsers send it themselves; a server must send it too. |
Idempotency-Key
|
Makes a retry safe: the same key, path and body within 24 hours returns the first response again. A key is shared by every API key and store in the workspace, so it must be unique to each request (a random id, not a row number from one store’s database): reusing the key with a different body is refused with 409. Servers only. |
X-Ottla-Client-Ip
|
The shopper’s public IP address, when your server calls on a shopper’s behalf, so each shopper has their own allowance. Read only for a key marked “Used by a store connector or another server” in the console, which also needs allowed IP addresses; ignored for any other key. |
X-Ottla-Request-Id
|
Your own id for this request, returned in the response header. Ottla creates one when you send none. Servers only. |
Responses
-
201 Created
Recorded.
-
202 Accepted
Not counted (not an error).
-
401 Unauthorised
No API key was sent (
unauthenticated), or the key is unknown, revoked or expired (invalid_api_key). -
403 Forbidden
The key cannot be used for this request:
forbidden_scope,ip_not_allowedortenant_suspendedas for any key, or theOrigincheck failed:origin_not_configured,origin_required,origin_invalidororigin_not_allowed. -
409 Conflict
The
Idempotency-Keywas used before with a different body (idempotency_key_reused), or a request with it is still running (idempotency_in_flight). -
422 Invalid
The request is not valid (
validation_failed), oranswer_idis not an answer from this workspace (invalid_answer_id). -
429 Rate limited
A rate limit was reached: this key’s limit for the operation’s group (
rate_limited), the workspace’s limit across all its keys (tenant_rate_limited), the limit for one network address (ip_rate_limited) or for one shopper (shopper_rate_limited). Waitretry_afterseconds.
| Field | Description |
|---|---|
rating
|
positive or negative. |
answer_id
|
The answer_id from POST /ask. It must be an answer from your workspace. |
session_id
|
The conversation’s session_id, up to 128 characters. You need it to add detail later. |
reason
|
A short reason code from your own list, up to 32 characters, such as wrong_product. |
comment
|
What went wrong, in the shopper’s words, up to 2,000 characters. |
expected_outcome
|
What the shopper expected instead, up to 2,000 characters. |
metadata
|
Anything else to keep with the feedback, as key and value pairs. |
sku
|
The product the answer was about. |
page_type
|
The kind of page, up to 32 characters. |
website_id
|
Ottla’s id for the website. Ignored for a key bound to one website. |
store_view_id
|
The store view, for a catalogue organised by store view. |
| Response | Description |
|---|---|
201 with status: "recorded" and id | The rating has been recorded. You can use the id to add more details if needed. |
202 with status: "ignored" and reason: "assisted_session" | We have accepted the rating but do not count it. This happens when a member of your team rates an answer while shopping on your store as a customer. |
422 with error: "invalid_answer_id" | The answer_id you sent does not belong to your workspace. |
Add detail to a vote
Adds the shopper’s reason, comment or expectation to a vote you’ve already recorded, usually after a thumbs down. {feedback} is the id from POST /feedback, and the session_id must match the one the vote was sent with. Browsers use this POST form, because Ottla accepts only GET and POST from browsers.
- Key
Authorization: Bearerwith thefeedback:writescope- Origin
- One of the key’s allowed origins
- Call from
- The browser or your server
- Rate limit
feedbackgroup, 120 a minute- Retries
- Safe with
Idempotency-Key
Headers and parameters
| Field | Description |
|---|---|
feedback
|
The id from POST /feedback. |
Origin
|
Your storefront’s address, which must be one of the key’s allowed origins. Browsers send it themselves; a server must send it too. |
Idempotency-Key
|
Makes a retry safe: the same key, path and body within 24 hours returns the first response again. A key is shared by every API key and store in the workspace, so it must be unique to each request (a random id, not a row number from one store’s database): reusing the key with a different body is refused with 409. Servers only. |
X-Ottla-Client-Ip
|
The shopper’s public IP address, when your server calls on a shopper’s behalf, so each shopper has their own allowance. Read only for a key marked “Used by a store connector or another server” in the console, which also needs allowed IP addresses; ignored for any other key. |
X-Ottla-Request-Id
|
Your own id for this request, returned in the response header. Ottla creates one when you send none. Servers only. |
Responses
-
200 OK
Updated.
-
401 Unauthorised
No API key was sent (
unauthenticated), or the key is unknown, revoked or expired (invalid_api_key). -
403 Forbidden
The key cannot be used for this request:
forbidden_scope,ip_not_allowedortenant_suspendedas for any key, or theOrigincheck failed:origin_not_configured,origin_required,origin_invalidororigin_not_allowed. -
404 Not found
No feedback with this id for this session (
invalid_feedback). -
409 Conflict
The
Idempotency-Keywas used before with a different body (idempotency_key_reused), or a request with it is still running (idempotency_in_flight). -
422 Invalid
The request is not valid (
validation_failed, witherrorskeyed by field), or theIdempotency-Keyheader is malformed (invalid_idempotency_key). -
429 Rate limited
A rate limit was reached: this key’s limit for the operation’s group (
rate_limited), the workspace’s limit across all its keys (tenant_rate_limited), the limit for one network address (ip_rate_limited) or for one shopper (shopper_rate_limited). Waitretry_afterseconds.
The same, for servers that prefer PATCH. Both forms update the same vote; neither changes its rating.
- Key
Authorization: Bearerwith thefeedback:writescope- Origin
- One of the key’s allowed origins
- Call from
- The browser or your server
- Rate limit
feedbackgroup, 120 a minute- Retries
- Safe with
Idempotency-Key
| Field | Description |
|---|---|
session_id
|
Must match the session_id the vote was sent with. |
reason
|
A short reason code from your own list, up to 32 characters. |
comment
|
What went wrong, up to 2,000 characters. |
expected_outcome
|
What the shopper expected, up to 2,000 characters. |
A successful update answers 200 with status: "updated" and the id. A wrong id, or a session_id that doesn’t match, gets 404 invalid_feedback.
Example: vote, then detail
curl https://ottla.ai/api/v1/feedback \
-H "Authorization: Bearer YOUR_BROWSER_KEY" \
-H "Origin: https://shop.example" \
-H "Content-Type: application/json" \
-d '{"rating": "negative", "answer_id": 58213, "session_id": "sess_8f2c1"}'
# then, with the id from the response
curl -X PATCH https://ottla.ai/api/v1/feedback/3304 \
-H "Authorization: Bearer YOUR_BROWSER_KEY" \
-H "Origin: https://shop.example" \
-H "Content-Type: application/json" \
-d '{"session_id": "sess_8f2c1", "reason": "wrong_product", "comment": "I asked about the 3 person tent."}'
<?php
use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://ottla.ai/api/v1/']);
$headers = ['Authorization' => 'Bearer YOUR_BROWSER_KEY', 'Origin' => 'https://shop.example'];
$vote = json_decode((string) $client->post('feedback', [
'headers' => $headers,
'json' => ['rating' => 'negative', 'answer_id' => 58213, 'session_id' => 'sess_8f2c1'],
])->getBody(), true);
$client->patch('feedback/'.$vote['id'], [
'headers' => $headers,
'json' => [
'session_id' => 'sess_8f2c1',
'reason' => 'wrong_product',
'comment' => 'I asked about the 3 person tent.',
],
]);
Errors
| Status | Code | What to do |
|---|---|---|
| 401 | unauthenticated, invalid_api_key | Send a valid key. |
| 403 | forbidden_scope and the origin_* codes | The key needs feedback:write, and the call needs an allowed Origin. |
| 404 | invalid_feedback | The id is wrong, or the session_id doesn’t match the vote. |
| 409 | idempotency_key_reused, idempotency_in_flight | Only when your server sends an Idempotency-Key. See Idempotency. |
| 422 | validation_failed, invalid_answer_id | Fix the fields in errors, or send an answer_id from your own workspace. |
| 429 | rate_limited and the other limit codes | Wait retry_after seconds. |
See Errors for every code.
FAQ
Questions developers ask
Why POST instead of PATCH?
Ottla accepts only GET and POST from browsers, so page scripts use the POST form. Both forms do exactly the same thing.
Can I change a vote?
Not in place. Each POST /feedback records a new vote, so send one per answer. The detail endpoint adds a reason, comment or expectation to a vote, but it can’t change the rating.
Where do I see feedback?
In AI assistant → Questions log, you can see ratings next to each question and answer. You can filter by Rated poorly to see thumbs down votes first.
Related
Ask
Where answer_id comes from.
Events and revenue attribution
Report clicks and orders alongside ratings.
Analytics
See how ratings fit in with your other assistant metrics.
Errors
View all error codes and what to do.