Road Editor API
The Nextbillion.ai Road Editor API is available only in a Enterprise plan. Please contact support if you wish to use this API and other premium services at support@nextbillion.ai.
Introduction
Nextbillion.ai’s Road Editor API is a service for the proprietary Road Restrictions Tool (RRT). With RRT, users can effortlessly set up a variety of restrictions on their maps, which include turn restrictions, speed limits, road closures, parking restrictions, and more. This proprietary platform enables users to enhance their maps with customized and detailed restrictions, providing a safer and more efficient navigation experience for drivers and pedestrians alike.
Let’s take a look at the methods provided available for the Road Editor API.
Create a new Restriction
This method is used to create new restrictions. Users can either create restrictions for a single road segment/node or multiple segments/nodes using a geofence. Using an HTTP POST request method in the Road Editor API, the users can create maxspeed, turn, fixedspeed, truck, closure and parking type of restrictions using a group of road nodes, segments or a geofence to indicate where the restriction should be applied, along with the attributes of the restriction like name, area, start time, end time, traveling mode etc.
Once a successful request is submitted, the service returns a response with the details of the new restriction such as its ID, type, and coordinates. The ID returned here can be used in other methods for carrying out different operations on the restrictions. This API method provides a flexible way for users to create new restriction groups catering to specific business needs for different geographic areas.
{base URL}/restrictions/{restriction_type}?key={your_api_key}
Request Parameter
Loading..Request Body
Loading..Response Schema
Loading..Sample API Request
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
curl --location --request POST '{base URL}/restrictions/closure?key=<your_api_key>' --header 'Content-Type: application/json' --data-raw '{ "name": "A Closure", "area": "singapore", "comment": "test comment", "mode": [ "4w" ], "segments": [ { "from": 100849941810, "to": 100849942580 } ], "direction": "backward" }'
Sample API 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
{ "id": 5092, "name": "A Closure", "area": "singapore", "bbox": { "maxLat": 1.32387825, "maxLon": 103.8018043, "minLat": 1.32387825, "minLon": 103.8018043 }, "status": "active", "repeatOn": null, "comment": null, "createAt": "2023-09-04T21:39:12.279Z", "updateAt": "2023-09-04T21:39:12.279Z", "startTime": null, "endTime": null, "mode": [ "4w" ], "restrictionType": "closure", "context": null, "state": "enabled", "source": "rrt", "geofence": null, "geofenceJson": null, "segments": [ { "from": 100849941810, "to": 100849942580, "coordinate": { "lat": 1.32387825, "lon": 103.8018043 } } ], "direction": "backward", "speed": 0, "speedLimit": 0, "highway": null }
Update a Restriction
Use this method to update a restriction using its ID. The endpoint accepts a HTTPS PATCH request with the ID of the restriction as a path parameter and restriction values to be updated in the request body. Once the request is processed, the endpoint returns an HTTP status code as a response indicating whether the update was successful or not. If the update was successful, the updated attributes of the restriction are also present in the response.
{base URL}/restrictions/{id}?key={your_api_key}
Request Parameter
Loading..Request Body
Loading..Response Schema
Loading..Sample API Request
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
curl --location --request PATCH 'https://nbai.nextbillion.io/road-editor/restrictions/11484/?key=<your_api_key>' \ --header 'Content-Type: application/json' \ --data '{ "name": "California 4w parking restriction", "area": "california", "status": "active", "operator": "system", "comment": "Updated restriction", "mode": ["4w"], "restriction_type": "closure", "state": "enabled", "segments": [ { "from": 100024861907, "to": 100025015462, "coordinate": { "lat": 37.7682622, "lon": -122.4533587 } } ] }'
Sample API 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
{ "id": 11484, "name": "California 4w parking restriction", "area": "california", "bbox": { "min_lat": 37.7682622, "min_lon": -122.4533587, "max_lat": 37.7682622, "max_lon": -122.4533587 }, "status": "active", "repeat_on": null, "operator": "api", "comment": "Updated restriction", "create_at": "2023-07-20T05:46:12.493Z", "update_at": "2023-09-21T07:07:11.555Z", "start_time": null, "end_time": null, "mode": [ "4w" ], "group_type": "segment", "restriction_type": "closure", "context": null, "state": "enabled", "source": "pbf", "geofence": null, "geofence_json": null, "segments": [ { "from": 100024861907, "to": 100025015462, "coordinate": { "lat": 37.7682622, "lon": -122.4533587 } } ], "direction": "both", "restrictions": [ { "from": 100024861907, "to": 100025015462, "coordinate": { "lat": 37.7682622, "lon": -122.4533587 }, "direction": "both", "state": "enabled", "status": "active", "way_id": "100005149687", "from_coordinate": { "lat": 37.7682622, "lon": -122.4533587 }, "to_coordinate": { "lat": 37.7682494, "lon": -122.4536157 }, "group_id": 11484, "repeat_on": null, "area": "california", "mode": [ "4w" ], "group_type": "segment", "source": "pbf", "restriction_type": "closure", "id": 47724 } ] }
Set state of a restriction by ID
Use this method to set the state
of a restriction using its ID. The state of a restriction determines if the restriction can be used or not.
Users can set the state of a restriction to one of enabled
, disabled
or deleted
by providing the ID of the restriction as a path parameter and the desired new state in the request body. The response to the API call will return an HTTP status code indicating the success or failure of the operation. If successful, the updated details of the restriction are also present in the responses.
{base URL}/restrictions/{id}/state?key={your_api_key}
Request Parameter
Loading..Request Body
Loading..Response Schema
Loading..Sample API Request
1 2 3 4 5
curl --location --request PUT '{base URL}/restrictions/11484/state?key=<your_api_key>' \ --header 'Content-Type: application/json' \ --data '{ "state":"enabled" }'
Sample API 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
{ "id": 11484, "name": null, "area": "california", "bbox": { "max_lat": 37.7682622, "max_lon": -122.4533587, "min_lat": 37.7682494, "min_lon": -122.4536157 }, "status": "active", "repeat_on": null, "comment": null, "create_at": "2023-07-20T05:46:12.493Z", "update_at": "2023-07-28T04:08:53.378Z", "start_time": null, "end_time": null, "mode": [], "restriction_type": "closure", "context": null, "state": "enabled", "geofence": null, "geofence_json": null }
Get Restrictions by bbox
This endpoint is used to fetch the list of restrictions using a bounding box. This endpoint is useful when applications need to retrieve and display a specific set of restrictions within a defined geographic area.
Users can send a GET request with details of the bounding box defined by its geographic coordinates to get a list of restrictions that fall within that bounding box. Users can also filter the restrictions to be returned in the input by type or traveling mode and upon receiving a successful request, the service will return the qualifying restrictions along with their status and other properties. This endpoint can be useful in a variety of applications such as transportation management systems, mapping software etc.
{base URL}/restrictions?key={your_api_key}
Request Parameter
Loading..Response Schema
Loading..Sample API Request:
curl --location '{baseURL}/restrictions?key=<your_api_key>&min_lat=37.752941&min_lon=-122.508755&max_lon=-122.418713&max_lat=37.783974&restriction_type=closure&status=active'
Sample API 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
[ { "id": 11469, "name": null, "area": "california", "bbox": { "max_lat": 37.770943, "max_lon": -122.418926, "min_lat": 37.770943, "min_lon": -122.418926 }, "status": "active", "repeat_on": null, "comment": null, "create_at": "2023-07-20T05:46:06.248Z", "update_at": "2023-07-20T05:46:06.248Z", "start_time": null, "end_time": null, "mode": [], "restriction_type": "closure", "context": null, "state": "enabled", "geofence": null, "geofence_json": null }, { "id": 12192, "name": null, "area": "california", "bbox": { "max_lat": 37.7762142, "max_lon": -122.4245713, "min_lat": 37.7762142, "min_lon": -122.4245713 }, "status": "active", "repeat_on": null, "comment": null, "create_at": "2023-07-20T05:51:13.478Z", "update_at": "2023-07-20T05:51:13.478Z", "start_time": null, "end_time": null, "mode": [], "restriction_type": "closure", "context": null, "state": "enabled", "geofence": null, "geofence_json": null }, { "id": 15464, "name": null, "area": "california", "bbox": { "max_lat": 37.7689259, "max_lon": -122.4270867, "min_lat": 37.7689259, "min_lon": -122.4270867 }, "status": "active", "repeat_on": null, "comment": null, "create_at": "2023-07-20T06:14:25.645Z", "update_at": "2023-07-20T06:14:25.645Z", "start_time": null, "end_time": null, "mode": [], "restriction_type": "closure", "context": null, "state": "enabled", "geofence": null, "geofence_json": null }, { "id": 15873, "name": null, "area": "california", "bbox": { "max_lat": 37.7689191, "max_lon": -122.4271173, "min_lat": 37.7684726, "min_lon": -122.4275825 }, "status": "active", "repeat_on": null, "comment": null, "create_at": "2023-07-20T06:17:17.722Z", "update_at": "2023-07-20T06:17:17.722Z", "start_time": null, "end_time": null, "mode": [], "restriction_type": "closure", "context": null, "state": "enabled", "geofence": null, "geofence_json": null }, { "id": 15919, "name": null, "area": "california", "bbox": { "max_lat": 37.7766001, "max_lon": -122.424646, "min_lat": 37.7766001, "min_lon": -122.424646 }, "status": "active", "repeat_on": null, "comment": null, "create_at": "2023-07-20T06:17:37.068Z", "update_at": "2023-07-20T06:17:37.068Z", "start_time": null, "end_time": null, "mode": [], "restriction_type": "closure", "context": null, "state": "enabled", "geofence": null, "geofence_json": null }, { "id": 15973, "name": null, "area": "california", "bbox": { "max_lat": 37.7767059, "max_lon": -122.4243708, "min_lat": 37.7767059, "min_lon": -122.4243708 }, "status": "active", "repeat_on": null, "comment": null, "create_at": "2023-07-20T06:17:59.794Z", "update_at": "2023-07-20T06:17:59.794Z", "start_time": null, "end_time": null, "mode": [], "restriction_type": "closure", "context": null, "state": "enabled", "geofence": null, "geofence_json": null }, { "id": 15981, "name": null, "area": "california", "bbox": { "max_lat": 37.768326, "max_lon": -122.428021, "min_lat": 37.7682735, "min_lon": -122.428042 }, "status": "active", "repeat_on": null, "comment": null, "create_at": "2023-07-20T06:18:03.166Z", "update_at": "2023-07-20T06:18:03.166Z", "start_time": null, "end_time": null, "mode": [], "restriction_type": "closure", "context": null, "state": "enabled", "geofence": null, "geofence_json": null }, { "id": 16343, "name": null, "area": "california", "bbox": { "max_lat": 37.7763049, "max_lon": -122.4242909, "min_lat": 37.7763049, "min_lon": -122.4242909 }, "status": "active", "repeat_on": null, "comment": null, "create_at": "2023-07-20T06:20:36.051Z", "update_at": "2023-07-20T06:20:36.051Z", "start_time": null, "end_time": null, "mode": [], "restriction_type": "closure", "context": null, "state": "enabled", "geofence": null, "geofence_json": null }, { "id": 16366, "name": null, "area": "california", "bbox": { "max_lat": 37.7674598, "max_lon": -122.4289407, "min_lat": 37.7674598, "min_lon": -122.4289407 }, "status": "active", "repeat_on": null, "comment": null, "create_at": "2023-07-20T06:20:45.634Z", "update_at": "2023-07-20T06:20:45.634Z", "start_time": null, "end_time": null, "mode": [], "restriction_type": "closure", "context": null, "state": "enabled", "geofence": null, "geofence_json": null } ]
Get Restrictions by ID
This endpoint is used to retrieve a specific restriction based on an ID, which is the unique identifier of the restriction. Users can send a GET request to this endpoint with a valid ID and the service will retrieve the restriction data associated with that ID and return it in the response. If no restriction is found with the specified ID, the service will return an error response with an appropriate message.
This endpoint is useful when a client wants to retrieve the details of a specific restriction, for example, to display the details on a map or to check the status of a certain restriction.
{base URL}/restrictions/{id}?key={your_api_key}
Request Parameter
Loading..Response Schema
Loading..Sample API Request
curl --location '{baseURL}/restrictions/9868?key=<your_api_key>'
Sample API 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
{ "id": 9868, "name": "A Max Speed Restriction", "area": "singapore", "bbox": { "max_lat": 1.32249115, "max_lon": 103.79859505, "min_lat": 1.32208025, "min_lon": 103.79757525 }, "status": "inactive", "repeat_on": null, "comment": null, "create_at": "2023-07-05T13:20:36.396Z", "update_at": "2023-09-19T15:57:46.306Z", "start_time": null, "end_time": null, "mode": [ "4w" ], "restriction_type": "maxspeed", "context": null, "state": "deleted", "geofence": null, "geofence_json": null }
Get Restriction List
Use this method to get a list of restrictions. This method accepts an HTTPS GET request containing criteria to retrieve restrictions based on area, restriction type, status etc. Users can also set the maximum number of results to be retrieved and result offset value. This provides a useful feature to display paginated results in the end application.
Upon receiving a valid request the service returns a response containing the list of restrictions that meet the specified criteria. The response will include the restrictions themselves, as well as any metadata about the pagination, such as the total number of results, result offset values and the maximum number of results per “page”.
{base URL}/restrictions/list?key={your_api_key}
Request Parameter
Loading..Response Schema
Loading..Sample API Request:
curl --location '{baseURL}/restrictions/list?key=<your_api_key>&offset=0&limit=15'
Sample API 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
{ "data": [ { "id": 115362, "name": "Opening hours test", "area": "singapore", "bbox": { "max_lat": 1.33301315, "max_lon": 103.8027566, "min_lat": 1.332526, "min_lon": 103.8025735 }, "status": "inactive", "repeat_on": "Tu,Sa 00:20-20:00", "comment": null, "create_at": "2023-07-20T20:18:40.348Z", "update_at": "2023-09-19T12:00:03.874Z", "start_time": null, "end_time": null, "mode": [ "4w" ], "restriction_type": "closure", "context": null, "state": "enabled", "geofence": null, "geofence_json": null }, { "id": 115390, "name": "Fell street", "area": "california", "bbox": { "max_lat": 37.77463795, "max_lon": -122.4330757, "min_lat": 37.77463795, "min_lon": -122.4330757 }, "status": "inactive", "repeat_on": "Th 08:00-11:00", "comment": null, "create_at": "2023-08-17T15:54:46.096Z", "update_at": "2023-09-14T16:00:02.622Z", "start_time": null, "end_time": null, "mode": [ "4w" ], "restriction_type": "closure", "context": null, "state": "enabled", "geofence": null, "geofence_json": null }, { "id": 115431, "name": "Tanglin Road", "area": "singapore", "bbox": { "max_lat": 1.3016361, "max_lon": 103.8189323, "min_lat": 1.3016361, "min_lon": 103.8189323 }, "status": "active", "repeat_on": null, "comment": null, "create_at": "2023-09-14T06:30:31.478Z", "update_at": "2023-09-14T06:48:00.949Z", "start_time": null, "end_time": null, "mode": [ "4w" ], "restriction_type": "turn", "context": null, "state": "enabled", "geofence": null, "geofence_json": null }, { "id": 115414, "name": "21 st avenue", "area": "california", "bbox": { "max_lat": 37.776486, "max_lon": -122.480186, "min_lat": 37.776486, "min_lon": -122.480186 }, "status": "active", "repeat_on": null, "comment": null, "create_at": "2023-08-29T05:20:59.687Z", "update_at": "2023-09-14T05:02:40.761Z", "start_time": null, "end_time": null, "mode": [ "4w" ], "restriction_type": "turn", "context": null, "state": "enabled", "geofence": null, "geofence_json": null }, { "id": 115389, "name": "Oak Street", "area": "california", "bbox": { "max_lat": 37.7737201, "max_lon": -122.4328221, "min_lat": 37.7737201, "min_lon": -122.4328221 }, "status": "inactive", "repeat_on": "We 08:20-11:20", "comment": null, "create_at": "2023-08-17T15:41:00.448Z", "update_at": "2023-09-13T16:40:05.167Z", "start_time": null, "end_time": null, "mode": [ "4w" ], "restriction_type": "closure", "context": null, "state": "enabled", "geofence": null, "geofence_json": null } ], "meta": { "offset": 0, "limit": 5, "total": 81 } }
Delete a Restriction
Use this method to delete a specific restriction using its ID. Users need to provide the ID of the restriction as a path parameter. Once the API call is made, the system will delete the specified restriction group and return an HTTP status code indicating the success or failure of the operation along with ID and state of the deleted restriction. This endpoint is useful when users need to remove a specific restriction group that is no longer required.
{base URL}/restrictions/{id}?key={your_api_key}
Request Parameter
Loading..Response Schema
Loading..Sample API Request:
curl --location --request DELETE '{baseURL}/restrictions/9868?key=<your_api_key>'
Sample API Response
1 2 3 4
{ "id": 9868, "state": "deleted" }
Get available areas
Use this method to get the available areas for your road editor API. This method accepts a HTTPS GET request with a valid key to return all the available areas. This endpoint is useful when users need to identify the areas available for adding and/or managing restrictions.
{base URL}/areas?key={your_api_key}
Request Parameter
Loading..Response Schema
Loading..Sample API Request:
curl --location '{base URL}/areas?key=<your_api_key>'
Sample API Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
[ { "timezone": 8, "name": "singapore", "code": "singapore", "modes": [ "4w" ] }, { "timezone": -5, "name": "california", "code": "california", "modes": [ "4w" ] } ]
API Query Limits
-
Please check with your NextBillion account manager, sales representative or reach out at support@nextbillion.ai for the following items:
-
Base URL of the API.
-
Correct value of
area
attribute.
-
-
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 Code | Description | Additional Notes |
---|---|---|
200 | Normal success case. | API request is successful. |
400 | Input validation failed. | There is a missing or an invalid parameter or a parameter with an invalid value type is added to the request. |
401 | APIKEY not supplied or invalid. | This error occurs when the wrong API key is passed in the request or the key is missing altogether |
403 | APIKEY 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. |
404 | Requested host/path not found. | This error occurs when a malformed hostname is used. |
422 | Could not process the request. | The restriction could not be applied due to an underlying map issue. Please check with support@nextbillion.ai for more information. |
429 | Too many requests. | QPM or API request count quota reached |
500 | Internal Service error. | There was an internal issue with NextBillion.ai services. You can reach out to support@nextbillion.ai for an explanation. |