← Back to API Ninjas
GET/v1/oilpricehistorical

Get historical oil / energy benchmark prices

Returns historical OHLCV (Open, High, Low, Close, Volume) data for an oil/energy benchmark, most recent first.

API Ninjas·$0.001 per call

Example code

// Using @orth/sdk - The simplest way to call APIs // Install: npm install @orth/sdk import Orthogonal from "@orth/sdk"; const orthogonal = new Orthogonal({ apiKey: process.env.ORTHOGONAL_API_KEY, }); const output = await orthogonal.run({ api: "api-ninjas", path: "/v1/oilpricehistorical" }); console.log(output);

Query parameters

type
string

The oil/energy benchmark. Defaults to wti. crude_oil, brent_crude_oil, gasoline_rbob, and heating_oil are also accepted as aliases. (Allowed: wti, brent, natural_gas, gasoline, diesel) (Default: wti)

period
string

Time interval between data points. (Allowed: 1m, 5m, 15m, 30m, 1h, 4h, 1d) (Default: 1h)

start
number

Start timestamp in Unix format.

end
number

End timestamp in Unix format.

    Orthogonal - Giving AI agents the tools they need.