Parchment Docs

Trip Planning

Directions and trip planning

Plan a multimodal trip

Generate multiple trip options using different transportation modes and combinations. A request with more than two waypoints returns one whole journey per travel strategy, each carried from stop to stop — a journey that cycles to the first stop still has the bike at the second. Segments carry legIndex to say which hop they belong to. A transit leg's routeOptions lists the other lines running the same stops at that time. Its shortName names the line; a line with no GTFS short name reads by its long name, and the train number moves to trip.shortName. A walking segment with streetTransfer leaves the paid area between stations the agency does not connect, so the next ride is a new fare. Where the station graph knows the station, a transit leg's transitDetails carry transfer (how the change from the previous ride is made: its class, time and the walk), entrance and exit (the entrance used for the first ride and the exit after the last, with the walk inside the station) and boardingPosition (where to stand on the train). A station walk that is not an estimate carries geometry, a level per vertex and written steps. Street instructions carry exitNumber for roundabouts and, where the map signposts the maneuver, exitRef (a motorway exit's number) and destination (where the signs point). Street segments carry hazards: crosswalks, traffic lights, stop and give-way signs, rail and tram crossings, tunnels, fords, steep grades, stairs, sharp curves, low clearances, school zones, where a bike lane ends or starts partway along a road, and the like, placed by distance along the segment. Some depend on conditions: unlit paths after sunset, flood-prone roads when rain is forecast, bridges at 2 °C or below, and speed cameras only where warning of them is lawful. Comfort hazards (rough surfaces, dismount sections, ferries, tolls, traffic calming, movable bridges, speed cameras, bike lanes starting) appear only for users with premium navigation. Driving and cycling segments carry drivingSide, and where the routing engine knows the lanes, laneGeometry: the route drawn in the lanes it takes (for cycling, the bike lane, or beside the traffic), with measures giving the distance along geometry each coordinate stands for. Driving segments also carry lanePlan: per instruction index, the approach lanes left to right and which lead on. An origin with heading starts driving routes, and cycling routes above 4 m/s speed, in that direction; walking routes ignore it. A trip with transit legs may carry departureProfile: for each catchable run of its first transit leg, when to leave, when it arrives through the connections on the stop boards, and the tightest transfer. Runs stop where the boards end; validUntil is the last leave time covered.

POST
/directions

Request Body

application/jsonRequired
waypointsRequiredarray<object>
selectedModestring
sortPreferencestring
Default: "shortest"Value in: "shortest" | "earliest_arrival" | "cheapest" | "fewest_transfers" | "least_walking" | "greenest"
excludedModesarray<string>

Modes the rider does not use. Trips with a segment in any of them are left out, except the mode of the selected tab, which is always planned. driving covers park-and-ride, biking an owned bike (bike-to-station, carry-on), bikeshare shared bikes and scooters, transit any trip with a transit leg.

routingPreferencesobject
availableVehiclesarray<object>
knownAccessPointsarray<object>
preferredDepartureTimestring
preferredArrivalTimestring
requestIdstring
timestampstring

Response Body

curl -X POST "https://example.com/directions/" \
  -H "Content-Type: application/json" \
  -d '{
    "waypoints": [
      {
        "location": {
          "lat": 0,
          "lng": 0
        },
        "address": "string",
        "label": "string",
        "type": "origin",
        "departAfter": "2019-08-24T14:15:22Z",
        "arriveBy": "2019-08-24T14:15:22Z",
        "dwellTime": 0,
        "heading": 360,
        "speed": 0
      },
      {
        "location": {
          "lat": 0,
          "lng": 0
        },
        "address": "string",
        "label": "string",
        "type": "origin",
        "departAfter": "2019-08-24T14:15:22Z",
        "arriveBy": "2019-08-24T14:15:22Z",
        "dwellTime": 0,
        "heading": 360,
        "speed": 0
      }
    ],
    "selectedMode": "multi",
    "sortPreference": "shortest",
    "excludedModes": [
      "transit"
    ],
    "routingPreferences": {
      "highways": 1,
      "tolls": 1,
      "ferries": 1,
      "hills": 1,
      "surfaceQuality": 1,
      "litPaths": 1,
      "safetyVsSpeed": 1,
      "shortest": true,
      "preferHOV": true,
      "wheelchairAccessible": true,
      "cyclingSpeed": 1,
      "walkingSpeed": 0.5,
      "bicycleType": "string",
      "maxWalkingDistance": 0,
      "maxTransfers": 0,
      "transitBufferMinutes": 5,
      "useKnownVehicleLocations": true,
      "useKnownParkingLocations": true,
      "includePrivateParking": true,
      "routingEngine": "string",
      "customModelOverride": "string",
      "avoidHighways": true,
      "avoidTolls": true,
      "avoidFerries": true,
      "avoidHills": true,
      "preferLitPaths": true,
      "preferPavedPaths": true,
      "safetyVsEfficiency": 1
    },
    "availableVehicles": [
      {
        "id": "string",
        "type": "car",
        "energyType": "electric",
        "name": "string",
        "location": {
          "lat": 0,
          "lng": 0
        }
      }
    ],
    "knownAccessPoints": [
      {
        "osmId": "string",
        "code": "string",
        "name": "string",
        "location": {
          "lat": 0,
          "lng": 0
        }
      }
    ],
    "preferredDepartureTime": "string",
    "preferredArrivalTime": "string",
    "requestId": "string",
    "timestamp": "string"
  }'
