API Documentation
Complete reference for the Fuel Data Lab API
1. Get the latest diesel price:
curl "https://fueldatalab.com/api/v1/prices/latest?product=diesel&geo_type=national" \ -H "Authorization: Bearer YOUR_API_KEY"
2. Response:
{
"product": "diesel",
"geo_type": "national",
"geo_code": "US",
"period": "2024-12-21",
"value": 3.578,
"unit": "dollars_per_gallon",
"delta_1w": -0.024
}All endpoints require a valid API key in the Authorization header:
Authorization: Bearer fsk_xxxxxxxxxxxxxxxxxxxx
Security: Keep your API keys secret. Never expose them in client-side code.
Three tiers based on usage needs:
1 unit = 1 API call. Returns 429 when exhausted.
Success:
{
"data": { ... },
"meta": {
"count": 52,
"limit": 100
}
}Error:
{
"error": "Description",
"code": "ERROR_CODE"
}/api/v1/catalogList all available products, geographies, and canonical series.
curl "https://fueldatalab.com/api/v1/catalog" -H "Authorization: Bearer YOUR_KEY"
/api/v1/seriesQuery fuel series by product, geography.
product,geo_type,geo_code,canonical=1curl "https://fueldatalab.com/api/v1/series?product=diesel&geo_type=national&canonical=1" \ -H "Authorization: Bearer YOUR_KEY"
/api/v1/prices/latestGet the most recent price for a product/region.
product,geo_type,geo_codecurl "https://fueldatalab.com/api/v1/prices/latest?product=diesel&geo_type=national" \ -H "Authorization: Bearer YOUR_KEY"
/api/v1/pricesGet price history for a specific series.
series_id (required),start,end,limitcurl "https://fueldatalab.com/api/v1/prices?series_id=UUID&limit=52" \ -H "Authorization: Bearer YOUR_KEY"
/api/v1/prices/seriesGet price history by product/geo instead of series_id.
/api/v1/metricsGet computed metrics (deltas, volatility, percentiles).
series_id (required),period,metrics (comma-separated)curl "https://fueldatalab.com/api/v1/metrics?series_id=UUID&metrics=delta_1w,volatility_12w" \ -H "Authorization: Bearer YOUR_KEY"
/api/v1/regimeGet current regime classification (stable, rising, falling, volatile, shocked).
curl "https://fueldatalab.com/api/v1/regime?series_id=UUID" -H "Authorization: Bearer YOUR_KEY"
/api/v1/stressGet stress score (0-100) with component breakdown.
curl "https://fueldatalab.com/api/v1/stress?series_id=UUID" -H "Authorization: Bearer YOUR_KEY"
/api/v1/shapeGet detected price movement pattern (trend, spike, oscillation, etc.).
curl "https://fueldatalab.com/api/v1/shape?series_id=UUID" -H "Authorization: Bearer YOUR_KEY"
/api/v1/surpriseGet surprise score for unexpected price moves (z-score of prediction error).
/api/v1/eventsQuery shock and regime change events.
product,geo_type,since (date),event_type (shock_up, shock_down, regime_change),severity (low, med, high),limitcurl "https://fueldatalab.com/api/v1/events?product=diesel&severity=high&limit=20" \ -H "Authorization: Bearer YOUR_KEY"
shock_upUpward price spike (≥2σ)
shock_downDownward price drop (≥2σ)
regime_changeMarket state transition
/api/v1/spreadsGet spread (price difference) between two series.
product,left_series_id,right_series_id,periodcurl "https://fueldatalab.com/api/v1/spreads?product=diesel&left_series_id=UUID1&right_series_id=UUID2" \ -H "Authorization: Bearer YOUR_KEY"
/api/v1/coherenceGet regional coherence — how synchronized are prices across regions?
High — All regions moving together
Moderate — Some divergence
Low — Fragmented market
/api/v1/analogsFind historical periods with similar price patterns. Returns top 5 matches with similarity scores and what happened next.
series_id (required),period,limitcurl "https://fueldatalab.com/api/v1/analogs?series_id=UUID" -H "Authorization: Bearer YOUR_KEY"
similarity_score0-1 score based on normalized pattern distance
what_happened_nextDescription of subsequent price movement
outcome_4wPrice change 4 weeks after analog period
outcome_12wPrice change 12 weeks after analog period
/api/v1/scenarios/runRun a price scenario projection.
curl -X POST "https://fueldatalab.com/api/v1/scenarios/run" \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"series_id":"UUID","type":"trend","duration_weeks":12}'flatPrice stays constant
trendContinue current trend
mean_reversionRevert toward 5-year mean
shockApply volatility shock
/api/v1/simulations/runSimulate fuel costs with configurable parameters.
curl -X POST "https://fueldatalab.com/api/v1/simulations/run" \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"series_id":"UUID","miles":10000,"mpg":6.5,"duration_weeks":12}'Available Metrics
delta_1wWeek-over-week price changedelta_4w4-week price changedelta_12w12-week price changevolatility_12wStandard deviation (12 weeks)percentile_5yPrice percentile vs 5-year historyzscore_spot_vs_5yZ-score vs 5-year meanPrice Shapes
linear_trend_uplinear_trend_downspike_decayoscillationplateauRegime Classifications
stablerisingfallingvolatileshockedmean_revertingStress Score (0-100)
volatility30% weight
surprise25% weight
regime25% weight
momentum20% weight