Skip to main content

Overview

Get directions between waypoints for cycling and walking. Set supersafe to route on Cyclemate’s safety-prioritized cycling network. Coordinates are [longitude, latitude], maximum 25 waypoints per request. Duration estimates assume 15 km/h cycling and 5 km/h walking. Instructions are in English. SuperSafe routing is available in supported cities (New York City, Los Angeles, the SF Bay Area, London). Versions are a per-endpoint path segment; this page documents v2 (POST /directions/v2/). See API versioning. When no route exists between the waypoints, the response is a 200 with route: null. That is an outcome, not an error; a routing outage returns 503 instead.

Authentication

This endpoint requires an API key. Include it in the apikey header:
A valid user session is also accepted and grants higher rate limits.

Rate limits

Requests are rate-limited; authenticated requests are allowed a higher rate than anonymous ones. On 429, honor the Retry-After header.

Request body

array
required
Array of [longitude, latitude] waypoints. Minimum 2, maximum 25.
string
default:"cycling"
cycling or walking.
boolean
default:"true"
Prefer protected bike lanes, bike paths, and low-traffic streets. Cycling only.
number
Current direction of travel in degrees [0, 360), used to constrain how the route leaves the start point. Pass the rider’s heading on a mid-ride reroute so the new route does not begin with a U-turn. If no road satisfies the constraint, route is null; retry without bearing. Cycling only.
string
Planned departure as "YYYY-MM-DDTHH:mm" with no timezone offset, interpreted in the route city’s timezone. Determines night routing (see metadata.nighttime) and which temporary road avoidances apply. Omit to route for now. Unparseable values return 400. Cycling only.
boolean
Overrides the clock: true routes on well-lit streets as if after dark, false routes on the daytime preference even at night. Honoured only in cities with street-lighting data, where metadata.nighttime reports the regime actually used; elsewhere it is ignored and metadata.nighttime stays false. Omit to let the departure time decide. Temporary road avoidances still follow the departure time. Cycling only.

Response body

object | null
The route. null when no route exists between the waypoints (a 200 outcome, not an error).
array
Snapped waypoint locations ({ name, location })
string
Unique identifier (UUID) for this request. Include it in support enquiries.
string | null
Routing network version identifier. null on walking responses.
string | null
"Prefers well-lit roads" on night routes, otherwise null.
array
Temporary road disruptions near the route that are active at the departure time or start within 60 minutes. Same shape as the disruptions field on Multi-Modal Routing. Absent when none apply, and never present on walking responses.
object
  • profile: routing profile used.
  • supersafe: whether SuperSafe routing was applied.
  • nighttime: whether night routing (preferring lit streets) was applied. Cycling only, in cities with lighting data (London today).
  • waypoint_count: number of waypoints.
The response example is captured from a real request. Long arrays in it are abridged with .

Variants

Reroute with current heading

Pass bearing when recomputing a route mid-ride so the new route leaves in the rider’s current direction of travel:
JavaScript

Route for a night departure

Pass departure_time to route for a particular time of day. After dark, in cities with lighting data, cycling routes prefer lit streets: metadata.nighttime is true and sublabel is "Prefers well-lit roads".

Walking

Set profile to walking for a pedestrian route. Every step’s mode is walking, graph_version is null, and night routing and disruptions do not apply.

Error responses

400 Bad request

Out-of-coverage routing carries a machine-readable code and the request’s search_id:

401 Unauthorized

404 Unknown version

Returned for a version sub-path that does not exist (e.g. POST /directions/v3/). See API versioning.

405 Method not allowed

Returned for any HTTP method other than POST.

429 Too many requests

Includes a Retry-After header with the seconds until the current window closes:

500 Internal server error

503 Service unavailable

Routing is temporarily unavailable. This is distinct from a genuine no-route result, which returns 200 with route: null. Retry after a short delay.