• Optimization
  • Navigation
  • Tracking
  • Maps
  • Places

  • Integrations

Directions API

Introduction

Nextbillion.ai’s Directions API is a service that computes a route between two places. With the Directions API, you can:

  • Find the most optimal route and ETAs between the origin and the destination.

  • Get directions for different driving modes like car & truck.

  • You can also add waypoints, which are coordinates along the route.

  • Plan your trips in advance by setting departure_time to get best routes and ETAs

  • Get different routes based on different truck dimensions and weight.

The Directions API has 2 versions to cater to different business needs. First, is the Fast version which would return the route and related information in real time. Second, is the Flexible version which offers truck routing and time-based routing features in addition to those available in the Fast version. We will be talking about both these services below

Also check out NextBillion's Road Editor API for easy manipulation and custom updates to road network data, enhancing the utility of Directions API response in meeting your business needs

Directions Fast API

GET

https://api.nextbillion.io/directions/json?key={your_api_key}


The Directions Fast API gets the directions in real time for trips starting at current time. The routes returned through this service have the traffic conditions factored in to avoid any delays under usual circumstances.

Directions Fast API service can take input using both HTTPS GET and POST requests. Request URL, parameters and response schema are exactly the same for both methods. However, an important difference between these two input methods is in the maximum number of waypoints that can be added to the input. We will cover them below.

GET Request

To utilize the Directions API and obtain route information, a GET request is made with the required parameters: key, origin, and destination. To customize the request, additional parameters such as waypoints, mode and avoid can be included based on the user's preferences.

Please note that the maximum number of waypoints allowed in a GET request is 50.

Request Parameters

Loading..

POST Request

The parameters and their properties for the Directions Fast POST version are the same as listed in the Request Parameter section. The key is passed as a request parameter and the rest of the parameters should be included in the Request Body. An example of a POST request is added in the Sample Queries-Directions Fast section below.

Please note that the maximum number of waypoints allowed in a POST request is 200.

Response Schema

Loading..

Sample Queries-Directions Fast

GET Request Example 1

Let’s look at a simple directions request with

  • an origin and destination pair for a trip being made by a car

  • a request for a simplified route geometry in the response

  • steps set to true to get turn-by-turn information for the complete route

