Brent Crude Price API

Brent Crude Price API

You need a reliable way to fetch the latest Brent crude oil price for finance applications such as risk dashboards, mark-to-market workflows, or automated alerts. By the end of this guide, you will be able to call the Energy API to retrieve the most recent Brent Crude quote (USD per barrel) using a simple GET request, parse the response fields you actually need, and ship production-ready integration code with sensible caching and error-handling practices.

What you’ll build and the exact endpoint to call

This walkthrough focuses on a single task: requesting the latest Brent Crude price (symbol BRENT_CRUDE) from the Energy API finance endpoint and extracting the fields your app needs to display a current quote, the quote date, and its currency.

Illustration: Brent Crude Price API
  • HTTP method: GET
  • Endpoint: https://energy-api.com/api/v1/latest
  • Query parameters: symbols=BRENT_CRUDE and api_key=YOUR_API_KEY
  • Authentication: api_key query parameter (no headers required)
  • Expected fields: success, date, base, rates.BRENT_CRUDE, dates.BRENT_CRUDE, currencies.BRENT_CRUDE

We will use official samples and a real Brent Crude response to keep implementation details precise and copy-pasteable for finance use cases.

Origin catalog facts you should copy into your implementation notes

  • Symbol name: Brent Crude
  • Symbol code: BRENT_CRUDE
  • Unit: USD/barrel
  • Auth: api_key query parameter. Placeholder YOUR_API_KEY only.
  • Do not pass base=USD when you also need TTF_GAS or EUA_CO2.
  • No MCP host. Starter $19.99/mo, trial 7 days / 50 calls.
  • curl: curl -G "https://energy-api.com/api/v1/latest" --data-urlencode "symbols=BRENT_CRUDE" --data-urlencode "api_key=YOUR_API_KEY"
  • Read rates.BRENT_CRUDE, dates.BRENT_CRUDE, currencies.BRENT_CRUDE. base may be MIXED.

Quickstart: curl you can paste into your terminal

Use this exact request to fetch the latest Brent Crude price. It calls the finance endpoint and requests only the BRENT_CRUDE symbol. Replace YOUR_API_KEY with your key when you run it locally.

curl -G "https://energy-api.com/api/v1/latest" --data-urlencode "symbols=BRENT_CRUDE" --data-urlencode "api_key=YOUR_API_KEY"

Response anatomy: fields your finance app should read

Below are complete JSON response examples. The first is the official sample demonstrating the response shape. The second is a real Brent Crude payload you can use to validate your parser against actual BRENT_CRUDE fields. After that, you’ll see the same Brent payload again to illustrate how you might validate caching behavior in tests without changing the expected values.

Official sample (format reference)

{
"success": true,
"date": "2026-10-14",
"base": "EUR",
"rates": {
"OMIE_ES_DA": 186.4441
},
"dates": {
"OMIE_ES_DA": "2026-10-14"
},
"currencies": {
"OMIE_ES_DA": "EUR"
},
"base_filter_note": null
}

Real API response (Brent Crude — copy these values exactly)

{"success":true,"date":"2026-10-06","base":"USD","rates":{"BRENT_CRUDE":125.44},"dates":{"BRENT_CRUDE":"2026-10-06"},"currencies":{"BRENT_CRUDE":"USD"},"base_filter_note":null}

Field usage in finance apps:

  • rates.BRENT_CRUDE: the latest Brent price (numeric). Unit is USD/barrel.
  • dates.BRENT_CRUDE: the price’s effective date (YYYY-MM-DD). Treat as the market date for your quote display.
  • currencies.BRENT_CRUDE: currency code for the price (USD for Brent).
  • date (top-level): canonical server date for the response, useful for debugging synchronization or cache labeling.
  • base: for single-symbol BRENT_CRUDE calls this will be USD in this example; the API can also return MIXED in multi-symbol contexts.

Same real payload (useful for cache and parser tests)

{"success":true,"date":"2026-10-06","base":"USD","rates":{"BRENT_CRUDE":125.44},"dates":{"BRENT_CRUDE":"2026-10-06"},"currencies":{"BRENT_CRUDE":"USD"},"base_filter_note":null}

