Home → Blog

You need a reliable, developer-friendly way to programmatically fetch the EIA Rocky Mountain diesel price so you can compute surcharges, quote budgets, or reconcile fuel exposure. By the end of this guide, you’ll be able to call the FreightPulse API, extract the Rocky Mountain Diesel value, and wire it into your Finance pipeline with clear handling for units, timestamps, authentication, and caching.

What you’ll build: stable access to the Rocky Mountain Diesel metric

This guide focuses on the EIA Rocky Mountain Diesel metric as delivered by FreightPulse. You’ll pull a recent value, verify metadata (currency, unit, timestamp), and structure a simple calculation flow that’s safe for Finance use-cases such as budgeting, accruals, or fuel-indexed surcharges. The examples stick to exactly the endpoints, headers, and fields documented below—no substitutions.

Illustration: Rocky Mountain Diesel Price API

Key facts you must know before integrating

Authentication and request limits

Include your API key via the X-API-Key header. If you don’t have a key yet, you can still make up to 100 requests per day per IP address as a guest. For production Finance workloads or automation that could exceed that guest limit, create a key after you sign up.

Use this link to start: Register. For endpoint reference and field definitions, see: Documentation.

Quickstart: cURL you can paste and run

The following is the official request you can paste into your terminal. It calls the historical path for the Rocky Mountain fuel metric and returns a Finance-friendly envelope with currency, unit, timestamp, and regional diesel values, including rocky_mountain.

Live FreightPulse /api/v1/fuel-prices.
Source: live

cURL:

curl -H "X-API-Key: YOUR_API_KEY" "https://freightpulsehq.com/api/v1/historical?metric=fuel_price_diesel_rocky_mountain&period=30d"

Official JSON response (verbatim) and what to read

JSON:

{
"success": true,
"data": {
"timestamp": "2026-10-04T00:00:22+00:00",
"source": "EIA (U.S. Energy Information Administration)",
"currency": "USD",
"unit": "gallon",
"data": {
"diesel": {
"national_average": 6.382,
"change_week": -0.147,
"change_percent": -2.25,
"updated_at": "2026-09-28",
"regions": {
"east_coast": 6.137,
"midwest": 6.526,
"gulf_coast": 5.955,
"rocky_mountain": 6.407,
"west_coast": 7.357,
"california": 8.181
}
},
"gasoline": {
"national_average": 4.465,
"change_week": -0.013,
"change_percent": -0.29,
"updated_at": "2026-09-28",
"grades": {
"regular": 4.465,
"midgrade": 5.073,
"premium": 5.482
}
},
"bunker_fuel": {
"available": false,
"note": "No known free source (Rotterdam/Singapore/Houston) — requires a paid provider (e.g. Ship & Bunker, Argus)."
}
},
"historical": {
"diesel_30d_avg": 6.291,
"diesel_90d_avg": 5.561,
"diesel_yoy_change": 72,
"gasoline_30d_avg": 4.355,
"gasoline_90d_avg": 4.111,
"gasoline_yoy_change": 42.9
}
},
"meta": {
"request_id": "0282bc84-c17f-436d-8623-ec1ed2f8cf76"
}
}

Fields you’ll actually use for Finance workflows:

Important: There is no official historical series published for fuel_price_diesel_rocky_mountain in this context. The response above provides current regional values and some aggregate history, but not a series[] array. If your Finance logic needs a time series, use the provided aggregates or cache successive responses over time in your own datastore.

Python example: fetch and compute a simple index adjustment

This example reads the Rocky Mountain value from the response and demonstrates a minimal surcharge computation. Replace YOUR_API_KEY with your key or run within the guest limit (100 requests/day per IP). Do not treat this as a quote for a freight-rate fare; it’s a fuel index calculation example only.

import os
import requests
from decimal import Decimal, ROUND_HALF_UP

API_URL = "https://freightpulsehq.com/api/v1/historical"
PARAMS = {
"metric": "fuel_price_diesel_rocky_mountain",
"period": "30d"
}
HEADERS = {
"X-API-Key": os.getenv("FREIGHTPULSE_API_KEY", "YOUR_API_KEY")
}

def fetch_rocky_mountain_diesel():
r = requests.get(API_URL, params=PARAMS, headers=HEADERS, timeout=20)
r.raise_for_status()
payload = r.json()
if not payload.get("success"):
raise RuntimeError("API returned success=false")
data = payload["data"]
currency = data.get("currency")
unit = data.get("unit")
updated_at = data.get("data", {}).get("diesel", {}).get("updated_at")
rocky_val = data.get("data", {}).get("diesel", {}).get("regions", {}).get("rocky_mountain")
ts = data.get("timestamp")
return {
"timestamp": ts,
"currency": currency,
"unit": unit,
"updated_at": updated_at,
"rocky_mountain": rocky_val
}