Request

  curl --location 'https://api.nextbillion.io/directions/json?origin=34.04367949,-118.30921138&destination=34.06660028,-118.24728963&mode=car&key=<your_api_key>&overview=simplified&steps=true'

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
{
    "status": "Ok",
    "routes": [
        {
            "geometry": "gcxnEpgbqUGim@yBqc@Eu{@pB_NdUyo@}RwK`EgMiN_HeHeHeWig@cQuXwOwMgDtCkNuM{TkMeQmQ_@wFkEcB",
            "distance": 7525.3,
            "duration": 1033.8,
            "start_location": {
                "latitude": 34.04356,
                "longitude": -118.30921
            },
            "end_location": {
                "latitude": 34.0666,
                "longitude": -118.24729
            },
            "legs": [
                {
                    "distance": {
                        "value": 7525
                    },
                    "duration": {
                        "value": 1033
                    },
                    "start_location": {
                        "latitude": 34.04356,
                        "longitude": -118.30921
                    },
                    "end_location": {
                        "latitude": 34.0666,
                        "longitude": -118.24729
                    },
                    "steps": [
                        {
                            "geometry": "gcxnEpgbqU?e@?uA?]?yCAcCA{A?uA?eDAaE?a@?mA?mA?uB?o@AqB?a@Ac@?EAUAWC]AO?OCe@C[G{@Gy@IeACc@Gw@Ca@MaBIiAC[KmBImB?AA_@Ao@A[CmB?]AoA?}@?sCA_D?]?eA?eB?Y?i@?c@?[?y@?q@?WAM?k@?cB?oD?cA?aA?a@?c@AsAA_G?W?C?O@M?M@S?M?K@I@K@GBSTaBD_@^cCD]BSLy@BONk@HWJ]HU^cAPi@Z{@HWp@iBNa@\\aAj@aBHUv@}BXw@Rm@FUNa@HWPg@\\cAN]JWt@uBr@qBL]Z}@f@uA^eAFO",
                            "start_location": {
                                "latitude": 34.04356,
                                "longitude": -118.30921
                            },
                            "end_location": {
                                "latitude": 34.04012,
                                "longitude": -118.27603
                            },
                            "distance": {
                                "value": 3178
                            },
                            "duration": {
                                "value": 410
                            },
                            "maneuver": {
                                "voice_instruction": [],
                                "bearing_before": 0,
                                "bearing_after": 90,
                                "coordinate": {
                                    "latitude": 34.043557,
                                    "longitude": -118.309211
                                },
                                "maneuver_type": "depart",
                                "modifier": "left"
                            }
                        },
                        {
                            "geometry": "wmwnEdx{pUoAs@w@_@uDuBeDeBWOGCi@[e@WIGIEEEGEGE",
                            "start_location": {
                                "latitude": 34.04012,
                                "longitude": -118.27603
                            },
                            "end_location": {
                                "latitude": 34.04331,
                                "longitude": -118.27399
                            },
                            "distance": {
                                "value": 400
                            },
                            "duration": {
                                "value": 51
                            },
                            "maneuver": {
                                "voice_instruction": [],
                                "bearing_before": 118,
                                "bearing_after": 28,
                                "coordinate": {
                                    "latitude": 34.040124,
                                    "longitude": -118.27603
                                },
                                "maneuver_type": "turn",
                                "modifier": "left"
                            }
                        },
                        {
                            "geometry": "uaxnElk{pUHWDMPi@^oAVq@Na@DOHMFCFI",
                            "start_location": {
                                "latitude": 34.04331,
                                "longitude": -118.27399
                            },
                            "end_location": {
                                "latitude": 34.04262,
                                "longitude": -118.27255
                            },
                            "distance": {
                                "value": 154
                            },
                            "duration": {
                                "value": 13
                            },
                            "maneuver": {
                                "voice_instruction": [],
                                "bearing_before": 29,
                                "bearing_after": 116,
                                "coordinate": {
                                    "latitude": 34.043309,
                                    "longitude": -118.273986
                                },
                                "maneuver_type": "turn",
                                "modifier": "right"
                            }
                        },
                        {
                            "geometry": "k}wnElb{pUB[BODQHYXcADK",
                            "start_location": {
                                "latitude": 34.04262,
                                "longitude": -118.27255
                            },
                            "end_location": {
                                "latitude": 34.04234,
                                "longitude": -118.27171
                            },
                            "distance": {
                                "value": 84
                            },
                            "duration": {
                                "value": 36
                            },
                            "maneuver": {
                                "voice_instruction": [],
                                "bearing_before": 146,
                                "bearing_after": 99,
                                "coordinate": {
                                    "latitude": 34.042622,
                                    "longitude": -118.272552
                                },
                                "maneuver_type": "continue",
                                "modifier": "left"
                            }
                        },
                        {
                            "geometry": "s{wnEd}zpUICo@WQKg@Y[OQA]So@[_Ac@iAm@[Qq@a@QKOIQMGEIIW]",
                            "start_location": {
                                "latitude": 34.04234,
                                "longitude": -118.27171
                            },
                            "end_location": {
                                "latitude": 34.04509,
                                "longitude": -118.26997
                            },
                            "distance": {
                                "value": 346
                            },
                            "duration": {
                                "value": 66
                            },
                            "maneuver": {
                                "voice_instruction": [],
                                "bearing_before": 119,
                                "bearing_after": 22,
                                "coordinate": {
                                    "latitude": 34.042343,
                                    "longitude": -118.271712
                                },
                                "maneuver_type": "end of road",
                                "modifier": "left"
                            }
                        },
                        {
                            "geometry": "ylxnEhrzpUQGOG_@[SSY[gAqAq@{@QYUc@OYa@e@mAaCe@}@_BwCKUu@{AmAgCoAgCCGO[a@_AWg@Wi@a@{@Wk@Uc@O[OWa@{@IMg@_AKQIOGKKOWc@g@}@Q[Wg@U]IM}@{AKOKQOUOY]g@QWOQ[e@OSSYU]OUGIOQSYUYIIAAGGOQEECAAAGCc@_@g@]m@a@_Ai@IG",
                            "start_location": {
                                "latitude": 34.04509,
                                "longitude": -118.26997
                            },
                            "end_location": {
                                "latitude": 34.05429,
                                "longitude": -118.25725
                            },
                            "distance": {
                                "value": 1571
                            },
                            "duration": {
                                "value": 200
                            },
                            "maneuver": {
                                "voice_instruction": [],
                                "bearing_before": 43,
                                "bearing_after": 32,
                                "coordinate": {
                                    "latitude": 34.045088,
                                    "longitude": -118.269967
                                },
                                "maneuver_type": "turn",
                                "modifier": "straight"
                            }
                        },
                        {
                            "geometry": "ifznExbxpUEEIIMQEEEGEGUSECMKk@k@[YaAaA[YOKKGMCKAI@KBC@EDEBQTY`@GJS\\ILUX",
                            "start_location": {
                                "latitude": 34.05429,
                                "longitude": -118.25725
                            },
                            "end_location": {
                                "latitude": 34.05655,
                                "longitude": -118.25663
                            },
                            "distance": {
                                "value": 325
                            },
                            "duration": {
                                "value": 47
                            },
                            "maneuver": {
                                "voice_instruction": [],
                                "bearing_before": 29,
                                "bearing_after": 43,
                                "coordinate": {
                                    "latitude": 34.054293,
                                    "longitude": -118.257249
                                },
                                "maneuver_type": "new name",
                                "modifier": "straight"
                            }
                        },
                        {
                            "geometry": "mtznE|~wpUmDeD][UYw@u@Y[Y[i@e@}@w@a@[SQ]Ug@[WMy@c@GCa@UuAy@eEaCsC}Aq@a@GEEEIEKKKKi@k@IGEECEo@q@[]m@o@UUeAeAQQQQYUEE_A_AWYMMYYo@m@GI]_@CGCEAE?I?K@IBKDSBK@I@O?G?KE[EUGSIQKQKKIIMIMEUCYAO@",
                            "start_location": {
                                "latitude": 34.05655,
                                "longitude": -118.25663
                            },
                            "end_location": {
                                "latitude": 34.06615,
                                "longitude": -118.24758
                            },
                            "distance": {
                                "value": 1407
                            },
                            "duration": {
                                "value": 202
                            },
                            "maneuver": {
                                "voice_instruction": [],
                                "bearing_before": 310,
                                "bearing_after": 37,
                                "coordinate": {
                                    "latitude": 34.056546,
                                    "longitude": -118.256634
                                },
                                "maneuver_type": "turn",
                                "modifier": "right"
                            }
                        },
                        {
                            "geometry": "mp|nEjfvpUQIOMKGk@Y",
                            "start_location": {
                                "latitude": 34.06615,
                                "longitude": -118.24758
                            },
                            "end_location": {
                                "latitude": 34.0666,
                                "longitude": -118.24729
                            },
                            "distance": {
                                "value": 56
                            },
                            "duration": {
                                "value": 5
                            },
                            "maneuver": {
                                "voice_instruction": [],
                                "bearing_before": 352,
                                "bearing_after": 28,
                                "coordinate": {
                                    "latitude": 34.066152,
                                    "longitude": -118.247583
                                },
                                "maneuver_type": "turn",
                                "modifier": "slight right"
                            }
                        },
                        {
                            "geometry": "gs|nEpdvpU",
                            "start_location": {
                                "latitude": 34.0666,
                                "longitude": -118.24729
                            },
                            "end_location": {
                                "latitude": 34.0666,
                                "longitude": -118.24729
                            },
                            "distance": {
                                "value": 0
                            },
                            "duration": {
                                "value": 0
                            },
                            "maneuver": {
                                "voice_instruction": [],
                                "bearing_before": 26,
                                "bearing_after": 0,
                                "coordinate": {
                                    "latitude": 34.066599,
                                    "longitude": -118.247289
                                },
                                "maneuver_type": "arrive"
                            }
                        }
                    ]
                }
            ]
        }
    ]
}

Here is a visual representation of the above response

GET Request Example 2

Taking the next step to use further features offered in Directions API. For the same origin and destination, let’s request:

  • full route geometry instead of simplified

  • a waypoints to be added in the request along with approaches information

  • to avoid highways in the returned route

  • to remove steps information from the response

Request

