Base URLhttps://ottla.ai/api/v1

API reference

Feedback

Rate an answer with a thumbs up or down. Optionally provide details on why.

Updated 10 min read

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.

An example chat on Kestrel & Fell’s store. The shopper asks: “Does the Ridgeline 3 come with a footprint?”. The assistant answers: “The Ridgeline 2 Person Tent comes with pegs, guy lines and a stuff sack.”. A note in the chat says: “Sorry about that. What went wrong?”.

Rate an answer

POST /api/v1/feedback 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: Bearer with the feedback:write scope
Origin
One of the key’s allowed origins
Call from
The browser or your server
Rate limit
feedback group, 120 a minute
Retries
Safe with Idempotency-Key

Headers and parameters

POST /feedback: headers and parameters
FieldDescription
Origin string (uri) header Required 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 string header Optional 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 string header Optional 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 string header Optional 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_allowed or tenant_suspended as for any key, or the Origin check failed: origin_not_configured, origin_required, origin_invalid or origin_not_allowed.

  • 409 Conflict

    The Idempotency-Key was 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), or answer_id is 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). Wait retry_after seconds.

Request fields
FieldDescription
rating string Required positive or negative.
answer_id integer Optional The answer_id from POST /ask. It must be an answer from your workspace.
session_id string Optional The conversation’s session_id, up to 128 characters. You need it to add detail later.
reason string Optional A short reason code from your own list, up to 32 characters, such as wrong_product.
comment string Optional What went wrong, in the shopper’s words, up to 2,000 characters.
expected_outcome string Optional What the shopper expected instead, up to 2,000 characters.
metadata object Optional Anything else to keep with the feedback, as key and value pairs.
sku string Optional The product the answer was about.
page_type string Optional The kind of page, up to 32 characters.
website_id integer Optional Ottla’s id for the website. Ignored for a key bound to one website.
store_view_id integer Optional The store view, for a catalogue organised by store view.
ResponseDescription
201 with status: "recorded" and idThe 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

POST /api/v1/feedback/{feedback} Add detail to feedback

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: Bearer with the feedback:write scope
Origin
One of the key’s allowed origins
Call from
The browser or your server
Rate limit
feedback group, 120 a minute
Retries
Safe with Idempotency-Key

Headers and parameters

POST /feedback/{feedback}: headers and parameters
FieldDescription
feedback integer path Required The id from POST /feedback.
Origin string (uri) header Required 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 string header Optional 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 string header Optional 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 string header Optional 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_allowed or tenant_suspended as for any key, or the Origin check failed: origin_not_configured, origin_required, origin_invalid or origin_not_allowed.

  • 404 Not found

    No feedback with this id for this session (invalid_feedback).

  • 409 Conflict

    The Idempotency-Key was 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, with errors keyed by field), or the Idempotency-Key header 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). Wait retry_after seconds.

PATCH /api/v1/feedback/{feedback} Add detail to feedback

The same, for servers that prefer PATCH. Both forms update the same vote; neither changes its rating.

Key
Authorization: Bearer with the feedback:write scope
Origin
One of the key’s allowed origins
Call from
The browser or your server
Rate limit
feedback group, 120 a minute
Retries
Safe with Idempotency-Key
Request fields
FieldDescription
session_id string Required Must match the session_id the vote was sent with.
reason string Optional A short reason code from your own list, up to 32 characters.
comment string Optional What went wrong, up to 2,000 characters.
expected_outcome string Optional 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."}'
Questions log filtered to answers shoppers rated poorly Example data
Thumbs down votes, with the shopper’s reason, ready for your team to review.

Errors

StatusCodeWhat to do
401unauthenticated, invalid_api_keySend a valid key.
403forbidden_scope and the origin_* codesThe key needs feedback:write, and the call needs an allowed Origin.
404invalid_feedbackThe id is wrong, or the session_id doesn’t match the vote.
409idempotency_key_reused, idempotency_in_flightOnly when your server sends an Idempotency-Key. See Idempotency.
422validation_failed, invalid_answer_idFix the fields in errors, or send an answer_id from your own workspace.
429rate_limited and the other limit codesWait 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.

Try Ottla on your own store

Start a 14-day free trial with no card needed. The trial has every Pro feature, with lower limits, so you can install the module or the widget, connect your catalogue and try the assistant on your own products.

14 days free. No card needed.