Skip to main content
GET
/
openapi
/
v1
/
commodities
/
{id}
/
history
Commodity price history
curl --request GET \
  --url https://api.hayinsights.com/openapi/v1/commodities/{id}/history \
  --header 'X-API-Key: <api-key>'
{
  "success": true,
  "statusCode": 200,
  "data": [
    {
      "date": "2026-03-19",
      "close": 4651.73
    },
    {
      "date": "2026-03-20",
      "close": 4491.15
    },
    {
      "date": "2026-03-22",
      "close": 4464.66
    }
  ],
  "meta": {
    "timestamp": "2026-06-19T08:50:01.000Z"
  }
}

Authorizations

X-API-Key
string
header
required

Your HayInsights API key (prefixed apk_). Create and manage keys in the HayInsights dashboard (Account → API keys).

Send it in the X-API-Key header on every request to /openapi/v1/*. Which data domains you may access and your request quota are both governed by the subscription plan attached to the key — see the Plans & features and Rate limits guides.

Path Parameters

id
string
required

Commodity slug.

Example:

"gold"

Query Parameters

period
enum<string>
default:3m

History window.

ValueDescription
7dLast 7 days
1mLast 1 month
3mLast 3 months
ytdYear-to-date
1yLast 1 year
Available options:
7d,
1m,
3m,
ytd,
1y
interval
enum<string>
default:daily

Sampling interval.

ValueDescription
dailyOne data point per day
weeklyOne data point per week
Available options:
daily,
weekly

Response

Closing-price history series.

Standard success envelope shared by every endpoint. Each operation's response wrapper extends this (via allOf) and adds a typed data property.

success
boolean
required

Always true for a successful response.

Example:

true

statusCode
integer
required

Mirrors the HTTP status code.

Example:

200

data
object[]
required
meta
object

Response metadata. Always present; timestamp is the server time the response was generated.