FuelEconomy.gov API Guide: Pull MPG and Cost Data
- Use menu endpoints to get years, makes, models, and vehicle options (IDs).
- Use a vehicle ID endpoint to fetch detailed data for that specific configuration.
- If you prefer bulk offline work, FuelEconomy.gov also offers CSV downloads.
What We Know (Sourced)
FuelEconomy.gov provides a "Vehicle Menu Items and XML Web Service Documentation" page describing how its web services are organized. The site also exposes REST-style endpoints that return XML for menu items (year, make, model, options) and for individual vehicle data.
FuelEconomy.gov also offers downloadable datasets (CSV) that may be easier than calling the web services repeatedly if you need bulk data.
A Simple End-to-End Workflow
The web service menu pattern is simple:
- Get available years.
- Pick a year, then get makes.
- Pick a make, then get models.
- Pick a model, then get options (vehicle IDs).
- Fetch the vehicle details for a specific ID.
For consumers, this is the same concept as shopping through vehicle menus — you're just doing it via XML endpoints instead of clicking.
Example Endpoints (Verified)
These endpoints are live and return XML:
https://www.fueleconomy.gov/ws/rest/vehicle/menu/yearhttps://www.fueleconomy.gov/ws/rest/vehicle/menu/make?year=2024https://www.fueleconomy.gov/ws/rest/vehicle/menu/model?year=2024&make=Toyotahttps://www.fueleconomy.gov/ws/rest/vehicle/menu/options?year=2024&make=Toyota&model=Camryhttps://www.fueleconomy.gov/ws/rest/vehicle/40867(example vehicle ID)
If you're turning this into a fuel-cost tool, you'll typically compute cost per mile once you have MPG (or MPGe/kWh fields). Related: cost per mile and EV charging cost per mile.
What's Next
- Bulk project? Download CSVs and work locally. Related: FuelEconomy.gov downloads.
- App or script? Use the menu workflow above and cache responses so you don't call the endpoints unnecessarily.
- Publishing comparisons? Explain assumptions and prefer cost-per-mile outputs over MPG-only rankings.
Frequently Asked Questions
Is this a JSON API?
FuelEconomy.gov refers to XML web services and the endpoints above return XML. If you need JSON, you can typically convert XML to JSON in your application code.
Should I use web services or CSV downloads?
Use CSV downloads for offline/bulk analysis. Use web services for interactive tools and live lookups.
How do I avoid keyword cannibalization in a content pipeline?
Use the API content for technical intent (developers) and keep consumer intent separate (label and shopping explainers). For consumer intent, link to hub posts like how to use FuelEconomy.gov.
Sources & References
- FuelEconomy.gov (DOE) — Vehicle Menu Items and XML Web Service Documentation
- FuelEconomy.gov (DOE) — Web service example: menu year (XML)
- FuelEconomy.gov (DOE) — Web service example: menu options (XML)
- FuelEconomy.gov (DOE) — Web service example: vehicle details (XML)
- FuelEconomy.gov (DOE) — Download Fuel Economy Data