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

direction example 1

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.

direction example 1

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

curl --location 'https://api.nextbillion.io/directions/json?origin=34.14169142%2C-118.11283644&destination=34.00419854%2C-118.08278668&mode=truck&departure_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
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
{
  "status": "Ok",
  "routes": [
    {
      "geometry": "qhkoE~}{oUE???q@???u@???]@??q@?q@?iA@aA?mA???M?u@@_@???]???{B@??i@?S???I?M???W?A?g@???Q?y@@A?]???O?eF@??C?kB?mA?C???_@???U?U?K?Y?q@???o@A??Y???Q?M???q@?A?_@@e@?A?o@?UImACmAACa@AEEUE[AUCg@ScIMgEAa@GoCAa@W_@??GiH?]???yA???Q???W???gD?A?sDAoC?Q??AeC?_C?qB?}@AiI??A{A???]???q@?K?i@?[?[?c@???s@??AcD???WAeF?oA@Y???iA??@W@YBe@?[@SBQ?AHcA@KBSB]D]Fc@D]Ly@Ha@Hg@Jg@Li@H]H]HYLa@La@Z{@Zw@?AHQPa@Xg@?AXe@bBsCZa@^k@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|@^z@??n@tA??FNp@tAx@`B?@R\\bCxE?@r@pAJRJRLVNX??R\\NZP\\T`@^r@JTPZNXR`@R\\NXLTLVNVLVLTHNJRjAxBp@nAtAfCVf@h@bAb@t@P^bAnBvB~Dh@~@b@z@d@z@Vb@Zj@NX`@t@HLbAlB??LTbAnBxClFVd@??JPLTl@`An@|@n@z@HJ??h@n@XZJJ\\ZhAdAXTHFDD`@XPLx@h@v@d@NH??j@X~@b@bA`@dA\\x@Vv@P\\H??XFh@H@?NDjANrBXb@Fv@Lp@LVDVHj@PPD??\\Nl@Tf@VFD\\R??JFd@Zf@^d@`@RP??VV`@b@LN??f@p@`@f@NPrCrDx@hAh@p@bBxB??z@fA??FHd@p@^b@`@h@t@`A\\d@j@t@^f@h@p@NPBFFFBFDBLPVZRV@?n@x@\\d@b@l@Z^TZVZ??TTTXNPNNHFDDLLXXVRfA|@@?bBjAPJTL\\Pz@b@DB@?PH??ZL??DB|@X|@X~@Tx@P@?h@Jf@Hn@H`@Ff@H@?JB\\DPBpAR??xAj@TD??d@Lh@LtA`@b@Lr@T??VLPJNNNPDHDF@BLVBHFN?@DJLXLVNRFHT\\??JHBBNP??LLVP??Q\\KP??MPQZ??Yd@??IJQVu@bA??_@h@GH??e@j@??{@hA??IHCDeAxAMPMP??i@t@e@l@]f@]j@ILSf@CFCFGN??a@jAIVM\\??IZ??Wt@??O`@??K\\?@M^c@nA??GRSl@??Yz@??KZ?@Ur@GN??Ut@Ut@o@nBMb@A?K\\GROb@Od@A@ELSn@??Wz@_@fAO`@Ur@e@tAq@nBg@|AKZ??MZKXOb@GP????Wt@?@Wr@?@m@Mg@IKAc@I_@G??a@GqCc@??y@QgAS?AiBc@}Bk@u@S??QG??s@Uq@UB[j@ZVJr@R|Ct@ZFL?",
      "distance": 37543.578,
      "duration": 1829.064,
      "start_location": {
        "latitude": 34.14169,
        "longitude": -118.11312
      },
      "end_location": {
        "latitude": 34.0042,
        "longitude": -118.08291
      },
      "legs": [
        {
          "distance": {
            "value": 37543
          },
          "duration": {
            "value": 1829
          },
          "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?y@@A?]???O?eF@??C?kB?mA?C???_@???U?U?K?Y?q@???o@A??Y???Q?M???q@?A?_@@e@?A?o@?UImACmAA",
              "start_location": {
                "latitude": 34.14169,
                "longitude": -118.11312
              },
              "end_location": {
                "latitude": 34.15185,
                "longitude": -118.1131
              },
              "distance": {
                "value": 1130
              },
              "duration": {
                "value": 162
              }
            },
            {
              "geometry": "ahmoEz}{oUCa@",
              "start_location": {
                "latitude": 34.15185,
                "longitude": -118.1131
              },
              "end_location": {
                "latitude": 34.15187,
                "longitude": -118.11293
              },
              "distance": {
                "value": 16
              },
              "duration": {
                "value": 4
              }
            },
            {
              "geometry": "ehmoEx|{oUAEEUE[AUCg@ScIMgEAa@GoCAa@W_@??GiH?]???yA???Q???W???gD?A?sDAoC?Q??AeC?_C?qB?}@AiI??A{A???]???q@?K?i@?[?[?c@???s@??AcD???WAeF?oA@Y???iA??@W@YBe@?[@SBQ?AHcA@K",
              "start_location": {
                "latitude": 34.15187,
                "longitude": -118.11293
              },
              "end_location": {
                "latitude": 34.15228,
                "longitude": -118.09378
              },
              "distance": {
                "value": 1771
              },
              "duration": {
                "value": 84
              }
            },
            {
              "geometry": "wjmoEbexoUBSB]D]Fc@D]Ly@Ha@Hg@Jg@Li@H]H]HYLa@La@Z{@Zw@?AHQPa@Xg@?AXe@bBsCZa@^k@??Za@?A`@k@@?n@_AZe@`@k@Zi@Xi@Xk@b@}@HS??JUPe@Tq@Ri@FSDMNo@@?Ji@H]N}@Jq@NeAH_ADk@@K?AHw@@]@a@@aB?a@?U?_@???m@??E}CEmECqCCoCAY?WWgJAWGiAAYCi@e@mGG{@C[?AMyAAS?AKmAEq@SsDKsCCk@EyA?EEeCA_AAqA?i@??AiA?A?W?kA?[?U???U?}@??AeD?AA}H?aG?mA?kS?yC?SAcGA{CAsAAoEC_F???c@??Ac@?M?M?A?]?kBA_B?I???iA?oB?uBAiC??@_@?A?}@@qD",
              "start_location": {
                "latitude": 34.15228,
                "longitude": -118.09378
              },
              "end_location": {
                "latitude": 34.14864,
                "longitude": -118.04898
              },
              "distance": {
                "value": 4288
              },
              "duration": {
                "value": 171
              }
            },
            {
              "geometry": "_tloEbmooU?{E?gE???iE???aBHe]@_@@OBs@@U@U@c@Ba@@a@Be@?q@HgADiA?ABq@@U@W@Y@[Be@Bc@@e@@U?A@[Bm@Bc@Bq@DiABm@DcA?ADgAHmCFwADiA@K?G??F{@?KH{@JeALy@BSBM?AJm@TcALk@HWX_AX{@J[??",
              "start_location": {
                "latitude": 34.14864,
                "longitude": -118.04898
              },
              "end_location": {
                "latitude": 34.14709,
                "longitude": -118.02982
              },
              "distance": {
                "value": 1787
              },
              "duration": {
                "value": 71
              }
            },
            {
              "geometry": "ijloEjukoUbCkGp@mB\\_A??Zw@?A\\}@??Zw@??FSf@qATk@Ri@To@JYFQ?ATm@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@}@TU??NM??Z[Z[PQ?Aj@g@JMRQj@k@z@w@z@}@h@m@BCd@m@^i@Zi@JSHO??N[JQ?ADKDILYFOJWL]J[Nc@DSDI@KDQDOBKBKH_@H_@Ji@FYDOBQDQDQFSDS@IJe@Ry@FYFWH]Jg@H]H[Je@Jc@??DQJa@Je@DUDSBEFWDWJg@Ja@Jg@DSF[FYD]DW@I?ABMBYBYDa@Ba@@[B]@[?O@U?U@UAaA??@eA?Y?wC?U@}D?k@?s@?w@?eA?mB?}B?A?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?mC?A?m@???e@?W?q@?{AAgA?{@?_@@_B?A?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": 202
              }
            },
            {
              "geometry": "o`joEhyaoU@mA?{@@aA?[@[?c@???Y??@]???Y?A?e@???{A??A{AAw@CiAEwBEiBO}H?a@A_B???u@?C?A?_@?gBA{A?g@?kAAo@?a@?oA?g@?eAAmB?mA?k@?u@?g@?s@?OAq@???k@?A?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": 53
              }
            },
            {
              "geometry": "uajoE|~~nUT_ABO??Bg@F_ADw@HeAHeAFw@Fu@JcALmAD[DUDWDOFUHUFQHSLWHQJOJOLQJMNOPSTQ??LKXQJETMPIPGPGHAREHCPAXCXAV?d@@D@N@NBJ@H@JBHBJDJBHBHDHDHDJDz@l@bBfApAj@VRXRJHRN??z@l@~@p@nA|@FD@@j@d@f@^??LJ^\\?@bAr@?@l@h@pArAxCdDjBrB??l@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@bA??vC|FtAnCx@xA`@t@RZRZ`@j@??r@~@Zb@NN@?^`@^^`@^`@\\d@^TP??PL??RLXR\\TTNn@\\RHZNl@Xl@VXLj@Tb@PnBx@RHvAl@t@ZfAd@l@Vx@\\\\L`@Pf@T`@Nj@TXLTJNFVJFBHBHDPFTJPHTL`@N\\N`@Pp@Vx@\\h@Tf@RVL^Nj@VTHTHHDZLRHTJjAf@@@b@R\\NZJp@XRF\\LTF??|@XxA\\JB`AV\\HlCl@fCn@@?lAXbEbA??`@HpAZTF??TFf@Lz@R~@RnBb@p@PZH@?RD\\Jx@R??t@Vp@Vp@Zn@Zn@^n@`@j@d@l@d@f@d@LNRRf@n@JJV^n@z@JPFLHJLTJLHNJNJRDDDFHNHLRX^n@Xb@T\\NTJLPXRX??RXTZNRTZb@h@PTRVb@h@NTNPZ\\VVJLt@x@TRf@h@^\\VXn@h@d@b@@@dA|@h@b@x@n@rBzA@?^VLH??b@Xz@h@n@^RJt@`@r@^TL\\Pn@ZXLf@Tj@VZL^Nj@Td@RTHZJ@?bBh@p@Rn@RXFVHZH^Jf@Jr@PD???h@L`APb@FXFZDPDv@JlAN\\D??fBN?@nBL\\B\\Bf@Bd@BjAB|@Br@@d@@??~ADT@L@X@@?ZB??z@Fz@H`AHlAPf@FNDb@HZF^Ft@PPDTFTDFB`@JxBh@bAV??~A^?@`AT??rAZtFtA??j@PnCl@@?p@Nd@H`@F~@FZ@l@Dl@Bh@@t@@j@?r@?\\APC@?JA`@Cr@K^Cd@G|@M??NA^EXCZA?Ar@Gj@Gd@GH?@?^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": 393
              }
            },
            {
              "geometry": "_v{nEp_foUp@RVF@@RD??|A`@bBb@@?LDp@Rp@Pn@Nb@L?@lA\\j@Rl@Tf@PPJNFl@Vf@Tt@\\~@b@f@THDNHd@Rh@VtB`A|@b@TJLH@?HDJD??PH??TJj@X`A`@??NHTJ??XN??j@VbAd@rAn@zAr@~@b@bAd@z@^v@`@pAj@v@^TL??PHj@VVJz@`@^Pf@VHDXL`@PHDp@Zb@Rd@Vp@XJDxAr@VJ??LF^PXLRJ`Ab@~Ar@??@@~Ar@??l@V??bAf@j@Xv@`@??",
              "start_location": {
                "latitude": 34.06192,
                "longitude": -118.00073
              },
              "end_location": {
                "latitude": 34.04494,
                "longitude": -118.00966
              },
              "distance": {
                "value": 2064
              },
              "duration": {
                "value": 82
              }
            },
            {
              "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@??NT@@LPLR??NRNRb@l@LPRXFHJL^j@PTV\\TZb@j@JNV\\TZh@r@TZ?@Z`@LPNVTXRZZb@X`@LRV\\LNJNJNLRNVDH??NTLR@@FJFH",
              "start_location": {
                "latitude": 34.04494,
                "longitude": -118.00966
              },
              "end_location": {
                "latitude": 34.03389,
                "longitude": -118.02754
              },
              "distance": {
                "value": 2090
              },
              "duration": {
                "value": 83
              }
            },
            {
              "geometry": "yfvnEbgkoUt@`A\\f@??Xb@Zb@TXJN`@f@LPNTX^Z`@X`@`@j@\\b@T\\X^X`@DH@?NVZ`@Zf@RZ??BDxA`CDHHPd@z@fAzBt@bB?@P\\P`@P^DJfA`C@?Zt@@@JTd@dALXXl@^v@v@fBl@rARb@??`@~@LVFPd@|@^z@??n@tA??FNp@tAx@`B?@R\\bCxE?@r@pAJRJRLVNX??R\\NZP\\T`@^r@JTPZNXR`@R\\NXLTLVNVLVLTHNJRjAxBp@nAtAfCVf@h@bAb@t@P^bAnBvB~Dh@~@b@z@d@z@Vb@Zj@NX`@t@HLbAlB??LTbAnBxClFVd@??JPLTl@`An@|@n@z@HJ??",
              "start_location": {
                "latitude": 34.03389,
                "longitude": -118.02754
              },
              "end_location": {
                "latitude": 34.01718,
                "longitude": -118.05396
              },
              "distance": {
                "value": 3070
              },
              "duration": {
                "value": 122
              }
            },
            {
              "geometry": "k~rnEflpoUh@n@XZJJ\\ZhAdAXTHFDD`@XPLx@h@v@d@NH??j@X~@b@bA`@dA\\x@Vv@P\\H??XFh@H@?NDjANrBXb@Fv@Lp@LVDVHj@PPD??\\Nl@Tf@VFD\\R??JFd@Zf@^d@`@RP??VV`@b@LN??f@p@`@f@NPrCrDx@hAh@p@bBxB??z@fA??FHd@p@^b@`@h@t@`A\\d@j@t@^f@h@p@NPBFFFBFDBLPVZRV@?",
              "start_location": {
                "latitude": 34.01718,
                "longitude": -118.05396
              },
              "end_location": {
                "latitude": 34.00412,
                "longitude": -118.06428
              },
              "distance": {
                "value": 1783
              },
              "duration": {
                "value": 71
              }
            },
            {
              "geometry": "wlpnEvlroUn@x@\\d@b@l@Z^TZVZ??TTTXNPNNHFDDLLXXVRfA|@@?bBjAPJTL\\Pz@b@DB@?PH??ZL??DB|@X|@X~@Tx@P@?h@Jf@Hn@H`@Ff@H@?JB\\DPBpAR??",
              "start_location": {
                "latitude": 34.00412,
                "longitude": -118.06428
              },
              "end_location": {
                "latitude": 33.9976,
                "longitude": -118.06834
              },
              "distance": {
                "value": 837
              },
              "duration": {
                "value": 35
              }
            },
            {
              "geometry": "_donEbfsoUxAj@TD??d@Lh@LtA`@b@Lr@T??VLPJNNNPDHDF@BLVBHFN?@DJLXLVNRFHT\\??",
              "start_location": {
                "latitude": 33.9976,
                "longitude": -118.06834
              },
              "end_location": {
                "latitude": 33.9948,
                "longitude": -118.07036
              },
              "distance": {
                "value": 377
              },
              "duration": {
                "value": 30
              }
            },
            {
              "geometry": "ornnEvrsoUJHBBNP??LLVP??",
              "start_location": {
                "latitude": 33.9948,
                "longitude": -118.07036
              },
              "end_location": {
                "latitude": 33.99445,
                "longitude": -118.07068
              },
              "distance": {
                "value": 49
              },
              "duration": {
                "value": 12
              }
            },
            {
              "geometry": "ipnnEvtsoUQ\\KP??MPQZ??Yd@??IJQVu@bA??_@h@GH??e@j@??{@hA??IHCDeAxAMPMP??i@t@e@l@]f@]j@ILSf@CFCFGN??a@jAIVM\\??IZ??Wt@??O`@??K\\?@M^c@nA??GRSl@??Yz@??KZ?@Ur@GN??Ut@Ut@o@nBMb@A?K\\GROb@Od@A@ELSn@??Wz@_@fAO`@Ur@e@tAq@nBg@|AKZ??MZKXOb@GP????Wt@?@Wr@?@",
              "start_location": {
                "latitude": 33.99445,
                "longitude": -118.07068
              },
              "end_location": {
                "latitude": 34.00141,
                "longitude": -118.08384
              },
              "distance": {
                "value": 1454
              },
              "duration": {
                "value": 153
              }
            },
            {
              "geometry": "y{onE~fvoUm@Mg@IKAc@I_@G??a@GqCc@??y@QgAS?AiBc@}Bk@u@S??QG??s@Uq@U",
              "start_location": {
                "latitude": 34.00141,
                "longitude": -118.08384
              },
              "end_location": {
                "latitude": 34.00582,
                "longitude": -118.08244
              },
              "distance": {
                "value": 509
              },
              "duration": {
                "value": 44
              }
            },
            {
              "geometry": "kwpnEf~uoUB[",
              "start_location": {
                "latitude": 34.00582,
                "longitude": -118.08244
              },
              "end_location": {
                "latitude": 34.0058,
                "longitude": -118.0823
              },
              "distance": {
                "value": 14
              },
              "duration": {
                "value": 5
              }
            },
            {
              "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": 42
              }
            },
            {
              "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

Direction Example 3

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&departure_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
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
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
{
   "status": "Ok",
   "routes": [
       {
           "geometry":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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@JBHWTw@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@VcAt@`@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?K@MB[j@ZVJr@R|Ct@ZFL?",
           "distance": 18429.605,
           "duration": 3296.561,
           "start_location": {
               "latitude": 34.14169,
               "longitude": -118.11312
           },
           "end_location": {
               "latitude": 34.0042,
               "longitude": -118.08291
           },
           "legs": [
               {
                   "distance": {
                       "value": 18429
                   },
                   "duration": {
                       "value": 3296
                   },
                   "start_location": {
                       "latitude": 34.14169,
                       "longitude": -118.11312
                   },
                   "end_location": {
                       "latitude": 34.0042,
                       "longitude": -118.08291
                   },
                   "steps": [
                       {
                           "geometry": "qhkoE~}{oUP?HAv@?bBAdEAvD?nB?~A?~DAd@?`D?h@?j@?tF?`GB",
                           "start_location": {
                               "latitude": 34.14169,
                               "longitude": -118.11312
                           },
                           "end_location": {
                               "latitude": 34.13291,
                               "longitude": -118.1131
                           },
                           "distance": {
                               "value": 976
                           },
                           "duration": {
                               "value": 155
                           }
                       },
                       {
                           "geometry": "uqioEz}{oUZeO",
                           "start_location": {
                               "latitude": 34.13291,
                               "longitude": -118.1131
                           },
                           "end_location": {
                               "latitude": 34.13277,
                               "longitude": -118.11051
                           },
                           "distance": {
                               "value": 239
                           },
                           "duration": {
                               "value": 30
                           }
                       },
                       {
                           "geometry": "ypioEtm{oUzSgCjIqA",
                           "start_location": {
                               "latitude": 34.13277,
                               "longitude": -118.11051
                           },
                           "end_location": {
                               "latitude": 34.12777,
                               "longitude": -118.10942
                           },
                           "distance": {
                               "value": 565
                           },
                           "duration": {
                               "value": 85
                           }
                       },
                       {
                           "geometry": "qqhoEzf{oUEWCO?IAMAK?M?K?M?O@M?G@I@OBIDODKFOFOLWFQ@E@G@E?S",
                           "start_location": {
                               "latitude": 34.12777,
                               "longitude": -118.10942
                           },
                           "end_location": {
                               "latitude": 34.12751,
                               "longitude": -118.10776
                           },
                           "distance": {
                               "value": 163
                           },
                           "duration": {
                               "value": 35
                           }
                       },
                       {
                           "geometry": "}ohoEn|zoUH?NATETCh@Kn@K`AOvAU`BWfAMbDk@RCTAx@OFA^GB?b@IF?HIFGTE",
                           "start_location": {
                               "latitude": 34.12751,
                               "longitude": -118.10776
                           },
                           "end_location": {
                               "latitude": 34.12313,
                               "longitude": -118.10665
                           },
                           "distance": {
                               "value": 500
                           },
                           "duration": {
                               "value": 67
                           }
                       },
                       {
                           "geometry": "qtgoEpuzoULCj@GJC^EDAf@GFAb@GJAPENCZEXE",
                           "start_location": {
                               "latitude": 34.12313,
                               "longitude": -118.10665
                           },
                           "end_location": {
                               "latitude": 34.12167,
                               "longitude": -118.10632
                           },
                           "distance": {
                               "value": 166
                           },
                           "duration": {
                               "value": 44
                           }
                       },
                       {
                           "geometry": "mkgoEnszoU[iAI]I[Kc@Qu@Mg@I_@",
                           "start_location": {
                               "latitude": 34.12167,
                               "longitude": -118.10632
                           },
                           "end_location": {
                               "latitude": 34.12218,
                               "longitude": -118.10485
                           },
                           "distance": {
                               "value": 148
                           },
                           "duration": {
                               "value": 27
                           }
                       },
                       {
                           "geometry": "sngoEhjzoUt@]b@UXMfBgAnA{@dA]xAS`@GhE]rFk@xFw@",
                           "start_location": {
                               "latitude": 34.12218,
                               "longitude": -118.10485
                           },
                           "end_location": {
                               "latitude": 34.11623,
                               "longitude": -118.10292
                           },
                           "distance": {
                               "value": 694
                           },
                           "duration": {
                               "value": 138
                           }
                       },
                       {
                           "geometry": "mifoEf~yoUTd@Rb@Xn@Vp@Pj@DH\\tANr@",
                           "start_location": {
                               "latitude": 34.11623,
                               "longitude": -118.10292
                           },
                           "end_location": {
                               "latitude": 34.11542,
                               "longitude": -118.10474
                           },
                           "distance": {
                               "value": 191
                           },
                           "duration": {
                               "value": 33
                           }
                       },
                       {
                           "geometry": "kdfoErizoU|E{@vAULCr@OXE",
                           "start_location": {
                               "latitude": 34.11542,
                               "longitude": -118.10474
                           },
                           "end_location": {
                               "latitude": 34.11341,
                               "longitude": -118.1042
                           },
                           "distance": {
                               "value": 230
                           },
                           "duration": {
                               "value": 35
                           }
                       },
                       {
                           "geometry": "yweoEffzoUAa@?q@?c@AcBCsE",
                           "start_location": {
                               "latitude": 34.11341,
                               "longitude": -118.1042
                           },
                           "end_location": {
                               "latitude": 34.11345,
                               "longitude": -118.10204
                           },
                           "distance": {
                               "value": 199
                           },
                           "duration": {
                               "value": 25
                           }
                       },
                       {
                           "geometry": "axeoEvxyoUdEAxEAtDE",
                           "start_location": {
                               "latitude": 34.11345,
                               "longitude": -118.10204
                           },
                           "end_location": {
                               "latitude": 34.11046,
                               "longitude": -118.10199
                           },
                           "distance": {
                               "value": 333
                           },
                           "duration": {
                               "value": 121
                           }
                       },
                       {
                           "geometry": "keeoElxyoUBq@BwB?g@",
                           "start_location": {
                               "latitude": 34.11046,
                               "longitude": -118.10199
                           },
                           "end_location": {
                               "latitude": 34.11042,
                               "longitude": -118.10094
                           },
                           "distance": {
                               "value": 97
                           },
                           "duration": {
                               "value": 17
                           }
                       },
                       {
                           "geometry": "ceeoEzqyoUjBCrBAd@?t@AX?^?\\?\\?jBC`@?ZAR?JALAPA|CUJ?",
                           "start_location": {
                               "latitude": 34.11042,
                               "longitude": -118.10094
                           },
                           "end_location": {
                               "latitude": 34.10623,
                               "longitude": -118.10073
                           },
                           "distance": {
                               "value": 467
                           },
                           "duration": {
                               "value": 175
                           }
                       },
                       {
                           "geometry": "}jdoEppyoUBkA?a@A{A",
                           "start_location": {
                               "latitude": 34.10623,
                               "longitude": -118.10073
                           },
                           "end_location": {
                               "latitude": 34.10622,
                               "longitude": -118.09972
                           },
                           "distance": {
                               "value": 93
                           },
                           "duration": {
                               "value": 25
                           }
                       },
                       {
                           "geometry": "{jdoEfjyoUl@?zKEtBAFAV?h@?R?F?hAAL?P?H?V?p@?dCAn@?n@?xA@pDE`@?^?\\Ap@AL?f@At@?T?J?Z?T?t@AnA?P?h@?j@A^@v@?t@Aj@?v@?^?jAA\\?^?Z?R@P?",
                           "start_location": {
                               "latitude": 34.10622,
                               "longitude": -118.09972
                           },
                           "end_location": {
                               "latitude": 34.09412,
                               "longitude": -118.09958
                           },
                           "distance": {
                               "value": 1351
                           },
                           "duration": {
                               "value": 270
                           }
                       },
                       {
                           "geometry": "g_boEjiyoU\\uADMDM~AmGLe@H[T}@T{@BKJ_@n@aCXgAZmAt@wCn@eCt@qCl@_CJ_@Lg@FWRu@Ja@Lc@Rq@DO",
                           "start_location": {
                               "latitude": 34.09412,
                               "longitude": -118.09958
                           },
                           "end_location": {
                               "latitude": 34.09096,
                               "longitude": -118.09087
                           },
                           "distance": {
                               "value": 876
                           },
                           "duration": {
                               "value": 160
                           }
                       },
                       {
                           "geometry": "okaoE|rwoUp@?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.09096,
                               "longitude": -118.09087
                           },
                           "end_location": {
                               "latitude": 34.07418,
                               "longitude": -118.09076
                           },
                           "distance": {
                               "value": 1868
                           },
                           "duration": {
                               "value": 350
                           }
                       },
                       {
                           "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@@|@@dA@Z?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": 476
                           }
                       },
                       {
                           "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": 490
                           }
                       },
                       {
                           "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": 463
                           }
                       },
                       {
                           "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": 15
                           }
                       },
                       {
                           "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": 49
                           }
                       },
                       {
                           "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.

Direction Example 4

GET Request Example 3

In this example, let’s check how to avoid routes with axle load restrictions

  • an origin and destination pair for a trip being made by a truck
  • Set truck_axle_load to allow routing trucks not exceeding a load of 9 tonnes per axle

Request

curl --location 'https://api.nextbillion.io/directions/json?origin=32.66167876,-97.33248769&destination=32.66161249,-97.35607262&mode=truck&key=<your_api_key>&option=flexible&truck_axle_load=9'

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
{
   "status": "Ok",
   "routes": [
       {
           "geometry": "mfjfE|faqQj@d@p@j@@?Jg@??q@e@??WSa@Y??g@_@MGMGOK??OG]OMEMEQCWEWCYAQ@Y???m@BsA@}@BM?IF[?S?A?g@@s@@??D\\L`A?@XvB??@HLdADZHx@Hz@Bz@Bv@@v@??@n@?xA??A^AjCCjAAh@EfA??A^CZAZEl@CZAPCXEb@CRGb@Eb@EZ??UdB]~BEjACx@CXCVK`A??y@tFKx@W|B[lCIn@??E\\Cb@Ex@SzA??EZCPE`@??G`@G^EZOfAQxAa@~CQrAa@|CYjBS|AQtAUhB??CR??Qf@Gh@E^ETId@G\\?@EVMj@Mx@[fB??a@vCKj@G\\M\\KPGh@??Kt@Mz@??ER??Z???Z???d@A@?R?@?X@??f@?j@AV@??V?n@?Z?^?fB???`DA@?|D@x@?X?nAA??xA@??hA???x@@??J?N?P@@?T@PBNBRBND",
           "distance": 3626.649,
           "duration": 329.617,
           "start_location": {
               "latitude": 32.66167,
               "longitude": -97.33247
           },
           "end_location": {
               "latitude": 32.66162,
               "longitude": -97.3561
           },
           "legs": [
               {
                   "distance": {
                       "value": 3626
                   },
                   "duration": {
                       "value": 329
                   },
                   "start_location": {
                       "latitude": 32.66167,
                       "longitude": -97.33247
                   },
                   "end_location": {
                       "latitude": 32.66162,
                       "longitude": -97.3561
                   },
                   "steps": [
                       {
                           "geometry": "mfjfE|faqQj@d@p@j@@?",
                           "start_location": {
                               "latitude": 32.66167,
                               "longitude": -97.33247
                           },
                           "end_location": {
                               "latitude": 32.66119,
                               "longitude": -97.33288
                           },
                           "distance": {
                               "value": 64
                           },
                           "duration": {
                               "value": 5
                           }
                       },
                       {
                           "geometry": "mcjfEniaqQJg@??q@e@??WSa@Y??g@_@MGMGOK??OG]OMEMEQCWEWCYAQ@Y???m@BsA@}@BM?IF[?S?A?g@@s@@??",
                           "start_location": {
                               "latitude": 32.66119,
                               "longitude": -97.33288
                           },
                           "end_location": {
                               "latitude": 32.66493,
                               "longitude": -97.33182
                           },
                           "distance": {
                               "value": 470
                           },
                           "duration": {
                               "value": 74
                           }
                       },
                       {
                           "geometry": "yzjfEzbaqQD\\L`A?@XvB??@HLdADZHx@Hz@Bz@Bv@@v@??@n@?xA??A^AjCCjAAh@EfA??A^CZAZEl@CZAPCXEb@CRGb@Eb@EZ??UdB]~B",
                           "start_location": {
                               "latitude": 32.66493,
                               "longitude": -97.33182
                           },
                           "end_location": {
                               "latitude": 32.66504,
                               "longitude": -97.34036
                           },
                           "distance": {
                               "value": 814
                           },
                           "duration": {
                               "value": 68
                           }
                       },
                       {
                           "geometry": "o{jfEfxbqQEjACx@CXCVK`A??y@tFKx@W|B[lCIn@??E\\Cb@Ex@SzA??EZCPE`@??G`@G^EZOfAQxAa@~CQrAa@|CYjBS|AQtAUhB??CR??",
                           "start_location": {
                               "latitude": 32.66503,
                               "longitude": -97.34036
                           },
                           "end_location": {
                               "latitude": 32.66727,
                               "longitude": -97.35155
                           },
                           "distance": {
                               "value": 1080
                           },
                           "duration": {
                               "value": 49
                           }
                       },
                       {
                           "geometry": "mikfEd~dqQQf@Gh@E^ETId@G\\?@EVMj@Mx@[fB??a@vCKj@G\\M\\KP",
                           "start_location": {
                               "latitude": 32.66727,
                               "longitude": -97.35155
                           },
                           "end_location": {
                               "latitude": 32.66826,
                               "longitude": -97.3551
                           },
                           "distance": {
                               "value": 352
                           },
                           "duration": {
                               "value": 22
                           }
                       },
                       {
                           "geometry": "sokfEjteqQGh@??Kt@Mz@??ER??",
                           "start_location": {
                               "latitude": 32.66825,
                               "longitude": -97.3551
                           },
                           "end_location": {
                               "latitude": 32.66845,
                               "longitude": -97.35597
                           },
                           "distance": {
                               "value": 85
                           },
                           "duration": {
                               "value": 22
                           }
                       },
                       {
                           "geometry": "{pkfEzyeqQZ???Z???d@A@?R?@?X@??f@?j@AV@??V?n@?Z?^?fB???`DA@?|D@x@?X?nAA??xA@??hA???x@@??J?N?P@@?T@PBNBRBND",
                           "start_location": {
                               "latitude": 32.66846,
                               "longitude": -97.35598
                           },
                           "end_location": {
                               "latitude": 32.66161,
                               "longitude": -97.3561
                           },
                           "distance": {
                               "value": 760
                           },
                           "duration": {
                               "value": 87
                           }
                       },
                       {
                           "geometry": "cfjfErzeqQ??",
                           "start_location": {
                               "latitude": 32.66162,
                               "longitude": -97.3561
                           },
                           "end_location": {
                               "latitude": 32.66162,
                               "longitude": -97.3561
                           },
                           "distance": {
                               "value": 0
                           },
                           "duration": {
                               "value": 0
                           }
                       }
                   ]
               }
           ]
       }
   ]
}

Observe that setting the axle load parameter to 0 tonnes returns a route through a narrow street which evidently is not fit to be used by a truck with a large load.

GET Request Example 4

In this example we will create a request for avoiding a U turn which can be a tricky maneuver for a truck to perform.

  • an origin and destination pair for a trip being made by a truck
  • avoid parameter set to uturn

Request

curl --location 'https://api.nextbillion.io/directions/json?origin=38.85739691,-77.05348619&destination=38.85740647,-77.05261010&avoid=uturn&mode=truck&key=<your_api_key>&option=flexible'

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
{
    "status": "Ok",
    "routes": [
        {
            "geometry": "uidlFfohuM@NBh@?F@h@?J?^??@dA?jAAt@A\\??CfA?@m@He@D[Be@D??sAHG@A?{BNQ@M@w@DAWFWK}B??Ag@EkAAY??Eo@??Cw@?A?a@??@O?g@d@G\\E\\E??^Eh@I??TC|@K??XEFA??n@GLAd@GF?^A@?`@?FAH???MaB",
            "distance": 990.358,
            "duration": 162.809,
            "start_location": {
                "latitude": 38.85739,
                "longitude": -77.05348
            },
            "end_location": {
                "latitude": 38.85743,
                "longitude": -77.05262
            },
            "legs": [
                {
                    "distance": {
                        "value": 990
                    },
                    "duration": {
                        "value": 162
                    },
                    "start_location": {
                        "latitude": 38.85739,
                        "longitude": -77.05348
                    },
                    "end_location": {
                        "latitude": 38.85743,
                        "longitude": -77.05262
                    },
                    "steps": [
                        {
                            "geometry": "uidlFfohuM@NBh@?F@h@?J?^??@dA?jAAt@A\\??CfA?@",
                            "start_location": {
                                "latitude": 38.85739,
                                "longitude": -77.05348
                            },
                            "end_location": {
                                "latitude": 38.85738,
                                "longitude": -77.05576
                            },
                            "distance": {
                                "value": 196
                            },
                            "duration": {
                                "value": 27
                            }
                        },
                        {
                            "geometry": "sidlFn}huMm@He@D[Be@D??sAHG@A?{BNQ@M@w@D",
                            "start_location": {
                                "latitude": 38.85738,
                                "longitude": -77.05576
                            },
                            "end_location": {
                                "latitude": 38.85966,
                                "longitude": -77.05608
                            },
                            "distance": {
                                "value": 255
                            },
                            "duration": {
                                "value": 37
                            }
                        },
                        {
                            "geometry": "{wdlFn_iuMAWFWK}B??Ag@EkAAY??Eo@??Cw@?A?a@??@O?g@",
                            "start_location": {
                                "latitude": 38.85966,
                                "longitude": -77.05608
                            },
                            "end_location": {
                                "latitude": 38.85978,
                                "longitude": -77.05352
                            },
                            "distance": {
                                "value": 223
                            },
                            "duration": {
                                "value": 43
                            }
                        },
                        {
                            "geometry": "sxdlFnohuMd@G\\E\\E??^Eh@I??TC|@K??XEFA??n@GLAd@GF?^A@?`@?FAH???",
                            "start_location": {
                                "latitude": 38.85978,
                                "longitude": -77.05352
                            },
                            "end_location": {
                                "latitude": 38.85736,
                                "longitude": -77.05311
                            },
                            "distance": {
                                "value": 272
                            },
                            "duration": {
                                "value": 40
                            }
                        },
                        {
                            "geometry": "oidlF|lhuMMaB",
                            "start_location": {
                                "latitude": 38.85736,
                                "longitude": -77.05311
                            },
                            "end_location": {
                                "latitude": 38.85743,
                                "longitude": -77.05262
                            },
                            "distance": {
                                "value": 43
                            },
                            "duration": {
                                "value": 12
                            }
                        },
                        {
                            "geometry": "}idlFzihuM??",
                            "start_location": {
                                "latitude": 38.85743,
                                "longitude": -77.05262
                            },
                            "end_location": {
                                "latitude": 38.85743,
                                "longitude": -77.05262
                            },
                            "distance": {
                                "value": 0
                            },
                            "duration": {
                                "value": 0
                            }
                        }
                    ]
                }
            ]
        }
    ]
}

Observe that removing the “uturn” constraint gives a relatively shorter route but with a major U-turn maneuver.

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 [email protected] 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.

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 [email protected] if the issue still persists.

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 [email protected] for an explanation.