← Back to all posts
Fleet Fuel Prices API

Comparing Traffic Data and Fuel Price APIs for Fleet Cost Planning

May 21, 2026 · 8 min read

The cost of moving a truck from A to B is mostly two numbers: the hours it takes and the fuel it burns. Everything else — tolls, driver pay, wear — either tracks those two or is fixed. So when you plan a lane, you are really comparing two cost curves: a delay curve driven by congestion and incidents, and a fuel curve driven by regional pump prices.

Most teams have good data for one and guesswork for the other. Road511 exposes both through the same API, so you can put a dollar figure on a corridor instead of an estimate. This post shows how the two endpoints fit together.

Two Endpoints, Two Cost Drivers

Cost driver Endpoint What it tells you
Delay/eventsActive incidents, construction, and closures on the route — the things that add hours
Fuel/fuel-pricesRegional diesel and gasoline prices — the per-gallon (or per-litre) rate along the route

Both are normalized, both are JSON, and both accept a jurisdiction filter so you can scope a query to exactly the states or provinces a lane passes through.

The Fuel Price API

The /fuel-prices endpoint returns regional pump prices: weekly US state-level data from the EIA and monthly Canadian province-level data from StatCan. For cost planning you almost always want latest=true, which collapses the history to the most recent observation per jurisdiction and fuel grade.

curl "https://api.road511.com/api/v1/fuel-prices\
?country=US&fuel_type=diesel&latest=true&limit=100" \
  -H "X-API-Key: your_key"

That returns the current diesel price for every US state in one call:

{
  "data": [
    {
      "id": 12048,
      "jurisdiction": "CA",
      "country": "US",
      "fuel_type": "diesel",
      "price": 5.21,
      "currency": "USD",
      "unit": "gallon",
      "period_date": "2026-05-18",
      "frequency": "weekly",
      "source": "EIA"
    },
    {
      "id": 12122,
      "jurisdiction": "TX",
      "country": "US",
      "fuel_type": "diesel",
      "price": 3.74,
      "currency": "USD",
      "unit": "gallon",
      "period_date": "2026-05-18",
      "frequency": "weekly",
      "source": "EIA"
    }
  ],
  "total": 51,
  "limit": 100,
  "offset": 0,
  "has_more": false
}

Two things to watch when you build cost math on top of this:

The Traffic Side: Turning Delay Into Dollars

Fuel is the easy half — it is a published rate. Delay is the half teams usually skip, because “there might be traffic” is hard to price. But active incidents and construction are queryable, per jurisdiction, right now:

curl "https://api.road511.com/api/v1/events\
?jurisdiction=IL&event_type=construction,incident&status=active" \
  -H "X-API-Key: your_key"

For a route rather than a whole state, the truck corridor endpoint buffers the path and returns only what intersects it:

curl "https://api.road511.com/api/v1/truck/corridor\
?from_lat=41.88&from_lng=-87.63\
&to_lat=32.78&to_lng=-96.80\
&buffer_km=5" \
  -H "X-API-Key: your_key"

Each event carries a severity and, where the source publishes it, lane-closure detail and an estimated_end_time. You convert that to a cost with a simple model: assign an expected delay to each severity band, multiply by your loaded cost per hour (driver + truck + opportunity), and sum across the corridor.

Putting It Together: A Corridor Cost Estimate

Here is the whole calculation for a Chicago→Dallas run — fuel from the states the lane crosses, plus a delay charge from active events on the corridor:

const KEY = { headers: { 'X-API-Key': 'your_key' } };
const API = 'https://api.road511.com/api/v1';

// 1. Fuel: latest diesel for the states this lane crosses
const states = ['IL', 'MO', 'OK', 'TX'];
const fuelRes = await fetch(
  `${API}/fuel-prices?country=US&fuel_type=diesel&latest=true`, KEY
);
const fuel = (await fuelRes.json()).data
  .filter(r => states.includes(r.jurisdiction));

// average $/gal across the lane, weighted however you like
const avgPrice = fuel.reduce((s, r) => s + r.price, 0) / fuel.length;

const laneMiles = 925;
const mpg = 6.5;
const fuelCost = (laneMiles / mpg) * avgPrice;

// 2. Delay: active events on the corridor
const evRes = await fetch(
  `${API}/truck/corridor?from_lat=41.88&from_lng=-87.63`
  + `&to_lat=32.78&to_lng=-96.80&buffer_km=5`, KEY
);
const events = (await evRes.json()).data;

const DELAY_HOURS = { minor: 0.1, moderate: 0.4, major: 1.2 };
const COST_PER_HOUR = 75;            // driver + truck + opportunity
const delayHours = events.reduce(
  (s, e) => s + (DELAY_HOURS[e.severity] || 0), 0
);
const delayCost = delayHours * COST_PER_HOUR;

console.log({
  fuelCost: fuelCost.toFixed(0),
  delayHours: delayHours.toFixed(1),
  delayCost: delayCost.toFixed(0),
  total: (fuelCost + delayCost).toFixed(0)
});

The output is a number you can compare lane to lane, or day to day:

{ fuelCost: '742', delayHours: '2.3', delayCost: '173', total: '915' }

The delay figure is the part competitors leave out. A lane that looks cheap on fuel can lose its margin to a single major construction zone — and now you can see that before you quote it.

Why Compare, Not Just Route

The point of pulling both numbers is the comparison. With fuel and delay on the same axis you can answer questions a router alone cannot:

Who Uses This

A Note on Data Cadence

Fuel prices are survey data, not a live feed: EIA publishes weekly, StatCan monthly, and Road511 caches for 24 hours since the source refreshes daily at most. Treat them as a stable planning rate, not a real-time spot price. Traffic events, by contrast, are polled continuously — the delay half of the model is current to within minutes. Build your UI so the planner sees both timestamps; they are answering two different questions.

Try It

Put a dollar figure on every lane

Regional fuel prices and live corridor traffic from one API. Free 14-day trial. No credit card.

Get Free API Key Explore the Map