Skip to main content

Overview

Motion is a drop-in replacement for the Google Routes API that adds segment-level physics enrichment for heavy freight. Every route step includes grade, curvature, fuel burn, zone awareness, and road classification - computed from real USGS elevation data and road geometry. It exposes two interfaces to the same routing engine:

Endpoints

Google-Compatible

MethodEndpointDescription
POST/directions/v2:computeRoutesCompute a route synchronously (Google Routes API format)

Route Management

MethodEndpointDescription
POST/v1/routesCreate a route (returns immediately or asynchronously)
GET/v1/routes/{route_id}Retrieve a route by ID
DELETE/v1/routes/{route_id}Delete a route
GET/v1/routes/{route_id}/telemetryGet segment-level telemetry data

Enrichment

Every route step is enriched with physics data computed from elevation models, road geometry, and vehicle parameters:
FieldDescription
gradePercentRoad grade derived from USGS elevation data
curvatureDegreesPerKmBearing change per kilometer
fuelBurnLitersFuel consumption estimate using road-load equations
zoneFlagsSchool zone and residential area detection
speedLimitKmhPosted speed limit
roadClassRoad classification (motorway, primary, residential, etc.)

Vehicle Presets

Two built-in presets are available. All parameters can be individually overridden in the request.
PresetWeightDimensions (L × W × H)
SEMI_TRAILER36,000 kg21.6 × 2.6 × 4.1 m
BOX_TRUCK12,000 kg10.0 × 2.4 × 3.5 m

Routing Profiles

Profiles control the relative weight of each enrichment factor:
ProfileFuelGradeZone
balanced1.01.01.0
fuel_optimal2.01.50.5
time_optimal0.30.30.3
fatigue_aware0.81.01.5

Errors

All error responses use a consistent structure:
{
  "error": {
    "type": "invalid_request_error",
    "code": "unsupported_waypoint_type",
    "message": "Address and placeId waypoints are not supported; use latLng coordinates.",
    "param": "origin"
  }
}
Error typeDescription
invalid_request_errorThe request was malformed or missing required fields
routing_errorThe routing engine could not compute a route
rate_limit_errorRate limit exceeded (60 requests/min per IP)
api_errorAn internal server error occurred
enrichment_errorEnrichment data could not be computed
Rate-limited responses include X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset headers.

Idempotency

POST /v1/routes accepts an Idempotency-Key header for safe retries. Requests with the same key and body return a cached response. Reusing a key with a different body returns 422.