Oil Price API Documentation - Quick Start in 5 Minutes | REST API
GitHub
GitHub
  • Guides

    • Authentication
    • Security & Compliance
    • API Versioning
    • Data Freshness & Update Frequency
    • Data Quality and Validation
    • Coal Price Data - Complete Guide
    • Testing & Development
    • Error Codes Reference
    • Webhook Signature Verification
    • Production Deployment Checklist
    • Service Level Agreement (SLA)
    • Rate Limiting & Response Headers
    • Troubleshooting Guide
    • Incident Response Guide
    • Video Tutorials | OilPriceAPI

Data Freshness & Update Frequency

Understanding when and how data updates is critical for building reliable integrations. This guide explains update frequencies, timestamp behavior, and how to detect stale data.


Overview

  • All timestamps are UTC in ISO 8601 format (e.g., 2026-02-02T14:35:00Z)
  • Update frequency varies by commodity type and data source
  • Timestamps update on every refresh cycle, even if the price hasn't changed

Timestamp Behavior

Does the timestamp update when the price doesn't change?

Yes. The created_at timestamp reflects when data was last refreshed, not when the price last changed. This is intentional - it lets you verify the API is actively polling data sources.

Example Response:

{
  "code": "BRENT_CRUDE",
  "price": 76.42,
  "currency": "USD",
  "unit": "barrel",
  "created_at": "2026-02-02T14:35:00Z"
}

The created_at timestamp means "this price was confirmed accurate at 14:35 UTC" - not "the price changed at 14:35."

How to detect actual price changes

To detect when prices actually change, you have several options:

  1. Compare consecutive price values in your application
  2. Use webhooks - only triggered on actual price changes
  3. Check the change_24h field in analytics endpoints for price movement

Update Frequency by Category

High-Frequency Data (5-15 minute updates)

CommodityFrequencyTrading HoursNotes
WTI Crude5 min24/5Multiple sources (ICE, NYMEX, IG)
Brent Crude5 min24/5ICE Futures + backup sources
ICE Gasoil5 min01:00-23:00 UTCICE Futures Europe
Natural Gas (Henry Hub)5 minTrading hoursNYMEX futures
UK Natural Gas15 minTrading hoursIG Markets
Gold1 min24/5Multiple sources
Silver1 min24/5Multiple sources
EU Carbon (EUA)15 min05:00-17:00 UTC Mon-FriICE Futures

Daily Data (1x per day)

CommodityUpdate TimeNotes
Dubai Crude15:00 UTC weekdaysPlatts MOC assessment
Newcastle CoalEnd of dayMarket close prices
Uranium SpotMondays 15:00 UTCWeekly spot market

Weekly Data

CommodityUpdate DayUpdate TimeSource
US Diesel (all regions)Monday02:00 UTCEIA
US GasolineMonday02:00 UTCEIA
Coal Spot (CAPP, PRB, Illinois)Tuesday02:00 UTCEIA
Rig CountsFriday18:30 UTCBaker Hughes
Natural Gas StorageThursday14:35 UTCEIA
Oil InventoriesWednesday14:35 UTCEIA WPSR

Monthly Data

Data TypeUpdate DaySource
DUC Wells~15thEIA DPR
OPEC Production~15thOPEC MOMR
Price Forecasts1stEIA STEO

Detecting Stale Data

Freshness Thresholds

Use these guidelines to determine if data might be stale:

Commodity TypeStale If Older ThanDuring
Crude oil, futures15 minutesTrading hours
Natural gas30 minutesTrading hours
Precious metals5 minutes24/5
Weekly data (diesel, coal)8 daysAny time
Monthly data35 daysAny time

Checking Freshness in Code

from datetime import datetime, timedelta, timezone

def is_stale(created_at_str, max_age_minutes):
    """Check if data is stale based on timestamp."""
    created_at = datetime.fromisoformat(created_at_str.replace('Z', '+00:00'))
    age = datetime.now(timezone.utc) - created_at
    return age > timedelta(minutes=max_age_minutes)

# Example: Check if crude oil data is stale (>15 min old)
if is_stale(response['created_at'], max_age_minutes=15):
    print("Warning: Data may be stale")

Weekend and Holiday Behavior

  • Weekends: Futures markets are closed. Expect no updates from Saturday to Sunday.
  • US Holidays: US-sourced data (EIA) may be delayed by 1-2 days.
  • UK Holidays: UK gas data may show last known price.
  • Market Holidays: Exchange-specific holidays affect futures data.

Response Headers for Freshness

Every API response includes headers to help monitor data currency:

HeaderDescriptionExample
X-Data-TimestampWhen the price was last updated2026-02-02T14:35:00Z
X-Data-SourcePrimary source for this data pointice_futures
X-CacheWhether response was cachedHIT or MISS

Handling Missing or Delayed Data

Why data might be missing

  1. Source outage: Data provider experiencing issues
  2. Market closed: No trading activity (weekends, holidays)
  3. Network issues: Temporary connectivity problems

What we do automatically

  • Failover: If primary source fails, backup sources activate within 5 minutes
  • Monitoring: Our team is alerted to source issues 24/7
  • Carry-forward: For some daily commodities, last known price is preserved with original timestamp

What you should do

  1. Check timestamps: Always verify created_at is recent enough for your use case
  2. Handle nulls: Missing data returns null - your code should handle this gracefully
  3. Use fallbacks: Consider caching recent prices as a fallback
  4. Subscribe to status: Follow @oilpricehourly for service updates

API Endpoints for Freshness Monitoring

Check Latest Timestamp

GET /v1/prices/latest?by_code=BRENT_CRUDE

The created_at field in the response shows when data was last refreshed.

Bulk Freshness Check

GET /v1/prices/latest

Returns latest prices for all commodities - useful for monitoring freshness across your portfolio.


Contact

For questions about data freshness or to report stale data:

  • Email: [email protected]
  • Response Time: Same business day for freshness concerns
Last Updated: 2/3/26, 1:27 AM
Prev
API Versioning
Next
Data Quality and Validation