Dynamic pricing in freight forwarding has always been a juggling act. Spot truckload markets can swing by double-digit percentages week to week, diesel prices yo-yo with geopolitical shocks, and a thunderstorm aimed at a specific port can blow up your carefully modeled ETAs and margins. Many teams try to tame this with spreadsheets, stale CSVs, and a patchwork of one-off integrations—leading to brittle tooling that fails when you need it most.
This post shows how to build a production-grade dynamic pricing engine—one that continuously optimizes quotes in real time—using a single, developer-friendly API: FreightPulse. Instead of stringing together separate feeds for EIA fuel prices, FTL lane quotes, AIS-derived port congestion, FMCSA/FMC carrier lookups, and natural-disruption alerts, you can pull all of this intelligence from one REST surface with consistent schemas. We’ll walk through the key endpoints, practical data interpretation, error handling, and implementation patterns for reliable, low-latency pricing pipelines.
By the end, you’ll have a blueprint for calculating fuel surcharges from current diesel, benchmarking FTL quotes against congestion or disruption risk, validating carriers before tender, and surfacing port congestion trends to your margin model—all behind the same base URL. We’ll include end-to-end cURL and code examples, complete JSON responses, and concrete field-by-field breakdowns so you can ship faster with fewer moving parts.
Why FreightPulse
A dynamic pricing engine only works if it sees the market as it moves. FreightPulse consolidates the core signals your model needs—fuel, rates, congestion, carriers, and disruptions—so you can trade spreadsheet wrangling for clean, consistent JSON. Here are the key reasons teams ship with it:
- One API replaces five. Instead of wiring EIA for fuel, Warp for FTL quotes, PortWatch AIS for congestion, FMCSA/FMC directories for carriers, and GDACS/USGS/NOAA for disruptions, you get a single REST interface with standardized response shapes. Less glue code, fewer auth hurdles, and no reconciling field names across vendors.
- Live freight rates next to cost drivers. Pull a live US full-truckload quote and immediately factor in current diesel averages plus 30/90-day fuel baselines in the same model. This enables immediate surcharge calculation, cross-lane normalization, and historical anchoring without joining external datasets.
- Operational trust through verification and risk. SAFER carrier lookups and OTI/NVOCC checks reduce the risk of quoting with a carrier that can’t legally haul your load. Pair that with disruption alerts near your origin or destination port to proactively re-price risk exposure or adjust service-level promises.
- Practical congestion signals. You don’t always need raw AIS firehose data. FreightPulse’s port congestion metric approximates port activity (7-day average vs 90-day baseline) so your pricing engine can moderate quotes or flag exceptions when activity dips. It’s a pragmatic proxy for schedule reliability that’s easy to plug in.
Beyond data consolidation, FreightPulse is built for developers: consistent JSON envelopes, friendly defaults, and straightforward filtering. It’s the fastest path from idea to production—without wrestling five third-party contracts or reconciling disjointed schemas.
Quick Start
Base URL:
https://freightpulsehq.com/api/v1
Authentication uses an HTTP header (X-API-Key). Requests without a key are also supported for exploration. Here is a first request that fetches national and regional fuel prices from EIA data:
curl -H "X-API-Key: YOUR_API_KEY" \
"https://freightpulsehq.com/api/v1/fuel-prices"
Sample JSON response:
{
"success": true,
"data": {
"timestamp": "2026-07-30T12:00:00Z",
"source": "EIA (U.S. Energy Information Administration)",
"currency": "USD",
"unit": "gallon",
"data": {
"diesel": {
"national_average": 3.847,
"change_week": -0.023,
"change_percent": -0.6,
"regions": {
"east_coast": 3.912,
"midwest": 3.756,
"gulf_coast": 3.623,
"rocky_mountain": 3.891,
"west_coast": 4.456,
"california": 4.892
},
"historical": {
"30d_avg": 3.82,
"90d_avg": 3.75,
"yoy_change_percent": -8.2
}
},
"gasoline": {
"national_average": 3.156,
"historical": {
"30d_avg": 3.1,
"90d_avg": 3.05,
"yoy_change_percent": 1.1
}
}
}
}
}
Key fields for pricing:
- diesel.national_average: Anchor for your fuel surcharge index.
- diesel.regions.*: Use when regional surcharges are needed; PADD-aligned breakouts help contextualize specific lanes.
- diesel.historical.30d_avg and 90d_avg: Stabilizers for your model to dampen overreaction to weekly swings; also useful for trend-based surcharges.
With an anchor like national diesel at your fingertips, we can now layer in lane-specific FTL quotes, port congestion signals, and disruption risk scores—all in a consistent request pattern.
Core Endpoints for Real-Time Rate Optimization
A dynamic pricing engine benefits most from a few core signals: current fuel costs, live freight quotes, congestion context, carrier verification, disruption risk, and supporting historical series. FreightPulse provides dedicated endpoints for each. In this section, we’ll cover all available endpoints, demonstrate usage, and explain the response fields you’ll integrate directly into your pricing logic.
1) Fuel Prices: GET /fuel-prices
Purpose: Provide current national and regional diesel/gasoline benchmarks from the EIA, plus historical averages for model stabilization and trend analysis.
Key parameters: None (straightforward fetch).
curl -H "X-API-Key: YOUR_API_KEY" \
"https://freightpulsehq.com/api/v1/fuel-prices"
Representative response and field breakdown:
{
"success": true,
"data": {
"timestamp": "2026-07-30T12:00:00Z",
"source": "EIA (U.S. Energy Information Administration)",
"currency": "USD",
"unit": "gallon",
"data": {
"diesel": {
"national_average": 3.847,
"change_week": -0.023,
"change_percent": -0.6,
"regions": {
"east_coast": 3.912,
"midwest": 3.756,
"gulf_coast": 3.623,
"rocky_mountain": 3.891,
"west_coast": 4.456,
"california": 4.892
},
"historical": {
"30d_avg": 3.82,
"90d_avg": 3.75,
"yoy_change_percent": -8.2
}
},
"gasoline": {
"national_average": 3.156,
"historical": {
"30d_avg": 3.1,
"90d_avg": 3.05,
"yoy_change_percent": 1.1
}
}
}
}
}
- timestamp: Last refresh time to drive cache invalidation and to log what your pricing engine used for auditability.
- diesel.national_average: Primary surcharge driver for most North American FTL.
- diesel.change_week and change_percent: Early warning for model reweighting; e.g., trigger more frequent recalculation during spikes.
- regions.*: PADD-based context to accommodate regional disparity in your surcharge or baseline.
- historical fields: Normalize quotes to 30/90-day baselines and check if you are in a spike/dip regime.
Implementation best practices:
- Cache the latest response with timestamp; only re-fetch on a schedule or on pricing recalculation events.
- Blend national with regional multipliers for lanes with known volatility (e.g., California endpoints).
- Log the exact snapshot used per quote to ensure reproducibility in postmortems.
2) Freight Rates: GET /freight-rates
Purpose: Get live FTL rates for US ZIP-to-ZIP lanes (via Warp), with optional pickup dates and weight/quantity parameters. This is your main lane-price signal.
Key parameters:
- mode: trucking (default), ocean, or air.
- origin_zip and destination_zip: Required for trucking mode.
- pickup_date, qty, total_weight_lb: Optional refinements for more accurate quotes.
- For ocean/air from Asia into US ZIPs: origin_country and dest_zip, with container_size for ocean.
curl -H "X-API-Key: YOUR_API_KEY" \
"https://freightpulsehq.com/api/v1/freight-rates?mode=trucking&origin_zip=10001&destination_zip=90210"
Sample response:
{
"success": true,
"data": {
"mode": "trucking",
"service": "FTL (53' dry van)",
"source": "Warp",
"price_usd": 7207.92,
"transit_days": 4,
"pickup_date": "2026-08-24",
"delivery_date": "2026-08-28"
}
}
- mode and service: Feed your product selection logic—e.g., show FTL vs alternative modes when lanes qualify for modal conversion.
- price_usd: The primary datum for your dynamic margin calculation.
- transit_days, pickup_date, delivery_date: Useful for quote promises and for penalty modeling (late delivery costs).
- source: For observability and audit: track which upstream partner generated the quote.
Practical considerations:
- When required parameters are missing, the endpoint returns HTTP 200 with { "available": false }. Treat this as a soft failure and prompt users or retry with corrected params.
- Enrich quotes by incorporating contemporaneous diesel from /fuel-prices and trend-normalizing against /historical series.
- Attach port congestion or disruption modifiers when the lane involves drayage to/from major ports.
3) Port Congestion: GET /port-congestion
Purpose: Provide an actionable congestion indicator for major global ports derived from IMF PortWatch (AIS-based) data. This is a lagged approximation of activity, not live queue/wait time. For pricing, treat it as a probability-of-delay proxy rather than a guarantee of real-time slowness.
Key parameters:
- port: Name or LOCODE (e.g., USLAX).
- country: Country name or ISO3 (e.g., USA).
- region: Continent or macro-region filter.
- congestion: Optional severity filter (low, moderate, high).
curl -H "X-API-Key: YOUR_API_KEY" \
"https://freightpulsehq.com/api/v1/port-congestion?port=USLAX"
Sample response:
{
"success": true,
"data": {
"results": [
{
"port": "Los Angeles-Long Beach",
"locode": "US LAX",
"country": "United States",
"congestion": "moderate",
"as_of": "2026-08-14",
"metrics": {
"recent_avg_portcalls_per_day": 8.7,
"baseline_avg_portcalls_per_day": 10.2,
"ratio_vs_baseline": 0.85
}
}
]
}
}
- congestion: A coarse label (low/moderate/high) derived from activity ratio; this is the simplest feature to feed into a pricing multiplier.
- as_of: Data lags by ~6–7 days. Store this date for transparency in your pricing UI and internal logs.
- ratio_vs_baseline: Numerical anchor for feature engineering. For example, scale a congestion factor when ratio dips below 0.9.
Usage tips:
- Pair /port-congestion with /historical port series for trend-aware pricing updates.
- When drayage touches a monitored port, add a congestion modifier that scales with ratio_vs_baseline and decays over time as fresh snapshots arrive.
- Display the lag note in customer-facing UIs to avoid confusion with live AIS wait times.
4) Carrier Verification: GET /carriers
Purpose: Validate US trucking carriers (FMCSA SAFER) and ocean NVOCC/OTI entities (FMC directories). Avoid quoting or tendering with carriers that are inactive or lack required credentials. Air is supported as a type but returns available:false at the moment.
Key parameters:
- q: Required search term (DOT number, carrier name, FMC org number, or name).
- type: trucking (default), ocean, or air.
curl -H "X-API-Key: YOUR_API_KEY" \
"https://freightpulsehq.com/api/v1/carriers?q=54283"
Sample response:
{
"success": true,
"data": {
"type": "trucking",
"query": "54283",
"results": [
{
"dot_number": 54283,
"legal_name": "SWIFT TRANSPORTATION COMPANY OF ARIZONA LLC",
"status": "active",
"safety_rating": "S",
"drivers": 12883,
"address": {
"city": "Phoenix",
"state": "AZ",
"country": "US"
}
}
]
}
}
- status: Gate your auto-tendering flow; block non-active records.
- safety_rating: Feed risk-weighting in your pricing engine; price-sensitive customers may accept a discount for lower-rated carriers, or you may enforce stricter thresholds.
- drivers: Capacity proxy that can be cross-referenced against your lane density.
- address: Helps support compliance documentation and factoring partner checks.
Implementation tips:
- Enforce a carrier verification step just before quote confirmation; show validation results inline to operators.
- Cache lookups by DOT number for short periods to reduce repeated requests during batch quoting.
5) Disruption Alerts: GET /disruptions
Purpose: Identify active natural hazards from GDACS, USGS, and NOAA/NWS. Use these alerts to re-price risk on affected lanes, increase buffer times, or suggest alternate routes. Note: This feed covers natural hazards only—no labor actions or geopolitical events.
Key parameters:
- type: cyclone, earthquake, flood, volcano, drought, wildfire, severe_weather.
- severity: low, moderate, high.
- country: Filter by country.
- port: Filter by port proximity (300km general; 100km for US weather).
curl -H "X-API-Key: YOUR_API_KEY" \
"https://freightpulsehq.com/api/v1/disruptions?port=USLAX&severity=high"
Sample response:
{
"success": true,
"data": {
"results": [
{
"id": "gdacs:TC:1001305",
"type": "cyclone",
"severity": "moderate",
"title": "Tropical Cyclone SAUDEL-26",
"country": "Japan",
"starts_at": "2026-08-18T12:00:00+00:00",
"source": "GDACS"
}
]
}
}
- severity: Map to risk multipliers or trigger human-in-the-loop review for high severity.
- port: Use to geo-fence alerts to your port-adjacent moves.
- starts_at: Useful for scheduling re-pricing jobs and time-bounded alerts.
Pricing heuristics:
- Add a disruption surcharge or increase your volatility buffer when severity is high near critical nodes.
- Flag quotes for manual oversight during overlapping high-severity events.
6) Historical Series: GET /historical
Purpose: Pull weekly national fuel series (diesel/gasoline) and daily port congestion series for curated major ports. This is valuable for smoothing, forecasting, and comparing a live signal to its typical range.
Key parameters:
- metric: fuel_price_diesel_national, fuel_price_gasoline_national, or port_congestion:<portid>.
- period: 30d (default), 90d, 1y.
curl -H "X-API-Key: YOUR_API_KEY" \
"https://freightpulsehq.com/api/v1/historical?metric=fuel_price_diesel_national&period=30d"
Sample response:
{
"success": true,
"data": {
"metric": "fuel_price_diesel_national",
"period": "30d",
"series": [
{ "date": "2026-07-27", "value": 5.257 },
{ "date": "2026-08-03", "value": 5.343 }
]
}
}
- series[].value: Feed into EWMA/EMA smoothing, rolling averages, or z-score outlier flags.
- metric/period: Useful for building a typed datastore keyed by metric identifier for feature reuse across models.
Best practices:
- Use a rolling window (e.g., 30d) to stabilize moment-in-time volatility.
- Compare current /fuel-prices against 30/90-day bands; scale surcharges based on deviations.
- Apply similar trend logic to port congestion to prevent overreacting to a single lagged snapshot.
Error Handling and Response Envelope
All FreightPulse responses share a consistent top-level shape. Successful calls include success: true and a data object. Errors return success: false with a human-readable error message. Incorporate this pattern to simplify your client handling and observability.
{
"success": false,
"error": "Human-readable message."
}
Implementation tips:
- Treat non-200 transport errors with automatic retries and exponential backoff.
- For 4xx responses, inspect the error message to correct input (e.g., missing params).
- Log the error object and the request params for reproducibility and faster root-cause analysis.
End-to-End Implementation: From Data Signals to Price Output
Let’s wire these endpoints into a robust, production-ready pipeline that can ingest signals, apply business logic, and output optimized quotes with transparent justifications and audit trails.
High-Level Flow
- Fetch anchoring costs: /fuel-prices supplies diesel baselines.
- Obtain a live lane quote: /freight-rates returns the market price for the lane and service.
- Apply congestion context: If drayage or port adjacency exists, call /port-congestion (and optionally /historical for the given port).
- Inject risk data: /disruptions scopes to ports (or countries) tied to your lane; increase precautionary buffers.
- Verify carriers: /carriers checks that tender candidates meet compliance and safety criteria before finalizing.
- Finalize and store: Produce a quote with margin, surcharges, time validity, and underlying datasets’ timestamps for audit.
Example: JavaScript (Node.js) Orchestration
// Pseudocode-level example: orchestrate a price for NY 10001 to CA 90210
const BASE = "https://freightpulsehq.com/api/v1";
const HEADERS = { "X-API-Key": process.env.FP_KEY };
async function getJson(url) {
const res = await fetch(url, { headers: HEADERS });
const body = await res.json();
if (!body.success) throw new Error(body.error || "Unknown API error");
return body.data;
}
async function priceLane(originZip, destZip) {
// 1) Fuel anchor
const fuel = await getJson(`${BASE}/fuel-prices`);
// 2) Live rate
const rate = await getJson(`${BASE}/freight-rates?mode=trucking&origin_zip=${originZip}&destination_zip=${destZip}`);
// 3) Optional port context (if lane involves LA/LB drayage heuristics)
const port = await getJson(`${BASE}/port-congestion?port=USLAX`);
// 4) Disruptions near LA/LB
const disruptions = await getJson(`${BASE}/disruptions?port=USLAX&severity=high`);
// 5) Carrier vetting (example DOT)
const carriers = await getJson(`${BASE}/carriers?q=54283`);
// Combine signals into a price
const diesel = fuel.data.diesel.national_average;
const congestionRatio = port.results?.[0]?.metrics?.ratio_vs_baseline ?? 1.0;
let base = rate.price_usd;
// Example surcharge logic
const fuelSurcharge = Math.max(0, (diesel - 3.00) * 0.15 * 100); // illustrative only
const congestionAdj = congestionRatio < 0.9 ? (1 + (0.9 - congestionRatio)) : 1.0;
const disruptionAdj = disruptions.results?.length ? 1.05 : 1.0;
const finalPrice = Math.round(base * congestionAdj * disruptionAdj + fuelSurcharge);
return {
requested_lane: { originZip, destZip },
base,
adjustments: {
fuelSurcharge,
congestionAdj,
disruptionAdj
},
finalPrice,
evidence: {
fuelTimestamp: fuel.timestamp,
ratePickup: rate.pickup_date,
portAsOf: port.results?.[0]?.as_of,
carrierExample: carriers.results?.[0]?.dot_number
}
};
}
This orchestration demonstrates a few principles:
- Use the same response envelope to simplify error handling and keep code clean.
- Tie every price to evidence timestamps for auditability and customer trust.
- Keep business logic transparent: isolate multipliers and surcharges so product managers and ops teams can iterate quickly.
Expanded Endpoint Coverage with Complete Examples
Below are additional cURL and JSON examples for each endpoint, with deeper interpretation so you can drop data directly into a model or UI component.
Fuel Prices: Diesel and Gasoline Anchors
Use case: Weekly recalibration of surcharge tables and daily variance alerts to ops teams.
curl -s -H "X-API-Key: YOUR_API_KEY" \
"https://freightpulsehq.com/api/v1/fuel-prices" | jq
Expanded field usage:
- diesel.yoy_change_percent: Macro trend intended for board-level reporting and strategy; treat this separately from day-to-day pricing.
- gasoline.national_average: Useful for LTL and parcel-adjacent or last-mile models if you broaden scope beyond FTL.
Freight Rates: Lane-Specific Quotes
Use case: Render an instant quote in your TMS UI and pre-compute several alternates (different pickup dates, weights) to surface tradeoffs.
curl -H "X-API-Key: YOUR_API_KEY" \
"https://freightpulsehq.com/api/v1/freight-rates?mode=trucking&origin_zip=60601&destination_zip=77001&pickup_date=2026-08-25&total_weight_lb=38500"
Interpreting outcomes:
- If available is false, re-ask for mandatory fields or reduce specificity and try again.
- Transit and delivery dates can feed SLA promises in your quoting UI; display confidence bands based on known congestion signals.
Port Congestion: Activity Ratio and Severity
Use case: Inform pricing and ETA buffers for drayage legs and ocean-involved intermodal shipments.
curl -H "X-API-Key: YOUR_API_KEY" \
"https://freightpulsehq.com/api/v1/port-congestion?country=United%20States&congestion=high"
This query narrows down US ports at high congestion levels. In a UI, you could:
- Add an icon or color badge near the port name with the severity.
- Show ratio_vs_baseline to give users quantitative context for “how high” congestion is.
Carriers: FMCSA and FMC Lookups
Use case: Auto-vetting carriers before rate confirmation; implementing must-pass rules (active status, acceptable safety rating).
curl -H "X-API-Key: YOUR_API_KEY" \
"https://freightpulsehq.com/api/v1/carriers?type=ocean&q=Evergreen"
Interpret results:
- For ocean, you’ll receive OTI/NVOCC directory information to validate legal entities and permissions.
- Air lookups return available:false today; design your UI to gracefully handle that.
Disruptions: Natural Hazards at Scale
Use case: Early reroute suggestions or dynamic pricing protection when severe weather targets a customer’s origin or destination.
curl -H "X-API-Key: YOUR_API_KEY" \
"https://freightpulsehq.com/api/v1/disruptions?type=severe_weather&country=US"
Operationalization:
- For high-severity results near your target ZIP or port, adjust your margin or surface a “risk-adjusted ETA” with additional buffer.
- Send alerts to account managers so they can proactively communicate with shippers.
Historical: Time Series for Stabilization
Use case: Price smoothing and anomaly detection for both fuel and port activity.
curl -H "X-API-Key: YOUR_API_KEY" \
"https://freightpulsehq.com/api/v1/historical?metric=port_congestion:USLAX&period=90d"
Practical usage:
- Compute a volatility score (e.g., rolling standard deviation) and scale your quote buffers accordingly.
- Visualize series in your ops dashboard to help non-technical users understand why quotes change over time.
Reliability, Performance, and Governance Best Practices
Building a pricing engine is as much about reliability and observability as it is about fetching data. Here are platform-agnostic best practices—adapt them to your stack so your FreightPulse integration is robust and governed.
Resilience Patterns
- Retries and backoff: Use exponential backoff with jitter on transient network failures. Cap retries to keep SLAs tight and provide graceful fallbacks (e.g., use cached data).
- Circuit breakers: If upstream latency or error rates spike, short-circuit requests for a cooldown period and serve the most recent cached snapshot with a “stale-as-of” banner in your UI.
- Health checks: Build a synthetic probe that regularly checks a lightweight endpoint (e.g., /fuel-prices) and logs latencies to your monitoring system. Alert on latency SLO breaches.
Latency and Routing
- Regional routing: Host your pricing microservice close to your primary user base to reduce network RTTs. Co-locate caches and your application servers.
- Batching where sensible: Group related historical fetches into adjacent calls to amortize overhead; keep hot-path latency tight by deferring non-critical telemetry to background jobs.
Observability and Audits
- Per-request logging: Store endpoint path, query params, timestamps, and top-level response metadata (e.g., success) for traceability.
- Audit trails: Every price output should tie back to the exact data snapshots used—store timestamps and key values like diesel national_average, congestion ratio, and disruption IDs.
- Dashboards: Build panels that track moving averages for response latency and error rates across endpoints (/freight-rates, /fuel-prices, etc.).
Governance Controls
- Per-app keys and roles: If you run multiple quoting apps (internal TMS, partner portal, public widget), segregate credentials per app. This isolates blast radius and improves forensic clarity.
- Data locality and privacy: Ensure logs with carrier PII (e.g., business addresses) follow your data residency and retention policies.
- Change management: When you update pricing formulas, version them and annotate dashboards so operators can link margin shifts to code deployments.
Python and JavaScript Client Examples
Below are concise examples of calling FreightPulse endpoints from Python and JavaScript. Use these as building blocks for your orchestrators.
Python: Fetch and Combine Fuel + FTL Quote
import os, requests, math
BASE = "https://freightpulsehq.com/api/v1"
HEADERS = { "X-API-Key": os.environ.get("FP_KEY", "") }
def get(path, params=None):
r = requests.get(f"{BASE}{path}", headers=HEADERS, params=params, timeout=15)
r.raise_for_status()
body = r.json()
if not body.get("success", False):
raise RuntimeError(body.get("error", "Unknown API error"))
return body["data"]
def dynamic_price(origin_zip, dest_zip):
fuel = get("/fuel-prices")
rate = get("/freight-rates", { "mode": "trucking", "origin_zip": origin_zip, "destination_zip": dest_zip })
diesel = fuel["data"]["diesel"]["national_average"]
base = rate["price_usd"]
fuel_surcharge = max(0.0, (diesel - 3.00) * 0.15 * 100.0)
final = math.ceil(base + fuel_surcharge)
return {
"base_rate": base,
"fuel_surcharge": fuel_surcharge,
"final_quote": final,
"fuel_timestamp": fuel["timestamp"],
"pickup": rate.get("pickup_date"),
"delivery": rate.get("delivery_date")
}
print(dynamic_price("10001", "90210"))
JavaScript: Risk-Adjusted Pricing with Port and Disruption Signals
async function riskAdjustedPrice(origin, dest, portLocode) {
const BASE = "https://freightpulsehq.com/api/v1";
const headers = { "X-API-Key": process.env.FP_KEY };
const get = async (url) => {
const r = await fetch(url, { headers });
const b = await r.json();
if (!b.success) throw new Error(b.error || "Upstream error");
return b.data;
};
const fuel = await get(`${BASE}/fuel-prices`);
const rate = await get(`${BASE}/freight-rates?mode=trucking&origin_zip=${origin}&destination_zip=${dest}`);
const port = await get(`${BASE}/port-congestion?port=${portLocode}`);
const dis = await get(`${BASE}/disruptions?port=${portLocode}&severity=high`);
const diesel = fuel.data.diesel.national_average;
const base = rate.price_usd;
const congestionRatio = port.results?.[0]?.metrics?.ratio_vs_baseline ?? 1.0;
const congestionAdj = congestionRatio < 0.95 ? (1 + (0.95 - congestionRatio) * 0.5) : 1;
const disruptionAdj = dis.results?.length ? 1.03 : 1;
const fuelSurcharge = Math.max(0, (diesel - 3.2) * 0.14 * 100);
const final = Math.round(base * congestionAdj * disruptionAdj + fuelSurcharge);
return { base, fuelSurcharge, congestionAdj, disruptionAdj, final };
}
Real-World Use Cases You Can Ship This Week
1) Fuel Surcharge Calculator for a 3PL
Pull the latest diesel from /fuel-prices and compare to a 30/90-day baseline from /historical. Compute surcharges dynamically by lane and display them alongside live quotes from /freight-rates. Operators can toggle between a “current” surcharge and a “stabilized” surcharge to reduce customer whiplash.
Endpoints used: /fuel-prices, /freight-rates, /historical.
2) Port-Congestion-Aware Pricing for a Freight Forwarder
When quoting shipments involving Los Angeles-Long Beach, call /port-congestion with port=USLAX and fetch /historical for trend context. If ratio_vs_baseline is below 0.9, apply a moderate congestion factor and extend lead time disclosures in your UI. Tie the “as_of” field to a tooltip explaining the 6–7 day lag so customers understand the nature of the signal.
Endpoints used: /port-congestion, /historical.
3) Carrier Vetting Widget Inside a TMS
Before confirming a quote, the TMS runs /carriers?q=DOT_NUMBER and displays legal_name, status, safety_rating, and drivers. If status != active or safety_rating is unacceptable, the system blocks progression or suggests alternatives. This reduces compliance risk and protects margins from preventable failure-to-perform events.
Endpoints used: /carriers.
4) Disruption-Aware Repricing Bot
A background worker polls /disruptions filtered by port and severity, then re-prices affected quotes by adding a small risk buffer. When a cyclone near a key Asian port escalates, the bot posts an alert to Slack with impacted quotes and a suggested repricing action for operator review.
Endpoints used: /disruptions, optionally /freight-rates for rechecks.
5) Market Intelligence Dashboard for Analysts
Analysts combine /historical diesel series with /historical port congestion curves for major ports to visualize correlations between fuel shocks and port activity. Overlay /freight-rates snapshots to test elasticity hypotheses and adjust strategic pricing guidelines.
Endpoints used: /historical, /fuel-prices, /freight-rates, /port-congestion.
FAQ
How often do FreightPulse fuel prices update?
Fuel prices reflect EIA updates and include national and regional breakdowns. You’ll also get 30/90-day averages for context, so your engine can stabilize surcharges even when the weekly refresh moves sharply.
Can I look up ocean carriers as well as trucking carriers?
Yes. The /carriers endpoint supports both trucking (FMCSA SAFER) and ocean NVOCC/OTI lookups (FMC). Use type=trucking or type=ocean with q set to a DOT number, org number, or name.
Does the port congestion data reflect real-time vessel wait times?
No. Port congestion is a lagged approximation derived from AIS-based activity (7-day average vs a 90-day baseline), with data typically lagging by ~6–7 days. It’s a practical indicator for pricing and planning—not a live queue length or real-time wait time metric.
Can I get disruption alerts near a specific port?
Yes. Use /disruptions with the port parameter to filter alerts by proximity (300 km globally, 100 km for US weather). Combine this with severity filtering to target only impactful events.
What happens if I miss a required parameter on a request?
For most endpoints you’ll receive an error object with success=false and a descriptive message. For /freight-rates, missing required parameters may return a 200 status with available=false—treat this as a soft validation failure and correct your inputs.
Deep Dive: Field-by-Field JSON Reference with Practical Uses
To make integration as frictionless as possible, here is an expanded, end-to-end set of complete JSON examples spanning multiple endpoints along with practical uses per field. Keep these handy when implementing your models and UI layers.
Fuel Prices Example (Complete)
{
"success": true,
"data": {
"timestamp": "2026-07-30T12:00:00Z",
"source": "EIA (U.S. Energy Information Administration)",
"currency": "USD",
"unit": "gallon",
"data": {
"diesel": {
"national_average": 3.847,
"change_week": -0.023,
"change_percent": -0.6,
"regions": {
"east_coast": 3.912,
"midwest": 3.756,
"gulf_coast": 3.623,
"rocky_mountain": 3.891,
"west_coast": 4.456,
"california": 4.892
},
"historical": {
"30d_avg": 3.82,
"90d_avg": 3.75,
"yoy_change_percent": -8.2
}
},
"gasoline": {
"national_average": 3.156,
"historical": {
"30d_avg": 3.1,
"90d_avg": 3.05,
"yoy_change_percent": 1.1
}
}
}
}
}
- currency and unit: Use for multi-currency systems and unit conversions; ensure downstream computations don’t assume a different base.
- diesel.historical.*: Use to determine if your current surcharge should be capped or floor-limited based on recent volatility.
Freight Rates Example (Complete)
{
"success": true,
"data": {
"mode": "trucking",
"service": "FTL (53' dry van)",
"source": "Warp",
"price_usd": 7207.92,
"transit_days": 4,
"pickup_date": "2026-08-24",
"delivery_date": "2026-08-28"
}
}
- transit_days: Combine with disruption and port signals to produce a confidence interval. For example, add +/- 1 day when moderate congestion is present.
Port Congestion Example (Complete)
{
"success": true,
"data": {
"results": [
{
"port": "Los Angeles-Long Beach",
"locode": "US LAX",
"country": "United States",
"congestion": "moderate",
"as_of": "2026-08-14",
"metrics": {
"recent_avg_portcalls_per_day": 8.7,
"baseline_avg_portcalls_per_day": 10.2,
"ratio_vs_baseline": 0.85
}
}
]
}
}
- metrics.recent_avg_portcalls_per_day: Useful for analysts who want absolute values; for pricing, the ratio is typically a better feature.
- as_of: Show to users to clarify the lag and avoid confusion with real-time vessel tracking.
Disruptions Example (Complete)
{
"success": true,
"data": {
"results": [
{
"id": "gdacs:TC:1001305",
"type": "cyclone",
"severity": "moderate",
"title": "Tropical Cyclone SAUDEL-26",
"country": "Japan",
"starts_at": "2026-08-18T12:00:00+00:00",
"source": "GDACS"
}
]
}
}
- id: Persist in your database for de-duplication and longitudinal analyses (e.g., how your pricing model performed through a cyclone season).
Carriers Example (Complete)
{
"success": true,
"data": {
"type": "trucking",
"query": "54283",
"results": [
{
"dot_number": 54283,
"legal_name": "SWIFT TRANSPORTATION COMPANY OF ARIZONA LLC",
"status": "active",
"safety_rating": "S",
"drivers": 12883,
"address": {
"city": "Phoenix",
"state": "AZ",
"country": "US"
}
}
]
}
}
- legal_name: Display this in your TMS and on shipper-facing docs to ensure correct entity representation.
- drivers: Pair with your own historical tender acceptance to see if larger carriers perform better on certain lanes.
Historical Example (Complete)
{
"success": true,
"data": {
"metric": "fuel_price_diesel_national",
"period": "30d",
"series": [
{ "date": "2026-07-27", "value": 5.257 },
{ "date": "2026-08-03", "value": 5.343 }
]
}
}
- series[].date: Use as a partition key in your data lake to accelerate analytical queries and cache invalidation.
Designing the Pricing Formula: Putting Signals to Work
Your pricing formula should be transparent, testable, and easy to iterate. Here’s a blueprint pattern:
- Base = /freight-rates.price_usd
- Fuel Surcharge = f(diesel.national_average, diesel.30d_avg), with guardrails to avoid overreacting to single-week spikes.
- Congestion Adjustment = g(ratio_vs_baseline) with thresholds (e.g., < 0.9 moderate, < 0.8 high) and decaying memory as newer snapshots arrive.
- Disruption Adjustment = h(severity, proximity), often a small percentage increase except during high-severity near-node events.
- Compliance Gate: carrier.status must be active; safety_rating must meet policy; otherwise reject or route to manual review.
To keep this process resilient:
- Feature flags: Allow toggling congestion or disruption adjustments on or off for A/B testing.
- Monitoring: Track lift from adjustments versus realized on-time performance to calibrate multipliers.
- Explainability: Store exact component contributions and surface them in your UI so reps can explain quotes to shippers.
Troubleshooting and Performance Tips
- Common 422 errors: Usually missing query parameters like q on /carriers or origin_zip/destination_zip on /freight-rates. Validate inputs client-side before sending.
- Handling “available:false”: For /freight-rates, this is typically a soft validation hint. Re-prompt users or default missing fields and try again.
- Caching strategy: Cache stable signals (fuel, historical) longer than volatile ones (freight rates, disruptions). Use ETags or timestamps where applicable.
- Concurrency: Fan out independent requests (fuel, disruptions, congestion) concurrently to minimize end-to-end latency.
- Timeouts: Set client timeouts and fail gracefully with stored snapshots to keep your quoting UI responsive under degraded network conditions.
Conclusion + CTA
Modern freight pricing demands current market rates, fuel context, operational risk signals, and compliance checks—delivered in a cohesive, reliable workflow. With FreightPulse, you can collapse five separate data sources into a single, developer-friendly API and ship dynamic pricing engines that are faster to build, easier to govern, and more transparent to operate.
From pulling live US FTL quotes and EIA diesel benchmarks to tracking lagged port congestion and natural-disruption alerts near critical nodes, the platform equips your models with the signals that matter. You get consistent JSON responses, straightforward filtering, and an integration path that scales from a proof of concept to production in days—not months.
Build your dynamic pricing engine today. Explore the endpoints, plug in the examples from this guide, and iterate confidently with clean, auditable inputs. Try FreightPulse for free and turn fragmented logistics data into real-time pricing intelligence your customers can trust.