Shape reference (official sample repeated for schema validation)

{
"success": true,
"date": "2026-10-14",
"base": "EUR",
"rates": {
"OMIE_ES_DA": 186.4441
},
"dates": {
"OMIE_ES_DA": "2026-10-14"
},
"currencies": {
"OMIE_ES_DA": "EUR"
},
"base_filter_note": null
}

Python example: request Brent and read price, date, and currency

This script calls the finance endpoint, asserts the expected keys exist, and prints normalized values suitable for finance displays or downstream computations.

import os
import sys
import json
import urllib.parse
import urllib.request

API_URL = "https://energy-api.com/api/v1/latest"
API_KEY = "YOUR_API_KEY" # Replace when running locally

def fetch_latest_brent(api_key: str) -> dict:
params = {
"symbols": "BRENT_CRUDE",
"api_key": api_key
}
url = API_URL + "?" + urllib.parse.urlencode(params)
req = urllib.request.Request(url, method="GET")
with urllib.request.urlopen(req, timeout=15) as resp:
data = resp.read().decode("utf-8")
return json.loads(data)

def parse_brent_payload(payload: dict) -> dict:
# Validate presence of expected fields
if not payload.get("success"):
raise RuntimeError("API call was not successful")

rates = payload.get("rates", {})
dates = payload.get("dates", {})
currencies = payload.get("currencies", {})

if "BRENT_CRUDE" not in rates:
raise KeyError("rates.BRENT_CRUDE missing")
if "BRENT_CRUDE" not in dates:
raise KeyError("dates.BRENT_CRUDE missing")
if "BRENT_CRUDE" not in currencies:
raise KeyError("currencies.BRENT_CRUDE missing")

return {
"value": float(rates["BRENT_CRUDE"]),
"unit": "USD/barrel", # From catalog facts
"price_date": dates["BRENT_CRUDE"], # YYYY-MM-DD
"currency": currencies["BRENT_CRUDE"],# USD for Brent
"response_date": payload.get("date"),
"base": payload.get("base")
}

if __name__ == "__main__":
try:
raw = fetch_latest_brent(API_KEY)
parsed = parse_brent_payload(raw)
print(f"Brent price: {parsed['value']} {parsed['currency']} per barrel")
print(f"Price date: {parsed['price_date']} (response date: {parsed['response_date']})")
print(f"Base field: {parsed['base']}")
except Exception as e:
print(f"Error: {e}", file=sys.stderr)
sys.exit(1)

Notes:

  • The script reads rates.BRENT_CRUDE, dates.BRENT_CRUDE, and currencies.BRENT_CRUDE as instructed in the catalog facts.
  • Unit is USD/barrel for Brent, which you should display alongside the numeric price.
  • Keep YOUR_API_KEY as the only placeholder. Do not add template braces.

How to interpret base, currency, and units for finance workflows

When requesting only BRENT_CRUDE, the API’s currency for the rate is USD, and the unit is USD/barrel. You should print both to avoid ambiguity in multi-commodity dashboards. For example, “125.44 USD/barrel (Brent).”

  • base: For single-symbol Brent requests, base can be USD. In multi-symbol requests that combine instruments with different currencies, base may be MIXED. Your code should not assume a single base across different instruments.
  • currencies.BRENT_CRUDE: Always read per-symbol currency for pricing logic and display formatting.
  • Do not pass base=USD when you also need TTF_GAS or EUA_CO2. If you later expand to combined queries, let the API return MIXED where applicable and format per instrument.

Practical integration details that save time

These concrete points tend to trip up finance integrations; address them early to avoid downstream code churn.

  • Symbol: Use BRENT_CRUDE exactly as written. Do not invent alternative tickers.
  • Authentication: Supply api_key as a query parameter. No headers required for this endpoint.
  • HTTP method: GET. Avoid accidental POSTs with form bodies; the endpoint expects query parameters.
  • Date fields: The API returns ISO-like dates as YYYY-MM-DD. Treat dates.BRENT_CRUDE as the quote’s effective market date.
  • Timezone: The payload date is a calendar date, not a timestamp. If you need time-of-day resolution, design your UI as date-based and show last refresh time from your own system clock.
  • Caching: For dashboards, cache BRENT_CRUDE responses for several minutes to reduce latency and call volume. Use the top-level date for cache labeling, and invalidate your cache when you need a fresh quote.
  • Non-trading days: Commodities quotes can observe weekends/holidays. If the value doesn’t change across a non-trading period, keep using the last available date and price until a new date appears in dates.BRENT_CRUDE.
  • Precision: Store numeric fields as decimal or high-precision float in finance systems to avoid rounding drift.
  • Resilience: If success is false or rates.BRENT_CRUDE is missing, back off and retry with exponential delays and alert your monitoring pipeline.

