- Home
- Docs
- API reference
- Driving directions and full route geometry
API reference
Driving directions and full route geometry
Returns full route geometries, turn-by-turn navigation steps, and leg breakdowns.
Endpoint
GET
Bearer Authhttps://api.wayline.cloud/v1/routeRequires an API key (authentication). Product overview: Routing API. Billing: see units & pricing.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
originrequired | query | PointString | Origin coordinate as lat,lng. |
destinationrequired | query | PointString | Destination coordinate as lat,lng. |
waypoints | query | string | Pipe-separated list of intermediate waypoints lat,lng|lat,lng. |
profile | query | string | Routing profile. car (default, alias driving), motorcycle (aliases bike,
motorbike, two_wheeler) or bicycle (alias cycling). A profile is served only
in regions that list it in GET /v1/coverage; otherwise the request fails with
PROFILE_UNAVAILABLE. Responses always echo the canonical name.
One of: car, driving, motorcycle, bike, motorbike, two_wheeler, bicycle, cyclingDefault: car |
units | query | string | Unit system for distance formatting (metric or imperial).One of: metric, imperialDefault: metric |
origin_bearing | query | number | Direction angle in degrees [0, 360) pointing toward departure direction for snapping to the correct side/heading of a roadway or flyover. |
origin_bearing_range | query | number | Tolerance angle in degrees (0, 180] for origin bearing, defaults to 45.Default: 45 |
destination_bearing | query | number | Direction angle in degrees [0, 360) pointing toward arrival direction. |
destination_bearing_range | query | number | Tolerance angle in degrees (0, 180] for destination bearing, defaults to 45.Default: 45 |
bearings | query | string | Semicolon-delimited list of bearing,range pairs matching coordinate count (e.g. 90,45;180,45 or 90,45;). |
origin_radius | query | number | Maximum search radius in meters (> 0) to snap the origin coordinate to road segments. |
destination_radius | query | number | Maximum search radius in meters (> 0) to snap the destination coordinate to road segments. |
radiuses | query | string | Semicolon-delimited list of snapping search radiuses in meters (e.g. 25;50). |
origin_approach | query | string | Approach constraint for origin (curb or unrestricted). curb forces departure on the curb side of divided streets, preventing illegal U-turns.One of: curb, unrestrictedDefault: unrestricted |
destination_approach | query | string | Approach constraint for destination (curb or unrestricted). curb forces arrival on the curb side of divided streets, preventing drop-offs across busy avenues.One of: curb, unrestrictedDefault: unrestricted |
approaches | query | string | Semicolon-delimited list of curb approach constraints matching waypoint count (e.g. curb;curb). |
alternatives | query | integer | Number of alternative routes to compute (0 to 2).Default: 0 |
geometry | query | string | Output format for route geometry.One of: none, polyline, polyline6, geojsonDefault: polyline |
overview | query | string | Detail of routes[].geometry: full (every road vertex) or simplified
(fewer points, ideal for GET /v1/staticmap URLs). The encoded polyline can be passed
unchanged as a /v1/staticmap path (enc: with precision 5, or precision:6 for polyline6).
One of: full, simplifiedDefault: full |
steps | query | boolean | Whether to return step-by-step turn maneuvers.Default: false |
annotations | query | boolean | Whether to include segment metadata (speeds, durations).Default: false |
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"const res = await fetch(
"https://api.wayline.cloud/v1/route?origin=37.788,-122.4075&destination=37.8044,-122.2712&steps=true&geometry=polyline",
{ headers: { Authorization: `Bearer ${process.env.WAYLINE_API_KEY}` } },
);
if (!res.ok) throw new Error(`Wayline ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);import os, requests
res = requests.get(
"https://api.wayline.cloud/v1/route",
params={"origin": "37.788,-122.4075", "destination": "37.8044,-122.2712", "steps": "true", "geometry": "polyline"},
headers={"Authorization": f"Bearer {os.environ['WAYLINE_API_KEY']}"},
timeout=10,
)
res.raise_for_status()
print(res.json())package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.wayline.cloud/v1/route?origin=37.788,-122.4075&destination=37.8044,-122.2712&steps=true&geometry=polyline", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("WAYLINE_API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res.Status, string(body))
}<?php
$ch = curl_init("https://api.wayline.cloud/v1/route?origin=37.788,-122.4075&destination=37.8044,-122.2712&steps=true&geometry=polyline");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("WAYLINE_API_KEY")],
CURLOPT_TIMEOUT => 10,
]);
$data = json_decode(curl_exec($ch), true);
print_r($data);require "net/http"
require "json"
uri = URI("https://api.wayline.cloud/v1/route?origin=37.788,-122.4075&destination=37.8044,-122.2712&steps=true&geometry=polyline")
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer #{ENV.fetch("WAYLINE_API_KEY")}"
res = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(req) }
puts JSON.parse(res.body)import java.net.URI;
import java.net.http.*;
public class Main {
public static void main(String[] args) throws Exception {
var req = HttpRequest.newBuilder(URI.create("https://api.wayline.cloud/v1/route?origin=37.788,-122.4075&destination=37.8044,-122.2712&steps=true&geometry=polyline"))
.header("Authorization", "Bearer " + System.getenv("WAYLINE_API_KEY"))
.GET().build();
var res = HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(res.statusCode() + " " + res.body());
}
}import 'dart:convert';
import 'dart:io';
import 'package:http/http.dart' as http;
Future<void> main() async {
final res = await http.get(
Uri.parse('https://api.wayline.cloud/v1/route?origin=37.788,-122.4075&destination=37.8044,-122.2712&steps=true&geometry=polyline'),
headers: {'Authorization': 'Bearer ${Platform.environment['WAYLINE_API_KEY']}'},
);
print(jsonDecode(res.body));
}{
"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
}Response
200 — Successful route directions response.
| Field | Type | Description |
|---|---|---|
routesrequired | Route[] | |
routes[].distance_metersrequired | integer | |
routes[].duration_secondsrequired | integer | |
routes[].distance_miles | number | |
routes[].distance_text | string | |
routes[].duration_text | string | |
routes[].geometry | any | Encoded polyline string or GeoJSON LineString object. |
routes[].legsrequired | RouteLeg[] | |
routes[].legs[].distance_metersrequired | integer | |
routes[].legs[].duration_secondsrequired | integer | |
routes[].legs[].distance_miles | number | |
routes[].legs[].distance_text | string | |
routes[].legs[].duration_text | string | |
routes[].legs[].summary | string | |
routes[].legs[].steps | RouteStep[] | |
originrequired | SnappedLocation | A requested coordinate and where it joined the road network. |
origin.latrequired | number | Requested latitude. |
origin.lngrequired | number | Requested longitude. |
origin.snapped | Point | Flexible coordinate input accepted as string, object, or array. |
destinationrequired | SnappedLocation | A requested coordinate and where it joined the road network. |
destination.latrequired | number | Requested latitude. |
destination.lngrequired | number | Requested longitude. |
destination.snapped | Point | Flexible coordinate input accepted as string, object, or array. |
profilerequired | string | Canonical routing profile used (car, motorcycle or bicycle). |
regionrequired | string | |
map_versionrequired | string | |
warnings | string[] | |
units_chargedrequired | integer |
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
| Status | When |
|---|---|
400 | Bad request (invalid coordinates, out of coverage, too many elements, etc.). |
401 | Missing or invalid API key, or expired key. |
402 | Free quota exhausted, no payment method, account suspended, or the monthly spend limit you set was reached. Never billed. Raise or remove the limit in the dashboard (Billing) and retry; nothing else changes. |
403 | Account disabled, key IP restriction failed, origin not allowed, or scope not permitted. |
404 | No route found between the requested coordinates. |
429 | Rate limit exceeded or test key daily quota reached. |
500 | Internal server error. |
503 | Upstream routing service temporarily unavailable. |
Error bodies contain a code such as OUT_OF_COVERAGE — see the error reference.
Try it
Interactive API Console
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.