Open dashboard

API Documentation & Playground

Introduction

The OSRMRoute Directions API is a RESTful web service built to integrate fast, high-performance geospatial routing, travel matrices, address search (geocoding) and route optimization into your applications. This documentation explains all of the API's capabilities, parameters and integration steps in detail.

Authentication

OSRMRoute API requests use a unique API key for authentication. You can add your API key to each request as a query parameter (?key=YOUR_KEY) or via the HTTP Authorization header (as a Bearer token).

GETAny endpoint

Parameters (Query Params)

ParameterTypeStatusDefaultDescription
keystringRequired-The unique API key obtained from your personal dashboard. This key determines the limits of your requests.

Error Codes

OSRMRoute uses standard HTTP status codes and detailed JSON error messages to indicate the state of a request.

Response Structure Explained

Main status codes and their meaning: - **200 OK**: The request was completed successfully. - **400 Bad Request**: Parameters are invalid or missing. - **401 Unauthorized**: The API key was not provided or is invalid. - **403 Forbidden**: The API key is blocked or inactive. - **429 Too Many Requests**: The daily credit limit was exceeded. - **500 Internal Error**: An internal system error occurred.

Routing API

Computes the fastest and shortest route from point A to point B (with intermediate via-points). Returns turn-by-turn instructions and GeoJSON geometry for different transport profiles (driving, cycling, walking).

GET/api/v1/osrm/route/v1/{profile}/{coordinates}

Parameters (Query Params)

ParameterTypeStatusDefaultDescription
profilestringRequireddrivingTransport mode profile. Supported values: driving (car), cycling (bike), walking (pedestrian).
coordinatesstringRequired-Coordinates of the points. Format: lon,lat;lon,lat;lon,lat... (at least 2 points).
overviewstringOptionalfullDetail level of the returned route geometry: simplified, full (full geometry), false (no geometry).
geometriesstringOptionalgeojsonGeometry format: geojson (GeoJSON object), polyline (encoded string).
stepsbooleanOptionaltrueWhether step-by-step instructions are returned for each turn.

Response Structure Explained

A successful response contains the route's total distance (in meters), travel duration (in seconds), waypoints and the GeoJSON route line.

Matrix API

Computes a fast distance and travel-time matrix between multiple points (an NxM table). An ideal tool for optimizing logistics routes.

GET/api/v1/osrm/table/v1/{profile}/{coordinates}

Parameters (Query Params)

ParameterTypeStatusDefaultDescription
profilestringRequireddrivingTransport profile (driving, cycling, walking).
coordinatesstringRequired-Matrix points. Format: lon,lat;lon,lat;lon,lat...
annotationsstringOptionalduration,distanceData to compute: duration (time), distance, or both.

Response Structure Explained

A successful response returns a two-dimensional distances and durations matrix table for every start-and-end point combination.

Map Matching API

Snaps imprecise GPS traces to the real road network (snap to road). Used to clean up noise in GPS signals.

GET/api/v1/osrm/match/v1/{profile}/{coordinates}

Parameters (Query Params)

ParameterTypeStatusDefaultDescription
profilestringRequireddrivingTransport profile.
coordinatesstringRequired-The sequence of GPS coordinates to snap (lon,lat;lon,lat...)
overviewstringOptionalfullGeometry precision of the matched route.

Nearest API

Snaps any coordinate to the nearest real road segment and returns information about the road name.

GET/api/v1/osrm/nearest/v1/{profile}/{coordinates}

Parameters (Query Params)

ParameterTypeStatusDefaultDescription
profilestringRequireddrivingTransport profile.
coordinatesstringRequired-The point to search near. Format: lon,lat (a single pair).
numberintegerOptional3The number of nearest road candidates to find.

Trip API

Solves the Traveling Salesman Problem (TSP): finds the most optimal round (or open) route to visit a given set of points and orders the points.

GET/api/v1/osrm/trip/v1/{profile}/{coordinates}

Parameters (Query Params)

ParameterTypeStatusDefaultDescription
profilestringRequireddrivingTransport profile.
coordinatesstringRequired-Points to visit. Format: lon,lat;lon,lat...
sourcestringOptionalanyThe point the route can start from (any or the first point).
destinationstringOptionalanyThe point the route ends at (any or the last point).

Geocoding API

Converts addresses to geographic coordinates (or vice versa). Ideal for integrated search systems.

GET/api/1/geocode

Parameters (Query Params)

ParameterTypeStatusDefaultDescription
qstringRequired-The address to search (e.g. "Nizami Street, Baku").
reversebooleanOptionalfalseMust be true to perform reverse geocoding (searching from coordinate to address).

Isochrone API

Returns polygons of the geographic zones reachable from a given point within a given time or distance.

GET/api/1/isochrone

Parameters (Query Params)

ParameterTypeStatusDefaultDescription
pointstringRequired-Center point. Format: lat,lon.
time_limitintegerOptional600Travel time limit (in seconds).

Route Optimization API

Optimizes the routes of a vehicle fleet (Vehicle Routing Problem). Computes the delivery and haulage plan of vehicles at the lowest cost.

POST/api/1/vrp

Parameters (Query Params)

ParameterTypeStatusDefaultDescription
vehiclesarrayRequired[]The list of vehicles (id, capacity, start address, etc.).
servicesarrayRequired[]The addresses to be serviced (id, coordinates, service time, etc.).

Location Clustering API

Groups (clusters) given coordinates by their geographic proximity and density.

POST/api/1/cluster

Parameters (Query Params)

ParameterTypeStatusDefaultDescription
customersarrayRequired[]Customer coordinates and weights to be clustered.