Documentation menu
Search docs…⌘K

API reference

Google Maps Distance Matrix compatible endpoint

Drop-in compatible endpoint matching the Google Distance Matrix API JSON response structure.

Endpoint

GEThttps://api.wayline.cloud/maps/api/distancematrix/json
Bearer Auth

Requires an API key (authentication). Product overview: Google-compatible Distance Matrix. Billing: see units & pricing.

Parameters

NameInTypeDescription
originsrequiredquerystringPipe-separated list of coordinate pairs (lat,lng|lat,lng).
destinationsrequiredquerystringPipe-separated list of coordinate pairs (lat,lng|lat,lng).
modequerystringTravel mode. driving (default), two_wheeler (motorcycle, as in the Google Routes API) or bicycling, where the region offers that profile. walking and transit are not supported. One of: driving, two_wheeler, motorcycle, bicyclingDefault: driving
keyquerystringAPI key.
unitsquerystringDistance unit system.One of: metric, imperialDefault: metric
departure_timequerystringReserved for compatibility.

Example

curl "https://api.wayline.cloud/maps/api/distancematrix/json?origins=37.788,-122.4075&destinations=37.8044,-122.2712%7C37.8313,-122.2852&units=imperial" \
  -H "Authorization: Bearer $WAYLINE_API_KEY"
Response (example)
{
  "status": "OK",
  "origin_addresses": [
    "37.788,-122.4075"
  ],
  "destination_addresses": [
    "37.8044,-122.2712",
    "37.8313,-122.2852"
  ],
  "rows": [
    {
      "elements": [
        {
          "status": "OK",
          "distance": {
            "value": 19870,
            "text": "12.3 mi"
          },
          "duration": {
            "value": 1260,
            "text": "21 mins"
          }
        },
        {
          "status": "OK",
          "distance": {
            "value": 6120,
            "text": "3.8 mi"
          },
          "duration": {
            "value": 840,
            "text": "14 mins"
          }
        }
      ]
    }
  ]
}

Response

200 — Google-compatible Distance Matrix result.

Response fields
FieldTypeDescription
statusrequiredstringOne of: OK, INVALID_REQUEST, MAX_ELEMENTS_EXCEEDED, OVER_QUERY_LIMIT, REQUEST_DENIED, UNKNOWN_ERROR
origin_addressesrequiredstring[]
destination_addressesrequiredstring[]
rowsrequiredGoogleMatrixRow[]
rows[].elementsrequiredGoogleMatrixElement[]
rows[].elements[].statusrequiredstringOne of: OK, ZERO_RESULTS, NOT_FOUND
rows[].elements[].distanceGoogleValueText
rows[].elements[].durationGoogleValueText
error_messagestring

Response headers

  • X-Request-Id — Unique identifier for tracking and debugging this request.
  • X-RateLimit-Limit — Maximum permitted requests in current window.
  • X-RateLimit-Remaining — Remaining request quota in current window.
  • X-RateLimit-Reset — Seconds until the rate limit window resets.
  • X-Units-Charged — Billable request units consumed by this request.
  • X-Cache — Cache lookup status (`HIT` or `MISS`).
  • X-Region — Region code serving this routing request (e.g. `bd`).

Errors

StatusWhen
400Google-compatible Invalid Request error.
401Google-compatible Request Denied error.
402Google-compatible Request Denied (payment required) error.
403Google-compatible Request Denied (forbidden) error.
429Google-compatible Over Query Limit error.
500Google-compatible Unknown Error.
503Google-compatible Upstream Unavailable Error.

Error bodies contain a code such as OUT_OF_COVERAGE — see the error reference.

Try it

Interactive API Console

GET /maps/api/distancematrix/json

Sends a real request from your browser using a test key (free, never billed). The key stays in this browser tab only.

No key yet? Create a free test key.

Was this page helpful?