curl --location 'https://api.nextbillion.io/directions/json?origin=34.04367949,-118.30921138&destination=34.06660028,-118.24728963&mode=car&key=<your_api_key>&overview=full&avoid=highway&waypoints=34.05558063,-118.27052810&appraoches=unrestricted;curb'

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{
   "status": "Ok",
   "routes": [
       {
           "geometry": "gcxnEpgbqU?e@?uA?]?yCAcCA{A?uA?eDAaE?a@?mA?mA?uB?o@AqB?a@Ac@?EAUAWC]AO?OCe@C[G{@Gy@IeACc@Gw@Ca@MaBIiAC[KmBImB?AA_@Ao@A[CmB?]AoA?}@?sCA_D?]?eA?eB?Y?i@?c@?[?y@?q@?WAM?k@?cB?oD?cA?aA?a@?c@AsAA_G?W?C?O@M?M@S?M?K@I@K@GBSTaBD_@^cCD]BSLy@m@@_B@S?g@@e@?IKIGKIIEMEKGMGIEIEIAGE_B}@eBaAi@YUO_@Si@[m@]e@WQKIEECGCuAu@YO[Qg@Y`AqCTq@JYwCcBqC}A{A{@aB}@SK_@Ui@[mAq@_@S]S[QUMu@c@sAu@ECECcH}DeAm@qFaDm@[IEc@UUOq@]MIUMEEMGKGs@c@IEL[`@kADIX{@Pi@FQBIL_@DMBMFONg@L_@Pm@Vu@Vu@DKh@}AHSh@}AJYL]ECDBHUBIVs@^eAHWl@eBZ}@h@aBZ{@DOf@wAX_AFOFSTq@J[\\gAL]J]pAiDXw@Z_AJYTq@HUHWFQDMHS^gAXy@Lc@J]X{@`@sAN_@`@kAP_@Ta@P]R[LUZk@`@s@Xe@JOZm@LSt@sAu@q@OMQQWUe@e@mCgCgAeAa@a@g@c@EGMKOOIGOMKKYUYWYUu@q@e@a@GGGG_@YMMa@_@MKIIo@i@{AyAOM_@]SSg@e@QOcAcAIG_@_@GYOMKMQO{@y@IIGG[Wo@m@YWOOq@o@{@y@[YKKUSKMOOGKMOGIOWKSGMgBcE]aAOIa@kAYy@Uk@Yq@MS]k@[c@W]SUOMGCKEGCIEGCMGMIGC[SQK]SgAu@u@_@IEUK[Oe@Uk@Um@n@e@d@]`@KLORUVQRGH[\\QTSTOTWZc@l@??a@f@QTGHa@l@GFWZCBKLA@QLCBWPGI]_@CGCEAE?I?K@IBKDSBK@I@O?G?KE[EUGSIQKQKKIIMIMEUCYAO@QIOMKGk@Y",
           "distance": 8390.4,
           "duration": 1251.9,
           "legs": [
               {
                   "distance": {
                       "value": 4637
                   },
                   "duration": {
                       "value": 758
                   },
                   "steps": []
               },
               {
                   "distance": {
                       "value": 3753
                   },
                   "duration": {
                       "value": 493
                   },
                   "steps": []
               }
           ]
       }
   ]
}

And here is a visual representation of the above response. We can see a different route is suggested when a waypoint is added and the API is requested to avoid highway.

POST request Example

Let’s look at a Directions Fast POST method request with values for different parameters to configure a request

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
curl --location --request POST ‘https://api.nextbillion.io/directions/json?key=<your_api_key>’
--header 'Content-Type: application/json'
--data '{
   "origin": "34.14169142,-118.11283644",
   "destination": "34.00419854,-118.08278668",
   "mode": "car",
   "overview": "simplified",
   "geometry": "polyline6",
   "avoid": "highway",
   "alternative": true,
   "altcount":2,
   "waypoints": "34.09410170,-117.93187758|34.04547240,-117.96517223",
   "approaches": "unrestricted;;curb",
   "steps": true
}'

Directions Flexible API

GET

https://api.nextbillion.io/directions/json?option=flexible&key={your_api_key}


The Directions Flexible API offers customizable features for determining routes accurately. It can serve requests for truck specific routing, time based routing, choosing between fastest and shortest route types and also offers to return segment-wise speed limits of the route suggested. The traffic conditions are also factored in, to avoid delays under usual circumstances.

To use the Directions Flexible API service please set the option parameter to flexible. Please note some request and response parameters available in the Fast version are not available in Flexible version and vice-versa.

The Flexible version also supports both HTTPS GET and POST methods. Request URL, parameters and response schemas are exactly the same for both methods. However, an important difference between these two input methods is in the maximum number of waypoints that can be added to the input. We will cover them below.

GET Request

To utilize the Directions Flexible API and obtain route information, a GET request is made with the required parameters: key, origin, destination and option. To customize the request, additional parameters such as waypoints, mode and avoid can be included based on the user's preferences.

Please note that the maximum number of waypoints allowed in a GET request is 50.

Request Parameters

Loading..

POST Request

The parameters and their properties for the Directions Flexible POST version are the same as listed in the Request Parameter section. The key and option are passed as query parameters and the rest of the parameters should be included in the Request Body. An example for a POST request is added in the Sample Queries - Directions Flexible section below.

Response Schema

Loading..

Sample Queries-Directions Flexible

GET Request Example 1

Using the same origin and destination pair from the example from Directions Fast, let's see how different routes are suggested by Directions Flexible for different configurations of parameters. Let’s start by creating a simple flexible request for

  • a trip being made by a truck

  • a specific departure_time

Request