const body = JSON.stringify({
  "waypoints": [
    {
      "location": {
        "lat": 0,
        "lng": 0
      },
      "address": "string",
      "label": "string",
      "type": "origin",
      "departAfter": "2019-08-24T14:15:22Z",
      "arriveBy": "2019-08-24T14:15:22Z",
      "dwellTime": 0,
      "heading": 360,
      "speed": 0
    },
    {
      "location": {
        "lat": 0,
        "lng": 0
      },
      "address": "string",
      "label": "string",
      "type": "origin",
      "departAfter": "2019-08-24T14:15:22Z",
      "arriveBy": "2019-08-24T14:15:22Z",
      "dwellTime": 0,
      "heading": 360,
      "speed": 0
    }
  ],
  "selectedMode": "multi",
  "sortPreference": "shortest",
  "excludedModes": [
    "transit"
  ],
  "routingPreferences": {
    "highways": 1,
    "tolls": 1,
    "ferries": 1,
    "hills": 1,
    "surfaceQuality": 1,
    "litPaths": 1,
    "safetyVsSpeed": 1,
    "shortest": true,
    "preferHOV": true,
    "wheelchairAccessible": true,
    "cyclingSpeed": 1,
    "walkingSpeed": 0.5,
    "bicycleType": "string",
    "maxWalkingDistance": 0,
    "maxTransfers": 0,
    "transitBufferMinutes": 5,
    "useKnownVehicleLocations": true,
    "useKnownParkingLocations": true,
    "includePrivateParking": true,
    "routingEngine": "string",
    "customModelOverride": "string",
    "avoidHighways": true,
    "avoidTolls": true,
    "avoidFerries": true,
    "avoidHills": true,
    "preferLitPaths": true,
    "preferPavedPaths": true,
    "safetyVsEfficiency": 1
  },
  "availableVehicles": [
    {
      "id": "string",
      "type": "car",
      "energyType": "electric",
      "name": "string",
      "location": {
        "lat": 0,
        "lng": 0
      }
    }
  ],
  "knownAccessPoints": [
    {
      "osmId": "string",
      "code": "string",
      "name": "string",
      "location": {
        "lat": 0,
        "lng": 0
      }
    }
  ],
  "preferredDepartureTime": "string",
  "preferredArrivalTime": "string",
  "requestId": "string",
  "timestamp": "string"
})

