Gas Prices API: Live Per-Station Fuel Prices to Structured JSON
Use the Apify Fuel Prices Scraper as a gas prices API. One call takes a US ZIP code, city, or GPS coordinates plus a fuel type and returns one flat row per station: name, full address, ratings, cash price, credit price, and the timestamp each price was last posted.
When to use this skill
- The user wants a gas prices API or fuel prices API for an app, script, or pipeline.
- They want gas prices by ZIP code, city, or coordinates as JSON or CSV.
- They want real time per-station prices for a specific fuel: Regular, Midgrade, Premium, Diesel, E85, or Unleaded88.
- They ask to "get gas price data", "pull fuel prices", or "export gas station prices".
Not for: historical price series (live prices only), national or state averages (per-station only), or station amenities such as phone, hours, or websites (not in the output).
What you get (one row per station)
id, name, priceUnit (dollars_per_gallon), starRating, ratingsCount, address_line1, address_line2, address_locality, address_region, address_postalCode, price_cash, price_cash_postedTime, price_credit, price_credit_postedTime, and distance (returned null on ZIP searches in testing, so do not rely on it). Prices of 0 or null with a null postedTime mean the station has no recent report for that payment type.
Prerequisites
The Actor
Run it with the Apify CLI
Regular gas prices for a ZIP code:
apify actors call "johnvc/fuelprices" -i '{"search":"11507","fuel":1}' \
--json \
--user-agent apify-awesome-skills/apify-gas-prices-api \
2>/dev/null
Diesel prices near GPS coordinates, fresh within two days:
apify actors call "johnvc/fuelprices" -i '{"search":"36.0816642, -115.0534345","fuel":4,"maxAge":2}' \
--json \
--user-agent apify-awesome-skills/apify-gas-prices-api \
2>/dev/null
Every call carries the three flags this repo expects: --json, --user-agent apify-awesome-skills/apify-gas-prices-api, and 2>/dev/null.
Run it from Claude or another AI agent (MCP)
The Actor is MCP-ready. Add the hosted server URL:
https://mcp.apify.com/?tools=actors,docs,johnvc/fuelprices
Then ask, for example: "Get diesel prices by ZIP code 75201 and export the stations as CSV." MCP setup docs: https://docs.apify.com/platform/integrations/mcp
Workflow
- Build the location.
search is the only required field: a ZIP code, a city name, or GPS coordinates pasted as "lat, lon". Coverage is primarily the United States, with some Canadian locations.
- Pick the fuel.
fuel is an integer code: 1 Regular (default), 2 Midgrade, 3 Premium, 4 Diesel, 5 E85, 12 Unleaded88.
- Bound freshness if needed.
maxAge in days drops stations whose prices are older; 0 (default) returns all.
- Run the Actor and read the dataset. One flat row per station; no pagination needed.
- Clean and deliver. Treat 0 or null prices as no data, dedupe across runs on
id, and hand back JSON or CSV. The run also writes a CSV file to the run's storage (output_file names it).
Inputs
search (string, required): ZIP code, city name, or "lat, lon" GPS coordinates
fuel (integer, default 1): 1 Regular, 2 Midgrade, 3 Premium, 4 Diesel, 5 E85, 12 Unleaded88
maxAge (integer, days, default 0): drop stations with prices older than this; 0 = no limit
lang (string, default "en"): only English is supported
output_file (string): optional CSV filename for the copy written to run storage, must end in .csv
Cost
Billing is per station row returned. One location lookup returns a handful to a few dozen rows, so a single call usually costs a cent or two. Estimate first for bulk sweeps across many locations; live prices and thresholds are in references/gotchas.md.
Honest limits
- Live prices only:
price_cash_postedTime and price_credit_postedTime are last-report timestamps, not a history. No historical series.
- Per-station data only: no national, state, or city averages. Compute aggregates yourself from the rows.
- No brand filter input, and no phone, website, hours, or latitude/longitude fields in the output.
- Cash and credit prices report independently; either can be 0 or null when no one has posted it recently.
- Coverage is US-first with some Canadian locations; small or rural areas can return few rows.
Troubleshooting
- Empty dataset: the location did not resolve; try a ZIP code instead of a town name, or a nearby larger city.
- Rows with 0 or null prices: no recent report for that station and payment type; set
maxAge (for example 2) to keep only fresh prices.
- Fewer stations than expected: normal for less common fuels such as E85 (5) or Unleaded88 (12); those networks are sparse.
See references/gotchas.md for cost guardrails and error recovery, and references/actor-index.md for the Actor routing table.
Related location-data Actors
1---2name: apify-gas-prices-api3description: Turn live US fuel prices into a gas prices API with the Apify Fuel Prices Scraper Actor (johnvc/fuelprices). Give a ZIP code, city, or GPS coordinates plus a fuel type (Regular, Midgrade, Premium, Diesel, E85, Unleaded88) and get one row per station with name, address, starRating, ratingsCount, cash and credit prices, and the time each price was posted. Use when the user wants a gas prices api, fuel prices api, gas price api, gas prices by zip code, real time gas prices as JSON or CSV, gas price data for an app or pipeline, or per-station fuel price extraction. Pay-per-result billing, MCP-ready for Claude and other AI agents.4license: MIT5---67# Gas Prices API: Live Per-Station Fuel Prices to Structured JSON89Use the Apify Fuel Prices Scraper as a gas prices API. One call takes a US ZIP code, city, or GPS coordinates plus a fuel type and returns one flat row per station: name, full address, ratings, cash price, credit price, and the timestamp each price was last posted.1011## When to use this skill1213- The user wants a gas prices API or fuel prices API for an app, script, or pipeline.14- They want gas prices by ZIP code, city, or coordinates as JSON or CSV.15- They want real time per-station prices for a specific fuel: Regular, Midgrade, Premium, Diesel, E85, or Unleaded88.16- They ask to "get gas price data", "pull fuel prices", or "export gas station prices".1718Not for: historical price series (live prices only), national or state averages (per-station only), or station amenities such as phone, hours, or websites (not in the output).1920## What you get (one row per station)2122`id`, `name`, `priceUnit` (dollars_per_gallon), `starRating`, `ratingsCount`, `address_line1`, `address_line2`, `address_locality`, `address_region`, `address_postalCode`, `price_cash`, `price_cash_postedTime`, `price_credit`, `price_credit_postedTime`, and `distance` (returned null on ZIP searches in testing, so do not rely on it). Prices of 0 or null with a null postedTime mean the station has no recent report for that payment type.2324## Prerequisites2526- Apify account (sign up at https://apify.com?fpr=9n7kx3&fp_sid=skillrepo).27- Authentication via `apify login`, or an `APIFY_TOKEN` environment variable (Apify Console, Settings, Integrations).2829## The Actor3031- Store page: https://apify.com/johnvc/fuelprices?fpr=9n7kx3&fp_sid=skillrepo32- Actor ID: `johnvc/fuelprices`33- Pricing: pay per station result returned (see `references/gotchas.md`).3435## Run it with the Apify CLI3637Regular gas prices for a ZIP code:3839```bash40apify actors call "johnvc/fuelprices" -i '{"search":"11507","fuel":1}' \41 --json \42 --user-agent apify-awesome-skills/apify-gas-prices-api \43 2>/dev/null44```4546Diesel prices near GPS coordinates, fresh within two days:4748```bash49apify actors call "johnvc/fuelprices" -i '{"search":"36.0816642, -115.0534345","fuel":4,"maxAge":2}' \50 --json \51 --user-agent apify-awesome-skills/apify-gas-prices-api \52 2>/dev/null53```5455Every call carries the three flags this repo expects: `--json`, `--user-agent apify-awesome-skills/apify-gas-prices-api`, and `2>/dev/null`.5657## Run it from Claude or another AI agent (MCP)5859The Actor is MCP-ready. Add the hosted server URL:6061`https://mcp.apify.com/?tools=actors,docs,johnvc/fuelprices`6263Then ask, for example: "Get diesel prices by ZIP code 75201 and export the stations as CSV." MCP setup docs: https://docs.apify.com/platform/integrations/mcp6465## Workflow66671. Build the location. `search` is the only required field: a ZIP code, a city name, or GPS coordinates pasted as "lat, lon". Coverage is primarily the United States, with some Canadian locations.682. Pick the fuel. `fuel` is an integer code: 1 Regular (default), 2 Midgrade, 3 Premium, 4 Diesel, 5 E85, 12 Unleaded88.693. Bound freshness if needed. `maxAge` in days drops stations whose prices are older; 0 (default) returns all.704. Run the Actor and read the dataset. One flat row per station; no pagination needed.715. Clean and deliver. Treat 0 or null prices as no data, dedupe across runs on `id`, and hand back JSON or CSV. The run also writes a CSV file to the run's storage (`output_file` names it).7273## Inputs7475- `search` (string, required): ZIP code, city name, or "lat, lon" GPS coordinates76- `fuel` (integer, default 1): 1 Regular, 2 Midgrade, 3 Premium, 4 Diesel, 5 E85, 12 Unleaded8877- `maxAge` (integer, days, default 0): drop stations with prices older than this; 0 = no limit78- `lang` (string, default "en"): only English is supported79- `output_file` (string): optional CSV filename for the copy written to run storage, must end in `.csv`8081## Cost8283Billing is per station row returned. One location lookup returns a handful to a few dozen rows, so a single call usually costs a cent or two. Estimate first for bulk sweeps across many locations; live prices and thresholds are in `references/gotchas.md`.8485## Honest limits8687- Live prices only: `price_cash_postedTime` and `price_credit_postedTime` are last-report timestamps, not a history. No historical series.88- Per-station data only: no national, state, or city averages. Compute aggregates yourself from the rows.89- No brand filter input, and no phone, website, hours, or latitude/longitude fields in the output.90- Cash and credit prices report independently; either can be 0 or null when no one has posted it recently.91- Coverage is US-first with some Canadian locations; small or rural areas can return few rows.9293## Troubleshooting9495- Empty dataset: the location did not resolve; try a ZIP code instead of a town name, or a nearby larger city.96- Rows with 0 or null prices: no recent report for that station and payment type; set `maxAge` (for example 2) to keep only fresh prices.97- Fewer stations than expected: normal for less common fuels such as E85 (5) or Unleaded88 (12); those networks are sparse.9899See `references/gotchas.md` for cost guardrails and error recovery, and `references/actor-index.md` for the Actor routing table.100101## Related location-data Actors102103- Google Maps Places API, station phone, hours, and websites: https://apify.com/johnvc/google-maps-places-api?fpr=9n7kx3&fp_sid=skillrepo104- Google Maps Directions API, routes and drive times between stations: https://apify.com/johnvc/google-maps-directions-api?fpr=9n7kx3&fp_sid=skillrepo