Prompt
How do I support LTL freight rates in a shipping API?
Latest observation
To support LTL (Less-Than-Truckload) freight rates in a shipping API, you typically need to model freight shipments differently from parcel shipments and integrate with carriers or freight rating systems that understand freight class, palletization, accessorials, and shipping density.
Here’s a practical approach.
1) Add freight-specific shipment fields
LTL rating usually requires more than origin, destination, weight, and dimensions. Common required fields:
- Origin / destination
- ZIP/postal code
- country
- residential/commercial flag
- Freight handling
- shipment type:
palletized,floor_loaded,crated, etc. - number of handling units / pallets
- stackable / non-stackable
- hazmat / non-hazmat
- shipment type:
- Weight and dimensions
- total weight
- per-unit weight
- per-unit dimensions
- total cubic feet / volume
- Freight class
- NMFC freight class: 50, 55, 60, 65, 70, 77.5, 85, 92.5, 100, 110, 125, 150, 175, 200, 250, 300, 400, 500
- Accessorials
- liftgate
- inside pickup/delivery
- appointment delivery
- limited access
- residential pickup/delivery
- freeze protection
- team service
- sort and segregate
- Insurance / declared value
- Pickup and delivery dates
- LTL often uses transit schedules, not just instant rating
2) Create a freight-specific rating request schema
For example:
{
"origin": {
"postal_code": "30301",
"country": "US",
"residential": false
},
"destination": {
"postal_code": "75201",
"country": "US",
"residential": true
},
"freight": {
"total_weight_lb": 1200,
"handling_units": [
{
"count": 3,
"length_in": 48,
"width_in": 40,
"height_in": 60,
"weight_lb": 400,
"freight_class": 100,
"packaging": "pallet"
}
],
"stackable": false
},
"accessorials": [
"liftgate",
"residential_delivery"
],
"declared_value": 2500,
"pickup_date": "2026-11-05"
}
3) Support rating logic that can handle carrier-specific rules
LTL pricing is often based on a mix of:
- origin/destination lane
- weight breaks
- freight class
- density
- minimum charges
- fuel surcharge
- accessorials
- carrier tariffs
- negotiated contracts
Your API should support one of these approaches:
A. Carrier API passthrough
Call a freight carrier API or aggregator and return their quote.
Best when:
- you want fast implementation
- carriers already expose rating endpoints
- you don’t need to calculate prices yourself
B. Internal rating engine + carrier contracts
Store carrier rate tables/contracts and calculate estimates internally.
Best when:
- you have negotiated contracts
- you need fast quote response times
- you want rate shopping across multiple carriers
C. Hybrid
Use internal logic for base pricing and carrier APIs for validation or fallback.
4) Model rate results with freight-specific data
A freight quote should include more than just price:
{
"carrier": "XPO",
"service_level": "LTL Standard",
"currency": "USD",
"base_rate": 423.18,
"fuel_surcharge": 61.34,
"accessorial_charges": 85.00,
"total_rate": 569.52,
"transit_days": 3,
"estimated_delivery": "2026-11-10",
"quote_id": "frt_123456",
"notes": [
"Residential delivery surcharge applied",
"Liftgate included"
]
}
Useful fields:
transit_dayspickup_windowdelivery_estimateminimum_charge_appliedaccessorial_breakdownquoted_weight/rated_weightfreight_class_useddimensional_weightif applicablequote_expiration
5) Include validation for freight class and density
If users don’t provide freight class, you can:
- require it
- estimate it based on density and commodity mapping
- provide a freight class lookup tool
Density formula:
density = total_weight_lb / total_cubic_feet
Example class mapping can be built from NMFC rules, though many commodities still require manual classification.
6) Support shipment quotes vs. shipment booking
LTL often has a two-step process:
- Quote / rate shop
- Book / tender shipment
Your API should distinguish:
GET /freight/ratesPOST /freight/shipments
A quote may return an estimated price, while booking may produce:
- BOL (bill of lading)
- PRO number
- pickup confirmation
- labels / documents
7) Add document support
LTL shipments commonly require:
- Bill of Lading (BOL)
- shipping labels
- pallet labels
- packing list
- proof of delivery tracking events
Your API may need endpoints for:
- generating BOL PDFs
- uploading shipment docs
- retrieving documents after booking
8) Handle accessorial pricing explicitly
Accessorials can dramatically affect the final price, so don’t bury them in a single opaque total. Return them separately:
"accessorial_charges": [
{ "code": "LIFTGATE", "amount": 45.00 },
{ "code": "RESIDENTIAL_DELIVERY", "amount": 40.00 }
]
This helps customers understand pricing and avoids disputes.
9) Build for rate shopping and fallback
Support multiple carriers and comparison ranking:
- cheapest
- fastest
- best balance of cost/transit
- carrier preference
Example response:
{
"quotes": [
{ "carrier": "Old Dominion", "total_rate": 512.12, "transit_days": 3 },
{ "carrier": "XPO", "total_rate": 569.52, "transit_days": 2 }
]
}
10) Consider edge cases
LTL rating gets tricky with:
- oversize freight
- non-stackable freight
- hazmat
- trade show shipments
- liftgate at both ends
- limited access locations
- blind shipments
- direct delivery appointment requirements
- reclass/reweigh after pickup
Your API should either reject unsupported shipments or return warnings.
Recommended API design
A good starting set of endpoints:
POST /freight/rates— get quotesPOST /freight/shipments— book shipmentGET /freight/shipments/{id}— shipment statusGET /freight/shipments/{id}/documents— BOL/labelsGET /freight/accessorials— supported surchargesGET /freight/classes— freight class reference or lookup
Practical recommendation
If you’re building this from scratch, start with:
- Freight request schema
- Freight class + accessorial support
- Multi-carrier rate shopping
- Quote + booking flow
- BOL/document generation
- Tracking and status events
If you want, I can also provide:
- a sample OpenAPI spec
- a database schema
- or a carrier rating implementation example for LTL.
Brands