fetch("https://example.com/directions/", {
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://example.com/directions/"
  body := strings.NewReader(`{
    "waypoints": [
      {
        "location": {
          "lat": 0,
          "lng": 0
        },
        "address": "string",
        "label": "string",
        "type": "origin",
        "departAfter": "2019-08-24T14:15:22Z",
        "arriveBy": "2019-08-24T14:15:22Z",
        "dwellTime": 0,
        "heading": 360,
        "speed": 0
      },
      {
        "location": {
          "lat": 0,
          "lng": 0
        },
        "address": "string",
        "label": "string",
        "type": "origin",
        "departAfter": "2019-08-24T14:15:22Z",
        "arriveBy": "2019-08-24T14:15:22Z",
        "dwellTime": 0,
        "heading": 360,
        "speed": 0
      }
    ],
    "selectedMode": "multi",
    "sortPreference": "shortest",
    "excludedModes": [
      "transit"
    ],
    "routingPreferences": {
      "highways": 1,
      "tolls": 1,
      "ferries": 1,
      "hills": 1,
      "surfaceQuality": 1,
      "litPaths": 1,
      "safetyVsSpeed": 1,
      "shortest": true,
      "preferHOV": true,
      "wheelchairAccessible": true,
      "cyclingSpeed": 1,
      "walkingSpeed": 0.5,
      "bicycleType": "string",
      "maxWalkingDistance": 0,
      "maxTransfers": 0,
      "transitBufferMinutes": 5,
      "useKnownVehicleLocations": true,
      "useKnownParkingLocations": true,
      "includePrivateParking": true,
      "routingEngine": "string",
      "customModelOverride": "string",
      "avoidHighways": true,
      "avoidTolls": true,
      "avoidFerries": true,
      "avoidHills": true,
      "preferLitPaths": true,
      "preferPavedPaths": true,
      "safetyVsEfficiency": 1
    },
    "availableVehicles": [
      {
        "id": "string",
        "type": "car",
        "energyType": "electric",
        "name": "string",
        "location": {
          "lat": 0,
          "lng": 0
        }
      }
    ],
    "knownAccessPoints": [
      {
        "osmId": "string",
        "code": "string",
        "name": "string",
        "location": {
          "lat": 0,
          "lng": 0
        }
      }
    ],
    "preferredDepartureTime": "string",
    "preferredArrivalTime": "string",
    "requestId": "string",
    "timestamp": "string"
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/directions/"
body = {
  "waypoints": [
    {
      "location": {
        "lat": 0,
        "lng": 0
      },
      "address": "string",
      "label": "string",
      "type": "origin",
      "departAfter": "2019-08-24T14:15:22Z",
      "arriveBy": "2019-08-24T14:15:22Z",
      "dwellTime": 0,
      "heading": 360,
      "speed": 0
    },
    {
      "location": {
        "lat": 0,
        "lng": 0
      },
      "address": "string",
      "label": "string",
      "type": "origin",
      "departAfter": "2019-08-24T14:15:22Z",
      "arriveBy": "2019-08-24T14:15:22Z",
      "dwellTime": 0,
      "heading": 360,
      "speed": 0
    }
  ],
  "selectedMode": "multi",
  "sortPreference": "shortest",
  "excludedModes": [
    "transit"
  ],
  "routingPreferences": {
    "highways": 1,
    "tolls": 1,
    "ferries": 1,
    "hills": 1,
    "surfaceQuality": 1,
    "litPaths": 1,
    "safetyVsSpeed": 1,
    "shortest": true,
    "preferHOV": true,
    "wheelchairAccessible": true,
    "cyclingSpeed": 1,
    "walkingSpeed": 0.5,
    "bicycleType": "string",
    "maxWalkingDistance": 0,
    "maxTransfers": 0,
    "transitBufferMinutes": 5,
    "useKnownVehicleLocations": true,
    "useKnownParkingLocations": true,
    "includePrivateParking": true,
    "routingEngine": "string",
    "customModelOverride": "string",
    "avoidHighways": true,
    "avoidTolls": true,
    "avoidFerries": true,
    "avoidHills": true,
    "preferLitPaths": true,
    "preferPavedPaths": true,
    "safetyVsEfficiency": 1
  },
  "availableVehicles": [
    {
      "id": "string",
      "type": "car",
      "energyType": "electric",
      "name": "string",
      "location": {
        "lat": 0,
        "lng": 0
      }
    }
  ],
  "knownAccessPoints": [
    {
      "osmId": "string",
      "code": "string",
      "name": "string",
      "location": {
        "lat": 0,
        "lng": 0
      }
    }
  ],
  "preferredDepartureTime": "string",
  "preferredArrivalTime": "string",
  "requestId": "string",
  "timestamp": "string"
}
response = requests.request("POST", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
Empty

Estimate travel time per mode

Rough door-to-door seconds for each requested mode between the waypoints, in order, without planning full trips: no geometry, alternatives or vehicle pickups. A mode comes back null when it has no route, or is out of reach (a walk over 100 km, a ride over 300 km). Transit is the earliest-arriving ride departing at departureTime, and is only estimated between two waypoints. Results are cached briefly. Requires premium navigation.

POST
/directions/estimates

Request Body

application/jsonRequired
waypointsRequiredarray<object>
modesRequiredarray<string>
routingPreferencesobject

Preferences per mode, as the trip plan for that mode would send them.

departureTimestring

Leave at this time; omit to leave now.

Format: "date-time"

Response Body

TypeScript Definitions

Use the response body type in TypeScript.

estimatesRequiredobject

TypeScript Definitions

Use the response body type in TypeScript.

messageRequiredstring
curl -X POST "https://example.com/directions/estimates" \
  -H "Content-Type: application/json" \
  -d '{
    "waypoints": [
      {
        "lat": 0,
        "lng": 0
      },
      {
        "lat": 0,
        "lng": 0
      }
    ],
    "modes": [
      "walking"
    ],
    "routingPreferences": {
      "walking": {
        "highways": 1,
        "tolls": 1,
        "ferries": 1,
        "hills": 1,
        "surfaceQuality": 1,
        "litPaths": 1,
        "safetyVsSpeed": 1,
        "shortest": true,
        "preferHOV": true,
        "wheelchairAccessible": true,
        "cyclingSpeed": 1,
        "walkingSpeed": 0.5,
        "bicycleType": "string",
        "maxWalkingDistance": 0,
        "maxTransfers": 0,
        "transitBufferMinutes": 5,
        "useKnownVehicleLocations": true,
        "useKnownParkingLocations": true,
        "includePrivateParking": true,
        "routingEngine": "string",
        "customModelOverride": "string",
        "avoidHighways": true,
        "avoidTolls": true,
        "avoidFerries": true,
        "avoidHills": true,
        "preferLitPaths": true,
        "preferPavedPaths": true,
        "safetyVsEfficiency": 1
      },
      "biking": {
        "highways": 1,
        "tolls": 1,
        "ferries": 1,
        "hills": 1,
        "surfaceQuality": 1,
        "litPaths": 1,
        "safetyVsSpeed": 1,
        "shortest": true,
        "preferHOV": true,
        "wheelchairAccessible": true,
        "cyclingSpeed": 1,
        "walkingSpeed": 0.5,
        "bicycleType": "string",
        "maxWalkingDistance": 0,
        "maxTransfers": 0,
        "transitBufferMinutes": 5,
        "useKnownVehicleLocations": true,
        "useKnownParkingLocations": true,
        "includePrivateParking": true,
        "routingEngine": "string",
        "customModelOverride": "string",
        "avoidHighways": true,
        "avoidTolls": true,
        "avoidFerries": true,
        "avoidHills": true,
        "preferLitPaths": true,
        "preferPavedPaths": true,
        "safetyVsEfficiency": 1
      },
      "driving": {
        "highways": 1,
        "tolls": 1,
        "ferries": 1,
        "hills": 1,
        "surfaceQuality": 1,
        "litPaths": 1,
        "safetyVsSpeed": 1,
        "shortest": true,
        "preferHOV": true,
        "wheelchairAccessible": true,
        "cyclingSpeed": 1,
        "walkingSpeed": 0.5,
        "bicycleType": "string",
        "maxWalkingDistance": 0,
        "maxTransfers": 0,
        "transitBufferMinutes": 5,
        "useKnownVehicleLocations": true,
        "useKnownParkingLocations": true,
        "includePrivateParking": true,
        "routingEngine": "string",
        "customModelOverride": "string",
        "avoidHighways": true,
        "avoidTolls": true,
        "avoidFerries": true,
        "avoidHills": true,
        "preferLitPaths": true,
        "preferPavedPaths": true,
        "safetyVsEfficiency": 1
      },
      "transit": {
        "highways": 1,
        "tolls": 1,
        "ferries": 1,
        "hills": 1,
        "surfaceQuality": 1,
        "litPaths": 1,
        "safetyVsSpeed": 1,
        "shortest": true,
        "preferHOV": true,
        "wheelchairAccessible": true,
        "cyclingSpeed": 1,
        "walkingSpeed": 0.5,
        "bicycleType": "string",
        "maxWalkingDistance": 0,
        "maxTransfers": 0,
        "transitBufferMinutes": 5,
        "useKnownVehicleLocations": true,
        "useKnownParkingLocations": true,
        "includePrivateParking": true,
        "routingEngine": "string",
        "customModelOverride": "string",
        "avoidHighways": true,
        "avoidTolls": true,
        "avoidFerries": true,
        "avoidHills": true,
        "preferLitPaths": true,
        "preferPavedPaths": true,
        "safetyVsEfficiency": 1
      }
    },
    "departureTime": "2019-08-24T14:15:22Z"
  }'
const body = JSON.stringify({
  "waypoints": [
    {
      "lat": 0,
      "lng": 0
    },
    {
      "lat": 0,
      "lng": 0
    }
  ],
  "modes": [
    "walking"
  ],
  "routingPreferences": {
    "walking": {
      "highways": 1,
      "tolls": 1,
      "ferries": 1,
      "hills": 1,
      "surfaceQuality": 1,
      "litPaths": 1,
      "safetyVsSpeed": 1,
      "shortest": true,
      "preferHOV": true,
      "wheelchairAccessible": true,
      "cyclingSpeed": 1,
      "walkingSpeed": 0.5,
      "bicycleType": "string",
      "maxWalkingDistance": 0,
      "maxTransfers": 0,
      "transitBufferMinutes": 5,
      "useKnownVehicleLocations": true,
      "useKnownParkingLocations": true,
      "includePrivateParking": true,
      "routingEngine": "string",
      "customModelOverride": "string",
      "avoidHighways": true,
      "avoidTolls": true,
      "avoidFerries": true,
      "avoidHills": true,
      "preferLitPaths": true,
      "preferPavedPaths": true,
      "safetyVsEfficiency": 1
    },
    "biking": {
      "highways": 1,
      "tolls": 1,
      "ferries": 1,
      "hills": 1,
      "surfaceQuality": 1,
      "litPaths": 1,
      "safetyVsSpeed": 1,
      "shortest": true,
      "preferHOV": true,
      "wheelchairAccessible": true,
      "cyclingSpeed": 1,
      "walkingSpeed": 0.5,
      "bicycleType": "string",
      "maxWalkingDistance": 0,
      "maxTransfers": 0,
      "transitBufferMinutes": 5,
      "useKnownVehicleLocations": true,
      "useKnownParkingLocations": true,
      "includePrivateParking": true,
      "routingEngine": "string",
      "customModelOverride": "string",
      "avoidHighways": true,
      "avoidTolls": true,
      "avoidFerries": true,
      "avoidHills": true,
      "preferLitPaths": true,
      "preferPavedPaths": true,
      "safetyVsEfficiency": 1
    },
    "driving": {
      "highways": 1,
      "tolls": 1,
      "ferries": 1,
      "hills": 1,
      "surfaceQuality": 1,
      "litPaths": 1,
      "safetyVsSpeed": 1,
      "shortest": true,
      "preferHOV": true,
      "wheelchairAccessible": true,
      "cyclingSpeed": 1,
      "walkingSpeed": 0.5,
      "bicycleType": "string",
      "maxWalkingDistance": 0,
      "maxTransfers": 0,
      "transitBufferMinutes": 5,
      "useKnownVehicleLocations": true,
      "useKnownParkingLocations": true,
      "includePrivateParking": true,
      "routingEngine": "string",
      "customModelOverride": "string",
      "avoidHighways": true,
      "avoidTolls": true,
      "avoidFerries": true,
      "avoidHills": true,
      "preferLitPaths": true,
      "preferPavedPaths": true,
      "safetyVsEfficiency": 1
    },
    "transit": {
      "highways": 1,
      "tolls": 1,
      "ferries": 1,
      "hills": 1,
      "surfaceQuality": 1,
      "litPaths": 1,
      "safetyVsSpeed": 1,
      "shortest": true,
      "preferHOV": true,
      "wheelchairAccessible": true,
      "cyclingSpeed": 1,
      "walkingSpeed": 0.5,
      "bicycleType": "string",
      "maxWalkingDistance": 0,
      "maxTransfers": 0,
      "transitBufferMinutes": 5,
      "useKnownVehicleLocations": true,
      "useKnownParkingLocations": true,
      "includePrivateParking": true,
      "routingEngine": "string",
      "customModelOverride": "string",
      "avoidHighways": true,
      "avoidTolls": true,
      "avoidFerries": true,
      "avoidHills": true,
      "preferLitPaths": true,
      "preferPavedPaths": true,
      "safetyVsEfficiency": 1
    }
  },
  "departureTime": "2019-08-24T14:15:22Z"
})

fetch("https://example.com/directions/estimates", {
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://example.com/directions/estimates"
  body := strings.NewReader(`{
    "waypoints": [
      {
        "lat": 0,
        "lng": 0
      },
      {
        "lat": 0,
        "lng": 0
      }
    ],
    "modes": [
      "walking"
    ],
    "routingPreferences": {
      "walking": {
        "highways": 1,
        "tolls": 1,
        "ferries": 1,
        "hills": 1,
        "surfaceQuality": 1,
        "litPaths": 1,
        "safetyVsSpeed": 1,
        "shortest": true,
        "preferHOV": true,
        "wheelchairAccessible": true,
        "cyclingSpeed": 1,
        "walkingSpeed": 0.5,
        "bicycleType": "string",
        "maxWalkingDistance": 0,
        "maxTransfers": 0,
        "transitBufferMinutes": 5,
        "useKnownVehicleLocations": true,
        "useKnownParkingLocations": true,
        "includePrivateParking": true,
        "routingEngine": "string",
        "customModelOverride": "string",
        "avoidHighways": true,
        "avoidTolls": true,
        "avoidFerries": true,
        "avoidHills": true,
        "preferLitPaths": true,
        "preferPavedPaths": true,
        "safetyVsEfficiency": 1
      },
      "biking": {
        "highways": 1,
        "tolls": 1,
        "ferries": 1,
        "hills": 1,
        "surfaceQuality": 1,
        "litPaths": 1,
        "safetyVsSpeed": 1,
        "shortest": true,
        "preferHOV": true,
        "wheelchairAccessible": true,
        "cyclingSpeed": 1,
        "walkingSpeed": 0.5,
        "bicycleType": "string",
        "maxWalkingDistance": 0,
        "maxTransfers": 0,
        "transitBufferMinutes": 5,
        "useKnownVehicleLocations": true,
        "useKnownParkingLocations": true,
        "includePrivateParking": true,
        "routingEngine": "string",
        "customModelOverride": "string",
        "avoidHighways": true,
        "avoidTolls": true,
        "avoidFerries": true,
        "avoidHills": true,
        "preferLitPaths": true,
        "preferPavedPaths": true,
        "safetyVsEfficiency": 1
      },
      "driving": {
        "highways": 1,
        "tolls": 1,
        "ferries": 1,
        "hills": 1,
        "surfaceQuality": 1,
        "litPaths": 1,
        "safetyVsSpeed": 1,
        "shortest": true,
        "preferHOV": true,
        "wheelchairAccessible": true,
        "cyclingSpeed": 1,
        "walkingSpeed": 0.5,
        "bicycleType": "string",
        "maxWalkingDistance": 0,
        "maxTransfers": 0,
        "transitBufferMinutes": 5,
        "useKnownVehicleLocations": true,
        "useKnownParkingLocations": true,
        "includePrivateParking": true,
        "routingEngine": "string",
        "customModelOverride": "string",
        "avoidHighways": true,
        "avoidTolls": true,
        "avoidFerries": true,
        "avoidHills": true,
        "preferLitPaths": true,
        "preferPavedPaths": true,
        "safetyVsEfficiency": 1
      },
      "transit": {
        "highways": 1,
        "tolls": 1,
        "ferries": 1,
        "hills": 1,
        "surfaceQuality": 1,
        "litPaths": 1,
        "safetyVsSpeed": 1,
        "shortest": true,
        "preferHOV": true,
        "wheelchairAccessible": true,
        "cyclingSpeed": 1,
        "walkingSpeed": 0.5,
        "bicycleType": "string",
        "maxWalkingDistance": 0,
        "maxTransfers": 0,
        "transitBufferMinutes": 5,
        "useKnownVehicleLocations": true,
        "useKnownParkingLocations": true,
        "includePrivateParking": true,
        "routingEngine": "string",
        "customModelOverride": "string",
        "avoidHighways": true,
        "avoidTolls": true,
        "avoidFerries": true,
        "avoidHills": true,
        "preferLitPaths": true,
        "preferPavedPaths": true,
        "safetyVsEfficiency": 1
      }
    },
    "departureTime": "2019-08-24T14:15:22Z"
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/directions/estimates"
body = {
  "waypoints": [
    {
      "lat": 0,
      "lng": 0
    },
    {
      "lat": 0,
      "lng": 0
    }
  ],
  "modes": [
    "walking"
  ],
  "routingPreferences": {
    "walking": {
      "highways": 1,
      "tolls": 1,
      "ferries": 1,
      "hills": 1,
      "surfaceQuality": 1,
      "litPaths": 1,
      "safetyVsSpeed": 1,
      "shortest": true,
      "preferHOV": true,
      "wheelchairAccessible": true,
      "cyclingSpeed": 1,
      "walkingSpeed": 0.5,
      "bicycleType": "string",
      "maxWalkingDistance": 0,
      "maxTransfers": 0,
      "transitBufferMinutes": 5,
      "useKnownVehicleLocations": true,
      "useKnownParkingLocations": true,
      "includePrivateParking": true,
      "routingEngine": "string",
      "customModelOverride": "string",
      "avoidHighways": true,
      "avoidTolls": true,
      "avoidFerries": true,
      "avoidHills": true,
      "preferLitPaths": true,
      "preferPavedPaths": true,
      "safetyVsEfficiency": 1
    },
    "biking": {
      "highways": 1,
      "tolls": 1,
      "ferries": 1,
      "hills": 1,
      "surfaceQuality": 1,
      "litPaths": 1,
      "safetyVsSpeed": 1,
      "shortest": true,
      "preferHOV": true,
      "wheelchairAccessible": true,
      "cyclingSpeed": 1,
      "walkingSpeed": 0.5,
      "bicycleType": "string",
      "maxWalkingDistance": 0,
      "maxTransfers": 0,
      "transitBufferMinutes": 5,
      "useKnownVehicleLocations": true,
      "useKnownParkingLocations": true,
      "includePrivateParking": true,
      "routingEngine": "string",
      "customModelOverride": "string",
      "avoidHighways": true,
      "avoidTolls": true,
      "avoidFerries": true,
      "avoidHills": true,
      "preferLitPaths": true,
      "preferPavedPaths": true,
      "safetyVsEfficiency": 1
    },
    "driving": {
      "highways": 1,
      "tolls": 1,
      "ferries": 1,
      "hills": 1,
      "surfaceQuality": 1,
      "litPaths": 1,
      "safetyVsSpeed": 1,
      "shortest": true,
      "preferHOV": true,
      "wheelchairAccessible": true,
      "cyclingSpeed": 1,
      "walkingSpeed": 0.5,
      "bicycleType": "string",
      "maxWalkingDistance": 0,
      "maxTransfers": 0,
      "transitBufferMinutes": 5,
      "useKnownVehicleLocations": true,
      "useKnownParkingLocations": true,
      "includePrivateParking": true,
      "routingEngine": "string",
      "customModelOverride": "string",
      "avoidHighways": true,
      "avoidTolls": true,
      "avoidFerries": true,
      "avoidHills": true,
      "preferLitPaths": true,
      "preferPavedPaths": true,
      "safetyVsEfficiency": 1
    },
    "transit": {
      "highways": 1,
      "tolls": 1,
      "ferries": 1,
      "hills": 1,
      "surfaceQuality": 1,
      "litPaths": 1,
      "safetyVsSpeed": 1,
      "shortest": true,
      "preferHOV": true,
      "wheelchairAccessible": true,
      "cyclingSpeed": 1,
      "walkingSpeed": 0.5,
      "bicycleType": "string",
      "maxWalkingDistance": 0,
      "maxTransfers": 0,
      "transitBufferMinutes": 5,
      "useKnownVehicleLocations": true,
      "useKnownParkingLocations": true,
      "includePrivateParking": true,
      "routingEngine": "string",
      "customModelOverride": "string",
      "avoidHighways": true,
      "avoidTolls": true,
      "avoidFerries": true,
      "avoidHills": true,
      "preferLitPaths": true,
      "preferPavedPaths": true,
      "safetyVsEfficiency": 1
    }
  },
  "departureTime": "2019-08-24T14:15:22Z"
}
response = requests.request("POST", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
{
  "estimates": {
    "walking": 0,
    "biking": 0,
    "driving": 0,
    "transit": 0
  }
}
{
  "message": "string"
}

Reroute the current segment during navigation

Plans a fresh street route from where the traveller is to the end of the segment they are on, favouring the direction they are already heading so the new route does not open with a U-turn. Send a position projected a few seconds ahead of the last fix. Returns one segment in the same shape as a /directions trip segment.

POST
/directions/reroute

Request Body

application/jsonRequired
positionRequiredobject
headingnumber
Minimum: 0Maximum: 360
speednumber

Metres per second. Walking, and cycling below 4 m/s, ignore heading: they can turn round.

Minimum: 0
destinationRequiredobject
modeRequiredstring
routingPreferencesobject

Response Body

curl -X POST "https://example.com/directions/reroute" \
  -H "Content-Type: application/json" \
  -d '{
    "position": {
      "lat": 0,
      "lng": 0
    },
    "heading": 360,
    "speed": 0,
    "destination": {
      "lat": 0,
      "lng": 0
    },
    "mode": "walking",
    "routingPreferences": {}
  }'
const body = JSON.stringify({
  "position": {
    "lat": 0,
    "lng": 0
  },
  "heading": 360,
  "speed": 0,
  "destination": {
    "lat": 0,
    "lng": 0
  },
  "mode": "walking",
  "routingPreferences": {}
})

fetch("https://example.com/directions/reroute", {
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://example.com/directions/reroute"
  body := strings.NewReader(`{
    "position": {
      "lat": 0,
      "lng": 0
    },
    "heading": 360,
    "speed": 0,
    "destination": {
      "lat": 0,
      "lng": 0
    },
    "mode": "walking",
    "routingPreferences": {}
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/directions/reroute"
body = {
  "position": {
    "lat": 0,
    "lng": 0
  },
  "heading": 360,
  "speed": 0,
  "destination": {
    "lat": 0,
    "lng": 0
  },
  "mode": "walking",
  "routingPreferences": {}
}
response = requests.request("POST", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
Empty

Alternative routes for the rest of the current segment

The same request as /reroute, answered with up to three routes from where the traveller is to the end of their segment. Each is a segment like /reroute returns, plus metrics: duration, distance, turns, protectedShare and majorRoadShare (fractions of distance), crossings, and via, the street carrying most of the route.

POST
/directions/alternatives

Request Body

application/jsonRequired
positionRequiredobject
headingnumber
Minimum: 0Maximum: 360
speednumber

Metres per second. Walking, and cycling below 4 m/s, ignore heading: they can turn round.

Minimum: 0
destinationRequiredobject
modeRequiredstring
routingPreferencesobject

Response Body

curl -X POST "https://example.com/directions/alternatives" \
  -H "Content-Type: application/json" \
  -d '{
    "position": {
      "lat": 0,
      "lng": 0
    },
    "heading": 360,
    "speed": 0,
    "destination": {
      "lat": 0,
      "lng": 0
    },
    "mode": "walking",
    "routingPreferences": {}
  }'
const body = JSON.stringify({
  "position": {
    "lat": 0,
    "lng": 0
  },
  "heading": 360,
  "speed": 0,
  "destination": {
    "lat": 0,
    "lng": 0
  },
  "mode": "walking",
  "routingPreferences": {}
})

fetch("https://example.com/directions/alternatives", {
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://example.com/directions/alternatives"
  body := strings.NewReader(`{
    "position": {
      "lat": 0,
      "lng": 0
    },
    "heading": 360,
    "speed": 0,
    "destination": {
      "lat": 0,
      "lng": 0
    },
    "mode": "walking",
    "routingPreferences": {}
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/directions/alternatives"
body = {
  "position": {
    "lat": 0,
    "lng": 0
  },
  "heading": 360,
  "speed": 0,
  "destination": {
    "lat": 0,
    "lng": 0
  },
  "mode": "walking",
  "routingPreferences": {}
}
response = requests.request("POST", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
Empty

Get available vehicle types

List all supported vehicle types and their characteristics

GET
/directions/vehicle-types

Response Body

curl -X GET "https://example.com/directions/vehicle-types"
fetch("https://example.com/directions/vehicle-types")
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "https://example.com/directions/vehicle-types"

  req, _ := http.NewRequest("GET", url, nil)
  
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/directions/vehicle-types"

response = requests.request("GET", url)

print(response.text)
Empty

Validate trip request

Validate a trip request without actually planning the trip

POST
/directions/validate

Request Body

application/jsonRequired
waypointsRequiredarray<object>
selectedModestring
sortPreferencestring
Default: "shortest"Value in: "shortest" | "earliest_arrival" | "cheapest" | "fewest_transfers" | "least_walking" | "greenest"
excludedModesarray<string>

Modes the rider does not use. Trips with a segment in any of them are left out, except the mode of the selected tab, which is always planned. driving covers park-and-ride, biking an owned bike (bike-to-station, carry-on), bikeshare shared bikes and scooters, transit any trip with a transit leg.

routingPreferencesobject
availableVehiclesarray<object>
knownAccessPointsarray<object>
preferredDepartureTimestring
preferredArrivalTimestring
requestIdstring
timestampstring

Response Body

curl -X POST "https://example.com/directions/validate" \
  -H "Content-Type: application/json" \
  -d '{
    "waypoints": [
      {
        "location": {
          "lat": 0,
          "lng": 0
        },
        "address": "string",
        "label": "string",
        "type": "origin",
        "departAfter": "2019-08-24T14:15:22Z",
        "arriveBy": "2019-08-24T14:15:22Z",
        "dwellTime": 0,
        "heading": 360,
        "speed": 0
      },
      {
        "location": {
          "lat": 0,
          "lng": 0
        },
        "address": "string",
        "label": "string",
        "type": "origin",
        "departAfter": "2019-08-24T14:15:22Z",
        "arriveBy": "2019-08-24T14:15:22Z",
        "dwellTime": 0,
        "heading": 360,
        "speed": 0
      }
    ],
    "selectedMode": "multi",
    "sortPreference": "shortest",
    "excludedModes": [
      "transit"
    ],
    "routingPreferences": {
      "highways": 1,
      "tolls": 1,
      "ferries": 1,
      "hills": 1,
      "surfaceQuality": 1,
      "litPaths": 1,
      "safetyVsSpeed": 1,
      "shortest": true,
      "preferHOV": true,
      "wheelchairAccessible": true,
      "cyclingSpeed": 1,
      "walkingSpeed": 0.5,
      "bicycleType": "string",
      "maxWalkingDistance": 0,
      "maxTransfers": 0,
      "transitBufferMinutes": 5,
      "useKnownVehicleLocations": true,
      "useKnownParkingLocations": true,
      "includePrivateParking": true,
      "routingEngine": "string",
      "customModelOverride": "string",
      "avoidHighways": true,
      "avoidTolls": true,
      "avoidFerries": true,
      "avoidHills": true,
      "preferLitPaths": true,
      "preferPavedPaths": true,
      "safetyVsEfficiency": 1
    },
    "availableVehicles": [
      {
        "id": "string",
        "type": "car",
        "energyType": "electric",
        "name": "string",
        "location": {
          "lat": 0,
          "lng": 0
        }
      }
    ],
    "knownAccessPoints": [
      {
        "osmId": "string",
        "code": "string",
        "name": "string",
        "location": {
          "lat": 0,
          "lng": 0
        }
      }
    ],
    "preferredDepartureTime": "string",
    "preferredArrivalTime": "string",
    "requestId": "string",
    "timestamp": "string"
  }'
const body = JSON.stringify({
  "waypoints": [
    {
      "location": {
        "lat": 0,
        "lng": 0
      },
      "address": "string",
      "label": "string",
      "type": "origin",
      "departAfter": "2019-08-24T14:15:22Z",
      "arriveBy": "2019-08-24T14:15:22Z",
      "dwellTime": 0,
      "heading": 360,
      "speed": 0
    },
    {
      "location": {
        "lat": 0,
        "lng": 0
      },
      "address": "string",
      "label": "string",
      "type": "origin",
      "departAfter": "2019-08-24T14:15:22Z",
      "arriveBy": "2019-08-24T14:15:22Z",
      "dwellTime": 0,
      "heading": 360,
      "speed": 0
    }
  ],
  "selectedMode": "multi",
  "sortPreference": "shortest",
  "excludedModes": [
    "transit"
  ],
  "routingPreferences": {
    "highways": 1,
    "tolls": 1,
    "ferries": 1,
    "hills": 1,
    "surfaceQuality": 1,
    "litPaths": 1,
    "safetyVsSpeed": 1,
    "shortest": true,
    "preferHOV": true,
    "wheelchairAccessible": true,
    "cyclingSpeed": 1,
    "walkingSpeed": 0.5,
    "bicycleType": "string",
    "maxWalkingDistance": 0,
    "maxTransfers": 0,
    "transitBufferMinutes": 5,
    "useKnownVehicleLocations": true,
    "useKnownParkingLocations": true,
    "includePrivateParking": true,
    "routingEngine": "string",
    "customModelOverride": "string",
    "avoidHighways": true,
    "avoidTolls": true,
    "avoidFerries": true,
    "avoidHills": true,
    "preferLitPaths": true,
    "preferPavedPaths": true,
    "safetyVsEfficiency": 1
  },
  "availableVehicles": [
    {
      "id": "string",
      "type": "car",
      "energyType": "electric",
      "name": "string",
      "location": {
        "lat": 0,
        "lng": 0
      }
    }
  ],
  "knownAccessPoints": [
    {
      "osmId": "string",
      "code": "string",
      "name": "string",
      "location": {
        "lat": 0,
        "lng": 0
      }
    }
  ],
  "preferredDepartureTime": "string",
  "preferredArrivalTime": "string",
  "requestId": "string",
  "timestamp": "string"
})

fetch("https://example.com/directions/validate", {
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://example.com/directions/validate"
  body := strings.NewReader(`{
    "waypoints": [
      {
        "location": {
          "lat": 0,
          "lng": 0
        },
        "address": "string",
        "label": "string",
        "type": "origin",
        "departAfter": "2019-08-24T14:15:22Z",
        "arriveBy": "2019-08-24T14:15:22Z",
        "dwellTime": 0,
        "heading": 360,
        "speed": 0
      },
      {
        "location": {
          "lat": 0,
          "lng": 0
        },
        "address": "string",
        "label": "string",
        "type": "origin",
        "departAfter": "2019-08-24T14:15:22Z",
        "arriveBy": "2019-08-24T14:15:22Z",
        "dwellTime": 0,
        "heading": 360,
        "speed": 0
      }
    ],
    "selectedMode": "multi",
    "sortPreference": "shortest",
    "excludedModes": [
      "transit"
    ],
    "routingPreferences": {
      "highways": 1,
      "tolls": 1,
      "ferries": 1,
      "hills": 1,
      "surfaceQuality": 1,
      "litPaths": 1,
      "safetyVsSpeed": 1,
      "shortest": true,
      "preferHOV": true,
      "wheelchairAccessible": true,
      "cyclingSpeed": 1,
      "walkingSpeed": 0.5,
      "bicycleType": "string",
      "maxWalkingDistance": 0,
      "maxTransfers": 0,
      "transitBufferMinutes": 5,
      "useKnownVehicleLocations": true,
      "useKnownParkingLocations": true,
      "includePrivateParking": true,
      "routingEngine": "string",
      "customModelOverride": "string",
      "avoidHighways": true,
      "avoidTolls": true,
      "avoidFerries": true,
      "avoidHills": true,
      "preferLitPaths": true,
      "preferPavedPaths": true,
      "safetyVsEfficiency": 1
    },
    "availableVehicles": [
      {
        "id": "string",
        "type": "car",
        "energyType": "electric",
        "name": "string",
        "location": {
          "lat": 0,
          "lng": 0
        }
      }
    ],
    "knownAccessPoints": [
      {
        "osmId": "string",
        "code": "string",
        "name": "string",
        "location": {
          "lat": 0,
          "lng": 0
        }
      }
    ],
    "preferredDepartureTime": "string",
    "preferredArrivalTime": "string",
    "requestId": "string",
    "timestamp": "string"
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/directions/validate"
body = {
  "waypoints": [
    {
      "location": {
        "lat": 0,
        "lng": 0
      },
      "address": "string",
      "label": "string",
      "type": "origin",
      "departAfter": "2019-08-24T14:15:22Z",
      "arriveBy": "2019-08-24T14:15:22Z",
      "dwellTime": 0,
      "heading": 360,
      "speed": 0
    },
    {
      "location": {
        "lat": 0,
        "lng": 0
      },
      "address": "string",
      "label": "string",
      "type": "origin",
      "departAfter": "2019-08-24T14:15:22Z",
      "arriveBy": "2019-08-24T14:15:22Z",
      "dwellTime": 0,
      "heading": 360,
      "speed": 0
    }
  ],
  "selectedMode": "multi",
  "sortPreference": "shortest",
  "excludedModes": [
    "transit"
  ],
  "routingPreferences": {
    "highways": 1,
    "tolls": 1,
    "ferries": 1,
    "hills": 1,
    "surfaceQuality": 1,
    "litPaths": 1,
    "safetyVsSpeed": 1,
    "shortest": true,
    "preferHOV": true,
    "wheelchairAccessible": true,
    "cyclingSpeed": 1,
    "walkingSpeed": 0.5,
    "bicycleType": "string",
    "maxWalkingDistance": 0,
    "maxTransfers": 0,
    "transitBufferMinutes": 5,
    "useKnownVehicleLocations": true,
    "useKnownParkingLocations": true,
    "includePrivateParking": true,
    "routingEngine": "string",
    "customModelOverride": "string",
    "avoidHighways": true,
    "avoidTolls": true,
    "avoidFerries": true,
    "avoidHills": true,
    "preferLitPaths": true,
    "preferPavedPaths": true,
    "safetyVsEfficiency": 1
  },
  "availableVehicles": [
    {
      "id": "string",
      "type": "car",
      "energyType": "electric",
      "name": "string",
      "location": {
        "lat": 0,
        "lng": 0
      }
    }
  ],
  "knownAccessPoints": [
    {
      "osmId": "string",
      "code": "string",
      "name": "string",
      "location": {
        "lat": 0,
        "lng": 0
      }
    }
  ],
  "preferredDepartureTime": "string",
  "preferredArrivalTime": "string",
  "requestId": "string",
  "timestamp": "string"
}
response = requests.request("POST", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
Empty

Get service status and capabilities

Get the current status and capabilities of the trip planning service

GET
/directions/status

Response Body

curl -X GET "https://example.com/directions/status"
fetch("https://example.com/directions/status")
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "https://example.com/directions/status"

  req, _ := http.NewRequest("GET", url, nil)
  
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/directions/status"

response = requests.request("GET", url)

print(response.text)
Empty

Persist a planned trip snapshot

Saves the chosen trip and its planning inputs under a random capability token so trip URLs survive refresh and can be shared across devices. Snapshots expire after 30 days.

POST
/directions/trips

Request Body

application/jsonRequired
requestRequiredunknown
tripRequiredunknown

Response Body

curl -X POST "https://example.com/directions/trips" \
  -H "Content-Type: application/json" \
  -d '{
    "request": null,
    "trip": null
  }'
const body = JSON.stringify({
  "request": null,
  "trip": null
})

fetch("https://example.com/directions/trips", {
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://example.com/directions/trips"
  body := strings.NewReader(`{
    "request": null,
    "trip": null
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/directions/trips"
body = {
  "request": null,
  "trip": null
}
response = requests.request("POST", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
Empty

Fetch a persisted trip snapshot

Returns the trip and planning inputs saved under this token, or 404 when unknown or expired.

GET
/directions/trips/{id}

Path Parameters

idRequiredstring

Response Body

curl -X GET "https://example.com/directions/trips/string"
fetch("https://example.com/directions/trips/string")
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "https://example.com/directions/trips/string"

  req, _ := http.NewRequest("GET", url, nil)
  
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://example.com/directions/trips/string"

response = requests.request("GET", url)

print(response.text)
Empty