Rate Per Mile API
Compute $/mile from total cost and miles. Returns the rate plus a comparison against the 2026 published average for LTL ($2.80/mi) or TL ($3.20/mi). JSON in, JSON out. CORS open. Free for 60 requests per hour without a key.
30-second start
POST your inputs. Get back the answer in JSON. No signup. No key required for the first 60 calls per hour per IP.
curl
curl -X POST https://www.wearewarp.com/api/v1/tools/rate-per-mile \
-H "Content-Type: application/json" \
-d '{"total_cost":1450,"miles":480,"mode":"tl"}'Or use GET with query params for one-liners:
curl GET
curl "https://www.wearewarp.com/api/v1/tools/rate-per-mile?total_cost=1450&miles=480&mode=tl"
Request
POST /api/v1/tools/rate-per-mile
LTL example:
curl
curl -X POST https://www.wearewarp.com/api/v1/tools/rate-per-mile \
-H "Content-Type: application/json" \
-d '{"total_cost":680,"miles":300,"mode":"ltl"}'Response
Every response has a data envelope (the computed result) and a meta envelope (rate limits, docs, upgrade path, attribution).
200 OK
{
"data": {
"rate_per_mile": 3.02,
"mode": "tl",
"benchmark_per_mile": 3.2,
"vs_benchmark_pct": -5.6,
"vs_benchmark_label": "below"
},
"meta": {
"request_id": "req_lzgk2zo_a1b2c3d4",
"tier": "anon",
"rate_limit": { "limit": 60, "remaining": 59, "reset_at": "2026-05-15T19:00:00.000Z" },
"docs": "https://www.wearewarp.com/developers/tools-api/rate-per-mile",
"attribution": "Powered by Warp — https://www.wearewarp.com"
}
}Code samples
JavaScript (fetch)
const res = await fetch('https://www.wearewarp.com/api/v1/tools/rate-per-mile', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({"total_cost":1450,"miles":480,"mode":"tl"}),
});
const { data, meta } = await res.json();
console.log(data.total_cost);Python (requests)
import requests
res = requests.post(
"https://www.wearewarp.com/api/v1/tools/rate-per-mile",
json={"total_cost":1450,"miles":480,"mode":"tl"},
)
data = res.json()["data"]
print(data["total_cost"])curl with sandbox key
curl -X POST https://www.wearewarp.com/api/v1/tools/rate-per-mile \
-H "Content-Type: application/json" \
-H "Authorization: Bearer wak_test_YOUR_KEY" \
-d '{"total_cost":1450,"miles":480,"mode":"tl"}'Rate limits and tiers
No tier blocks access. Hit the limit and the response includes an upgradeURL with the next tier's signup flow.
Every response includes X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset headers. The meta.rate_limit object mirrors the same values in JSON.
Rate-limited response:
429 Too Many Requests
{
"error": "Anonymous rate limit reached (60/hr). Get a free sandbox key for 1000/hr at https://www.wearewarp.com/agents/account.",
"code": "RATE_LIMITED",
"meta": { "tier": "anon", "rate_limit": { "limit": 60, "remaining": 0 }, "upgrade": "..." }
}Errors
Bad input example:
400 Bad Request
{
"error": "total_cost and miles must be greater than zero.",
"code": "BAD_INPUT",
"meta": { "request_id": "req_...", "docs": "https://www.wearewarp.com/developers/tools-api/rate-per-mile" }
}Attribution
The free tier carries an attribution request: link back to wearewarp.com from any surface that displays results from this API. A “Powered by Warp” link in your footer is enough. Live keys remove the attribution request.
Every API response includes meta.attribution so you can render the link programmatically.
How rate per mile is calculated
- Rate per mile. total_cost ÷ miles.
- Benchmark. Mode-specific 2026 published average. LTL $2.80/mi (per shipment). TL $3.20/mi.
- vs benchmark %. (rate − benchmark) ÷ benchmark × 100. Negative is below benchmark; positive is above.
Benchmarks are refreshed quarterly from public freight rate indices. They reflect averaged shipper rates, not spot or contract pricing. For LTL the benchmark assumes a standard-density palletized shipment; light/bulky freight will run higher.
Related
Get a free sandbox key
Sandbox keys take 30 seconds. No card. 1,000 calls per hour across every Warp tool API.