Prisma Reviews / Guides / VTEX reviews API in Python
VTEX reviews API in Python: Reviews and Ratings app, app key and token
VTEX stores get product reviews from the Reviews and Ratings app, and the app exposes them on the store’s own host with VTEX’s standard app key and token headers. The API is simple (one list endpoint with from/to ranges) and limited (no date filter, no replies, and VTEX no longer maintains the app). This guide reads approved reviews with requests, following VTEX’s OpenAPI spec as Prisma’s VTEX connector does (in beta, built from the spec). The store-platform picture is on e-commerce reviews API.
pip install requestsCredentials: the account name (as in {account}.myvtex.com), an app key (vtexappkey-…) and its app token, generated in the VTEX Admin under API keys with a role that can read reviews, plus the store’s address for links.
1. Approved reviews, newest first, in ranges of 100
import os, requests
from datetime import datetime, timedelta, timezone
ACCOUNT = os.environ["VTEX_ACCOUNT"]
API = f"https://{ACCOUNT}.myvtex.com/reviews-and-ratings/api"
H = {"X-VTEX-API-AppKey": os.environ["VTEX_APP_KEY"], "X-VTEX-API-AppToken": os.environ["VTEX_APP_TOKEN"], "Accept": "application/json"}
STORE = f"https://{ACCOUNT}.myvtex.com"
def reviews(since=None, page_size=100):
seen, start = set(), 0
while True:
r = requests.get(f"{API}/reviews", headers=H, params={"from": start, "to": start + page_size, "order_by": "ReviewDateTime:desc", "status": "true"}, timeout=30)
if r.status_code == 404:
raise RuntimeError("The Reviews and Ratings app isn't installed on this account")
r.raise_for_status()
body = r.json()
rows = body.get("data", [])
for rv in rows:
if rv["id"] in seen or rv.get("approved") is False: # ranges may overlap by one
continue
seen.add(rv["id"])
created = datetime.fromisoformat((rv.get("reviewDateTime") or "").replace("Z", "+00:00")) if rv.get("reviewDateTime") else None
if since and created and created < since:
return
yield rv, created
total = (body.get("range") or {}).get("total", 0)
start += page_size
if not rows or start >= total:
return
since = datetime.now(timezone.utc) - timedelta(days=31)
for rv, created in reviews(since):
print(rv["id"], rv.get("rating"), rv.get("reviewerName"), created.date() if created else "", rv.get("locale"), rv.get("productId"), rv.get("title"), (rv.get("text") or "")[:80], STORE)Fields: id, productId, rating (1 to 5), title, text, reviewerName, reviewDateTime, locale and approved. The spec doesn’t say whether to is inclusive, so consecutive ranges may share one review: deduplicate by id. status=true returns approved reviews only.
2. What the API won’t do
No reply field or endpoint, no date filter (sort by ReviewDateTime:desc and stop early), and no product URL in the review: build it from productId through the Catalog API if you need links.
3. The same job through Prisma
Prisma connects a VTEX store with the account, app key and token (checked against the app before storing, encrypted), reads approved reviews newest first with early stop, keeps locale as the language, and returns them in the same JSON as Shopify apps, WooCommerce, BigCommerce, Google and 80+ other platforms, with a webhook per new review.
H = {"Authorization": f"Bearer {os.environ['PRISMA_API_KEY']}"}
r = requests.get("https://api.prismareviews.com/v1/reviews", headers=H, params={"platform": "vtex", "limit": 100}, timeout=30)
for rev in r.json()["data"]:
print(rev["rating"], rev["author"], rev["title"], rev["text"], rev["language"])VTEX is read-only in Prisma, like on VTEX, and in beta. Connection fields: Platforms. A test key returns sample reviews so the code runs now.
FAQ
Where do VTEX product reviews come from?
From the Reviews and Ratings app (vtex.reviews-and-ratings), which exposes GET /reviews-and-ratings/api/reviews on the store’s myvtex.com host. VTEX no longer actively maintains the app, but stores still run it and the endpoint answers.
How do I authenticate to the VTEX reviews endpoint?
With an application key generated in the VTEX Admin (API keys) that has a role with access to the store’s reviews: send X-VTEX-API-AppKey (vtexappkey-…) and X-VTEX-API-AppToken headers.
Can I reply to VTEX reviews by API?
No. The Reviews and Ratings app has no reply field or endpoint. Moderation (approving reviews) is the only write; merchants answer customers by other channels.
VTEX, Shopify apps, WooCommerce and Google, one key.
2 locations free. Test keys return sample reviews from every platform.