# GoodRx API

> GoodRx returns nearby pharmacy coupon prices for medicines and prescriptions as a workflow and API.

GoodRx compares medicine coupon prices near a US ZIP code; provide the medicine and ZIP code, with prescription details optional.

- Page: https://fous.com/workflows/goodrx
- Handle: `@goodrx`
- Category: [Health](https://fous.com/workflows/category/health)
- Source website: https://goodrx.com
- Last verified: Sep 28, 2026
- Fous is not affiliated with GoodRx.

## Methods

### Compare drug prices

Operation `compare_drug_prices`, version 1. 1 credit per call.

Compare standard GoodRx coupon prices at pharmacies near a US ZIP code for a medicine and prescription. Prices may change and some pharmacies may not offer coupons.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `form` | string | no | `"tablet"` | Prescription form, for example tablet; omit for GoodRx’s most common choice. |
| `medicine` | string | yes | `"amoxicillin"` | Brand or generic medicine name, for example amoxicillin. |
| `quantity` | integer | no | `30` | Number of units, for example 30; omit for GoodRx’s most common choice. |
| `strength` | string | no | `"500 mg"` | Prescription strength, for example 500 mg; omit for GoodRx’s most common choice. |
| `zip_code` | string | yes | `"60614"` | Five-digit US ZIP code, for example 60614. |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "medicine",
    "zip_code"
  ],
  "properties": {
    "form": {
      "type": "string",
      "default": "",
      "description": "Prescription form, for example tablet; omit for GoodRx’s most common choice.",
      "examples": [
        "tablet"
      ]
    },
    "medicine": {
      "type": "string",
      "description": "Brand or generic medicine name, for example amoxicillin.",
      "examples": [
        "amoxicillin",
        "atorvastatin"
      ]
    },
    "quantity": {
      "type": "integer",
      "minimum": 1,
      "description": "Number of units, for example 30; omit for GoodRx’s most common choice.",
      "examples": [
        30
      ]
    },
    "strength": {
      "type": "string",
      "default": "",
      "description": "Prescription strength, for example 500 mg; omit for GoodRx’s most common choice.",
      "examples": [
        "500 mg"
      ]
    },
    "zip_code": {
      "type": "string",
      "pattern": "^[0-9]{5}$",
      "description": "Five-digit US ZIP code, for example 60614.",
      "examples": [
        "60614",
        "10001"
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "form": "tablet",
      "medicine": "amoxicillin",
      "quantity": 30,
      "strength": "500 mg",
      "zip_code": "60614"
    },
    {
      "medicine": "atorvastatin",
      "zip_code": "10001"
    },
    {
      "medicine": "amoxicillin",
      "zip_code": "60614"
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `form` | string or null | `"tablet"` | Prescription form used. |
| `medicine` | string | `"Amoxicillin"` | Medicine shown by GoodRx. |
| `quantity` | integer or null | `30` | Number of units used. |
| `strength` | string or null | `"500mg"` | Prescription strength used. |
| `pharmacies` | array |  | Nearby pharmacies sorted by standard GoodRx coupon price. |
| `pharmacies[].goodrx_link` | string | `"https://www.goodrx.com/amoxicillin?form=tablet&dosage=500mg&quantity=30&pharmacyId=49222"` |  |
| `pharmacies[].pharmacy_name` | string | `"Aurora Pharmacy"` |  |
| `pharmacies[].savings_percent` | number or null | `58.8` |  |
| `pharmacies[].coupon_price_usd` | number | `12.2` |  |
| `pharmacies[].retail_price_usd` | number or null | `29.63` |  |

**Example input**

```json
{
  "form": "tablet",
  "medicine": "amoxicillin",
  "quantity": 30,
  "strength": "500 mg",
  "zip_code": "60614"
}
```

**Example output**

```json
{
  "form": "tablet",
  "medicine": "Amoxicillin",
  "quantity": 30,
  "strength": "500mg",
  "pharmacies": [
    {
      "goodrx_link": "https://www.goodrx.com/amoxicillin?form=tablet&dosage=500mg&quantity=30&pharmacyId=49222",
      "pharmacy_name": "Aurora Pharmacy",
      "savings_percent": 58.8,
      "coupon_price_usd": 12.2,
      "retail_price_usd": 29.63
    },
    {
      "goodrx_link": "https://www.goodrx.com/amoxicillin?form=tablet&dosage=500mg&quantity=30&pharmacyId=49499",
      "pharmacy_name": "Sams Club",
      "savings_percent": 31.1,
      "coupon_price_usd": 12.4,
      "retail_price_usd": 18.01
    },
    {
      "goodrx_link": "https://www.goodrx.com/amoxicillin?form=tablet&dosage=500mg&quantity=30&pharmacyId=3",
      "pharmacy_name": "Walgreens",
      "savings_percent": 52.4,
      "coupon_price_usd": 12.84,
      "retail_price_usd": 26.97
    }
  ]
}
```

## Quick start

Call the API with a Fous API key (`FOUS_API_KEY`). To create one, turn on Developer mode in Fous Studio, then open Keys & connections → API keys (https://app.fous.com/keys).

```bash
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
: "${FOUS_API_KEY:?Set FOUS_API_KEY before running this example}"

curl 'https://api.fous.com/v1/query' \
  --fail-with-body --silent --show-error --max-time 120 \
  -H "Authorization: Bearer $FOUS_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "api": "@goodrx",
  "visibility": "public",
  "operation": "compare_drug_prices",
  "version": 1,
  "input": {
    "form": "tablet",
    "medicine": "amoxicillin",
    "quantity": 30,
    "strength": "500 mg",
    "zip_code": "60614"
  },
  "response": {
    "format": "json"
  }
}'
```

```python
# Save as fous.py and run with python3 fous.py. No packages needed.
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
import json
import os
import urllib.error
import urllib.request

api_key = os.environ.get("FOUS_API_KEY")
if not api_key:
    raise RuntimeError("Set FOUS_API_KEY before running this example")

body = json.loads("{\n  \"api\": \"@goodrx\",\n  \"visibility\": \"public\",\n  \"operation\": \"compare_drug_prices\",\n  \"version\": 1,\n  \"input\": {\n    \"form\": \"tablet\",\n    \"medicine\": \"amoxicillin\",\n    \"quantity\": 30,\n    \"strength\": \"500 mg\",\n    \"zip_code\": \"60614\"\n  },\n  \"response\": {\n    \"format\": \"json\"\n  }\n}")
request = urllib.request.Request(
    "https://api.fous.com/v1/query",
    data=json.dumps(body).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    method="POST",
)
try:
    with urllib.request.urlopen(request, timeout=120) as response:
        result = json.load(response)
except urllib.error.HTTPError as error:
    raise RuntimeError(f"HTTP {error.code}: {error.read().decode('utf-8', errors='replace')}") from error
if result.get("success") is False:
    raise RuntimeError(result.get("error", {}).get("message", "Request failed"))
print(json.dumps(result["data"]["output"], indent=2))
```

```typescript
// Save as fous.mts and run with npx tsx fous.mts.
// First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
const apiKey = process.env.FOUS_API_KEY;
if (!apiKey) throw new Error("Set FOUS_API_KEY before running this example");

const response = await fetch("https://api.fous.com/v1/query", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  signal: AbortSignal.timeout(120_000),
  body: JSON.stringify({
  "api": "@goodrx",
  "visibility": "public",
  "operation": "compare_drug_prices",
  "version": 1,
  "input": {
    "form": "tablet",
    "medicine": "amoxicillin",
    "quantity": 30,
    "strength": "500 mg",
    "zip_code": "60614"
  },
  "response": {
    "format": "json"
  }
}),
});
type ApiResult = { success: boolean; data?: { output: unknown }; error?: { message: string } };
const result: ApiResult = await response.json();
if (!response.ok || result.success === false) {
  throw new Error(result.error?.message ?? `HTTP ${response.status}`);
}
if (!result.data) throw new Error("Missing API response data");
console.log(result.data.output);
```

Or describe the data in plain language: send `{"api":"@goodrx","prompt":"Describe the data you need, with every detail"}` to the same URL. Fous fills in the input, runs the method that fits and returns only the fields you asked for; `data.route.calls[].request` is the exact call it made. Routing is free; the run costs the same.

## Use cases

- Compare coupon prices for a medicine near a customer’s ZIP code
- Identify nearby pharmacies with lower coupon prices
- Estimate savings against listed retail prices

## FAQ

### Is Fous affiliated with GoodRx?

No. Fous is not affiliated with GoodRx. This workflow reads the public goodrx.com website and returns its data.

### How much does it cost?

Each run costs 1 credit. With pay-as-you-go, a credit costs 1¢; monthly plans cost less per credit.

### Do I need a GoodRx account?

No. You only need a Fous account.

### How current is the data?

Fous gets the data from goodrx.com when you run it; repeating the same request within a day may return the saved result. Fous checks this workflow automatically; it last passed a check on Sep 28, 2026.

### What are nearby pharmacies charging for a medicine?

Use Compare drug prices with the medicine and five-digit US ZIP code. Prescription form, quantity, and strength are optional.

### Which nearby pharmacy has the lowest coupon price?

Compare drug prices returns nearby pharmacies sorted by standard GoodRx coupon price.

### How much could a coupon save versus retail price?

Compare drug prices returns coupon price, retail price, and savings percentage for nearby pharmacies.

## Related

- [Drugs.com API](https://fous.com/workflows/drugs-com.md): Drugs.com provides public medicine guides, interaction and food or lifestyle warnings for 2–10 medicines, pill matches by imprint, color, or shape, and listed US cash prices by strength, form, and quantity.
- [Cost Plus Drugs API](https://fous.com/workflows/cost-plus-drugs.md): Transparent medicine prices from Mark Cuban Cost Plus Drug Company.
- [Costco API](https://fous.com/workflows/costco.md): Costco returns US product prices/details and warehouse hours/services/gas prices; delivery affects availability, member prices may be hidden, and posted gas and holiday hours may differ.
- [NHS API](https://fous.com/workflows/nhs.md): NHS provides condition and medicine guidance, with condition dates reflecting the latest pages used, and nearby England service listings ordered by distance; availability details may be missing.
- [RetailMeNot API](https://fous.com/workflows/retailmenot.md): Store coupons, promo codes and shopping deals.
- [Aldi API](https://fous.com/workflows/aldi.md): Search groceries and prices at ALDI US.
- [Medicare Care Compare API](https://fous.com/workflows/medicare-care-compare.md): Medicare Care Compare provides public Medicare quality ratings and details for U.S. hospitals and nursing homes; nursing home results include active facilities in the current public listing and fines from the past three years.
- [Best Buy API](https://fous.com/workflows/best-buy.md): Best Buy returns US electronics and appliance listings, prices, deals, specifications, images, reviews, and nearby store pickup and shipping details; prices and availability can change by location and before checkout.
- [All Health workflows](https://fous.com/workflows/category/health)
