# GasBuddy API

> GasBuddy returns nearby station prices and average gas prices as a workflow and API.

GasBuddy (Gas Buddy) lists nearby stations and reported fuel prices for a US or Canadian city, address, or postal code. Get average gas prices returns reported averages and regular-price changes for a US state or listed metro area, using its name or code.

- Page: https://fous.com/workflows/gasbuddy
- Handle: `@gasbuddy`
- Category: [Energy](https://fous.com/workflows/category/energy)
- Source website: https://gasbuddy.com
- Last verified: Sep 29, 2026
- Fous is not affiliated with GasBuddy.

## Methods

### Get average gas prices

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

Get GasBuddy’s latest reported average prices and regular-price changes for a US state or listed metro area. Midgrade, premium and current-area low/high prices are not published with these averages; updates may lag the current day.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `location` | string | yes | `"Ohio"` | US state name or two-letter code, or city and state, for example "Chicago, IL". |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "location"
  ],
  "properties": {
    "location": {
      "type": "string",
      "description": "US state name or two-letter code, or city and state, for example \"Chicago, IL\".",
      "examples": [
        "Ohio",
        "Chicago, IL",
        "OH"
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "location": "Ohio"
    },
    {
      "location": "Chicago, IL"
    },
    {
      "location": "OH"
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `place` | string | `"Ohio"` | State or GasBuddy metro area. |
| `currency` | string | `"USD"` | Currency of all prices and changes. |
| `gasbuddy_link` | string | `"https://fuelinsights.gasbuddy.com/#Home/US/Ohio"` |  |
| `last_updated_date` | string or null | `"2026-09-28"` | Date of the latest reported average, not necessarily today. |
| `diesel_price_per_gallon` | number or null | `6.735` |  |
| `premium_price_per_gallon` | number or null |  |  |
| `regular_price_per_gallon` | number or null | `4.269` |  |
| `midgrade_price_per_gallon` | number or null |  |  |
| `regular_change_from_week_ago` | number or null | `-0.218` |  |
| `regular_change_from_year_ago` | number or null | `1.421` |  |
| `regular_change_from_month_ago` | number or null | `0.395` |  |
| `regular_change_from_yesterday` | number or null | `-0.037` |  |
| `lowest_regular_price_per_gallon` | number or null |  |  |
| `highest_regular_price_per_gallon` | number or null |  |  |

**Example input**

```json
{
  "location": "Ohio"
}
```

**Example output**

```json
{
  "place": "Ohio",
  "currency": "USD",
  "gasbuddy_link": "https://fuelinsights.gasbuddy.com/#Home/US/Ohio",
  "last_updated_date": "2026-09-28",
  "diesel_price_per_gallon": 6.735,
  "premium_price_per_gallon": null,
  "regular_price_per_gallon": 4.269,
  "midgrade_price_per_gallon": null,
  "regular_change_from_week_ago": -0.218,
  "regular_change_from_year_ago": 1.421,
  "regular_change_from_month_ago": 0.395,
  "regular_change_from_yesterday": -0.037,
  "lowest_regular_price_per_gallon": null,
  "highest_regular_price_per_gallon": null
}
```

### List cheapest gas stations

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

Find nearby GasBuddy stations and their reported fuel prices for a US or Canadian city, address, or postal code. Results are ordered by listed price among nearby search results; prices may be missing or out of date.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `location` | string | yes | `"Denver, CO"` | US or Canadian city, street address, or postal code, such as Denver, CO or 90210. |
| `fuel_type` | string | no | `"premium"` | Fuel grade, such as premium. Defaults to regular. |
| `max_results` | integer | no | `50` | Maximum number of stations, such as 20. Defaults to 20; maximum 50. |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "location"
  ],
  "properties": {
    "location": {
      "type": "string",
      "description": "US or Canadian city, street address, or postal code, such as Denver, CO or 90210.",
      "examples": [
        "Denver, CO",
        "Los Angeles, CA",
        "90210"
      ]
    },
    "fuel_type": {
      "enum": [
        "regular",
        "midgrade",
        "premium",
        "diesel"
      ],
      "type": "string",
      "default": "regular",
      "description": "Fuel grade, such as premium. Defaults to regular.",
      "examples": [
        "premium",
        "diesel"
      ]
    },
    "max_results": {
      "type": "integer",
      "default": 20,
      "maximum": 50,
      "minimum": 1,
      "description": "Maximum number of stations, such as 20. Defaults to 20; maximum 50.",
      "x-fous-developer": true,
      "examples": [
        50,
        25,
        20
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "location": "Denver, CO"
    },
    {
      "location": "Los Angeles, CA",
      "fuel_type": "premium",
      "max_results": 50
    },
    {
      "location": "90210"
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `stations` | array |  | Nearby stations, lowest listed price first, stations without a price last. |
| `stations[].city` | string or null | `"Denver"` | City. |
| `stations[].unit` | string | `"gallon"` | gallon or litre. |
| `stations[].brand` | string or null | `"Sam's Club"` | Fuel or store brand. |
| `stations[].price` | number or null | `3.57` | Listed price for the selected fuel in the stated currency and unit. |
| `stations[].currency` | string | `"USD"` | USD or CAD. |
| `stations[].latitude` | number or null | `39.769096133279` | Station latitude. |
| `stations[].reported` | string or null | `"5 Hours Ago"` | Approximate age of the selected price, such as 2 Hours Ago. |
| `stations[].longitude` | number or null | `-104.899241924286` | Station longitude. |
| `stations[].cash_price` | number or null |  | Cash price for the selected fuel when reported. |
| `stations[].price_type` | string or null | `"credit"` | Cash or credit for the listed price. |
| `stations[].station_id` | string | `"25649"` | GasBuddy station ID. |
| `stations[].star_rating` | number or null | `4.3` | Star rating when shown. |
| `stations[].credit_price` | number or null | `3.57` | Credit price for the selected fuel when reported. |
| `stations[].station_link` | string | `"https://www.gasbuddy.com/station/25649"` | GasBuddy page for the station. |
| `stations[].station_name` | string or null | `"Sam's Club"` | Name shown for the station. |
| `stations[].street_address` | string or null | `"7805 E 35th Ave"` | Street address. |

**Example input**

```json
{
  "location": "Denver, CO"
}
```

**Example output**

```json
{
  "stations": [
    {
      "city": "Denver",
      "unit": "gallon",
      "brand": "Sam's Club",
      "price": 3.57,
      "currency": "USD",
      "latitude": 39.769096133279,
      "reported": "5 Hours Ago",
      "longitude": -104.899241924286,
      "cash_price": null,
      "price_type": "credit",
      "station_id": "25649",
      "star_rating": 4.3,
      "credit_price": 3.57,
      "station_link": "https://www.gasbuddy.com/station/25649",
      "station_name": "Sam's Club",
      "street_address": "7805 E 35th Ave"
    },
    {
      "city": "Denver",
      "unit": "gallon",
      "brand": "Costco",
      "price": 3.59,
      "currency": "USD",
      "latitude": 39.781004,
      "reported": "1 Hour Ago",
      "longitude": -104.796366,
      "cash_price": null,
      "price_type": "credit",
      "station_id": "208619",
      "star_rating": 5,
      "credit_price": 3.59,
      "station_link": "https://www.gasbuddy.com/station/208619",
      "station_name": "Costco",
      "street_address": "4741 N Airport WayE"
    },
    {
      "city": "Denver",
      "unit": "gallon",
      "brand": "Maverik",
      "price": 3.59,
      "currency": "USD",
      "latitude": 39.784177313031,
      "reported": "26 Minutes Ago",
      "longitude": -104.797430634499,
      "cash_price": null,
      "price_type": "credit",
      "station_id": "201189",
      "star_rating": 4.4,
      "credit_price": 3.59,
      "station_link": "https://www.gasbuddy.com/station/201189",
      "station_name": "Maverik",
      "street_address": "16351 Green Valley Ranch Blvd"
    }
  ]
}
```

## 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": "@gasbuddy",
  "visibility": "public",
  "operation": "get_average_gas_prices",
  "version": 1,
  "input": {
    "location": "Ohio"
  },
  "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\": \"@gasbuddy\",\n  \"visibility\": \"public\",\n  \"operation\": \"get_average_gas_prices\",\n  \"version\": 1,\n  \"input\": {\n    \"location\": \"Ohio\"\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": "@gasbuddy",
  "visibility": "public",
  "operation": "get_average_gas_prices",
  "version": 1,
  "input": {
    "location": "Ohio"
  },
  "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":"@gasbuddy","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 listed fuel prices near a planned stop
- Find nearby stations by fuel grade
- Track regular-price changes over time
- Compare reported average prices across states or metro areas
- Map stations using their locations

## FAQ

### Is Fous affiliated with GasBuddy?

No. Fous is not affiliated with GasBuddy. This workflow reads the public gasbuddy.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 GasBuddy account?

No. You only need a Fous account.

### How current is the data?

Fous gets the data from gasbuddy.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 29, 2026.

### Which nearby stations have the lowest listed fuel prices?

List cheapest gas stations returns nearby stations ordered by listed price, using a US or Canadian city, address, or postal code.

### What are the reported average gas prices in my state?

Get average gas prices returns reported averages for a US state or listed metro area, using its name or code.

### How have regular gas prices changed recently?

Get average gas prices provides regular-price changes from yesterday, a week ago, a month ago, and a year ago.

## Related

- [AAA API](https://fous.com/workflows/aaa.md): AAA daily gas price averages for the United States, states and metro areas.
- [US Energy Information Administration API](https://fous.com/workflows/us-energy-information-administration.md): US Energy Information Administration provides official energy statistics and analysis, including latest weekly fuel prices and preliminary monthly state electricity prices with historical comparisons.
- [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.
- [CarGurus API](https://fous.com/workflows/cargurus.md): CarGurus helps shoppers browse dealer-listed new and used cars with deal ratings, and view average used prices, price ranges and 12-month price history by model year.
- [Alternative Fuels Data Center API](https://fous.com/workflows/alternative-fuels-data-center.md): U.S. Department of Energy data on alternative fuel stations and vehicles.
- [FuelEconomy.gov API](https://fous.com/workflows/fueleconomy-gov.md): FuelEconomy.gov provides official vehicle fuel economy ratings, driving range, emissions, five-year savings, and annual fuel costs based on current fuel prices and EPA’s 15,000-mile annual driving assumption.
- [Etherscan API](https://fous.com/workflows/etherscan.md): Etherscan shows current gas prices, estimated costs, wallet balances, displayed token holdings and newest confirmed transactions, plus transaction status and details; pending fees are unconfirmed.
- [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 Energy workflows](https://fous.com/workflows/category/energy)
