Review answers
These endpoints are called from a shopper's browser, so they take your publishable key rather than a secret one. Anything specific to one customer also takes a signed email and timestamp. Identifying the customer explains how to produce the signature.
To call them from your own server instead, send a secret key as a bearer token and leave apiPublishableKey out. See Calling the widget API from a server.
POST /widgets/review-answers
Ask a question about a product and get an answer generated from its published reviews, with the reviews it draws on. The answer is shown only to the shopper who asked; it is never published anywhere. Repeated questions are answered from cache. Only available when the store has review answers switched on, which GET /widgets/reviews reports as reviewAnswers.enabled. It is rate limited per visitor token and per IP address.
Query parameters
apiPublishableKeystringYour organization's publishable key, from Settings, API keys. Leave it out when the request carries a secret key as a bearer token instead, which is how a server calls these endpoints.
Body parameters
productSlugstringSlug of the product the question is about. Send this or productExternalId.
productExternalIdstringThe product's ID on one of your sites, such as its Shopify product ID, sent instead of productSlug. Either Shopify form works.
sitestringThe slug of the site productExternalId belongs to. Only needed when the same ID is on more than one of your sites.
questionstringrequiredThe shopper's question, up to 300 characters.
visitorTokenstringrequiredRandom id identifying the visitor's browser, used only for rate limiting. Only a hash of it is ever stored, and never with the question.
pageContextstringWhat the page the shopper is on says about the product: its title, description and product copy, as the widget read them. Given to the model as facts about the product alongside its reviews, up to 4,000 characters. The product's stored description is included whether or not this is sent.
contextstringNotes from the store for the model: extra facts to draw on or guidance on how to answer, up to 2,000 characters. Set on the widget by the store, never by the shopper. A change regenerates cached answers on their next ask.