Skip to main content
Moderate reviews from your own code when the Admin API doesn’t fit, for example to auto-publish high ratings or to reject reviews flagged by a spam filter. Moderation is an updateReviewWorkflow run that sets status, and removal is a deleteReviewWorkflow run that soft deletes the review.
1

Set the status

Run updateReviewWorkflow with the review id and the new status:
src/api/admin/review-moderation/[id]/route.ts
Routes under /admin require an authenticated admin user by default. The workflow returns the updated review.
2

Delete a review

Add a DELETE handler to the same file that runs deleteReviewWorkflow with the review id as its whole input:
src/api/admin/review-moderation/[id]/route.ts
The review gets a deleted_at timestamp. Its row and its four links stay in the database.

Publish reviews automatically

Run the moderation from a subscriber to publish reviews without an operator. The module emits review.review.created with the new review’s id, so you can load the review and decide:
src/subscribers/auto-publish-reviews.ts
This publishes every review rated 4 or 5 and leaves the rest pending for an operator. See the Events reference for the payload.

Correct a review’s content

updateReviewWorkflow also accepts rating, customer_note, and seller_note. Use it to fix a rating, redact a note, or clear a store’s answer:
The workflow saves the previous rating, customer_note, seller_note, and status before it writes, and restores them if a later step fails.

Account for soft deleted reviews in averages

A soft deleted review disappears from query.graph and the APIs, but the service’s rating helpers still count it, because their query doesn’t check deleted_at. Compute averages with query.graph if deletions must change the number, as shown in Compute aggregate ratings.

Next steps