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).
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)
import { ScrapeNest } from "scrapenest";
const client = new ScrapeNest({ apiKey: process.env.SCRAPENEST_API_KEY });
const res = await client.gasPrices({ location: "37122", grade: "regular", limit: 20 });
for (const s of res.stations.slice(0, 5)) console.log(s.brand, s.address, s.price, s.updated_relative);
if (res.region_stats) console.log(res.region_stats.region, res.region_stats.average_price);
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
HTTP
Code
Meaning
422
validation_error
The location can't be resolved to a US place, or grade isn't one of the five.
503
upstream_fetch_failed
The 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.