Alerts
Create a price alert
Changed onCreates a threshold alert on commodity_code. Delivery is by email; set webhook_url to also send an alert.triggered webhook. A webhook_url must match an active endpoint registered with POST /v1/webhooks for the alert.triggered event; otherwise the request is rejected with 422 and errors.webhook_url.
Plan limits: Free 1 alert, Developer 20, Starter and Professional 100, Scale unlimited. Reaching the limit returns 422 with error: "Alert limit reached" and an upgrade message.
post/v1/alerts
Request
- Base URLhttps://api.oilpriceapi.com
- AuthAPI key in header Authorization
Request body
Example request
{
"price_alert": {
"name": "Brent above 95",
"commodity_code": "BRENT_CRUDE_USD",
"condition_operator": "greater_than",
"condition_value": 95,
"webhook_url": "https://example.com/hooks/opa",
"enabled": true,
"cooldown_minutes": 60
}
}Response
Alert created
Example response
{
"id": 1234,
"name": "Brent above 95",
"commodity_code": "BRENT_CRUDE_USD",
"alert_type": "threshold",
"delivery_mode": "threshold",
"condition_operator": "greater_than",
"condition_value": 95,
"condition": "BRENT_CRUDE_USD > 95.0",
"enabled": true,
"cooldown_minutes": 60
}Changes
- breaking
added required request body
- info
api operation id
postV1Alertsremoved and replaced withcreateV1Alert - info
added the media type
application/jsonfor the response with the status
3 more changes in this revision
- breaking