Demo API (No Authentication)
Status: ✅ Available | ⚡ Real-time | 🆓 No API Key Required
Try the API instantly without signing up. Perfect for testing and exploring.
GET/v1/demo/prices
Overview
The demo endpoint provides instant access to real-time commodity prices without authentication. Use it to:
- Test your integration before signing up
- Explore API responses in the browser
- Build quick prototypes
Limitations
| Feature | Demo API | Authenticated API |
|---|---|---|
| Rate Limit | 20/hour | Up to 100k+/month |
| Commodities | 9 | 220+ |
| Historical Data | ❌ | ✅ |
| WebSocket | ❌ | ✅ (Premium) |
Available Commodities
- BRENT_CRUDE_USD
- WTI_USD
- NATURAL_GAS_USD
- GOLD_USD
- EUR_USD
- GBP_USD
- HEATING_OIL_USD
- GASOLINE_USD
- DIESEL_USD
Response
{
"status": "success",
"data": {
"prices": [
{
"code": "NATURAL_GAS_USD",
"name": "Natural Gas (Henry Hub)",
"price": 5.34,
"currency": "USD",
"updated_at": "2026-01-22T13:43:16Z",
"change_24h": 7.04,
"source": "OilPriceAPI"
}
],
"meta": {
"demo_mode": true,
"rate_limit": "20 requests per hour"
}
}
}
Response Fields
| Field | Type | Description |
|---|---|---|
code | string | Commodity identifier |
name | string | Human-readable commodity name |
price | number | Current spot price |
currency | string | Price currency (usually USD) |
updated_at | string | ISO 8601 timestamp of last update |
change_24h | number | Percentage change from 24 hours ago (e.g., 7.04 = +7.04%) |
source | string | Always "OilPriceAPI" for demo |
change_24h is a percentage
The change_24h field contains the percentage change from 24 hours ago, not the absolute dollar change. For example, 7.04 means the price increased by 7.04% in the last 24 hours.
Examples
# Get all demo prices
curl https://api.oilpriceapi.com/v1/demo/prices
# Get specific commodity (demo only supports free-tier commodities)
curl https://api.oilpriceapi.com/v1/demo/prices/WTI_USD
// JavaScript - No API key needed!
const response = await fetch("https://api.oilpriceapi.com/v1/demo/prices");
const data = await response.json();
data.data.prices.forEach((commodity) => {
const changeDir = commodity.change_24h >= 0 ? "↑" : "↓";
console.log(
`${commodity.name}: $${commodity.price} ${changeDir}${Math.abs(commodity.change_24h)}%`,
);
});
# Python - No API key needed!
import requests
response = requests.get('https://api.oilpriceapi.com/v1/demo/prices')
data = response.json()
for commodity in data['data']['prices']:
change_dir = '↑' if commodity['change_24h'] >= 0 else '↓'
print(f"{commodity['name']}: ${commodity['price']} {change_dir}{abs(commodity['change_24h'])}%")
Rate Limit Headers
X-RateLimit-Limit: 20
X-RateLimit-Remaining: 19
X-RateLimit-Reset: 1737557999
X-Demo-Mode: true
Ready for More?
Sign up for free to access:
- 220+ commodities
- Historical data
- Higher rate limits
- WebSocket streaming