Route Dispatch API

Introduction

NextBillion.ai’s Route Dispatch API is designed to share any planned route, along with intermediary stops, to drivers registered with NextBillion.ai. Users can dispatch a route to registered drivers by providing their email addresses in the input request. Additionally, users can provide route details like distance, stops, type of the task to be performed at those stops, arrival time and routing characteristics among others.

Once a route is successfully configured using the following endpoint, the driver can get all the details on their Driver app, available on Android & iOS.

POST

https://api.nextbillion.io/fleetify/routes?key={your_api_key}

Let’s take a look at the available parameters.

Request Parameters

NameTypeRequiredFormat and UsageDescription
keyStringYesFormat: 32 characters alphanumeric string Usage: key=API_KEYA key is a unique identifier that is required to authenticate a request to the API.

Request Body

Loading..

Response Schema

Loading..

Sample Request

1
curl --location 'https://api.nextbillion.io/fleetify/routes?key=<your_api_key>' \
2
--header 'Content-Type: application/json' \
3
--data-raw '{
4
"driver_email": "[email protected]",
5
"distance": 8775,
6
"routing": {
7
"mode": "car"
8
},
9
"steps": [
10
{
11
"type": "job",
12
"arrival": 1732949336,
13
"location": [34.0928, -118.2829],
14
"address": "1234 Sunset Boulevard, Los Angeles, CA 90026",
15
"metadata": {
16
"customer_name": "Matthew",
17
"customer_phone_number": "779-408-9942",
18
"instructions": "Knock on the door and pet the dog"
19
}
20
},
21
{
22
"type": "job",
23
"arrival": 1732949456,
24
"location": [34.1015, -118.3269],
25
"address": "5678 Hollywood Boulevard, Los Angeles, CA 90028",
26
"metadata": {
27
"customer_name": "David",
28
"customer_phone_number": "453-567-1000",
29
"instructions": "Call the customer before arrival"
30
}
31
}
32
]
33
}'
34

Sample Response

1
{
2
"status": 200,
3
"data": {
4
"id": "4e496f8d-773c-4a94-a1d6-8ea46a6af8eb",
5
"short_id": "xWNDaHh8fshx",
6
"ro_request_id": "",
7
"vehicle_id": "",
8
"distance": 8775,
9
"routing": {
10
"mode": "car"
11
},
12
"steps": [
13
{
14
"id": "cd5fa4ef-a2bc-4ba7-889e-c9c55595d4fc",
15
"short_id": "DZuIGgG6K9cU",
16
"type": "job",
17
"arrival": 1732949336,
18
"address": "1234 Sunset Boulevard, Los Angeles, CA 90026",
19
"location": [
20
34.0928,
21
-118.2829
22
],
23
"meta": {
24
"customer_phone_number": "779-408-9942",
25
"customer_name": "Matthew",
26
"instructions": "Knock on the door and pet the dog"
27
},
28
"completion": {
29
"status": "scheduled",
30
"completed_at": null,
31
"document": null,
32
"document_modified_at": null
33
}
34
},
35
{
36
"id": "493ee5f7-0207-4195-84a5-ba3d33377fa6",
37
"short_id": "I85NJzBe8edB",
38
"type": "job",
39
"arrival": 1732949456,
40
"address": "5678 Hollywood Boulevard, Los Angeles, CA 90028",
41
"location": [
42
34.1015,
43
-118.3269
44
],
45
"meta": {
46
"customer_phone_number": "453-567-1000",
47
"customer_name": "David",
48
"instructions": "Call the customer before arrival"
49
},
50
"completion": {
51
"status": "scheduled",
52
"completed_at": null,
53
"document": null,
54
"document_modified_at": null
55
}
56
}
57
],
58
"document_snapshot": null,
59
"completion": {
60
"status": "scheduled"
61
},
62
"total_steps": 2,
63
"completed_steps": 0,
64
"created_at": 1732520080,
65
"driver": {
66
"id": "262428945511644309",
67
"fullname": "John Doe",
68
"email": "[email protected]"
69
}
70
}
71
}

API Query Limits

  1. NextBillion.ai allows a maximum rate limit of 6000 queries per minute or 100 queries/second for continuous requests.
    1. Note: We can increase the quota if needed on request. Contact [email protected] for more details.
  2. The maximum number of steps that can be provided in the input are 1000.
  3. arrival should always be either equal to or greater than the current time and it should increase monotonically for each step.

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 invalidThis 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 resourcesYou 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 foundThis error occurs when a malformed hostname is used.
422Could not process the requestA feasible solution could not be generated for the given set of locations or parameter configuration.
429Too many requestsQPM reached 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.

© 2024 NextBillion.ai all rights reserved.