# G2 Search API Documentation

<p><strong>G2 Search API</strong> searches G2 products by text. Each result has the product id, uuid, slug, name, vendor, rating from 0 to 5, review count, description, categories, image and G2 URL. Pass the slug to the Reviews API.</p><p>Sort with <code>order</code>: <code>relevance</code> (default), <code>popular</code>, <code>top_shelf</code> (highest average rating) or <code>alphabetical</code>. Note that <code>top_shelf</code> favours products with one or two reviews and a perfect rating.</p><p>Page through the results with <code>page</code> (1 to 400). Page N always holds the results of page N. A page past the last page returns an empty list or a 422 error, never page 1. The <code>pagination</code> block has the page, the last page, the total number of results and whether a next page exists.</p><p>Filter with <code>star_rating</code> (buckets 1 to 5) and <code>category_id</code> (facet ids from <code>available_filters.categories</code>). Filters are always honoured: rows outside a requested star bucket are removed, so a page can hold fewer than 20 results. A product without reviews has <code>rating: null</code>.</p><p>Each page is one lookup and one credit. Failed requests are never billed.</p>

- **Documentation:** [https://scrappa.co/docs/g2-api/g2_search](https://scrappa.co/docs/g2-api/g2_search)
- **API group:** G2 API
- **Endpoint:** `GET https://scrappa.co/api/g2/search`

## Authentication

Send your Scrappa API key in the `X-API-KEY` request header. Paid endpoints also support accountless x402 payments when called without an API key.

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `query` | string | Yes | Search text, 2 to 100 characters. Example: crm. |
| `page` | integer | No | One-based page number, 1 to 400 (default 1). Example: 2. |
| `order` | string | No | Sort order: relevance (default), popular, top_shelf or alphabetical. |
| `star_rating` | array | No | Star buckets 1 to 5 (5 = 4.5 stars and up). Repeat the parameter or send a comma list. Example: 5. |
| `category_id` | array | No | Category facet id from available_filters.categories. Repeat the parameter or send a comma list. Example: 83. |

## Example response

```json
{
    "data": {
        "count": 1,
        "order": "relevance",
        "query": "crm",
        "results": [
            {
                "id": 576,
                "url": "https://www.g2.com/products/zoho-crm/reviews",
                "name": "Zoho CRM",
                "slug": "zoho-crm",
                "uuid": "00000000-0000-0000-0000-000000000000",
                "rating": 4.1,
                "vendor": "Zoho",
                "position": 2,
                "image_url": "https://images.g2crowd.com/uploads/product/image/example/zoho-crm.png",
                "vendor_id": 1,
                "categories": [
                    {
                        "id": 179,
                        "name": "CRM",
                        "slug": "crm"
                    }
                ],
                "description": "Zoho CRM is a customer relationship management platform.",
                "vendor_slug": "zoho",
                "review_count": 2955
            }
        ],
        "pagination": {
            "page": 1,
            "has_next": true,
            "last_page": 400,
            "total_results": 21978
        },
        "available_filters": {
            "categories": [
                {
                    "id": 83,
                    "name": "Information Technology",
                    "count": 172017
                }
            ]
        }
    },
    "meta": {
        "billable": true,
        "endpoint_family": "search"
    },
    "success": true
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Invalid Page | The result page does not exist. Use a lower page number. This response is not billable. |
| 422 | Validation Error | A required parameter or a value is invalid. This response is not billable. |
| 503 | Upstream Unavailable | G2 could not be reached or returned data that does not match the request. This response is not billable and is retryable. |

## More Scrappa resources

- [API documentation](https://scrappa.co/docs)
- [Full LLM-readable API reference](https://scrappa.co/llms-full.txt)
- [OpenAPI specification](https://scrappa.co/docs/api.json)
- [Pricing](https://scrappa.co/pricing)
