# Migrating from the Google Distance Matrix API

> Switch from the Google Maps Distance Matrix API to Wayline using the compatible endpoint — field-by-field mapping, differences and a safe rollout plan.

Source: https://www.wayline.cloud/docs/guides/migrate-from-google-distance-matrix

Wayline offers a Google Distance Matrix **compatible** endpoint at `/maps/api/distancematrix/json` that returns the same JSON structure. If your integration already sends coordinates, migrating is usually a base-URL and key change.

Google Maps is a trademark of Google LLC. Wayline is not affiliated with Google. Do not store Google results in Wayline or mix them — see each provider's terms.

## The one-line change

```diff
- https://maps.googleapis.com/maps/api/distancematrix/json?origins=…&destinations=…&key=GOOGLE_KEY
+ https://api.wayline.cloud/maps/api/distancematrix/json?origins=…&destinations=…&key=WAYLINE_KEY
```

Prefer sending the key in the `Authorization: Bearer` header instead of `key=` once you're migrated.

## Field mapping

| Google request parameter | Wayline compatible endpoint | Notes |
|---|---|---|
| `origins`, `destinations` | Same | Coordinates only (`lat,lng`, pipe-separated). Addresses and `place_id:` are not supported. |
| `key` | Same, or `Authorization: Bearer` | |
| `units` | Same (`metric`, `imperial`) | Affects `text` only; `value` is always meters/seconds. |
| `mode` | `driving` only | |
| `departure_time`, `traffic_model` | Accepted, ignored | No live traffic; `duration_in_traffic` is not returned. |
| `avoid`, `language`, `region`, `transit_*` | Not supported | |

| Google response field | Wayline | Notes |
|---|---|---|
| `status` | Same values | `OK`, `INVALID_REQUEST`, `MAX_ELEMENTS_EXCEEDED`, `OVER_QUERY_LIMIT`, `REQUEST_DENIED`, `UNKNOWN_ERROR` |
| `origin_addresses`, `destination_addresses` | Echo of the coordinates you sent | No reverse geocoding. |
| `rows[].elements[].status` | `OK`, `ZERO_RESULTS`, `NOT_FOUND` | |
| `elements[].distance.value/text` | Same | Meters + localized text. |
| `elements[].duration.value/text` | Same | Free-flow seconds. |

## Rollout plan

1. **Shadow**: send a sample of production requests to both providers and log the difference (don't show Wayline results yet).
2. **Compare**: review the distribution of distance/duration differences for your routes.
3. **Canary**: switch 5% of traffic, watch error rates and support tickets.
4. **Cut over** and remove the old key.

## Moving to the native API later

The native [Matrix endpoint](/docs/api/compute-matrix) returns extra data (snapped locations, region, map version, `units_charged`) and accepts JSON bodies. Migrate when convenient — the compatible endpoint is a supported part of v1.

Related: [Wayline vs Google Distance Matrix](/compare/google-maps-distance-matrix-api) · [Compatible endpoint reference](/docs/api/google-distance-matrix-compat)
