Skip to main content
POST
/
route
Calculate route
curl --request POST \
  --url https://routing.solvice.io/route \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "coordinates": [
    [
      123
    ]
  ],
  "bearings": [
    [
      123
    ]
  ],
  "radiuses": [
    123
  ],
  "hints": [
    "<string>"
  ],
  "generate_hints": true,
  "alternatives": 5,
  "steps": true,
  "annotations": [
    "<string>"
  ],
  "geometries": "<string>",
  "overview": "<string>",
  "continue_straight": true,
  "approaches": [
    "<string>"
  ],
  "waypoints": [
    123
  ],
  "snapping": "<string>",
  "departureTime": "2024-03-15T08:30:00.000Z",
  "interpolate": true,
  "exclude": [],
  "slice": 123
}
'
import requests

url = "https://routing.solvice.io/route"

payload = {
"coordinates": [[123]],
"bearings": [[123]],
"radiuses": [123],
"hints": ["<string>"],
"generate_hints": True,
"alternatives": 5,
"steps": True,
"annotations": ["<string>"],
"geometries": "<string>",
"overview": "<string>",
"continue_straight": True,
"approaches": ["<string>"],
"waypoints": [123],
"snapping": "<string>",
"departureTime": "2024-03-15T08:30:00.000Z",
"interpolate": True,
"exclude": [],
"slice": 123
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
coordinates: [[123]],
bearings: [[123]],
radiuses: [123],
hints: ['<string>'],
generate_hints: true,
alternatives: 5,
steps: true,
annotations: ['<string>'],
geometries: '<string>',
overview: '<string>',
continue_straight: true,
approaches: ['<string>'],
waypoints: [123],
snapping: '<string>',
departureTime: '2024-03-15T08:30:00.000Z',
interpolate: true,
exclude: [],
slice: 123
})
};

fetch('https://routing.solvice.io/route', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://routing.solvice.io/route",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'coordinates' => [
[
123
]
],
'bearings' => [
[
123
]
],
'radiuses' => [
123
],
'hints' => [
'<string>'
],
'generate_hints' => true,
'alternatives' => 5,
'steps' => true,
'annotations' => [
'<string>'
],
'geometries' => '<string>',
'overview' => '<string>',
'continue_straight' => true,
'approaches' => [
'<string>'
],
'waypoints' => [
123
],
'snapping' => '<string>',
'departureTime' => '2024-03-15T08:30:00.000Z',
'interpolate' => true,
'exclude' => [

],
'slice' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://routing.solvice.io/route"

payload := strings.NewReader("{\n \"coordinates\": [\n [\n 123\n ]\n ],\n \"bearings\": [\n [\n 123\n ]\n ],\n \"radiuses\": [\n 123\n ],\n \"hints\": [\n \"<string>\"\n ],\n \"generate_hints\": true,\n \"alternatives\": 5,\n \"steps\": true,\n \"annotations\": [\n \"<string>\"\n ],\n \"geometries\": \"<string>\",\n \"overview\": \"<string>\",\n \"continue_straight\": true,\n \"approaches\": [\n \"<string>\"\n ],\n \"waypoints\": [\n 123\n ],\n \"snapping\": \"<string>\",\n \"departureTime\": \"2024-03-15T08:30:00.000Z\",\n \"interpolate\": true,\n \"exclude\": [],\n \"slice\": 123\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://routing.solvice.io/route")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"coordinates\": [\n [\n 123\n ]\n ],\n \"bearings\": [\n [\n 123\n ]\n ],\n \"radiuses\": [\n 123\n ],\n \"hints\": [\n \"<string>\"\n ],\n \"generate_hints\": true,\n \"alternatives\": 5,\n \"steps\": true,\n \"annotations\": [\n \"<string>\"\n ],\n \"geometries\": \"<string>\",\n \"overview\": \"<string>\",\n \"continue_straight\": true,\n \"approaches\": [\n \"<string>\"\n ],\n \"waypoints\": [\n 123\n ],\n \"snapping\": \"<string>\",\n \"departureTime\": \"2024-03-15T08:30:00.000Z\",\n \"interpolate\": true,\n \"exclude\": [],\n \"slice\": 123\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://routing.solvice.io/route")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"coordinates\": [\n [\n 123\n ]\n ],\n \"bearings\": [\n [\n 123\n ]\n ],\n \"radiuses\": [\n 123\n ],\n \"hints\": [\n \"<string>\"\n ],\n \"generate_hints\": true,\n \"alternatives\": 5,\n \"steps\": true,\n \"annotations\": [\n \"<string>\"\n ],\n \"geometries\": \"<string>\",\n \"overview\": \"<string>\",\n \"continue_straight\": true,\n \"approaches\": [\n \"<string>\"\n ],\n \"waypoints\": [\n 123\n ],\n \"snapping\": \"<string>\",\n \"departureTime\": \"2024-03-15T08:30:00.000Z\",\n \"interpolate\": true,\n \"exclude\": [],\n \"slice\": 123\n}"

