# GoodRx Drug Search API Documentation

Scrappa's `GET /api/goodrx/search` endpoint finds prescription drugs by name. Each result returns the drug name and a pass-through slug. Use the slug with `GET /api/goodrx/drug` and `GET /api/goodrx/drug-info`. Public data only.

- **Documentation:** [https://scrappa.co/docs/goodrx-api/goodrx_search](https://scrappa.co/docs/goodrx-api/goodrx_search)
- **API group:** GoodRx API
- **Endpoint:** `GET https://scrappa.co/api/goodrx/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 | Drug name to search, e.g. atorvastatin. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/goodrx/search?query=atorvastatin"
```

## Example response

```json
{
    "success": true,
    "query": "atorvastatin",
    "total": 2,
    "drugs": [
        {
            "name": "Atorvastatin",
            "slug": "atorvastatin",
            "url": "https://www.goodrx.com/atorvastatin"
        }
    ],
    "pager": {
        "first_page": 1,
        "next_page": null,
        "last_page": 1
    },
    "meta": {
        "duration_ms": 8420,
        "attempts": 1,
        "source": "goodrx"
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 422 | Validation Error | One or more query parameters failed validation. |
| 503 | Upstream Unavailable | GoodRx returned a blocked, empty or malformed page on every attempt. |

## 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)