End-to-end example with output mapping

Using the real payload below, your code should produce a normalized structure with the final price, currency, unit, and the date for finance display.

{"success":true,"date":"2026-10-06","base":"USD","rates":{"BRENT_CRUDE":125.44},"dates":{"BRENT_CRUDE":"2026-10-06"},"currencies":{"BRENT_CRUDE":"USD"},"base_filter_note":null}
  • Display string: “125.44 USD/barrel (Brent) — 2026-10-06”.
  • Key-value mapping:
    • value = 125.44
    • currency = USD
    • unit = USD/barrel
    • price_date = 2026-10-06

Using the response safely in finance calculations

If you’re converting to another currency or feeding a PnL engine:

  • Always reference currencies.BRENT_CRUDE to confirm the rate’s currency before FX conversion.
  • Persist the original value and price_date alongside any converted values for auditability.
  • If you later add other energy instruments, expect base to be MIXED. Do not assume a global base for cross-instrument netting.

Pricing, auth, and environment setup

You can start with the Starter plan at $19.99/mo, which includes a trial of 7 days and 50 calls. There is no MCP host. Authentication is via the api_key query parameter only. Keep keys outside your repo and inject them via environment variables in CI/CD.

  • Plan: Starter $19.99/mo
  • Trial: 7 days / 50 calls
  • Auth: api_key query parameter (YOUR_API_KEY as the placeholder here)
  • No MCP host

When ready, create your account and retrieve your API key:

Troubleshooting and observability tips

Make your integration debuggable from day one:

  • Log the full request URL without the api_key, and the HTTP status code.
  • Capture the raw JSON payload for failed calls (again, omit secrets in logs).
  • Add health checks that verify success is true and that rates.BRENT_CRUDE, dates.BRENT_CRUDE, and currencies.BRENT_CRUDE exist.
  • Set a reasonable GET timeout (e.g., 10–15s) and implement 2–3 retries with jitter for transient network errors.
  • In alert messages, include the last good price and its date so stakeholders see business context, not just a red light.

FAQ

Q1: Which exact fields should I read for Brent in finance apps?
A1: Read rates.BRENT_CRUDE (numeric price), dates.BRENT_CRUDE (YYYY-MM-DD), and currencies.BRENT_CRUDE (USD). Optionally log the top-level date and base.

Q2: Do I need to pass a base parameter for Brent?
A2: No. For BRENT_CRUDE, just pass symbols=BRENT_CRUDE and your api_key. If you later query multiple instruments including TTF_GAS or EUA_CO2, do not pass base=USD; allow MIXED when returned.

Q3: What unit should I display for Brent?
A3: USD/barrel. This comes from the catalog facts and aligns with currencies.BRENT_CRUDE = USD.

Q4: How should I cache the latest price?
A4: Cache the entire JSON for a few minutes. Use dates.BRENT_CRUDE for the quote’s market date and the top-level date for labeling. Refresh on demand for critical workflows.

Q5: How do I test my parser without live changes?
A5: Use the real Brent payload in this article as a fixture. Validate extraction of rates.BRENT_CRUDE, dates.BRENT_CRUDE, and currencies.BRENT_CRUDE and confirm your code handles both USD base and MIXED gracefully.

Ship your Brent integration now: create your account with Register and keep the reference close by with the Documentation. With a single GET call using symbols=BRENT_CRUDE and your api_key, your finance system can display the latest Brent price, the correct unit (USD/barrel), and the quote date confidently.

Ready to get started?

Get your API key and start querying energy commodity prices in minutes.

Get API Key

Related posts