# G2 Product comparison API (g2.compare)

- Canonical page: https://everyinfra.com/en/g2-api/compare
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "g2", "action": "compare", "params": {...}}
- Price: $0.001389 per call ($1.39 per 1,000 requests); failed calls and empty results are not charged
- Returns: single object
- Mode: sync; add "mode": "async" for slow tasks

G2 Product comparison reads one G2 comparison page, the side-by-side view of software products, and returns the page `url`, its `combined_slug`, the product entries in `products` with `product_count`, the rating details broken down by dimension in `ratings`, and the alternative products the page suggests in `alternatives_shown`, each with its slug, name and link. Software buyers use it to see where products differ dimension by dimension, and product marketers use it to track how their product scores against named rivals.

Name the products in `slugs`, or point at a comparison page you already have with `combined_slug` or `url`. The returned `combined_slug` is the comparison's combined slug, the part of the address after /compare/, so store it with the date of each call to set later readings of the same page against earlier ones.

## Health

- Live health (24h percent, hourly and daily trends): https://api.everyinfra.com/api/v1/social/availability?platform=g2&action=compare

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| slugs | not declared | yes | not declared | Specifies an array of product slugs or product URLs for the compare action, which are automatically joined with -vs- to construct the G2 comparison path. This parameter does not execute separate parallel queries or accept vendor names; choose product combinations with existing G2 comparison pages. |
| combined_slug | not declared | no | not declared | Specifies the pre-joined comparison path slug following /compare/ for the compare action, taking precedence over auto-generated slug arrays. It does not accept single vendor-and-product identifiers, and passing an explicit url parameter takes higher precedence. |
| url | not declared | no | not declared | Specifies the target G2 resource URL or bare slug. For profile, reviews, and alternatives, pass a /products/<slug> URL or product slug; for vendor, pass a /sellers/<slug> URL or seller slug. For compare, passing a full /compare/ URL overrides auto-generated paths, though the required slugs parameter must still be supplied. |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| url | Link to the record on the platform. |
| combined_slug | platform-native meaning |
| product_count | platform-native meaning |
| products | platform-native meaning |
| ratings | platform-native meaning |
| alternatives_shown | platform-native meaning |
| platform | Source platform identifier, the same as platform in the request (for example xiaohongshu, tiktok). |

## Example

```bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "g2",
  "action": "compare",
  "params": {
    "slugs": [
      "slack",
      "microsoft-teams"
    ]
  }
}'
```

```python
import os
import requests

response = requests.post(
    "https://api.everyinfra.com/api/v1/social",
    headers={"Authorization": f"Bearer {os.environ['EVERYINFRA_API_KEY']}"},
    json={
        "platform": "g2",
        "action": "compare",
        "params": {
            "slugs": [
                "slack",
                "microsoft-teams",
            ],
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

No real sample for these example parameters yet: structure only, every value is a placeholder (…).

```text
{
  "id": "req_…",
  "platform": "g2",
  "action": "compare",
  "results": {
    "url": …,
    "combined_slug": …,
    "product_count": …,
    "products": …,
    "ratings": …,
    "alternatives_shown": …,
    "platform": …
  },
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### How do I name the products to compare?

Put them in `slugs` as an array of strings, one per product, using each product's G2 slug, the part after /products/ in its G2 link, or the full product URL. The slugs are joined with -vs- to build the address of the comparison page. G2 Search returns product links you can take the slugs from.

### Which input wins if I send more than one?

The full comparison `url` comes first, then `combined_slug`, the part of the address after /compare/, and only then `slugs`. Send just one of them to keep the request clear; if you copied a comparison page from your browser, pass it whole as `url` and leave out the slugs.

### What does `ratings` contain?

`ratings` holds the rating details the comparison page breaks down by dimension, so you can see where products differ instead of relying on one overall score. Read it next to `alternatives_shown`, the alternative products the page suggests beyond the ones you named; each comes with a slug you can pass to G2 Reviews.

## Also

- Capability catalog (no key): https://api.everyinfra.com/api/v1/social/catalog?platform=g2
- OpenAPI: https://everyinfra.com/openapi.json · Agents guide: https://everyinfra.com/agents.md
