HTTP Interface for routing‐api - HY-OHTUPROJ-OSRM/osrm-project GitHub Wiki
Preface
This documentation provides details about the available HTTP endpoints in routing-api. These routes facilitate zone additions/deletions, road processing status updates and more.
Beware of the difference between effectValue
and effect_value
, and even better, fix it if possible.
Routes
/zones
Method: GET
Description: Returns all zones which that currently modify road speeds as a GeoJSON FeatureCollection
.
Example response data:
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[25.108741, 60.208046],
[25.108097, 60.207555],
[25.114301, 60.206052],
[25.114794, 60.206745],
[25.108741, 60.208046]
]
]
},
"properties": {
"id": 64,
"type": "constant",
"effect_value": 5,
"name": "Työmaa",
"source": "digitraffic"
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[24.89436, 60.162182],
[24.894875, 60.161435],
[24.901199, 60.161455],
[24.89861, 60.163015],
[24.89436, 60.162182]
]
]
},
"properties": {
"id": 68,
"type": "roadblock",
"effect_value": null,
"name": "Onnettomuus",
"source": null
}
},
...
]
}
/zones/diff
Method: POST
Description: Takes the payload as a JSON object, which contains an array of zones to add as GeoJSON features called added
and an array of zone ids to delete called deleted
. Modifying a zone is done by deleting the old zone and adding the modified zone as a new zone. Sending a request to this route causes the roads inside the zones to be blocked in routing, which may take from seconds to minutes depending on dataset size and machine speed.
Example request data:
{
"added": [
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[24.89436, 60.162182],
[24.894875, 60.161435],
[24.901199, 60.161455],
[24.89861, 60.163015],
[24.89436, 60.162182]
]
]
},
"properties": {
"id": 1,
"type": "roadblock",
"name": "Blocked area",
"effectValue": 10,
"source": "digitraffic"
}
},
...
],
"deleted": [
"1",
"2",
...
]
}
/status
Method: GET
Description: Establishes a server-sent events connection, which receives status updates of the road speed update process (i.e. the process started by a request to /zones/diff
).
Event schema:
{
"status": "none" | "processing" | "completed",
"progress": {
"percentage": Number (0-100)
"estimate": ISO 8601 timestring | undefined
}
}
Example event stream:
data: {"status":"none","progress":{"percentage":0}}
data: {"status":"processing","progress":{"percentage":0,"estimate":"2024-06-28T20:01:09.575Z"}}
data: {"status":"processing","progress":{"percentage":10,"estimate":"2024-06-28T20:01:09.575Z"}}
data: {"status":"processing","progress":{"percentage":20,"estimate":"2024-06-28T20:01:09.575Z"}}
...
data: {"status":"processing","progress":{"percentage":90,"estimate":"2024-06-28T20:01:09.575Z"}}
data: {"status":"completed","progress":{"percentage":100,"estimate":"2024-06-28T20:01:09.575Z"}}
/route
Method: GET
Description: A middleware and a proxy for the corresponding endpoint in osrm-backend. See their documentation for reference.
This fetches a route between two points. This route will be affected by the zones created by requests to /zones/diff
.
You can add an "exclude=[id]" attribute to the route call, where the [id] is an id from 1 to 7, defined in the profiles/vehicle_class_config.lua file. Using this tag excludes all routes with height or weight limits below the ones defined for the vehicle in the config file.
The middleware portion of the call handles routing through temporary routes, as those are not included in the OSRM-backend's topology.
/tile
Method: GET
Description: A proxy for the corresponding endpoint in osrm-backend. See their documentation for reference.
Returns vector tiles of the road network which osrm-backend uses for routing. The speed values of the road segments are affected by requests to /zones/diff
.
/segments
Method: GET
Description: Return all currently blocked segments in a detailed format.
Example response data:
[
{
"start": {
"id": "378265",
"lat": 60.2086783,
"lon": 24.9417179
},
"end": {
"id": "378266",
"lat": 60.2091056,
"lon": 24.9414745
},
"originalSpeed": 30,
"currentSpeed": 0
},
{
"start": {
"id": "378424",
"lat": 60.2067288,
"lon": 24.9678996
},
"end": {
"id": "378425",
"lat": 60.2073081,
"lon": 24.9681886
},
"originalSpeed": 30,
"currentSpeed": 0
},
...
]
/nodes/nearest
Method: GET
Description: Gets the if of the closest node to any given coordinates.
/nodes/:id
Method: GET
Description: Gets the coordinates of any node, by id.
/temps
Methods: GET
and POST
Description: Return all temporary roads or create one depending on the method.
Example response data:
[
{
"id": 21,
"type": "iceroad",
"name": "Pielisen jäätie",
"status": true,
"tags": ["pielinen"],
"geom": {
"type": "LineString",
"coordinates": [
[25.1332476, 60.5043091],
[25.1332819, 60.5043455]
]
},
"length": 7.253,
"speed": 50,
"max_weight": 12,
"max_height": 3.3,
"description": "",
"created_at": "2025-06-09T19:39:24.692Z",
"updated_at": "2025-06-09T19:39:24.692Z"
},
...
]
/temps/:id
Method: GET
, PATCH
, and DELETE
Description: Either get, update, or delete a temporary road by id.
/temps/:id/toggle
Method: POST
Description: Toggles the "status" attribute for the temporary road matching the id. Used to signify if a temporary road is in use.
/traffic/roadwork
Method: GET
Description: Return data for all active roadworks in Finland.
Example response data:
[
{
"id": "GUID50438182",
"title": "Tie 148, Porvoo. Tietyö. ",
"municipality": "Porvoo",
"startTime": "2024-11-03T22:00:00Z",
"endTime": "2025-08-31T20:59:59.999Z",
"severity": "HIGHEST",
"restrictions": [
{
"type": "INTERMITTENT_SHORT_TERM_STOPS",
"name": "Liikenne on pysäytetty ajoittain"
},
{
"type": "SPEED_LIMIT",
"name": "Nopeusrajoitus",
"value": 50,
"unit": "km/h"
},
{
"type": "SPEED_LIMIT_LENGTH",
"name": "Matka, jolla nopeusrajoitus voimassa",
"value": 600,
"unit": "m"
}
],
"coordinates": [
[
[25.482277, 60.326868],
[25.482285, 60.326674],
[25.4823, 60.326302],
[25.482302, 60.326021]
]
]
},
...
]
/disconnected_links
Method: POST
Parameters: minDist
, maxDist
, namesAreSame
Description: Return a list of disconnected nodes.
Example response data:
{
"data": [
{
"id": 1,
"temp_road_id": null,
"hide_status": false,
"startNode": {
"id": 1924,
"way_name": "(unnamed)",
"lat": 60.5043091,
"lon": 25.1332476
},
"endNode": {
"id": 488558,
"way_name": "(unnamed)",
"lat": 60.5043455,
"lon": 25.1332819
},
"distance": 4.4619,
"county_name": "Järvenpää"
}
]
}