Skip to content

Create Product Review

Submit a review and rating for a product.

Endpoint

POST /api/shop/reviews

The product is identified by productId in the body. There is no POST /products/{id}/reviews route — that path exists for reading only.

Request Headers

HeaderRequiredDescription
Content-TypeYesapplication/json
X-STOREFRONT-KEYYesYour storefront API key
AuthorizationDependsCustomer Bearer token. Required unless the store allows guest reviews.

Request Body

json
{
  "productId": 126,
  "title": "Excellent product!",
  "comment": "Very satisfied with this purchase.",
  "rating": 5,
  "name": "John Doe"
}
FieldTypeRequiredDescription
productIdintegerYesThe product being reviewed. product_id is accepted as well.
titlestringYesReview headline.
commentstringYesReview body. No minimum length is enforced.
ratingintegerYesStar rating from 1 to 5.
namestringNoDisplay name shown with the review.

Response Fields (201 Created)

The stored review, flat — there is no wrapper object and no message.

FieldTypeDescription
idintegerReview ID. Needed for Update and Delete.
namestringDisplay name as submitted.
title / commentstringReview text as submitted.
ratingintegerStar rating.
statusstringAlways pending on creation.
createdAt / updatedAtstringISO 8601 timestamps.

The product ID is not echoed back — keep it client-side if the confirmation screen needs it.

Who Can Review

Two store settings gate this endpoint, and both are enforced here.

SettingEffect when off
Customer reviewsEvery submission is refused with 403, token or not.
Guest reviewsA submission without a customer token is refused with 403. Logged-in customers are unaffected.

Nothing stops the same customer reviewing the same product more than once — enforce a one-review rule in the client if the store wants one.

Use Cases

  • Review form on a product page — post the four fields and show the returned status of pending, since the review will not appear in the default listing until it is approved.
  • Show the customer their own submission — the default product-review listing excludes pending rows, so read it back with ?status=pending on Get Product Reviews.

Best Practices

  • Tell the shopper the review is awaiting approval — a 201 here does not mean the review is visible; it is stored as pending.
  • Validate the rating before sending — the server rejects anything outside 1–5, and a slider that allows 0 produces a 400 after the shopper has typed a review.
  • Send name explicitly — it is optional and is not filled in from the customer's profile, so a review submitted without it displays with an empty author.
  • Check the store's review settings before rendering the form — a store with reviews disabled answers 403 on every submission, so the form should not be shown at all.

Released under the MIT License.