Skip to main content
POST
/
directions
/
v2:computeRoutes
curl --request POST \
  --url http://localhost:8000/directions/v2:computeRoutes \
  --header 'Content-Type: application/json' \
  --data '
{
  "origin": {
    "location": {
      "latLng": {
        "latitude": 41.878,
        "longitude": -87.636
      }
    }
  },
  "destination": {
    "location": {
      "latLng": {
        "latitude": 41.705,
        "longitude": -87.613
      }
    }
  }
}
'
{
  "routes": [
    {
      "routeLabels": [
        "DEFAULT_ROUTE"
      ],
      "legs": [
        {
          "distanceMeters": 123,
          "duration": "<string>",
          "staticDuration": "<string>",
          "polyline": {
            "encodedPolyline": "<string>"
          },
          "startLocation": {
            "latLng": {
              "latitude": 41.878,
              "longitude": -87.636
            }
          },
          "endLocation": {
            "latLng": {
              "latitude": 41.878,
              "longitude": -87.636
            }
          },
          "steps": [
            {
              "distanceMeters": 123,
              "staticDuration": "28s",
              "polyline": {
                "encodedPolyline": "<string>"
              },
              "startLocation": {
                "latLng": {
                  "latitude": 41.878,
                  "longitude": -87.636
                }
              },
              "endLocation": {
                "latLng": {
                  "latitude": 41.878,
                  "longitude": -87.636
                }
              },
              "navigationInstruction": {
                "maneuver": "DEPART",
                "instructions": "<string>"
              },
              "travelMode": "DRIVE",
              "enrichment": {
                "gradePercent": 2.5,
                "curvatureDegreesPerKm": 15.3,
                "fuelBurnLiters": 0.42,
                "zoneFlags": [
                  "SCHOOL_ZONE"
                ],
                "speedLimitKmh": 123,
                "roadClass": "MOTORWAY",
                "degradedFields": [
                  "<string>"
                ],
                "degradedReason": "<string>"
              },
              "travelAdvisory": {},
              "localizedValues": {},
              "transitDetails": {}
            }
          ],
          "travelAdvisory": {},
          "localizedValues": {},
          "stepsOverview": {}
        }
      ],
      "distanceMeters": 123,
      "duration": "<string>",
      "staticDuration": "<string>",
      "polyline": {
        "encodedPolyline": "<string>"
      },
      "description": "<string>",
      "warnings": [
        "<string>"
      ],
      "viewport": {
        "low": {
          "latitude": 123,
          "longitude": 123
        },
        "high": {
          "latitude": 123,
          "longitude": 123
        }
      },
      "travelAdvisory": {},
      "optimizedIntermediateWaypointIndex": [
        123
      ],
      "localizedValues": {},
      "routeToken": "<string>",
      "polylineDetails": {}
    }
  ],
  "fallbackInfo": {},
  "geocodingResults": {}
}

Headers

X-Goog-FieldMask
string

Accepted for Google compatibility but ignored. The full response is always returned.

Body

application/json

Request body for route computation. Accepts all Google Routes API fields — unsupported fields are silently ignored.

origin
object
required

Origin waypoint (required)

destination
object
required

Destination waypoint (required)

intermediates
object[]

Intermediate waypoints (stops or pass-through points)

travelMode
string
default:DRIVE

Travel mode. Only DRIVE is supported (truck routing).

routingPreference
string
default:TRAFFIC_UNAWARE

Routing preference. Traffic is not currently modeled.

departureTime
string<date-time>

Departure time in ISO 8601 UTC format. Affects school zone detection and time-based routing.

computeAlternativeRoutes
boolean
default:false

When true and no intermediate waypoints, returns up to 3 alternative routes.

routeModifiers
object

Route modifiers (avoid tolls, highways, ferries)

languageCode
string
default:en-US

Language for navigation instructions

vehicleSpec
object

Vehicle specification for physics enrichment. Defaults to SEMI_TRAILER preset if omitted.

routingProfile
enum<string>
default:balanced

Routing profile that adjusts enrichment weights

Available options:
balanced,
fuel_optimal,
time_optimal,
fatigue_aware
profileOverrides
object

Override individual profile weights (e.g. {"fuelWeight": 1.5})

webhookUrl
string<uri>

Webhook URL for async route completion notifications. Only used by POST /v1/routes.

Response

Successfully computed route(s). The response matches the Google Routes API computeRoutes response shape exactly, with an additional enrichment field on each step.

Response from the Google-compatible computeRoutes endpoint. Returns one or more routes in the same format as the Google Routes API, enriched with segment-level physics data (grade, curvature, fuel burn, zone flags).

routes
object[]
required

Computed routes (primary + alternatives if requested)

fallbackInfo
object

Google field — always null

geocodingResults
object

Google field — always null