https://api.nextbillion.io/directions/json?origin=34.14169142,-118.11283644&destination=34.00419854,-118.08278668&mode=truck&departrure_time=1683105152&option=flexible&key=<your_api_key>

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
{
   "status": "Ok",
   "mode": "truck",
   "routes": [
       {
           "geometry": "qhkoE~}{oUE?q@?u@?]@q@?q@?iA@aA?mA?M?u@@_@?]?{B@i@?S?I?M?W?A?g@?Q?{@@]?O?eF@C?mB?kA?C?_@?U?W?I?Y?q@?o@AY?Q?M?sA@g@?o@?UImACmAACa@AEEUE[AUCg@ScIMgEAa@GoCAa@W_@GiH?]?yA?Q?W?iD?sDAoC?QAeC?_C?qB?}@AiIA{A?]?q@?K?i@?[?[?c@?s@AcD?WAeF?oA@Y?iA@W@YBe@?[@SBSHcA@KBSB]D]Fc@D]Ly@Ha@Hg@Jg@Li@H]H]HYLa@La@Z{@Zy@HQPa@Xi@Xe@bBsCZa@^k@Zc@b@k@n@_AZe@`@k@Zi@Xi@Xk@b@}@HSJUPe@Tq@Ri@FSDMPo@Ji@H]N}@J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Zj@NX`@t@HLbAlBBb@DLpAxCPd@J\\FZBX@X?`@Ax@?d@?F?LBPDLFNJPFHDFBJHHDFJNLLLPr@|@NLPNBBXNTLB@@@PAdAb@|@^b@RTLLHh@\\f@^^ZFRFLLNl@t@T`@JLb@p@|A`CX`@FHf@|@JNJTNXHTHPBLDNL\\J\\DRFP?BDNJp@N`A@LD^BX@R@^@L?P@Z?l@Ct@K~AQtBO`BCXC^ALE`@E`@ATANATCr@?r@?r@Br@@JF`ABTZhBLn@H`@HXJXRl@@@Ph@NXDHDHHN\\d@\\f@Z^NRRTRPPPPN@@TN`@XHDVNXNJFLFJBLFp@P~@XZJRCv@^f@Xh@ZZRnAv@b@X~@l@d@X\\R\\RRLRLPJTHRHRJ\\LF?D@H?Z@R@J@L@VDTF\\JHBXHb@J~Dt@CRCj@Cf@Cp@Cj@Cn@C~@?LG`HMxKAv@?FATAdAAJ?JAJAPE\\E^CTEXUfBEXGZGNGNWb@ORx@tAFLhAbCABITMf@CTM~@WxBIv@j@ZVJr@R|Ct@ZFL?",
           "distance": 35973.574,
           "duration": 1690.291,
           "start_location": {
               "latitude": 34.14169,
               "longitude": -118.11312
           },
           "end_location": {
               "latitude": 34.0042,
               "longitude": -118.08291
           },
           "legs": [
               {
                   "distance": {
                       "value": 35973
                   },
                   "duration": {
                       "value": 1690
                   },
                   "start_location": {
                       "latitude": 34.14169,
                       "longitude": -118.11312
                   },
                   "end_location": {
                       "latitude": 34.0042,
                       "longitude": -118.08291
                   },
                   "steps": [
                       {
                           "geometry": "qhkoE~}{oUE?q@?u@?]@q@?q@?iA@aA?mA?M?u@@_@?]?{B@i@?S?I?M?W?A?g@?Q?{@@]?O?eF@C?mB?kA?C?_@?U?W?I?Y?q@?o@AY?Q?M?sA@g@?o@?UImACmAA",
                           "start_location": {
                               "latitude": 34.14169,
                               "longitude": -118.11312
                           },
                           "end_location": {
                               "latitude": 34.15185,
                               "longitude": -118.1131
                           },
                           "distance": {
                               "value": 1129
                           },
                           "duration": {
                               "value": 163
                           }
                       },
                       {
                           "geometry": "ahmoEz}{oUCa@",
                           "start_location": {
                               "latitude": 34.15185,
                               "longitude": -118.1131
                           },
                           "end_location": {
                               "latitude": 34.15187,
                               "longitude": -118.11293
                           },
                           "distance": {
                               "value": 16
                           },
                           "duration": {
                               "value": 15
                           }
                       },
                       {
                           "geometry": "ehmoEx|{oUAEEUE[AUCg@ScIMgEAa@GoCAa@W_@GiH?]?yA?Q?W?iD?sDAoC?QAeC?_C?qB?}@AiIA{A?]?q@?K?i@?[?[?c@?s@AcD?WAeF?oA@Y?iA@W@YBe@?[@SBSHcA@K",
                           "start_location": {
                               "latitude": 34.15187,
                               "longitude": -118.11293
                           },
                           "end_location": {
                               "latitude": 34.15228,
                               "longitude": -118.09378
                           },
                           "distance": {
                               "value": 1771
                           },
                           "duration": {
                               "value": 71
                           }
                       },
                       {
                           "geometry": "wjmoEbexoUBSB]D]Fc@D]Ly@Ha@Hg@Jg@Li@H]H]HYLa@La@Z{@Zy@HQPa@Xi@Xe@bBsCZa@^k@Zc@b@k@n@_AZe@`@k@Zi@Xi@Xk@b@}@HSJUPe@Tq@Ri@FSDMPo@Ji@H]N}@Jq@NeAH_ADk@@MHw@@]@a@@aB?a@?U?_@?m@E}CEmECqCCoCAY?WWgJAWGiAAYCi@e@mGG{@C]MyAAUKmAEq@SsDKsCCk@EyA?EEeCA_AAqA?i@AkA?W?kA?[?U?U?}@AgDA}H?aG?mA?kS?yC?SAcGA{CAsAAoEC_F?c@Ac@?M?O?]?kBA_B?I?iA?oB?uBAiC?a@?[?a@?k@As@?Q@UAi@?K",
                           "start_location": {
                               "latitude": 34.15228,
                               "longitude": -118.09378
                           },
                           "end_location": {
                               "latitude": 34.14867,
                               "longitude": -118.04892
                           },
                           "distance": {
                               "value": 4294
                           },
                           "duration": {
                               "value": 176
                           }
                       },
                       {
                           "geometry": "etloEvlooU?c@?o@?i@?_@?[AQ?A?S?s@?i@?wAAiC?aA?E?}@?[?M?O?EA[?c@?e@?_@?e@?e@?m@?W?c@Ai@@]?a@?q@@g@@g@?m@@k@@k@@k@@]?W@W@g@DqA@_@@OBs@Bk@@c@Ba@@a@Be@Bo@DiADkABq@@U@W@Y@[Be@Bc@@e@@W@[Bm@Bc@Bq@DiABm@DeADgAHmCFwADiA@K?GF{@?KH{@JeALy@BSBOJm@TcALk@HWX_AX{@J[",
                           "start_location": {
                               "latitude": 34.14867,
                               "longitude": -118.04892
                           },
                           "end_location": {
                               "latitude": 34.14709,
                               "longitude": -118.02982
                           },
                           "distance": {
                               "value": 1781
                           },
                           "duration": {
                               "value": 68
                           }
                       },
                       {
                           "geometry": "ijloEjukoUbCkGp@mB\\_AZy@\\}@Zw@FSf@qATk@Ri@To@JYFSTm@z@{BHSb@iAJ[Vo@`@eAXw@^aAVs@^}@La@Tm@v@qBJ[Tm@Tk@@G\\y@BGDM|@eCTm@Vq@^aA\\u@Zk@NY^i@b@o@j@q@z@}@TUNMZ[Z[PSj@g@JMRQj@k@z@w@z@}@h@m@BCd@m@^i@Zi@JSHON[JSDKDILYFOJWL]J[Nc@DSDI@KDQDOBKBKH_@H_@Ji@FYDOBQDQDQFSDS@IJe@Ry@FYFWH]Jg@H]H[Je@Jc@DQJa@Je@DUDSBEFWDWJg@Ja@Jg@DSF[FYD]DW@KBMBYBYDa@Ba@@[B]@[?O@U?U@UAaA@eA?Y?wC?U@}D?k@?s@?w@?eA?mB?_C?W?[?cC?m@?oA?o@?c@?i@?k@?gA?qA?a@?m@?s@?gA?c@Ac@@eA?_A?gA?e@?W@Y?Q?k@?eB?}E?{@?m@Aa@?{EAw@@Q?c@?s@Ac@@m@?s@?k@?i@?m@?}@?g@?mB?kA?oC?m@?e@?W?q@?{AAgA?{@?_@@aB?a@?oA@cB?k@@cA@eCD{GBcG",
                           "start_location": {
                               "latitude": 34.14709,
                               "longitude": -118.02982
                           },
                           "end_location": {
                               "latitude": 34.13528,
                               "longitude": -117.97925
                           },
                           "distance": {
                               "value": 5064
                           },
                           "duration": {
                               "value": 203
                           }
                       },
                       {
                           "geometry": "o`joEhyaoU@mA?{@@aA?[@[?c@?Y@]?[?e@?{AA{AAw@CiAEwBEiBO}H?a@A_B?u@?E?_@?gBA{A?g@?kAAo@?a@?oA?g@?eAAmB?mA?k@?u@?g@?s@?OAq@?m@?iA?cA?u@?{B",
                           "start_location": {
                               "latitude": 34.13528,
                               "longitude": -117.97925
                           },
                           "end_location": {
                               "latitude": 34.13547,
                               "longitude": -117.96479
                           },
                           "distance": {
                               "value": 1332
                           },
                           "duration": {
                               "value": 50
                           }
                       },
                       {
                           "geometry": "uajoE|~~nUT_ABOBg@F_ADw@HeAHeAFw@Fu@JcALmAD[DUDWDOFUHUFQHSLWHQJOJOLQJMNOPSTQLKXQJETMPIPGPGHAREHCPAXCXAV?d@@D@N@NBJ@H@JBHBJDJBHBHDHDHDJDz@l@bBfApAj@VRXRJHRNz@l@~@p@nA|@HFj@d@f@^LJ^^bAt@l@h@pArAxCdDjBrBl@n@l@p@tAvAj@n@f@h@h@h@~@`AhAlAzB`C|AbBz@|@j@l@l@n@f@h@hBnBxA|AbBfBZ^Z`@\\`@`@f@TXRXV`@\\d@Zd@PXT\\T`@v@vAh@bAvC|FtAnCx@xA`@t@RZRZ`@j@r@~@Zb@PN^`@^^`@^`@\\d@^TPPLRLXR\\TTNn@\\RHZNl@Xl@VXLj@Tb@PnBx@RHvAl@t@ZfAd@l@Vx@\\\\L`@Pf@T`@Nj@TXLTJNFVJFBHBHDPFTJPHTL`@N\\N`@Pp@Vx@\\h@Tf@RVL^Nj@VTHTHHDZLRHTJlAh@b@R\\NZJp@XRF\\LTF|@XxA\\JB`AV\\HlCl@hCn@lAXbEbA`@HpAZTFTFf@Lz@R~@RnBb@p@P\\HRD\\Jx@Rt@Vp@Vp@Zn@Zn@^n@`@j@d@l@d@f@d@LNRRf@n@JJV^n@z@JPFLHJLTJLHNJNJRDDDFHNHLRX^n@Xb@T\\NTJLPXRXRXTZNRTZb@h@PTRVb@h@NTNPZ\\VVJLt@x@TRf@h@^\\VXn@h@f@d@dA|@h@b@x@n@tBzA^VLHb@Xz@h@n@^RJt@`@r@^TL\\Pn@ZXLf@Tj@VZL^Nj@Td@RTH\\JbBh@p@Rn@RXFVHZH^Jf@Jr@PD?h@L`APb@FXFZDPDv@JlAN\\DfBPnBL\\B\\Bf@Bd@BjAB|@Br@@d@@~ADT@L@Z@ZBz@Fz@H`AHlAPf@FNDb@HZF^Ft@PPDTFTDFB`@JxBh@bAV~A`@`ATrAZtFtAj@PpCl@p@Nd@H`@F~@FZ@l@Dl@Bh@@t@@j@?r@?\\ARCJA`@Cr@K^Cd@G|@MNA^EXCZCr@Gj@Gd@GJ?^CTAF?XAZ?t@?d@@t@D|AHXBZDXB`@Fb@HXFTHb@Lf@NPD",
                           "start_location": {
                               "latitude": 34.13547,
                               "longitude": -117.96479
                           },
                           "end_location": {
                               "latitude": 34.06192,
                               "longitude": -118.00073
                           },
                           "distance": {
                               "value": 9718
                           },
                           "duration": {
                               "value": 317
                           }
                       },
                       {
                           "geometry": "_v{nEp_foUp@RXHRD|A`@dBb@LDp@Rp@Pn@Nb@NlA\\j@Rl@Tf@PPJNFl@Vf@Tt@\\~@b@f@THDNHd@Rh@VtB`A|@b@TJNHHDJDPHTJj@X`A`@NHTJXNj@VbAd@rAn@zAr@~@b@bAd@z@^v@`@pAj@v@^TLPHj@VVJz@`@^Pf@VHDXL`@PHDp@Zb@Rd@Vp@XJDxAr@VJLF^PXLRJ`Ab@~Ar@@@~Ar@l@VbAf@j@Xv@`@",
                           "start_location": {
                               "latitude": 34.06192,
                               "longitude": -118.00073
                           },
                           "end_location": {
                               "latitude": 34.04494,
                               "longitude": -118.00966
                           },
                           "distance": {
                               "value": 2064
                           },
                           "duration": {
                               "value": 69
                           }
                       },
                       {
                           "geometry": "{kxnEjwgoUb@V^TXRPLXR\\X\\X\\XXX\\ZXZTVVXPTVZZb@RXT^T\\T^Vd@Vd@Rd@Xl@Vn@Pb@\\|@J\\V|@ZbAPn@Ld@@DHTVx@Nf@f@bBh@rBt@bCf@hB`@vA^nARt@`@pANd@DNFVHVHVL`@J\\HXJXJZJVJVHTJVJVLXP\\LVNXNXLTPX\\f@j@x@PVLPLRNRNRb@l@LPRXFHJL^j@PTV\\TZb@j@JNV\\TZh@r@TZ?@Z`@LPNVTXRZZb@X`@LRV\\LNJNJNLRNVDHNTNTFJFH",
                           "start_location": {
                               "latitude": 34.04494,
                               "longitude": -118.00966
                           },
                           "end_location": {
                               "latitude": 34.03389,
                               "longitude": -118.02754
                           },
                           "distance": {
                               "value": 2090
                           },
                           "duration": {
                               "value": 70
                           }
                       },
                       {
                           "geometry": "yfvnEbgkoUt@`A\\f@Xb@Zb@TXJN`@f@LPNTX^Z`@X`@`@j@\\b@T\\X^X`@FHNVZ`@Zf@RZBDxA`CDHHPd@z@fAzBt@dBP\\P`@P^DJhA`C\\v@JTd@dALXXl@^v@v@fBl@rARb@`@~@LVFPd@|@^z@n@tAFNp@tAx@bBR\\bCzEr@pAJRJRLVNXR\\NZP\\T`@^r@JTPZNXR`@R\\NXLTLVNVLVLTHNJRjAxBp@nAtAfCVf@h@bAb@t@P^bAnBvB~Dh@~@b@z@d@z@Vb@Zj@NX`@t@HLbAlB",
                           "start_location": {
                               "latitude": 34.03389,
                               "longitude": -118.02754
                           },
                           "end_location": {
                               "latitude": 34.01937,
                               "longitude": -118.05071
                           },
                           "distance": {
                               "value": 2683
                           },
                           "duration": {
                               "value": 90
                           }
                       },
                       {
                           "geometry": "alsnE|wooUBb@DLpAxCPd@J\\FZBX@X?`@Ax@?d@?F?LBPDLFNJPFHDFBJHHDFJNLL",
                           "start_location": {
                               "latitude": 34.01937,
                               "longitude": -118.05071
                           },
                           "end_location": {
                               "latitude": 34.01825,
                               "longitude": -118.05395
                           },
                           "distance": {
                               "value": 337
                           },
                           "duration": {
                               "value": 25
                           }
                       },
                       {
                           "geometry": "aesnEdlpoULPr@|@NLPNBBXNTLB@@@PAdAb@|@^b@RTLLHh@\\f@^^ZFRFLLNl@t@T`@JLb@p@|A`CX`@FHf@|@JNJTNXHTHPBLDNL\\J\\DRFP?BDNJp@N`A@LD^BX@R@^@L?P@Z?l@Ct@K~AQtBO`BCXC^ALE`@E`@ATANATCr@?r@?r@Br@@JF`ABTZhBLn@H`@HXJXRl@@@Ph@NXDHDHHN\\d@\\f@Z^NRRTRPPPPN@@TN`@XHDVNXNJFLFJBLFp@P~@XZJRCv@^f@Xh@ZZRnAv@b@X~@l@d@X\\R\\RRLRLPJTHRHRJ\\LF?D@H?Z@R@J@L@VDTF\\JHBXHb@J~Dt@",
                           "start_location": {
                               "latitude": 34.01825,
                               "longitude": -118.05395
                           },
                           "end_location": {
                               "latitude": 34.00523,
                               "longitude": -118.07154
                           },
                           "distance": {
                               "value": 2463
                           },
                           "duration": {
                               "value": 196
                           }
                       },
                       {
                           "geometry": "uspnEbzsoUCRCj@Cf@Cp@Cj@Cn@C~@?LG`HMxKAv@?FATAdAAJ?JAJAPE\\E^CTEXUfBEXGZGNGNWb@OR",
                           "start_location": {
                               "latitude": 34.00523,
                               "longitude": -118.07154
                           },
                           "end_location": {
                               "latitude": 34.00611,
                               "longitude": -118.07949
                           },
                           "distance": {
                               "value": 750
                           },
                           "duration": {
                               "value": 89
                           }
                       },
                       {
                           "geometry": "eypnExkuoUx@tAFLhAbC",
                           "start_location": {
                               "latitude": 34.00611,
                               "longitude": -118.07949
                           },
                           "end_location": {
                               "latitude": 34.00541,
                               "longitude": -118.08065
                           },
                           "distance": {
                               "value": 133
                           },
                           "duration": {
                               "value": 19
                           }
                       },
                       {
                           "geometry": "ytpnE`suoUABITMf@CTM~@WxBIv@",
                           "start_location": {
                               "latitude": 34.00541,
                               "longitude": -118.08065
                           },
                           "end_location": {
                               "latitude": 34.0058,
                               "longitude": -118.0823
                           },
                           "distance": {
                               "value": 158
                           },
                           "duration": {
                               "value": 36
                           }
                       },
                       {
                           "geometry": "gwpnEj}uoUj@ZVJr@R|Ct@ZFL?",
                           "start_location": {
                               "latitude": 34.0058,
                               "longitude": -118.0823
                           },
                           "end_location": {
                               "latitude": 34.0042,
                               "longitude": -118.08291
                           },
                           "distance": {
                               "value": 188
                           },
                           "duration": {
                               "value": 27
                           }
                       },
                       {
                           "geometry": "gmpnEdavoU??",
                           "start_location": {
                               "latitude": 34.0042,
                               "longitude": -118.08291
                           },
                           "end_location": {
                               "latitude": 34.0042,
                               "longitude": -118.08291
                           },
                           "distance": {
                               "value": 0
                           },
                           "duration": {
                               "value": 0
                           }
                       }
                   ]
               }
           ]
       }
   ]
}

