Gas prices API for US stations

Live US gas prices. Parsed JSON. One flat-rate call.

POST /v1/scrape/gas-prices 10 credits Site-specific

Live US fuel prices for any ZIP or city/state combination. Returns structured JSON with brand, address, price, reporter, freshness, and the state-level low/average, not HTML you still have to parse. Supports the five fuel grades: regular, midgrade, premium, diesel, and E85.

The hard part

Public fuel-price listings are awkward to consume programmatically, and some markets sit behind a cookie banner. Other scraping APIs hand you raw HTML and an invoice for their AI extraction add-on. We ship clean, parsed JSON instead. One flat credit cost, one stable schema.

Gas prices API: what you get

  • All five fuel grades via grade=regular|midgrade|premium|diesel|e85.
  • Structured station data: brand, sub-brand, station_id, address, city, state, price, reporter, freshness.
  • State-level stats: lowest plus average (for grades other than regular, computed from the returned stations).
  • Accepts a 5-digit ZIP, ZIP+4, City, ST (comma optional), City, State, or lat,lng (no separate geocoder call).
  • 10 credits flat. Cache hits 1 credit. Failures don't bill.

Gas prices API use cases

  • Fleet and route costs

    Look up diesel or regular prices for the ZIP codes along a route and pick where to fill up.

  • Price comparison features

    Show nearby stations with brand, address, price and how fresh each reported price is.

  • Regional price tracking

    Store the region_stats lowest and average prices for a state over time.

Gas prices API quickstart: Python, Node and curl

Install the SDK with pip install scrapenest (PyPI) or npm install scrapenest (npm), or send the raw HTTP call with your key in the Authorization: Bearer header. No key yet? Sign up free, verify your email, then create a key in your dashboard.

import os
from scrapenest import Client

client = Client(os.environ["SCRAPENEST_API_KEY"])
res = client.gas_prices("37122", grade="regular", limit=20)
for s in res.stations[:5]:
    print(s.brand, s.address, s.price, s.updated_relative)
if res.region_stats:
    print(res.region_stats.region, res.region_stats.lowest_price, res.region_stats.average_price)

Gas prices API request and response

Request body

{
  "location": "37122",
  "grade": "regular",
  "limit": 20
}

Response JSON

{
  "location": {
    "query": "37122",
    "zip": "37122",
    "city": "Mount Juliet",
    "state": "TN"
  },
  "grade": "regular",
  "stations": [
    {
      "brand": "Kroger",
      "sub_brand": "Kroger Fuel Center",
      "station_id": "21847",
      "address": "401 S Mt Juliet Rd",
      "city": "Mount Juliet",
      "state": "TN",
      "price": 2.79,
      "currency": "USD",
      "unit": "USD/gallon",
      "reporter": "anon_18234",
      "updated_relative": "37 Minutes Ago"
    }
  ],
  "region_stats": {
    "state": "TN",
    "region": "Tennessee",
    "region_type": "state",
    "lowest_price": 2.69,
    "average_price": 2.95
  },
  "source_url": "https://scrapenest.dev",
  "fetched_at": "2026-05-19T14:30:00Z",
  "took_ms": 4823,
  "cache_hit": false,
  "credits_charged": 10
}

Fields with no value are left out of the JSON rather than sent as null, so read optional fields defensively.

Gas prices API pricing

10 credits flat. Cache hits bill at 1 credit. The cache TTL defaults to 10 minutes (prices change slowly); override via cache_ttl_seconds up to 1 hour.

  • Pricing freshness is reporter-driven: stations update every few minutes to several hours. The updated_relative field on each station tells you how stale that specific price is.
  • Stations without a reported price for the requested grade are omitted from the response (the source shows them as - - -).

Plans and pay-as-you-go rates are on the pricing page.

Gas prices API limits

  • location: 2 to 200 characters: a ZIP or ZIP+4, City, ST, City, State, a bare city or lat,lng.
  • limit: 1 to 50 stations, default 20. Listings typically surface about 13.
  • grade: regular (default), midgrade, premium, diesel or e85.
  • Cache: 10 minutes by default, up to 1 hour with cache_ttl_seconds.
  • US locations only. A lookup that returns no stations bills 0 credits.

Gas prices API error codes

HTTPCodeMeaning
422validation_errorThe location can't be resolved to a US place, or grade isn't one of the five.
503upstream_fetch_failedThe price source couldn't be reached. Not billed; retry once with backoff.

Every endpoint can also return 401 unauthorized (missing or wrong key), 402 insufficient_credits (balance used up), 403 email_not_verified (an email signup must verify its address before its key works) and 429 rate_limited or concurrency_limit_exceeded. All errors share one JSON envelope; see the error reference.

questions

Gas prices API FAQ

How do I get gas prices by ZIP code?

POST a 5-digit ZIP as the location and you get back the stations near it with their current per-gallon price, brand, and street address as JSON. The endpoint also accepts ZIP+4, "City, ST", "City, State", and "lat,lng", so you don't need to run a geocoder first.

Is there a free gas prices API?

You can call this one on the free tier: every account starts with 1,000 credits a month and no card, and a gas-price lookup costs 10 credits (1 on a cache hit). That's roughly 100 fresh lookups a month before you pay anything.

Which fuel grades are available?

All five: regular, midgrade, premium, diesel, and E85. Pass the one you want as grade. Stations that haven't reported a price for that grade are left out of the response rather than returned with a null price.

How current are the prices?

Prices are crowd-reported, so freshness varies by station — anywhere from a few minutes to several hours old. Every station carries an updated_relative field so you can see exactly how stale that specific price is and drop anything past your own threshold.

Do I get state or regional averages too?

Yes, when the source publishes them. For regular, region_stats carries the source's regional lowest and average price. The source's regional figures cover regular only, so for other grades they are computed from the returned stations of that grade (with a note saying so) and omitted when none reported a price.

Page updated