GET or POST /v1/route

Routing API for driving directions and route geometry

Turn an origin, a destination and optional waypoints into a full driving route: total distance and time, per-leg breakdowns, turn-by-turn steps and a polyline or GeoJSON line to draw on your map.

Request and response

Copy, paste and run with your test key. The response below is an illustrative example.
curl "https://api.wayline.cloud/v1/route?origin=37.788,-122.4075&destination=37.8044,-122.2712&steps=true&geometry=polyline" \
  -H "Authorization: Bearer $WAYLINE_API_KEY"
Response (example)
{
  "request_id": "req_01JD8Q5B2M1X",
  "routes": [
    {
      "distance_meters": 19870,
      "duration_seconds": 1260,
      "geometry": "o~ywFdmbbMh@`@…",
      "legs": [
        {
          "distance_meters": 19870,
          "duration_seconds": 1260,
          "summary": "",
          "steps": [
            "…"
          ]
        }
      ]
    }
  ],
  "waypoints": [
    {
      "location": [
        37.788,
        -122.4075
      ],
      "snapped": [
        37.7881,
        -122.4076
      ],
      "distance_to_road_meters": 4
    },
    {
      "location": [
        37.8044,
        -122.2712
      ],
      "snapped": [
        37.8045,
        -122.2713
      ],
      "distance_to_road_meters": 7
    }
  ],
  "region": "us",
  "map_version": "20261121-2330",
  "units_charged": 1
}

What the Routing API gives you

  • Waypoints and legs

    Add intermediate stops; each leg returns its own distance and duration.

  • Geometry your way

    polyline (precision 5), polyline6 or GeoJSON LineString — or none when you only need numbers.

  • Turn-by-turn steps

    Set steps=true for maneuvers with road names, ready for navigation UIs.

  • Alternatives

    Request up to two alternative routes and pick the best for your use case.

Draw routes on any map

Route geometry is returned in standard encodings so it works with MapLibre, Leaflet, deck.gl or native SDKs. Display “© OpenStreetMap contributors” wherever you show the route.

Frequently asked questions

Is the distance a straight line or a real road distance?

Always real road distance. Every result is computed along the OpenStreetMap road network with a driving profile, never as a straight-line (haversine) estimate.

Which areas do you cover?

Coverage is region-based. The Coverage page lists every enabled region with its map data date. Points outside an enabled region return an OUT_OF_COVERAGE error and are never billed.

How many waypoints can a route have?

The waypoint limit depends on your rate-limit plan and is shown on this page and in your dashboard. A route request costs one unit regardless of the number of waypoints.

Start building in minutes

Create an account, grab a test key and make your first request in under five minutes.