Here is a visual representation of the above response

GET Request Example 2

In the next next step let’s request the route between same origin and destination but for

  • different departure_time

  • different truck parameters

  • shortest route type

  • avoiding highway

Request

https://api.nextbillion.io/directions/json?origin=34.14169142,-118.11283644&destination=34.00419854,-118.08278668&mode=truck&avoid=highway&departrure_time=1683220363&option=flexible&route_type=shortest&truck_size=220,200,400&key=<your_api_key>

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
{
   "status": "Ok",
   "mode": "truck",
   "routes": [
       {
           "geometry": "qhkoE~}{oUP?HAv@?bBAdEAv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JBz@RF@zAZp@NPDn@N`@H~@T~@Vf@Lj@NlA\\b@J?K@MB[j@ZVJr@R|Ct@ZFL?",
           "distance": 18572.605,
           "duration": 1765.061,
           "start_location": {
               "latitude": 34.14169,
               "longitude": -118.11312
           },
           "end_location": {
               "latitude": 34.0042,
               "longitude": -118.08291
           },
           "legs": [
               {
                   "distance": {
                       "value": 18572
                   },
                   "duration": {
                       "value": 1765
                   },
                   "start_location": {
                       "latitude": 34.14169,
                       "longitude": -118.11312
                   },
                   "end_location": {
                       "latitude": 34.0042,
                       "longitude": -118.08291
                   },
                   "steps": [
                       {
                           "geometry": "qhkoE~}{oUP?HAv@?bBAdEAvD?nB?~A?",
                           "start_location": {
                               "latitude": 34.14169,
                               "longitude": -118.11312
                           },
                           "end_location": {
                               "latitude": 34.13782,
                               "longitude": -118.11309
                           },
                           "distance": {
                               "value": 430
                           },
                           "duration": {
                               "value": 40
                           }
                       },
                       {
                           "geometry": "kpjoEx}{oUAwF?oE",
                           "start_location": {
                               "latitude": 34.13782,
                               "longitude": -118.11309
                           },
                           "end_location": {
                               "latitude": 34.13783,
                               "longitude": -118.11081
                           },
                           "distance": {
                               "value": 210
                           },
                           "duration": {
                               "value": 24
                           }
                       },
                       {
                           "geometry": "mpjoEpo{oUZ?REZOLKLA\\Al@@N?dE@",
                           "start_location": {
                               "latitude": 34.13783,
                               "longitude": -118.11081
                           },
                           "end_location": {
                               "latitude": 34.13586,
                               "longitude": -118.11064
                           },
                           "distance": {
                               "value": 222
                           },
                           "duration": {
                               "value": 55
                           }
                       },
                       {
                           "geometry": "cdjoEnn{oU?cD?{@?{A?[?OAeA?{@?U?_A?}C?kHAiE?i@?aC@_C?wC?e@?cA?W?S?{@?Y?uB?_A?w@?U?c@?Q@m@?U?g@?[?WBe@?ODeABi@D[@YFaB?yB?YCoF?i@?_@A_A?M",
                           "start_location": {
                               "latitude": 34.13586,
                               "longitude": -118.11064
                           },
                           "end_location": {
                               "latitude": 34.13574,
                               "longitude": -118.09436
                           },
                           "distance": {
                               "value": 1498
                           },
                           "duration": {
                               "value": 170
                           }
                       },
                       {
                           "geometry": "kcjoEvhxoUp@GPCNAb@E|@IF?r@KhAOXGlAUz@SxBe@j@Ol@Ov@SZKd@OB?^Md@MVKNG`@MlCcATIlBu@\\OXKv@YHEh@SPGHEb@Q\\If@QHEP?`@MNGRGNEHCNEx@SZGXGTGf@MNE\\I`@KJCDCHKZGHAvCk@PCVEn@KHAHAHAp@KJCLALAJAH?P?L?N@F@NBPBH@RFHDFBFBFBHDFDHDJHFFHFRRFHDDFFFFFDDDFDBBDBDBFDLHJFXH",
                           "start_location": {
                               "latitude": 34.13574,
                               "longitude": -118.09436
                           },
                           "end_location": {
                               "latitude": 34.12205,
                               "longitude": -118.09125
                           },
                           "distance": {
                               "value": 1612
                           },
                           "duration": {
                               "value": 141
                           }
                       },
                       {
                           "geometry": "ymgoEhuwoUPBJ@RBN@P@T?v@?~@Ah@A\\?tACv@?p@AX?`@?\\?j@?|@A\\?b@Ar@?ZAr@?lBAlFC`@?nA?LAd@?^?f@?F?^?XAx@?R?X?@?^Al@?f@?^Ah@?^?n@AB?j@?V?H?t@AdBAbA?|AALAV?pA?xBA~@AbCAN?X?nBCbA?vBAdA?jAAp@?jAA`AAV?V?|@Ab@?P?^?d@Ax@?~@?n@?d@?vCA|@?bAAL?b@?N?xAAl@AP?tA?`@Av@?p@Aj@?l@?d@?`@?T?f@A~@?L?n@?pA?H?LApA?`@AH?J?R?Z?`@?b@?Z?Z?h@AX?n@?\\?RH\\A|@?~@?r@Ad@?t@A|@@z@?\\?`@Aj@?b@?TIN?RA`@?V?p@?x@?f@A|@?R?j@A\\?\\?p@?^AX?V?R?N?V?r@At@?Z?d@Az@?L?T?X?JA^?V?x@?~@AX?R?f@?V?Z?zAA|@?v@AlB?lBANA^?pB?X?dA?p@?nA?f@?NA^?N?`@?v@@t@AL?l@?L?\\?T?H?Z?F?rA?~@AN?|@?R?@?\\?l@?j@A~@?F?H?R?R?v@AZ?T?L?T?T?V?X?fA?VAF?NJJ?l@?R?F?N?NAZ?",
                           "start_location": {
                               "latitude": 34.12205,
                               "longitude": -118.09125
                           },
                           "end_location": {
                               "latitude": 34.07418,
                               "longitude": -118.09076
                           },
                           "distance": {
                               "value": 5327
                           },
                           "duration": {
                               "value": 486
                           }
                       },
                       {
                           "geometry": "sb~nEfrwoUZ?Z?b@AjCGv@AlAA^?P?N?L@R?X@V?fAC^Ap@?j@Al@?h@?ZAF?L?d@ADEHET?^?`@Af@?t@?`@?h@?\\?X?P?l@?P?T?b@?L@b@Ar@AL?T?b@?j@CfA?XAj@?t@?\\AJ?^?x@?n@At@?dB?^?JA\\@J?d@?hAAH?p@?V?^?`@?f@@|@@`B@j@@vCBN?n@AT?tAAb@@J?TAf@?z@?R?p@?TApB?tAAbA?P?fA?n@?R?NAn@?X?v@?z@?T?P?f@?J?j@@p@?H?V?^?\\?bAAT?L?NJP?D?D?B?H?L?R?x@AN?F?D?V?Z?`@?^?v@?h@?vB?h@AT?R?\\?`A?x@Ax@?lBC^?r@?T?f@?dA?dA?x@?P?bCAv@?@?~@AL@D?N?d@@H@JB",
                           "start_location": {
                               "latitude": 34.07418,
                               "longitude": -118.09076
                           },
                           "end_location": {
                               "latitude": 34.04447,
                               "longitude": -118.09056
                           },
                           "distance": {
                               "value": 3307
                           },
                           "duration": {
                               "value": 313
                           }
                       },
                       {
                           "geometry": "}hxnE~pwoUHWTw@La@FUDKLc@Pk@`@qAFODKd@}ADMZeAHURo@FORs@Pk@`@mABIH[ZaA\\eATs@r@{BDMLa@DQ`@kAPm@FO`AcDHUJ[DKPa@Zq@P]JQRYPST[Za@DCHKJKPOLM^YHGROJIBA^ULIJGPMPM`@WRMVQJGj@_@TMDEJEx@k@h@]ZUZSZUJIfAu@VQhA{@BCdAq@^Yf@_@PMPOFEDEv@u@NShBoBNO\\a@d@k@l@q@|@}@d@i@~@gAjA_Bb@o@BSVYNSrAwAtAqAPEHGNMBC`@a@RUTWJMb@k@HKLQRYTa@T]NWN[R_@P_@Vk@Xm@FQDIFOHUt@_CFOTu@J_@J_@FQPo@Lc@J_@Ni@VcA",
                           "start_location": {
                               "latitude": 34.04447,
                               "longitude": -118.09056
                           },
                           "end_location": {
                               "latitude": 34.02852,
                               "longitude": -118.06809
                           },
                           "distance": {
                               "value": 2801
                           },
                           "duration": {
                               "value": 241
                           }
                       },
                       {
                           "geometry": "geunEpdsoUt@`@j@Zn@ZNFd@TfB~@|Av@^R^PZNbAf@dAh@`@RRJfAl@lCvAtAt@x@b@PJTNVPPJBBXRRPHHNNHHRTNNZ`@RTNPNRT^HLHLLVR`@LZjAbCzB~Eb@`ANZBHt@`Bt@~Af@x@JRj@z@V\\JLt@x@PPTT\\Vt@j@JFTN\\T^Pl@Xt@XNFLDr@PZHVFx@RfB\\vA\\ND^JD?nBb@\\JrAXp@Nh@Jb@Hz@Pb@Jj@N~AZbATfATH@XFh@JD@b@JVDJBB@`@Hz@P\\H^HNDv@NZHLBF@JBz@RF@zAZp@NPDn@N`@H~@T~@Vf@Lj@NlA\\b@J",
                           "start_location": {
                               "latitude": 34.02852,
                               "longitude": -118.06809
                           },
                           "end_location": {
                               "latitude": 34.00583,
                               "longitude": -118.08257
                           },
                           "distance": {
                               "value": 2951
                           },
                           "duration": {
                               "value": 227
                           }
                       },
                       {
                           "geometry": "mwpnE`_voU?K@MB[",
                           "start_location": {
                               "latitude": 34.00583,
                               "longitude": -118.08257
                           },
                           "end_location": {
                               "latitude": 34.0058,
                               "longitude": -118.0823
                           },
                           "distance": {
                               "value": 26
                           },
                           "duration": {
                               "value": 18
                           }
                       },
                       {
                           "geometry": "gwpnEj}uoUj@ZVJr@R|Ct@ZFL?",
                           "start_location": {
                               "latitude": 34.0058,
                               "longitude": -118.0823
                           },
                           "end_location": {
                               "latitude": 34.0042,
                               "longitude": -118.08291
                           },
                           "distance": {
                               "value": 188
                           },
                           "duration": {
                               "value": 45
                           }
                       },
                       {
                           "geometry": "gmpnEdavoU??",
                           "start_location": {
                               "latitude": 34.0042,
                               "longitude": -118.08291
                           },
                           "end_location": {
                               "latitude": 34.0042,
                               "longitude": -118.08291
                           },
                           "distance": {
                               "value": 0
                           },
                           "duration": {
                               "value": 0
                           }
                       }
                   ]
               }
           ]
       }
   ]
}

