Updated Oct 2026

G2 reviews API in Python: products, reviews, pagination

G2 gives vendors an API (Seller API v2) that returns the reviews of their own products: the star rating, the title, the structured answers (“What do you like best?”, “What do you dislike?”) and the reviewer. It is read-only and JSON:API-shaped, with cursor-style links.next pagination. This guide reads everything with requests, maps the awkward bits, and shows the same through Prisma. The vendor-side view of G2 and the other B2B sites is on B2B software reviews API.

Shell
pip install requests

You need a G2 API token from the G2 Developer Portal, issued to a vendor account whose plan includes review access.

1. List your products

Python
import os, requests

API = "https://data.g2.com/api/v2"
H = {"Authorization": f"Bearer {os.environ['G2_API_TOKEN']}", "Accept": "application/json"}

r = requests.get(f"{API}/users/me/products", headers=H, params={"page[size]": 250}, timeout=30)
r.raise_for_status()
for p in r.json()["data"]:
    print(p["id"], p["attributes"]["name"], p["attributes"].get("slug"))
PRODUCT_ID = r.json()["data"][0]["id"]

A 401 or 403 here means the token is wrong or the G2 plan doesn’t include review access through the API.

2. Page through the reviews, with the reviewer

Python
def reviews(product_id, since=None):
    params = {"page[size]": 250, "include": "user"}
    if since:
        params["filter[updated_at_gt]"] = since           # ISO 8601, for incremental syncs
    url = f"{API}/products/{product_id}/reviews"
    while url:
        r = requests.get(url, headers=H, params=params, timeout=30)
        r.raise_for_status()
        page = r.json()
        users = {u["id"]: u["attributes"].get("name") for u in page.get("included", []) if u["type"] == "users"}
        for rev in page["data"]:
            a = rev["attributes"]
            ans = a.get("answers") or {}
            uid = ((rev.get("relationships") or {}).get("user") or {}).get("data") or {}
            yield {
                "id": rev["id"],
                "rating": round(a["star_rating"]) if a.get("star_rating") is not None else None,   # G2 allows half stars
                "stars_exact": a.get("star_rating"),
                "title": a.get("title"),
                "likes": (ans.get("love") or {}).get("value"),
                "dislikes": (ans.get("hate") or {}).get("value"),
                "author": users.get(uid.get("id")),
                "published_at": a.get("published_at") or a.get("submitted_at"),
                "updated_at": a.get("user_updated_at"),
                "url": a.get("url"),
            }
        url = (page.get("links") or {}).get("next")   # absolute URL with the cursor; params already inside
        params = None

for rev in reviews(PRODUCT_ID):
    print(rev["rating"], rev["author"], rev["title"], "|", (rev["likes"] or "")[:60], "|", (rev["dislikes"] or "")[:60])

Notes from running this in production: answers holds the structured questions keyed by name (love, hate and others) with a value; published_at is null for reviews not yet public; user_updated_at changes when the reviewer edits, which is what filter[updated_at_gt] watches; links.next is absolute, so don’t re-attach the params. The API tells you whether the vendor responded but not the response text, and there is no endpoint to post one.

3. The same job through Prisma

Prisma connects G2 with the token (checked before storing), imports the products the token can see or the ones you list, syncs reviews incrementally and returns them in the same JSON as Capterra, Trustpilot, Google and 50+ other platforms, with likes and dislikes merged into text.

Python
H = {"Authorization": f"Bearer {os.environ['PRISMA_API_KEY']}"}
r = requests.get("https://api.prismareviews.com/v1/reviews", headers=H, params={"platform": "g2", "since": "2026-01-01", "limit": 100}, timeout=30)
for rev in r.json()["data"]:
    print(rev["rating"], rev["author"], rev["title"], rev["text"][:100], rev["url"])

G2 is read-only in Prisma, like on G2 itself; each review carries its url so you answer in the vendor portal. Connection fields: G2 on Platforms. G2 is included from the Beam plan up. A test key returns sample G2 reviews so the code runs today.

FAQ

How do I get a G2 API token?

From the G2 Developer Portal, as a vendor with a G2 profile whose plan includes API access to reviews. The token is sent as Authorization: Bearer. A 401 or 403 usually means the token is wrong or the plan doesn’t include review access.

Can I reply to G2 reviews by API?

No. The G2 API exposes whether the vendor responded, not a way to post the response. Replies are written in the G2 vendor portal.

Why are G2 ratings not whole numbers?

G2 allows half stars, so star_rating can be 4.5. Round it if your model expects 1 to 5 integers, and keep the original for reporting.

G2, Capterra, Trustpilot and Google, one JSON.

Get API key

2 locations free. Test keys return sample reviews from every platform.

Get your API key in a minute

Free Spark plan: 2 locations, no card. Test keys return sample data on all 58 platforms, so you can build before connecting a real one.