Fuel Surcharge API & Widgets

Automate fuel surcharge inputs for freight, shipping & logistics software

Use current gasoline and diesel price inputs in your CRM, quoting tool, spreadsheet, or internal dashboard — without maintaining scrapers. Start with a widget, then move to API-backed surcharge logic when you need full control.

Free trial · no credit card required

Just need to run the numbers? Try the free interactive fuel surcharge calculator — prefilled with the latest weekly DOE diesel price.

The clean v1 surcharge workflow

National default, optional US state override, cached calculation. Your pricing logic stays in your app — we just supply the fuel input.

1. National default

Pull the US national gasoline and diesel averages once per day as your baseline surcharge input.

2. State override

Pull state-specific codes only for the US states your customers configure, by two-letter state code.

3. Cache & calculate

Store the value and timestamp, then let your customers add their own buffer / multiplier rules. Move daily → hourly only if needed.

Example API calls

National defaults

GET /v1/prices/latest?by_code=GASOLINE_RETAIL_USD,DIESEL_RETAIL_USD

State override (e.g. California)

GET /v1/prices/latest?by_code=GASOLINE_RETAIL_STATE_CA_USD,DIESEL_RETAIL_STATE_CA_USD

Code mapping

  • gasoline, no state → GASOLINE_RETAIL_USD
  • diesel, no state → DIESEL_RETAIL_USD
  • gasoline, state=XX → GASOLINE_RETAIL_STATE_XX_USD
  • diesel, state=XX → DIESEL_RETAIL_STATE_XX_USD

Best-fit use cases

Freight quoting & TMS software
Shipment / order management CRMs
Fleet management & logistics ops
Ecommerce shipping-cost tools
Procurement & spreadsheet surcharge models
Custom software agencies serving logistics clients

What this is — and is not

Not station-level or pump-specific quotes
Not a real-time gas-station price feed
Not a transfer of public display, redistribution, or benchmark licensing rights

How to think about it: OilPriceAPI is a data-pulling / API service. Public redistribution, display, and benchmark licensing rights are not transferred, and cannot be: we hold none, so no agreement with us at any tier could convey them. The fuel-surcharge workflow uses current/latest retail fuel values as an input inside your own application.

Implementation checklist

  1. Pull national gasoline/diesel once per day.
  2. Pull state-specific codes only for states your customers configure.
  3. Store the value and timestamp.
  4. Use the cached value inside your surcharge logic.
  5. Let end customers add buffer / multiplier rules.
  6. Move from daily to hourly only if necessary.