fueleconomy.gov API
www.fueleconomy.gov · Government
Official US EPA/DOE fuel economy data — MPG ratings, CO2 emissions, and annual fuel costs for every vehicle since 1984. Free, no API key required.
Authentication
Sample Requests
Get all vehicle makes for a given model year.
Hover any highlighted part to learn what it does
| Accept | application/json |
curl -X GET "https://www.fueleconomy.gov/ws/rest/vehicle/menu/make?year=2023" \ -H "Accept: application/json"
import requests
params = {
"year": "2023"
}
headers = {
"Accept": "application/json"
}
response = requests.get(
"https://www.fueleconomy.gov/ws/rest/vehicle/menu/make",
params=params,
headers=headers,
)
print(response.json())const url = new URL('https://www.fueleconomy.gov/ws/rest/vehicle/menu/make');
url.searchParams.set('year', '2023');
const response = await fetch(url, {
headers: {
'Accept': 'application/json'
},
});
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://www.fueleconomy.gov/ws/rest/vehicle/menu/make")
q := baseURL.Query()
q.Set("year", "2023")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
req.Header.Set("Accept", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://www.fueleconomy.gov/ws/rest/vehicle/menu/make")
uri.query = URI.encode_www_form({
"year" => "2023"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
req["Accept"] = "application/json"
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://www.fueleconomy.gov/ws/rest/vehicle/menu/make?" . http_build_query([
"year" => "2023"
]);
$opts = ["http" => [
"method" => "GET",
"header" => implode("\r\n", [
"Accept: application/json"
]),
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Get full fuel economy data for a specific vehicle ID.
Hover any highlighted part to learn what it does
| Accept | application/json |
curl -X GET "https://www.fueleconomy.gov/ws/rest/vehicle/48015/attributes" \ -H "Accept: application/json"
import requests
headers = {
"Accept": "application/json"
}
response = requests.get(
"https://www.fueleconomy.gov/ws/rest/vehicle/48015/attributes",
headers=headers,
)
print(response.json())const url = 'https://www.fueleconomy.gov/ws/rest/vehicle/48015/attributes';
const response = await fetch(url, {
headers: {
'Accept': 'application/json'
},
});
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
)
func main() {
targetURL := "https://www.fueleconomy.gov/ws/rest/vehicle/48015/attributes"
req, _ := http.NewRequest("GET", targetURL, nil)
req.Header.Set("Accept", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://www.fueleconomy.gov/ws/rest/vehicle/48015/attributes")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
req["Accept"] = "application/json"
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://www.fueleconomy.gov/ws/rest/vehicle/48015/attributes";
$opts = ["http" => [
"method" => "GET",
"header" => implode("\r\n", [
"Accept: application/json"
]),
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- No API key needed
- Set Accept: application/json header for JSON (default is XML)
- Step 1: Get makes — GET /vehicle/menu/make?year=2023
- Step 2: Get models — GET /vehicle/menu/model?year=2023&make=Toyota
- Step 3: Get vehicle IDs — GET /vehicle/menu/options?year=2023&make=Toyota&model=Camry
- Step 4: Get MPG — GET /vehicle/{id}/attributes
What can you build with fueleconomy.gov API?
fueleconomy.gov API is a Government API. Developers commonly use government APIs for:
- surfacing public datasets in citizen-facing apps
- building transparency and civic engagement tools
- accessing legislation, court records, and official data
- powering research and journalism tools
- creating compliance and regulatory monitoring dashboards
No authentication required. This API is open — no signup or key needed. Ideal for quick prototypes and public-facing features. fueleconomy.gov API is free to use, making it a low-risk choice to experiment with.
New to APIs? Read our beginner's guide