Plan a future trip

Implement Using: Directions Flexible API

To plan a trip in the future we configure the departure_time parameter of the Directions Flexible API along with other constraints. Providing a departure_time allows the service to consider the general traffic conditions at the given time and provide the best route and ETAs accordingly. To configure this request, we provide:

  • origin & destination to to denote the starting and end locations of the trip
  • mode set to “car” to get a route which a car can take
  • departure_time parameter set with the timestamp when the trip is to be made
  • option set to “flexible”

Request

1curl --location 'https://api.nextbillion.io/directions/json?origin=34.06219448,-118.29864009&destination=34.00680087,-118.27003189&mode=car&key=<your_api_key>&option=flexible&departure_time=1718640000' \
2--header 'Content-Type: application/json'

Response

1{
2 "status": "Ok",
3 "routes": [...]
4}