# Migrating from the Mapbox Matrix API

> Move from the Mapbox Matrix API to Wayline's matrix endpoint — coordinate order, parameter and response mapping, and differences to plan for.

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

Mapbox's Matrix API and Wayline's [Matrix endpoint](/docs/api/compute-matrix) solve the same problem with different request shapes.

## Coordinate order

Mapbox uses **`lng,lat`** in a semicolon-separated path. Wayline uses **`lat,lng`** in a JSON body. Swap the order when you migrate — the most common migration bug.

## Request mapping

| Mapbox | Wayline |
|---|---|
| `GET /directions-matrix/v1/mapbox/driving/{coords}` | `POST /v1/matrix` |
| `{lng,lat;lng,lat;…}` path | `points`, or `origins` + `destinations` (`{lat, lng}`) |
| `sources=0;1` | `origins` |
| `destinations=2;3` | `destinations` |
| `annotations=duration,distance` | `metrics=both` (default), `duration` or `distance` |
| `access_token` | `Authorization: Bearer` |
| `driving-traffic` profile | Not available (no live traffic yet) |

## Response mapping

| Mapbox | Wayline |
|---|---|
| `durations[i][j]` | `rows[i].elements[j].duration_seconds` |
| `distances[i][j]` | `rows[i].elements[j].distance_meters` |
| `null` cell | `status: "NO_ROUTE"` |
| `sources[]`, `destinations[]` | `origins[]`, `destinations[]` with `snapped` and `distance_to_road_meters` |

## Example

Related: [Wayline vs Mapbox Matrix](/compare/mapbox-matrix-api) · [Distance Matrix API](/products/distance-matrix-api)
