Oil Price API Documentation - Quick Start in 5 Minutes | REST API
GitHub
GitHub
  • Interactive Explorer

    • Interactive API Explorer
  • Price Data

    • API Reference
    • Get Latest Prices
    • Historical Prices
  • Commodities

    • List Commodities
    • Get Commodity Details
  • Marine Fuels

    • List Marine Fuel Ports
    • Get Port Details with Prices
  • Premium Endpoints

    • All Prices API - One Call, All Commodities
    • Cushing Oil Storage Intelligence API
    • Drilling Intelligence API
    • Marine Fuels API
    • ICE Brent Futures API
  • Futures

    • Futures API
    • ICE Brent Futures
    • ICE WTI Futures
    • ICE Gas Oil Futures
    • NYMEX Natural Gas Futures
  • Dark Data (Premium)

    • Dark Data API
    • Rig Counts
    • Oil Inventories
    • OPEC Production
    • Drilling Productivity
    • Forecasts (STEO)
  • Analytics

    • Analytics API
  • Account & Billing

    • Account API

Billing API

Overview

The Billing API allows you to manage your subscription, view invoices, and update payment methods programmatically. All billing is handled securely through Stripe.


Plans & Pricing

PlanPriceAPI Requests/MonthFeatures
Free$0100 (lifetime)Basic prices
Hobby$9/mo10,000All commodities
Starter$29/mo50,000+ Webhooks
Professional$79/mo100,000+ SMS Alerts
Business$199/mo200,000+ Team seats
EnterpriseCustom500,000+Custom SLA

Endpoints

Get Available Plans

GET /billing/plans

Response:

{
  "plans": [
    {
      "id": "hobby",
      "name": "Hobby",
      "price_monthly": 900,
      "price_yearly": 9000,
      "currency": "usd",
      "request_limit": 10000,
      "features": ["all_commodities", "historical_data"]
    }
  ]
}

Get Current Subscription

GET /billing/subscriptions/current

Response:

{
  "subscription": {
    "id": "sub_123",
    "plan": "professional",
    "status": "active",
    "current_period_start": "2025-01-01T00:00:00Z",
    "current_period_end": "2025-02-01T00:00:00Z",
    "cancel_at_period_end": false,
    "usage": {
      "requests_used": 45000,
      "requests_limit": 100000,
      "percent_used": 45
    }
  }
}

Create Subscription

POST /billing/subscriptions

Request Body:

{
  "plan_id": "professional",
  "billing_period": "monthly"
}

Change Plan

POST /billing/subscriptions/change_plan

Request Body:

{
  "new_plan_id": "business"
}

Plan changes are prorated. Upgrades take effect immediately; downgrades take effect at the next billing period.

Cancel Subscription

POST /billing/subscriptions/cancel

Cancels at end of current billing period. You retain access until then.

Reactivate Subscription

POST /billing/subscriptions/reactivate

Reactivates a subscription scheduled for cancellation.


Payment Methods

List Payment Methods

GET /billing/payment_methods

Update Payment Method

PATCH /billing/payment_methods/update

Request Body:

{
  "payment_method_id": "pm_card_visa_123"
}

Create Setup Intent

POST /billing/intents/setup

Returns a Stripe Setup Intent for adding a new payment method.


Invoices

List Invoices

GET /billing/invoices

Response:

{
  "invoices": [
    {
      "id": "inv_123",
      "amount": 7900,
      "currency": "usd",
      "status": "paid",
      "period_start": "2025-01-01",
      "period_end": "2025-01-31",
      "pdf_url": "https://invoice.stripe.com/..."
    }
  ]
}

Usage Tracking

Get Current Usage

GET /billing/usage

Response:

{
  "period": {
    "start": "2025-01-01T00:00:00Z",
    "end": "2025-02-01T00:00:00Z"
  },
  "requests": {
    "used": 45000,
    "limit": 100000,
    "remaining": 55000
  },
  "daily_breakdown": [
    {"date": "2025-01-15", "requests": 1500},
    {"date": "2025-01-16", "requests": 1800}
  ]
}

Customer Portal

For self-service billing management, redirect users to Stripe's Customer Portal:

POST /billing/customer-portal/sessions

Response:

{
  "url": "https://billing.stripe.com/session/..."
}

Redirect users to this URL for:

  • Update payment method
  • View invoice history
  • Download invoices
  • Cancel subscription

Credit Packs (Pay-as-you-go)

For users who exceed their monthly limits:

List Available Credit Packs

GET /billing/credit_packs

Purchase Credits

POST /billing/credit_purchases

Request Body:

{
  "pack_id": "10k_requests",
  "quantity": 1
}

Webhook Events

Subscribe to billing webhooks for real-time updates:

EventDescription
subscription.createdNew subscription started
subscription.updatedPlan changed
subscription.cancelledSubscription cancelled
invoice.paidPayment successful
invoice.payment_failedPayment failed
usage.limit_warning80% of limit reached
usage.limit_exceeded100% of limit reached

Questions?

Contact [email protected] for billing questions or custom Enterprise pricing.

Last Updated: 12/17/25, 12:26 PM