
G2 Data API: Extract Structured JSON in 2026
This guide covers extracting publicly accessible data. Always review a site's robots.txt and Terms of Service before scraping. TL;DR Use AlterLab's Extract...
AlterLab handles this automatically — scrape any URL with one API call. No infrastructure required.
Try it freeThis guide covers extracting publicly accessible data. Always review a site's robots.txt and Terms of Service before scraping.
TL;DR
Use AlterLab's Extract API with a JSON schema to pull structured G2 review data. POST the target URL and schema to the Extract API endpoint and receive typed JSON—no HTML parsing required.
Why use G2 data?
G2 hosts public product reviews that are useful for:
- Training sentiment analysis models on real‑world feedback
- Building competitive intelligence dashboards that track rating trends
- Enriching CRM records with verified purchase signals from reviewers
What data can you extract?
From a typical G2 review page you can request:
- product_name – the name of the SaaS or tool being reviewed
- rating – the star rating shown (e.g., "4.5")
- review_count – total number of reviews for that product
- category – the G2 taxonomy category (e.g., "Customer Relationship Management")
- verified_purchase – flag indicating whether the reviewer confirmed purchase
These fields are publicly visible; you define them in a JSON schema and AlterLab returns them as typed values.
The extraction approach
Raw HTTP requests return HTML that changes frequently. Parsing with regex or CSS selectors breaks when G2 updates its layout. A data API that accepts a schema and returns validated JSON removes that fragility. AlterLab handles request handling, anti‑bot measures, and AI‑driven field extraction so you receive consistent output.
Quick start with AlterLab Extract API
First, install the client and refer to the Getting started guide for setup.
from alterlab import AlterLabSync
client = AlterLabSync("YOUR_API_KEY")
schema = {
"type": "object",
"properties": {
"product_name": {
"type": "string",
"description": "The product name field"
},
"rating": {
"type": "string",
"description": "The rating field"
},
"review_count": {
"type": "string",
"description": "The review count field"
},
"category": {
"type": "string",
"description": "The category field"
},
"verified_purchase": {
"type": "string",
"description": "The verified purchase field"
}
}
}
result = client.scrape(
url="https://g2.com/example-page",
extraction_schema=schema,
)
print(result["filtered_content"])The call returns a JSON object matching the schema, for example:
{
"product_name": "Salesforce CRM",
"rating": "4.4",
"review_count": "12580",
"category": "Customer Relationship Management",
"verified_purchase": "true"
}You can achieve the same with cURL; see the Extract API docs for full reference.
curl -X POST https://api.alterlab.io/v1/extract \
-H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://g2.com/example-page",
"schema": {"properties": {"product_name": {"type": "string"}, "rating": {"type": "string"}, "review_count": {"type": "string"}}}
}'Batch and async usage
For large‑scale jobs, fire off multiple extract requests in parallel and handle each response as it arrives.
from alterlab import AlterLab
import asyncio
client = AlterLab("YOUR_API_KEY")
urls = [
"https://g2.com/products/salesforce-crm/reviews",
"https://g2.com/products/hubspot-crm/reviews",
"https://g2.com/products/zoho-crm/reviews"
]
schema = {
"type": "object",
"properties": {
"product_name": {"type": "string"},
"rating": {"type": "string"},
"review_count": {"type": "string"}
}
}
async def fetch(url):
return client.scrape(url=url, extraction_schema=schema)
async def main():
tasks = [fetch(u) for u in urls]
results = await asyncio.gather(*tasks)
for resp in results:
print(resp.data)
asyncio.run(main())Define your schema
The schema parameter drives the extraction. AlterLab validates each field against the declared type and returns only matching data. If a field cannot be found, the API returns null for that property, keeping the output shape predictable. You can nest objects or add arrays for lists of reviewers, but for simple review summaries a flat object works best.
Handle pagination and scale
G2 splits reviews across pages. Retrieve the next page URL from the HTML (or from a JSON endpoint if available) and loop until no further pages exist. To stay within rate limits, space requests or use AlterLab’s built‑in concurrency controls. For cost estimates, visit the AlterLab pricing page—charges are per successful extraction with no minimums and credits that never expire.
Extract structured reviews data from G2
Key takeaways
- Use a JSON schema to ask AlterLab for exactly the fields you need from G2 pages.
- The Extract API returns typed JSON, eliminating fragile HTML parsing.
- Parallelize requests for high volume while respecting rate limits and costs.
- Always verify that your extraction target is public and complies with the site’s terms.
AlterLab // Web Data, Simplified.
Was this article helpful?
Frequently Asked Questions
Related Articles

Oxylabs Alternative: Practical Developer Guide for Web Scraping Pipelines
Build reliable scraping pipelines with anti-bot handling, auto-escalation, and monitoring using a practical AltLab-compatible solution. Follow the 3-step setup, integrate with your existing workflow, and control costs at $0.0002 per request.
Herald Blog Service

Python aiohttp vs. httpx for High-Throughput Web Scraping
A benchmark‑driven comparison of aiohttp and httpx for asynchronous scraping, with concrete numbers, code snippets, and guidance on when to choose each library.
Herald Blog Service

MCP Servers Explained: How AI Tools Access the Real-Time Web in 2026
Learn how Model Context Protocol servers enable AI agents to fetch live data via scraping APIs, with architecture, code examples, and best practices for 2026.
Herald Blog Service
Popular Posts
Recommended

Selenium Bot Detection: Why You Get Flagged and How to Fix It

How to Scrape AliExpress: Complete Guide for 2026

Why Your Headless Browser Gets Detected (and How to Fix It)

Mastering Playwright Stealth for Agentic Web Workflows

Playwright Bot Detection: What Actually Works in 2026
Newsletter
Scraping insights and API tips. No spam.
Recommended Reading

Selenium Bot Detection: Why You Get Flagged and How to Fix It

How to Scrape AliExpress: Complete Guide for 2026

Why Your Headless Browser Gets Detected (and How to Fix It)

Mastering Playwright Stealth for Agentic Web Workflows

Playwright Bot Detection: What Actually Works in 2026
Stay in the Loop
Get scraping insights, API tips, and platform updates. No spam — we only send when we have something worth reading.
Explore AlterLab
Web Scraping API Resources
Part of the Web Scraping API Documentation cluster
Complete API reference with 5-tier auto-escalation — Curl to challenge resolution.
Pillar pageConfigure Tier 4 browser rendering for SPAs and dynamic content.
Scrape pages behind login using session management.
Real success rates and cost data across all 5 tiers.
MCP Server, Python SDK, and Firecrawl-compatible API for AI agent workflows.