You need to ship a feature this week that shows real gas prices near a ZIP code and, if a user taps a station, returns details like coordinates, hours, and amenities. By the end of this guide, you’ll have a working request in Postman (and code) against the Gas Price Locator API on Zyla API Hub, plus a path to call the same API from an MCP-compatible AI agent.
What the Gas Price Locator API provides
The Gas Price Locator API returns up-to-date gas station prices for a given ZIP code and fuel type. It also provides detailed station metadata (address, coordinates, phone, opening hours, amenities, fuels, and more) when you look up a station by its ID. This is a practical fit for routing apps, delivery dashboards, fleet dashboards, and any consumer app that helps users find cheaper gas nearby.
All calls go through Zyla API Hub: one account, one key, one subscription model. You authenticate with a simple bearer token header. The marketplace hosts more than 10,000 public APIs you can browse at zylalabs.com.
Getting started on Zyla API Hub
Open the API listing for the Gas Price Locator API on Zyla. Click Subscribe (or Start Free Trial where available) to get your API key, then call the endpoints using the Authorization header format shown below. Zyla subscriptions are quota-based (not pay-per-call). For this API, the first subscription tier offers a 7-day trial or 50 requests; there is no Free Plan. Check the API page for current access options and pricing.
When you’re ready to test, sign in and grab your key. If you don’t have an account yet, you can Register in a minute.
Authentication
Use your Zyla key with a bearer token header:
- Header: Authorization: Bearer YOUR_API_KEY
There is no request body for the endpoints covered here. Query parameters are used when required (documented below).
Endpoints you will use
1) Get Prices
Method: GET
URL: https://zylalabs.com/api/4808/gas-price-locator-api/5997/get-prices
Description: Pass a ZIP code and a fuel type to retrieve gas station prices for that area or the closest stations nearby.
Required query parameters:
- zip (number): e.g., 90001
- type (string): e.g., regular
Postman setup
- Method: GET
- URL: https://zylalabs.com/api/4808/gas-price-locator-api/5997/get-prices
- Params: zip=90001, type=regular
- Headers: Authorization: Bearer YOUR_API_KEY
- Send request
Official cURL example
curl -s -X GET "https://zylalabs.com/api/4808/gas-price-locator-api/5997/get-prices?zip=90001&type=regular" \
-H "Authorization: Bearer YOUR_API_KEY"
Official example response
{
"status": "success",
"zip": "77478",
"gas_type": "regular",
"currency": "USD",
"gas_prices": [
{
"average": "$2.60",
"lowest": "$2.07"
},
{
"station": "Shell",
"address": "2995 Dulles Ave Missouri City, TX",
"price": "$2.33"
},
{
"station": "Sam's Club",
"address": "351 SH-6 Sugar Land, TX",
"price": "$2.33"
},
{
"station": "Murphy Express",
"address": "7520 Highway 90 A. Sugar Land, TX",
"price": "$2.36"
},
{
"station": "WB Food Mart",
"address": "13003 W Bellfort Ave Sugar Land, TX",
"price": "$2.38"
},
{
"station": "Shell",
"address": "1750 Williams Trace Blvd Sugar Land, TX",
"price": "$2.39"
},
{
"station": "Valero & Circle K",
"address": "13445 W Airport Blvd Sugar Land, TX",
"price": "$2.59"
},
{
"station": "Chevron",
"address": "13811 SW Fwy Sugar Land, TX",
"price": "$2.69"
},
{
"station": "Texaco",
"address": "7800 US-90 A Sugar Land, TX",
"price": "$2.69"
},
{
"station": "Exxon",
"address": "1740 Dulles Ave Sugar Land, TX",
"price": "$2.79"
},
{
"station": "Shell",
"address": "13747 SW Fwy Sugar Land, TX",
"price": "$2.79"
}
]
}
What fields you’ll actually use
- status: string to confirm success.
- zip: the ZIP code used in the lookup.
- gas_type: the requested fuel type.
- currency: currency for prices (USD in the sample).
- gas_prices: array that may start with an aggregate object (average, lowest), followed by station-level entries with station, address, price.
Practical notes:
- Prices are currency-formatted strings (e.g., “$2.33”), not raw numbers. If you need numeric values, strip currency symbols before calculations.
- Units are dollars per gallon when the data source indicates this (see Station Data for unit context).
- The array may combine aggregate stats and station rows. Your parser should handle both shapes gracefully.
2) Station Data
Method: GET
URL: https://zylalabs.com/api/4808/gas-price-locator-api/23308/station-data
Description: Returns detailed data for a station. You must specify a station ID. You can obtain the ID from the Get Prices endpoint.
Parameters: The listing instructs you to specify a station ID, but does not document the parameter keys. Callers should refer to the API page for how to provide the station ID when invoking this endpoint. Do not invent parameter names; send only the Authorization header until you have the exact documented param format in your account’s console or docs.
Official cURL example
Official example response
What fields you’ll actually use
- data.station_id, data.name: identify the station.
- data.address.*: renderable lines and city/state/ZIP for UI and geocoding fallbacks.
- data.coordinates.lat/lng: precise map placement.
- data.open_status, data.opening_hours: show whether it’s open and typical hours.
- data.rating.overall, data.rating.count: render stars and review counts.
- data.currency, data.price_unit: display units correctly (dollars_per_gallon).
- data.fuels: filter or badge supported fuel types.
- data.amenities: surface useful features (e.g., Pay At Pump, ATM).
- data.nearby_station_ids: chain requests to suggest alternatives.
Copy-paste code: Python example for Get Prices
This example calls the Get Prices endpoint with the documented query parameters and parses both the aggregate and station entries. Replace YOUR_API_KEY before running.
import os
import requests
API_KEY = os.getenv("ZYLALABS_API_KEY", "YOUR_API_KEY")
url = "https://zylalabs.com/api/4808/gas-price-locator-api/5997/get-prices"
params = {
"zip": "90001",
"type": "regular"
}
headers = {
"Authorization": f"Bearer {API_KEY}"
}
resp = requests.get(url, params=params, headers=headers, timeout=20)
resp.raise_for_status()
data = resp.json()
if data.get("status") != "success":
raise SystemExit(f"API returned non-success: {data}")
print(f"ZIP: {data.get('zip')} | Fuel: {data.get('gas_type')} | Currency: {data.get('currency')}")
stations = []
for entry in data.get("gas_prices", []):
if "station" in entry:
stations.append({
"station": entry.get("station"),
"address": entry.get("address"),
"price": entry.get("price")
})
else:
# Aggregate row (e.g., average/lowest)
avg = entry.get("average")
low = entry.get("lowest")
if avg or low:
print(f"Aggregate: average={avg}, lowest={low}")
print("Top stations:")
for s in stations[:5]:
print(f"- {s['station']} | {s['price']} | {s['address']}")
Testing with Postman quickly
If you prefer Postman to cURL while exploring, here’s a quick path to a green run:
- Create a new GET request tab.
- Set the URL to https://zylalabs.com/api/4808/gas-price-locator-api/5997/get-prices.
- Open the Params tab and add:
- zip = 90001
- type = regular
- Open the Headers tab and add:
- Authorization = Bearer YOUR_API_KEY
- Send the request and confirm a 200 OK with the JSON response shown above.
Next, set up a second GET tab pointing to https://zylalabs.com/api/4808/gas-price-locator-api/23308/station-data and include the same Authorization header. The listing notes you must specify a station ID for this endpoint; consult your Zyla console/docs for the exact parameter format when you’re ready to fetch a specific station by ID.
Real-world implementation notes
- Units and currency: The Station Data endpoint explicitly reports currency and price_unit as dollars_per_gallon. Treat prices from Get Prices as currency strings; format them consistently if you mix data sources in your app.
- Parsing the gas_prices list: Your code should anticipate that the first one or two entries might be aggregate rows (average, lowest), followed by per-station rows with station, address, price.
- Cache strategy: Cache successful responses by (zip, type) to reduce repeated fetches. A short TTL (e.g., 5–15 minutes) is usually sensible for fuel prices; adjust per your UX needs.
- Graceful fallbacks: If a station’s granular info isn’t present on Get Prices, use Station Data (with the station ID) to enrich coordinates, hours, amenities, and nearby suggestions.
- Quotas: Zyla plans are subscription + quota based, not pay-per-call. The first tier here is a 7-day trial or 50 requests. Watch your usage and batch calls where possible.
Calling the API from an AI agent via MCP
If you’re using an MCP-compatible client (Claude Code, Cursor, Windsurf, and others), you can route calls through Zyla’s MCP endpoint. Point your agent tooling at:
Provide your Zyla API key where your MCP client expects it (the endpoint accepts an apikey query parameter; follow your MCP client’s configuration for secrets). Within the agent, invoke the Gas Price Locator API endpoints exactly as shown above (including the Authorization: Bearer YOUR_API_KEY header and the documented query parameters for Get Prices). Keep the same Hub URLs:
- Get Prices: https://zylalabs.com/api/4808/gas-price-locator-api/5997/get-prices
- Station Data: https://zylalabs.com/api/4808/gas-price-locator-api/23308/station-data
This allows your agent to fetch gas prices and then drill into station details inside your coding environment without leaving the editor.
Common use cases you can ship this week
- “Find cheap gas near me” widget: On page load, grab the user’s ZIP and fuel type, call Get Prices, and render the top five lowest prices with addresses.
- Map overlay for drivers: Use Get Prices to list candidates, then call Station Data for the selected station to pin precise coordinates and display amenities and hours.
- Fuel budgeting feature: Parse the aggregate “average” and “lowest” rows to estimate trip fuel costs and potential savings by station.
- Alternate suggestions: Use nearby_station_ids from Station Data to suggest backups if a station is busy or temporarily closed.
Where to find this API and your account
Browse the Gas Price Locator API on Zyla: Gas Price Locator API. You can also explore more than 10,000 public APIs on zylalabs.com and test them with the same key and subscription framework.
FAQ
How do I authenticate?
Include the header Authorization: Bearer YOUR_API_KEY for every request.
What parameters are required for Get Prices?
zip (number) and type (string). Example: zip=90001 and type=regular.
How do I get station details like coordinates and amenities?
Use the Station Data endpoint. You must specify a station ID. Obtain the ID from Get Prices, then call Station Data as documented on the API page.
What are the pricing and limits?
Zyla uses subscription + quota, not pay-per-call. For this API, the first tier is a 7-day trial or 50 requests and there is no Free Plan. Check the API page for current plans.
Can I call this API from an AI coding agent?
Yes. Use Zyla’s MCP endpoint in your MCP-compatible client, configure your API key, and call the same Hub URLs shown above.
Ready to test with your own key in Postman and ship the integration? Create your account now: Register, subscribe to the Gas Price Locator API, and make your first request within minutes.