Migrate a legacy Google Directions API integration to the Routes API computeRoutes method with an explicit field mask

domain: developers.google.com · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. POST to routes.googleapis.com/directions/v2:computeRoutes instead of the legacy GET directions endpoint
  2. Set the X-Goog-FieldMask header explicitly (e.g. routes.duration,routes.distanceMeters,routes.polyline) — omitting it returns an error
  3. Replace polyline-encoded waypoints with an intermediates array of lat/lng or place IDs
  4. Map renamed parameters: mode to travelMode, avoid to routeModifiers, optimize=true to optimizeWaypointOrder
  5. Avoid the wildcard "*" field mask so only needed fields are billed/computed

Known gotchas

Related routes

Migrate a Google Maps Places integration from the Legacy Places API to Places API (New)
developers.google.com · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans