Skip to main content

Oil Price API

Get latest-available oil price data into your app quickly.

Example Response Format

Sample JSON shape returned by the API (values shown are placeholders)

{
  "status": "success",
  "data": {
    "WTI": {
      "price": 0,
      "currency": "USD",
      "unit": "barrel",
      "timestamp": "2026-01-01T00:00:00Z"
    },
    "BRENT": {
      "price": 0,
      "currency": "USD",
      "unit": "barrel",
      "timestamp": "2026-01-01T00:00:00Z"
    }
  }
}

No credit card required to start • Token authentication • JSON responses

Start with the right workflow

Choose the guide for what you are trying to do

Pick the path closest to your task, test the exact endpoint or source, then confirm plan fit before building around it.

Some datasets depend on source, plan, or provider access. These guides route you to verification when the data path is not self-service.

Developers starting from an API key

Make your first API request

Make one authenticated request, inspect the JSON response, and confirm the fields your application needs before wiring it into a workflow.

Start with one request. Do not assume a dataset, symbol, or response field is available until the request succeeds.

Open quick start

Users who know the commodity but need the right code or endpoint

Find codes and latest prices

Use valid commodity codes, call the latest-price path for the specific code, and save the response fields your app needs.

If a code or source is missing, send the commodity, region, source, and intended workflow instead of guessing a code.

Open code guide

Spreadsheet and dashboard users

Use OilPriceAPI in Excel

Use the Excel add-in path: save your API key in the OilPrice pane, run Test Connection, then use supported worksheet formulas.

Do not paste API keys into worksheet cells. Supported formulas and platforms depend on the released add-in build and verified install path.

Open Excel quick start

Research, reporting, and backtesting workflows

Understand historical rows

Before using historical data in analysis, check what each row represents: date, price, source/type fields, and dataset-specific semantics.

Do not treat a historical row as an official settlement, close, or complete history unless that dataset explicitly supports it.

Open historical guide

Front-month, contract, OHLC, settlement, or curve-style workflows

Choose futures or latest prices

Use latest-price paths for supported benchmark/latest workflows. Use futures-specific pages when you need contract month or curve semantics.

Do not describe latest-price endpoints as exchange-grade futures feeds or market data suitable for resale.

Open futures guide

Trial users and pricing-page visitors

Check data fit before plan fit

Confirm the commodity, region or source, workflow, and expected request volume first. Then review the lowest viable plan if the data path fits.

Unknown or gated data should route to support verification before upgrade pressure.

Review plan fit
1

Get API Key

Sign up for free and get your API token instantly. No credit card required.

Get Free API Key
2

Make Request

Use simple HTTP requests to get latest-available oil price data in JSON format.

GET /v1/prices/latest
3

Use Data

Integrate timestamped oil price data into your trading app, dashboard, or analysis tool.

Ready to test

Basic Oil Price Request

Get current WTI and Brent crude oil prices with a single request

Request:

curl https://api.oilpriceapi.com/v1/prices/latest \
-H 'Authorization: Token YOUR_API_TOKEN' \
-H 'Content-Type: application/json'

Response:

{
  "status": "success",
  "data": {
    "WTI": {
      "price": 0,
      "currency": "USD",
      "unit": "barrel",
      "timestamp": "2026-01-01T00:00:00Z"
    },
    "BRENT": {
      "price": 0,
      "currency": "USD",
      "unit": "barrel",
      "timestamp": "2026-01-01T00:00:00Z"
    }
  }
}

JavaScript/Node.js Integration

Ready-to-use JavaScript code for web apps and Node.js backends

const response = await fetch('https://api.oilpriceapi.com/v1/prices/latest', {
  headers: {
    'Authorization': 'Token YOUR_API_TOKEN',
    'Content-Type': 'application/json'
  }
});

const data = await response.json();
console.log('WTI Price:', data.data.WTI.price);
console.log('Brent Price:', data.data.BRENT.price);

Python Integration

Perfect for data analysis, trading algorithms, and research

import requests

headers = {
    'Authorization': 'Token YOUR_API_TOKEN',
    'Content-Type': 'application/json'
}

response = requests.get('https://api.oilpriceapi.com/v1/prices/latest', headers=headers)
data = response.json()

print(f"WTI Price: {data['data']['WTI']['price']}")
print(f"Brent Price: {data['data']['BRENT']['price']}")

Popular API Endpoints

Most commonly used endpoints to get started quickly

GET /v1/prices/latest

Current oil prices (WTI, Brent, etc.)

GET /v1/prices/WTI

Specific commodity price data

GET /v1/prices/historical

Historical price data

GET /v1/drilling-intelligence

Rig counts & drilling data

Frequently Asked Questions

How do I get started with the oil price API?

Sign up for a free account to receive your API token. Then make HTTP requests to our endpoints with your token in the Authorization header. See the pricing page for current trial terms and plan limits.

What programming languages are supported?

Our REST API works with any language that can make HTTP requests. We provide official SDKs for Python and Node.js, plus code examples in many other languages.

How much does the oil price API cost?

Current plan terms, usage limits, and package rights are maintained on the pricing page and in your account dashboard.

What data endpoints are available?

Core endpoints include /v1/prices/latest for latest-available prices, /v1/prices/historical for time-series data, /v1/futures for futures contracts, and /v1/drilling-intelligence for energy data.

How often is oil price data updated?

Freshness depends on the commodity, source, market hours, and package. Use timestamps and freshness metadata in API responses to evaluate the data returned for your use case.

Do you offer a free trial?

Yes. You can create a free account to test the API before upgrading. See the pricing page for current trial terms and plan limits.

What authentication method is used?

We use token-based authentication. Include your API token in the Authorization header as "Token YOUR_API_TOKEN" with every request. Tokens can be regenerated from your dashboard.

Can I get historical oil price data?

Yes. Use the /v1/prices/historical endpoint with start_date and end_date parameters. Available history depends on the commodity, source, and package. You can query by day, week, or month intervals where supported.

Trusted by Energy Professionals

"We integrated OilPriceAPI into our trading platform in less than 2 hours. The documentation is excellent and the API is fast and reliable."

MR

Michael Rodriguez

Senior Developer, Energy Trading Co

"Finally, a commodity data API that doesn't require a Bloomberg Terminal budget. Perfect for our algorithmic trading research."

SK

Dr. Sarah Kim

Quantitative Analyst, Hedge Fund

"The Python SDK saved us weeks of development time. Clean API design and excellent error handling out of the box."

JP

James Patterson

Lead Engineer, Analytics Startup

Ready to Start?

No credit card required to start • Token authentication • JSON responses