OilPriceAPI Docs
GitHub
GitHub
  • Interactive Explorer

    • Interactive API Explorer
  • Price Data

    • API Reference
    • Get Latest Prices
    • Historical Prices
    • Batch Prices
    • Excel Latest Price Gateway
    • Price Widget Endpoints
    • Price Utility Endpoints
    • Natural Gas Intelligence
  • Commodities

    • List Commodities
    • Get Commodity Details
  • AI Agents (MCP)

    • Get Market Brief
    • Subscriptions / Watches
    • Agent Subscriptions with MCP
  • Marine Fuels

    • Marine Fuel API
    • List Marine Fuel Ports
    • Get Port Details with Prices
    • Bunker Fuels
    • Maritime Fuels
  • Premium Endpoints

    • All Prices API - One Call, All Commodities
    • Cushing Oil Storage Intelligence API
    • Drilling Intelligence API
    • Marine Fuels API
    • ICE Brent Futures API
    • Benchmark Close
    • Aviation Fuel Pilot
  • Spreads & Margins

    • Spreads & Margins
    • Crack Spreads
    • Basis Spreads
    • Refining Margins
    • Curve Structure
    • Physical Premiums
  • Market Indicators

    • Market Indicators
    • Fuel Switching
    • Price Context
    • Storage Analytics
    • CFTC Positioning
    • Congressional Trades
    • Market Annotations
  • Futures

    • Futures API
    • ICE Brent Futures
    • ICE WTI Futures
    • ICE Gas Oil Futures
    • NYMEX Natural Gas Futures
    • ICE EUA Carbon Futures
    • EU Carbon Futures
    • TTF Gas Futures
    • LNG JKM Futures
    • UK Carbon Futures
  • Dark Data (Premium)

    • Energy Intelligence API
    • Rig Counts
    • Well Permits
    • Well Production Beta
    • Oil Inventories
    • OPEC Production
    • Drilling Productivity
    • Forecasts (STEO)
  • Well Production (Beta)

    • Well Production Data
    • Well Production API Reference
  • Analytics

    • Analytics API
  • Webhooks API

    • Webhooks API Reference
    • Webhook Endpoint Reference
  • Alerts

    • Price Alerts API
  • Account & Billing

    • Account API
    • API Keys
    • Subscriptions
    • Organizations

Webhooks API Reference

Webhooks let OilPriceAPI deliver events to your HTTPS endpoint. Use this API-reference page for endpoint mechanics, and the Webhooks Guide for full signing, retry, and cookbook examples.

Lifecycle

  1. Create a webhook endpoint.
  2. Receive events.
  3. Verify HMAC-SHA256 signature.
  4. Return a fast 2xx response.
  5. Inspect delivery history and retry failures.
  6. Test, update, or delete the endpoint.

Endpoints

MethodEndpointDescription
GET/v1/webhooksList webhooks
POST/v1/webhooksCreate webhook
GET/v1/webhooks/:idGet webhook
PUT/PATCH/v1/webhooks/:idUpdate webhook
DELETE/v1/webhooks/:idDelete webhook
GET/v1/webhooks/:id/eventsDelivery/event history
POST/v1/webhooks/:id/testSend test event

Signature Verification

Every production webhook receiver should verify signatures before parsing business data.

import crypto from "node:crypto";

function verifyWebhook(payload, timestamp, signature, secret) {
  const message = `${payload}.${timestamp}`;
  const expected = crypto.createHmac("sha256", secret).update(message).digest("hex");
  return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(signature));
}

Reject stale timestamps outside your replay window, usually 5 minutes. Store event ids such as evt_... for idempotency.

Event Payload

{
  "id": "evt_123",
  "type": "price.updated",
  "created_at": "2026-07-15T14:30:00Z",
  "data": {
    "code": "WTI_USD",
    "price": 74.52,
    "currency": "USD",
    "created_at": "2026-07-15T14:30:00Z"
  }
}

Error Cases

StatusWhen
400Invalid URL, event type, or payload
401Missing or invalid API key
404Webhook id not found
422Validation failed
429Rate limit exceeded

Related

  • Webhook Endpoint Reference
  • Webhooks Guide
  • Webhook Verification
  • Alerts API
Last Updated: 7/16/26, 1:53 PM
Next
Webhook Endpoint Reference