def compute_surcharge(diesel_price_usd_per_gal, base_threshold=Decimal("3.00"), factor_per_gal=Decimal("0.05")):
if diesel_price_usd_per_gal is None:
return None
price = Decimal(str(diesel_price_usd_per_gal))
delta = (price - base_threshold)
if delta < Decimal("0"):
delta = Decimal("0")
surcharge = (delta * factor_per_gal).quantize(Decimal("0.0001"), rounding=ROUND_HALF_UP)
return surcharge

if __name__ == "__main__":
info = fetch_rocky_mountain_diesel()
rocky = info["rocky_mountain"]
# Example Finance math: translate a per-gallon delta into a surcharge index
surcharge_idx = compute_surcharge(rocky)
print("Timestamp:", info["timestamp"])
print("EIA updated_at:", info["updated_at"])
print("Currency/Unit:", info["currency"], "/", info["unit"])
print("Rocky Mountain Diesel (USD/gal):", rocky)
print("Computed surcharge index:", surcharge_idx)

How to interpret units, currency, and timestamps

Prices are in USD and expressed per gallon (unit = gallon). The payload timestamp is ISO 8601 with a +00:00 offset, which is straightforward to parse and store as UTC. The EIA “updated_at” date indicates the most recent update date present in the “diesel” block.

For downstream Finance calculations, pick a consistent precision and rounding mode (for example, 4 decimal places, half-up) and document it in your GL or pricing policy. The example uses Decimal to avoid binary float drift in USD calculations.

Data availability and what “historical” provides

While the cURL path includes “historical”, there is no official historical time series for fuel_price_diesel_rocky_mountain provided as a series[] array here. The response includes:

If your Finance workflow needs line-by-line daily or weekly ticks, you can snapshot this response at your own cadence and create a private series, tagging each record by data.timestamp and diesel.updated_at. In reporting, avoid implying these aggregates are a day-by-day series.

Caching, update cadence, and retries

Because the response cites EIA as the source, you should use diesel.updated_at to bound your cache TTL. A practical approach is:

Implement standard retry logic (e.g., exponential backoff on 429/5xx). For batch Finance jobs, schedule pulls ahead of your computation windows, and surface both updated_at and the numeric value in logs so reconciliation is easy.

Port congestion and related signals

If your Finance team models inland fuel costs alongside ocean supply chain conditions, remember that FreightPulse port congestion uses IMF PortWatch data that is lagged approximately 6–7 days and measured as a 7-day average versus a 90-day baseline. It is not live AIS vessel wait time. Keep that lag in mind when correlating congestion metrics with diesel price impacts in budgets or accrual models.

Do not misstate “today’s price” or a fare

Per the catalog facts: do not quote a freight-rates USD fare as today’s price. The Rocky Mountain value you read from the API is a fuel index reference in USD per gallon; use it appropriately for Finance calculations like surcharges or scenario analysis. If your stakeholders need a contemporaneous number in dashboards, label it clearly with updated_at and the EIA source.

Integration patterns for Finance teams

1) Budget indexing

Store rocky_mountain and updated_at in a table keyed by fiscal period. Drive a rolling budget line that multiplies forecast gallons by the indexed price delta from a baseline threshold. Include diesel_30d_avg for smoothing when volatility is high.

2) Accruals and true-up

At period close, lock the rocky_mountain value as of the latest available updated_at. When the next update arrives, compute the delta-based true-up. Keep both values and timestamps in your audit trail to explain changes.

3) Surcharge calculation

Apply a documented formula against the Rocky Mountain value and round per your billing policy. Use currency=USD and unit=gallon from the payload for unambiguous calculations and disclosure lines on invoices.

Error handling and observability

Security and key management

Pass X-API-Key over HTTPS only. In CI/CD and production, inject the key via environment variables and scope access to least privilege on the host. Avoid baking keys into client-side code paths. For guest usage without a key, keep a counter and throttle your own calls to remain under 100 requests/day per IP.

Production checklist

Troubleshooting

FAQ

Q: Do I need an API key?
A: You can start without one, but guest access is limited to 100 requests per day per IP. For production Finance jobs or dashboards, use an API key in X-API-Key.

Q: What units and currency are the Rocky Mountain diesel prices in?
A: USD per gallon, as indicated by currency = USD and unit = gallon in the response.

Q: Where does the data come from?
A: The source field states EIA (U.S. Energy Information Administration).

Q: Is there an official historical series array I can iterate?
A: No. There is no official series[] for fuel_price_diesel_rocky_mountain here. Use the provided aggregates (e.g., diesel_30d_avg) or build your own time series by snapshotting responses over time.

Q: Are port congestion metrics live?
A: No. FreightPulse congestion uses IMF PortWatch, lagged ~6–7 days (7-day average vs a 90-day baseline), not live AIS wait times.

Ready to wire the Rocky Mountain Diesel metric into your Finance stack? Create your account and get an API key at Register, then review all available fields and integration notes in the Documentation.