response = http.request(request)
puts response.read_body
{
  "routes": [
    {
      "distance": 123,
      "duration": 123,
      "geometry": "<string>",
      "legs": [
        {
          "summary": "<string>",
          "distance": 123,
          "duration": 123,
          "weight": 123
        }
      ]
    }
  ],
  "waypoints": [
    {
      "hint": "<string>",
      "distance": 123,
      "name": "<string>",
      "location": [
        123
      ]
    }
  ]
}
{
"code": "<string>",
"message": "<string>",
"timestamp": 123
}
{
"code": "<string>",
"message": "<string>",
"timestamp": 123
}
{
"code": "<string>",
"message": "<string>",
"timestamp": 123
}
{
"code": "<string>",
"message": "<string>",
"timestamp": 123
}
{
"code": "<string>",
"message": "<string>",
"timestamp": 123
}
{
"code": "<string>",
"message": "<string>",
"timestamp": 123
}

Authorizations

Authorization
string
header
required

API key authentication. Include your API key in the Authorization header.

Body

application/json

Route Dto

coordinates
number<double>[][] | null
required

The coordinates this request will use, coordinates as [{lon},{lat}] values, in decimal degrees.

Minimum array length: 2
bearings
integer<int32>[][] | null

Limits the search to segments with given bearing in degrees towards true north in clockwise direction. Can be null or an array of [{value},{range}] with integer 0 .. 360,integer 0 .. 180.

radiuses
integer<int32>[] | null

Limits the coordinate snapping to streets in the given radius in meters. Can be null double >= 0.

hints
string[] | null

Hints for the coordinate snapping. Array of base64 encoded strings.

generate_hints
boolean | null

Whether or not adds a Hint to the response which can be used in subsequent requests. (optional, default true)

alternatives
integer<int32> | null

Search for up to this many alternative routes. Please note that even if alternative routes are requested, a result cannot be guaranteed. (optional, default 0)

Required range: 0 <= x <= 10
steps
boolean | null

Return route steps for each route leg. (optional, default false)

annotations
string[] | null

An array with strings of duration, nodes, distance, weight, datasources, speed (optional)

geometries
string | null

Returned route geometry format (influences overview and per step). Can also be geojson. (optional, default polyline)

Pattern: polyline|geojson|polyline6
overview
string | null

Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all (false). (optional, default simplified)

Pattern: full|simplified|false
continue_straight
boolean | null

Forces the route to keep going straight at waypoints and don't do a uturn even if it would be faster. Default value depends on the profile.

approaches
string[] | null

Keep waypoints on curb side. Can be null (unrestricted, default) or curb.

waypoints
integer<int32>[] | null

Indices to coordinates to treat as waypoints. If not supplied, all coordinates are waypoints. Must include first and last coordinate index

snapping
string | null
Pattern: default|any
vehicleType
enum<string> | null

The vehicle type for which the table is requested

Available options:
CAR,
BIKE,
TRUCK,
ELECTRIC_CAR,
ELECTRIC_BIKE
routingEngine
enum<string> | null

Routing data engine used to calculate distances/durations.

  • OSM: Open Street Map, traffic-unaware (default).
  • TOMTOM: TomTom map data with predictive traffic patterns. Use with departureTime and optionally interpolate.
  • TOMTOM_REAL_TIME: TomTom map data with real-time traffic. The departureTime field is ignored — every request uses the current time. Available on POST /route and POST /table/sync only (not on async /table or /route/batch).
  • GOOGLE: Google routing data (contact sales).
  • ANYMAP: Solvice's proprietary engine with advanced traffic modeling.
  • CUSTOM: Bring-your-own engine via custom integration.
Available options:
OSM,
TOMTOM,
GOOGLE,
ANYMAP,
CUSTOM,
TOMTOM_REAL_TIME
departureTime
string<date-time> | null

The departure time for which you want to calculate the route. This will take into account predictive travel time based on TomTom data.

Example:

"2024-03-15T08:30:00.000Z"

interpolate
boolean | null

Enable linear interpolation between time slices for more accurate results based on departure time

exclude
enum<string>[] | null

Exclude certain road types from routing

Available options:
TOLL,
MOTORWAY,
FERRY,
TUNNEL,
BRIDGE
slice
number<double> | null

Time slice override for routing. Can be decimal for interpolation (e.g., 2.5 for halfway between slice 2 and 3). If not specified, slice will be determined from departure time.

Response

Route created successfully

Route response

routes
object[] | null

Represents a route through (potentially multiple) waypoints.

waypoints
object[] | null

List of waypoints to get from A to B.