You’re building a multitenant supply chain SaaS and need a clean way to contract your external data, trace it end-to-end per tenant, and bill accurately for the API work each customer triggers. By the end of this post, you’ll be able to define data contracts for FreightPulse responses, attach lineage and tenant context to every call, and wire usage metering that cleanly separates and invoices tenants without crosstalk.
Introduction
Multitenant logistics platforms constantly ingest third-party data: diesel price benchmarks for fuel surcharges, live truckload quotes, carrier verifications, port congestion signals, and disruption alerts. Without rigorous data contracts and lineage, those feeds morph into brittle glue code, unexplainable totals at billing time, and the occasional tenant data leak across environments.
FreightPulse consolidates core logistics intelligence behind one REST API. That helps, but it doesn’t automatically give you tenant isolation or audit-grade usage tracking. The key is to wrap FreightPulse with explicit data contracts and lineage hooks that turn every response into a typed payload with provenance, versioning, and cost attribution. The result: reliable pricing calculators, clean tenant boundaries, and a bill your finance team and customers can both verify.
Why FreightPulse
FreightPulse combines multiple operations-critical data surfaces behind one API. For multitenant SaaS, that means fewer connector types to govern and a single integration surface to contract and monitor. Concretely:
- Unified schema reduces contract sprawl. Fuel prices (EIA), FTL quotes (via Warp), port congestion (IMF PortWatch), carrier lookups (FMCSA/FMC), and natural-disruption alerts are returned in a consistent JSON envelope, so your ingestion contract can be standardized.
- Lower operational coupling. You don’t have to stitch five feeds (EIA, AIS-derived congestion, FMCSA, NVOCC directory, weather/disaster alerts) with different auth models and timestamps. One authentication header and one error shape simplify your lineage and error dashboards.
- Deterministic field meanings. Responses include clear units (USD, gallon) and ISO timestamps; congestion is explicitly a 7-day average versus a 90-day baseline with a documented data lag. This makes contracts defensible and lineage less ambiguous.
- Faster tenant onboarding. With one provider, you can spin up tenant-scoped usage meters and cache layers around a handful of endpoints instead of re-implementing quotas and retries per data vendor.
Quick Start
FreightPulse is a REST API with a single base URL and an authentication header. Unauthenticated requests are allowed in limited quantities for exploration, but production services should send an API key.
- Base URL: https://freightpulsehq.com/api/v1
- Authentication: X-API-Key: YOUR_API_KEY
- Response envelope: {"success": true|false, "data": {...}, "error": "message"}
First request: read national and regional diesel/gasoline benchmarks from EIA via FreightPulse. This is the backbone for a fuel-surcharge engine and a great example to define your first data contract.
curl -s -H "X-API-Key: YOUR_API_KEY" "https://freightpulsehq.com/api/v1/fuel-prices"
Example JSON response (values are illustrative but use the documented fields):
{
"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
}
}
}
}
}
What to read and store:
- timestamp: ISO 8601 UTC time for the dataset snapshot.
- currency and unit: keep these to avoid math mistakes in downstream billing and surcharge formulas.
- diesel.national_average and diesel.regions.*: primary rate drivers for surcharge contracts per tenant.
- historical.*: cache for trend charts; these are averages you can use to smooth pricing volatility.
Core Endpoints
This section shows how to build durable data contracts and lineage around three common logistics capabilities while highlighting the key fields that affect tenant billing and isolation.
1) Fuel Benchmarks for Surcharges
Endpoint: GET /fuel-prices
Key params: none
Sample request:
curl -s -H "X-API-Key: YOUR_API_KEY" "https://freightpulsehq.com/api/v1/fuel-prices"
Response fields to contract:
- data.diesel.national_average (USD per gallon)
- data.diesel.regions.* (PADD regional USD per gallon)
- data.gasoline.national_average (if your product surcharges gas fleets)
- timestamp (UTC)
Notes for lineage:
- Record the endpoint, the exact query (no params here), response timestamp, and your ingest time.
- Attach tenant_id and use-case tag (e.g., “fuel_surcharge_calc”).
- Cache for at least a day if your business rules allow; weekly changes are available as change_week and change_percent.
2) Live US FTL Freight Quotes
Endpoint: GET /freight-rates
Key params:
- mode: trucking | ocean | air (default trucking)
- origin_zip, destination_zip (required for trucking)
- pickup_date (optional), qty, total_weight_lb (optional)
Sample request (FTL dry van):
curl -s -H "X-API-Key: YOUR_API_KEY" "https://freightpulsehq.com/api/v1/freight-rates?mode=trucking&origin_zip=10001&destination_zip=90210"
Example 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"
}
}
Contract and lineage tips:
- Persist mode, service, price_usd, transit_days, pickup_date, delivery_date.
- Also store the input lane (origin_zip, destination_zip) and the time you requested the quote.
- Missing required params returns HTTP 200 with "available": false rather than an error. Meter the call anyway for usage, but mark result_available=false for billing transparency.
3) Port Congestion (Lagged Approximation)
Endpoint: GET /port-congestion
Key params:
- port (name or LOCODE, e.g., USLAX)
- country or region (optional, filter)
- congestion: low | moderate | high (optional)
Sample request:
curl -s -H "X-API-Key: YOUR_API_KEY" "https://freightpulsehq.com/api/v1/port-congestion?port=USLAX"
Example 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
}
}
]
}
}
Important constraints to codify in your contract:
- Data lag: approximately 6–7 days. It is a 7-day average vs a 90-day baseline, not live AIS tracking.
- Primary signal: ratio_vs_baseline and congestion label. Use them for capacity or dwell proxies in planning dashboards.
- Lineage: store port filter used, result length, and the as_of date to drive UI disclaimers.
4) Carrier Verification (FMCSA/FMC)
Endpoint: GET /carriers
Key params:
- q (query string, required for trucking/ocean)
- type: trucking | ocean | air (air returns available:false)
Sample request (trucking by DOT number):
curl -s -H "X-API-Key: YOUR_API_KEY" "https://freightpulsehq.com/api/v1/carriers?q=54283"
Example 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"
}
}
]
}
}
Contract and lineage:
- Persist legal_name, status, safety_rating, dot_number, and address.* for compliance checks.
- For auditability, keep the original query and type plus a hash of the result payload for change detection.
5) Natural-Disruption Alerts
Endpoint: GET /disruptions
Key params:
- type: cyclone | earthquake | flood | volcano | drought | wildfire | severe_weather
- severity: low | moderate | high
- country, port (optional, port filters by distance; 300km default, 100km for US weather)
Sample request (high-severity near USLAX):
curl -s -H "X-API-Key: YOUR_API_KEY" "https://freightpulsehq.com/api/v1/disruptions?port=USLAX&severity=high"
Example 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"
}
]
}
}
Contract and lineage:
- Store id, type, severity, country, starts_at. Attach your tenant shipment or port context.
- Matrices like “risk_near_port” are deterministic transformations from the result set; keep your mapping code versioned for reproducibility.
Designing Data Contracts for Multitenant Ingestion
Data contracts specify the exact fields you ingest per endpoint, their types, and the invariants you expect (units, currency, lags). With FreightPulse, all responses share a standard envelope. Your contract can standardize a few concerns across endpoints and isolate tenant-specific projections.
Recommended envelope contract for ingestion (your internal schema, not an API requirement):
{
"tenant_id": "uuid-or-slug",
"ingest_at": "2026-08-24T10:15:00Z",
"source_service": "freightpulse",
"fp_endpoint": "/fuel-prices",
"fp_request": {
"querystring": "mode=trucking&origin_zip=10001&destination_zip=90210",
"headers": ["X-Request-Id: ..."]
},
"fp_response": {
"success": true,
"data": { ... } // raw FreightPulse data block
},
"contract_version": "fuel_prices.v1",
"schema_fingerprint": "sha256:...",
"result_available": true
}
Key practices:
- Pin contract_version per data surface (e.g., fuel_prices.v1, freight_rates.v1). Only promote a new version when fields or semantics change.
- Store fp_endpoint and original querystring for replay and audit.
- Never reshape FreightPulse’s fields before persisting; derive tenant-specific projections as separate views (e.g., fuel_surcharge.v1).
Implementing Lineage and Tenant Isolation
Lineage must let you answer: which tenant triggered a call, which inputs were used, what raw outputs were returned, and which derived values fed invoices or UIs.
- Forward lineage: tenant_id → request envelope → raw response → derived tables (e.g., surcharge calc, route ETA, risk alerts).
- Backward lineage: invoice line → derived table row → raw response hash → fp_endpoint and query → tenant_id.
Isolation tips:
- Namespace storage per tenant (logical partition keys or physical datasets). Enforce tenant_id in all write/read paths.
- Cache keyed by (tenant_id, fp_endpoint, normalized_params). Even if multiple tenants request the same lane, keep separate cache records to avoid leakage in analytics or billing rollups.
- Mask or redact fields not needed for a tenant-facing feature to reduce accidental exposure in logs or UI.
Metering and billing:
- Increment a usage counter for every API attempt, including cases where "available": false is returned by /freight-rates when required params are missing.
- Classify cost centers: reference (fuel-prices, historical), transactional (freight-rates), situational (port-congestion, disruptions), compliance (carriers). This mapping helps produce tenant-facing billing narratives.
- Attach costs at event time, not batch time. Batch recomputes should read cached freightpulse responses, not refetch, to avoid double-counting.
A Small Client Example with Field-Level Validation
The following snippet fetches fuel prices and validates the currency and unit per your contract. Use the same headers and base URL for other endpoints.
# Python 3.x
import requests
from datetime import datetime
BASE_URL = "https://freightpulsehq.com/api/v1"
API_KEY = "YOUR_API_KEY"
def get_fuel_prices(tenant_id: str):
resp = requests.get(f"{BASE_URL}/fuel-prices", headers={"X-API-Key": API_KEY}, timeout=10)
payload = resp.json()
assert payload.get("success") is True, payload.get("error")
data = payload["data"]
# Contract checks
assert data["currency"] == "USD", "Unexpected currency"
assert data["unit"] == "gallon", "Unexpected unit"
ts = datetime.fromisoformat(data["timestamp"].replace("Z", "+00:00"))
diesel = data["data"]["diesel"]
national = float(diesel["national_average"])
regions = diesel["regions"]
record = {
"tenant_id": tenant_id,
"ingest_at": datetime.utcnow().isoformat() + "Z",
"fp_endpoint": "/fuel-prices",
"contract_version": "fuel_prices.v1",
"result_available": True,
"raw": payload, # keep raw for lineage
"projection": {
"timestamp": data["timestamp"],
"national_diesel_usd_per_gal": national,
"regions": regions
}
}
return record
if __name__ == "__main__":
print(get_fuel_prices("tenant_abc"))
Real-World Use Cases
- Fuel-surcharge calculator per tenant portfolio. Read /fuel-prices to anchor baseline diesel, then apply your tenant’s tariff table and lane multipliers. Persist inputs (timestamp, national/regional averages) and outputs (surcharge percent) alongside the raw FreightPulse payload to support customer disputes.
- Port risk and dwell dashboard for forwarders. Combine /port-congestion (ratio_vs_baseline, congestion label) with /disruptions filtered by port to surface capacity warnings for shipments entering a region. Show the as_of date prominently to clarify lagged nature and avoid “real-time” misinterpretations.
- Carrier onboarding gate for 3PL operations. Use /carriers with type=trucking to verify DOT status and safety_rating before assigning loads, and store a decision artifact tied to the raw response. Attach a lineage link from each load tender back to the verification event.
Practical Integration Details That Save Time
- Authentication: Send X-API-Key in every production request. Unauthenticated calls are capped; treat them as exploration only.
- Timestamps: ISO 8601 UTC strings (e.g., 2026-08-14, 2026-08-18T12:00:00Z). Normalize to UTC in storage.
- Units and currency: USD is standard; fuel unit is gallon. Persist these for every event and assert them in validation.
- Error handling: Error shape is {"success": false, "error": "..."}; also watch HTTP codes like 401, 403, 422, 429 for control flow and retry/backoff strategies.
- Caching: Fuel benchmarks are stable within the week; congestion has a 6–7 day lag; disruptions are event-driven and worth a short TTL cache by port. Cache per tenant to keep isolation unambiguous.
- Idempotency: For write-less endpoints, idempotency is a client concern. Tie each run to a deterministic request key (tenant_id + endpoint + normalized params + day bucket) to avoid double metering.
End-to-End Example: Building a Tenant-Isolated Lane Quote Service
Goal: Provide tenants with same-page live FTL quotes and a surcharge overlay, with clean lineage and itemized usage.
- Standardize the input. Contract a request DTO with tenant_id, origin_zip, destination_zip, pickup_date, and optional cargo attributes.
- Fetch the live quote. Call /freight-rates with trucking mode. Persist raw response + inputs + a hash of the raw JSON. If any required param is missing and you receive "available": false, persist that outcome for billing visibility.
- Fetch the fuel baseline. Call /fuel-prices once per day per tenant and cache, then reference the cached baseline within your quote flow to compute tenant-specific surcharge.
- Derive and store the final projection. The derived object includes price_usd, transit_days, surcharge_percent, and total_with_surcharge. Attach references to both raw ingestion records by their hashes.
- Emit usage metrics. Increment counters: freight_rates.calls, fuel_prices.cache_hits, fuel_prices.calls. Roll up by tenant_id daily.
One-Stop Historical Context
For trendlines and SLA reporting, pull historical time series directly rather than rolling your own aggregates from ad-hoc calls.
Endpoint: GET /historical
Key params:
- metric: fuel_price_diesel_national | fuel_price_gasoline_national | port_congestion:<portid>
- period: 30d | 90d | 1y
Sample request:
curl -s -H "X-API-Key: YOUR_API_KEY" "https://freightpulsehq.com/api/v1/historical?metric=fuel_price_diesel_national&period=30d"
Example 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 }
]
}
}
Contract notes:
- series.*.date is a calendar date string; treat values as daily or weekly samples depending on metric type.
- Attach the metric and period to your lineage to avoid mixing tenant charts across different lookback windows.
FAQ
How often do FreightPulse fuel prices update?
Fuel prices originate from EIA and reflect weekly benchmarks. The response includes a timestamp and fields like change_week and change_percent. Cache them prudently and display the timestamp in UI and invoices.
Can I look up ocean carriers as well as trucking carriers?
Yes. Use /carriers with type=ocean to query NVOCC/OTI entries from the FMC directory. Air returns available:false, so scope your UI accordingly.
Does the port congestion data reflect real-time vessel wait times?
No. Congestion is a lagged approximation: a 7-day average of portcalls versus a 90-day baseline, typically delayed by about 6–7 days. Use ratio_vs_baseline and the congestion label for planning, not minute-by-minute operational control.
Can I explore the API without an API key?
Yes, unauthenticated requests are allowed for limited exploration per IP. For production and consistent throughput, send the X-API-Key header.
What error shape should my client expect?
All responses share {"success": true|false, "data": {...}, "error": "..."} and standard HTTP codes such as 401, 403, 422, and 429. Log both the HTTP status and the error field to speed up troubleshooting.
Conclusion + CTA
Data contracts and lineage are the difference between a multitenant product that scales and one that’s impossible to reconcile at invoice time. By contracting FreightPulse payloads, keeping raw responses immutable, and attaching tenant context and request fingerprints, you can ship features like surcharge calculators, live quotes, and risk dashboards while maintaining strict tenant isolation and transparent billing.
FreightPulse gives your team one API surface for fuel benchmarks, live freight quotes, port congestion signals, carrier verifications, and disruption alerts. That consolidation simplifies contracts, reduces integration risk, and accelerates time to production.
FreightPulse brings these datasets together behind one REST API so you can focus on product. Try FreightPulse for free and start wiring your data contracts and lineage today.