Overview
Get directions between waypoints with support for cycling, walking, and driving profiles. Optionally use the supersafe flag for bike routing on a dedicated cycling network with safety prioritization.
Authentication
This endpoint requires Auth0 authentication. Include your access token in the Authorization header:
Authorization: Bearer YOUR_AUTH0_ACCESS_TOKEN
Request Body
Array of [longitude, latitude] waypoints. Minimum 2, maximum 25. Example: [[lon1, lat1], [lon2, lat2]]
Routing profile. Options:
cycling - Optimized for bicycles
walking - Optimized for pedestrians
driving - Optimized for cars
driving-traffic - Driving with traffic data
Enable super-safe bike routing using Cyclemate’s network router. Only applies to cycling profile. When enabled, routes prioritize:
Protected bike lanes
Low-traffic streets
Bike paths and greenways
Reduced elevation gain
Additional routing options (passed to Mapbox when not using supersafe) Format of returned geometry: geojson or polyline
Level of detail: full, simplified, or false
Include turn-by-turn instructions
Return alternative routes
Response
Array of route objects Total route distance in meters
Estimated travel time in seconds
Route geometry as GeoJSON LineString
Array of leg objects (one per waypoint pair) Turn-by-turn instructions Step geometry as GeoJSON LineString
Snapped waypoint locations
Response code: Ok on success
Routing metadata mapbox or network_router (when supersafe is enabled)
Request Example
Standard Cycling Route
curl -X POST "https://api.cyclemate.com/directions/" \
-H "Authorization: Bearer YOUR_AUTH0_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"coordinates": [[-73.9851, 40.7589], [-73.9712, 40.7614]],
"profile": "cycling",
"options": {
"steps": true,
"overview": "full"
}
}'
const response = await fetch ( 'https://api.cyclemate.com/directions/' , {
method: 'POST' ,
headers: {
'Authorization' : 'Bearer YOUR_AUTH0_ACCESS_TOKEN' ,
'Content-Type' : 'application/json' ,
},
body: JSON . stringify ({
coordinates: [[ - 73.9851 , 40.7589 ], [ - 73.9712 , 40.7614 ]],
profile: 'cycling' ,
}),
});
const directions = await response . json ();
console . log ( `Route distance: ${ directions . routes [ 0 ]. distance } m` );
Super-Safe Bike Route
const response = await fetch ( 'https://api.cyclemate.com/directions/' , {
method: 'POST' ,
headers: {
'Authorization' : 'Bearer YOUR_AUTH0_ACCESS_TOKEN' ,
'Content-Type' : 'application/json' ,
},
body: JSON . stringify ({
coordinates: [[ - 73.9851 , 40.7589 ], [ - 73.9712 , 40.7614 ]],
profile: 'cycling' ,
supersafe: true ,
}),
});
const directions = await response . json ();
console . log ( `Super-safe route: ${ directions . routes [ 0 ]. distance } m` );
import requests
url = "https://api.cyclemate.com/directions/"
headers = {
"Authorization" : "Bearer YOUR_AUTH0_ACCESS_TOKEN"
}
data = {
"coordinates" : [[ - 73.9851 , 40.7589 ], [ - 73.9712 , 40.7614 ]],
"profile" : "cycling" ,
"supersafe" : True
}
response = requests.post(url, headers = headers, json = data)
directions = response.json()
Response Example
{
"routes" : [
{
"distance" : 1523.4 ,
"duration" : 365.2 ,
"geometry" : {
"type" : "LineString" ,
"coordinates" : [
[ -73.9851 , 40.7589 ],
[ -73.9845 , 40.7595 ],
[ -73.9712 , 40.7614 ]
]
},
"legs" : [
{
"distance" : 1523.4 ,
"duration" : 365.2 ,
"steps" : [
{
"distance" : 150.2 ,
"duration" : 36.0 ,
"name" : "West 52nd Street" ,
"maneuver" : {
"type" : "depart" ,
"instruction" : "Head east on West 52nd Street" ,
"bearing_before" : 0 ,
"bearing_after" : 90 ,
"location" : [ -73.9851 , 40.7589 ]
},
"geometry" : {
"type" : "LineString" ,
"coordinates" : [
[ -73.9851 , 40.7589 ],
[ -73.9845 , 40.7589 ]
]
}
}
]
}
]
}
],
"waypoints" : [
{
"location" : [ -73.9851 , 40.7589 ],
"name" : "West 52nd Street"
},
{
"location" : [ -73.9712 , 40.7614 ],
"name" : "Central Park West"
}
],
"code" : "Ok" ,
"metadata" : {
"routing_engine" : "network_router" ,
"profile" : "cycling" ,
"waypoint_count" : 2
}
}
Super-Safe Routing
When supersafe: true is enabled for cycling routes, the API uses Cyclemate’s proprietary network router that:
Prioritizes Safety : Routes prefer protected bike lanes, bike paths, and low-traffic streets
Local Knowledge : Uses city-specific bike infrastructure data (NYC, LA, SF, Chicago, London)
Elevation Aware : Minimizes elevation gain when possible
Real-time Updates : Incorporates user feedback and recent infrastructure changes
Error Responses
Invalid request {
"error" : "At least 2 coordinates are required"
}
Invalid profile {
"error" : "Invalid profile. Must be one of: cycling, walking, driving, driving-traffic"
}
Service unavailable {
"error" : "Mapbox service temporarily unavailable" ,
"details" : "Request timed out"
}
Notes
Coordinates must be in [longitude, latitude] format
Maximum 25 waypoints per request
Super-safe routing is only available in supported cities (NYC, LA, SF Bay Area, Chicago, London)
Duration estimates assume average cycling speed of 15 km/h (9.3 mph)
Turn-by-turn instructions are in English