Following is a visual representation of the above response. Observe that choosing the shortest path and adding other configurations, changes the suggested route.

POST request Example

Let’s look at a Directions Flexible POST method request with values for different parameters to configure a request

1
2
3
4
5
6
7
8
9
10
11
12
13
14
curl --location --request POST ‘https://api.nextbillion.io/directions/json?key=<your_api_key>&option=flexible’
--header 'Content-Type: application/json'
--data '{
   "origin": "34.14169142,-118.11283644",
   "destination": "34.00419854,-118.08278668",
   "mode": "car",
   "overview": "simplified",
   "geometry": "polyline6",
   "avoid": "highway",
   "alternative": true,
   "altcount":2,
   "waypoints": "34.09410170,-117.93187758|34.04547240,-117.96517223",
   "approaches": "unrestricted;;curb"
}'

API Query Limits

  • Following are the maximum number of waypoints allowed in a single request:

    • Directions Fast

      • 50 when using HTTPS GET

      • 200 when using HTTPS POST

    • Directions Flexible have a limit of 50 waypoints when irrespective of the HTTPS method used.

  • Maximum dimensions allowed for truck_size are 5000 cm for length, 5000 cm for width, 1000 cm for height.

  • Maximum weight allowed for truck_weight (including the trailer and shipped goods) is 100,000 kg

  • NextBillion.ai allows a maximum rate limit of 6000 queries per minute or 100 queries/second for continuous requests.

    Note: We can increase the quota if needed, on request. Contact support@nextbillion.ai for more details.

API Error Codes

Response CodeDescriptionAdditional Notes
200Normal success case.

Normal success case.

400Input validation failed.

There is a missing or an invalid parameter or a parameter with an invalid value type is added to the request.

401APIKEY not supplied or invalid.

This error occurs when the wrong API key is passed in the request or the key is missing altogether

403APIKEY is valid but does not have access to requested resources.

You might be querying for a geographical region which is not valid for your account, or requesting a service which is not enabled for you.

404Requested host/path not found.

This error occurs when a malformed hostname is used.

422Could not process the request.

Valid route could not be generated for the given parameters

429Too many requests.

QPM or API request count quota reached

500Internal Service error.

There was an internal issue with NextBillion.ai services. You can reach out to support@nextbillion.ai for an explanation.

413Request entity too large

This error is caused when the length of input request URI or the request body is too large. Please modify the request. Reach out to support@nextbillion.ai if the issue still persists.