OilMetrics API Docs

Introduction

The OilMetrics API is a RESTful API providing various endpoints and parameters for retrieving historical or live oil prices.

Authentication

The OilMetrics API uses API tokens to authenticate requests. You can view and manage your API token in the OilMetrics API Dashboard.

curl https://oilmetricsapi.com/api/prices/latest -H 'Authorization: Token YOUR_API_KEY' -H 'Content-Type: application/json'

The OilMetrics API uses API tokens to authenticate requests. You can view and manage your API token in the OilMetrics API Dashboard (opens new window). Requests made with your API token count towards your account request limit, so be sure to keep it private. To make an authenticated request your API token should be passed in your request's Authorization header. For example in a cURL (opens new window) request it can be passed like so:

Errors

OilMetrics API uses conventional HTTP response codes to indicate the success or failure of an API request.

OilMetrics API uses conventional HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, your API token has expired, etc.). Codes in the 5xx range indicate an error with OilMetrics API's servers. #

Endpoints

All end points can be called using the following base url:

So as an example, to access the latest oil price the full request URL would be:

The endpoint being - /latest Below is a list of all available endpoints:

    latest

    This endpoint returns the latest available oil price.

    Example cURL request:

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

    Note YOUR_API_TOKEN needs to be replaced with your own API token.

    Example response:

    { "status": "success", "data": { "price": 80.29, "formatted": "$80.29", "currency": "USD", "code": "OIL_BRENT_USD", "type": "spot_price", "created_at": "2018-10-17T20:14:05.698Z" } }