Skip to main content
POST
/
v3
/
routing
/
solve
Solve a vehicle routing problem
curl --request POST \
  --url https://api.example.com/v3/routing/solve \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "jobs": [
    {
      "id": "<string>",
      "break_interruptible": true,
      "delivery": {
        "location": {
          "coordinate": [
            123
          ]
        },
        "break_interruptible": true,
        "id": "<string>",
        "service_duration_s": 123,
        "setup_duration_s": 123,
        "time_windows": [
          {
            "from": "<string>",
            "to": "<string>",
            "earliness_cost_per_hour": 123,
            "lateness_cost_per_hour": 123
          }
        ]
      },
      "demand": {},
      "eligible_vehicles": {
        "allowed": [
          "<string>"
        ],
        "excluded": [
          "<string>"
        ]
      },
      "location": {
        "coordinate": [
          123
        ]
      },
      "mandatory": true,
      "pickup": {
        "location": {
          "coordinate": [
            123
          ]
        },
        "break_interruptible": true,
        "id": "<string>",
        "service_duration_s": 123,
        "setup_duration_s": 123,
        "time_windows": [
          {
            "from": "<string>",
            "to": "<string>",
            "earliness_cost_per_hour": 123,
            "lateness_cost_per_hour": 123
          }
        ]
      },
      "preferences": [
        {
          "vehicle": "<string>",
          "violation_cost": 123
        }
      ],
      "service_duration_s": 123,
      "setup_duration_s": 123,
      "skills": [
        {
          "name": "<string>",
          "violation_cost": 123
        }
      ],
      "tags": [
        "<string>"
      ],
      "time_windows": [
        {
          "from": "<string>",
          "to": "<string>",
          "earliness_cost_per_hour": 123,
          "lateness_cost_per_hour": 123
        }
      ],
      "unassigned_cost": 123
    }
  ],
  "vehicles": [
    {
      "id": "<string>",
      "shifts": [
        {
          "from": "<string>",
          "to": "<string>",
          "breaks": [
            {
              "duration_s": 123,
              "type": "floating",
              "location": {
                "coordinate": [
                  123
                ]
              },
              "paid": true,
              "trigger": {
                "threshold_s": 123,
                "resets_accumulator": true
              },
              "windows": [
                {
                  "from": "<string>",
                  "to": "<string>",
                  "earliness_cost_per_hour": 123,
                  "lateness_cost_per_hour": 123
                }
              ]
            }
          ],
          "capacity": {},
          "end": {
            "coordinate": [
              123
            ]
          },
          "max_overtime_s": 123,
          "max_tasks": 1,
          "reloads": [
            {
              "depot": "<string>",
              "max_reloads": 1
            }
          ],
          "serves_tags": [
            "<string>"
          ],
          "start": {
            "coordinate": [
              123
            ]
          },
          "unload_before_end": true
        }
      ],
      "capacity": {},
      "cost": {
        "fixed": 123,
        "per_km": 123,
        "per_overtime_hour": 123,
        "per_service_hour": 123,
        "per_shift": 123,
        "per_stop": 123,
        "per_travel_hour": 123,
        "per_wait_hour": 123,
        "standby": 123
      },
      "count": 1,
      "incompatible_dimensions": [
        [
          "<string>"
        ]
      ],
      "limits": {
        "max_distance_m": 123,
        "max_drive_time_s": 123,
        "max_duty_time_s": 123,
        "max_leg_drive_time_s": 123
      },
      "preferred_tags": [
        {
          "tag": "<string>",
          "violation_cost": 123
        }
      ],
      "profile": "<string>",
      "skills": [
        "<string>"
      ]
    }
  ],
  "depots": [
    {
      "id": "<string>",
      "location": [
        123
      ],
      "cost_per_visit": 123,
      "service_duration_s": 123,
      "throughput": {},
      "windows": [
        {
          "from": "<string>",
          "to": "<string>",
          "earliness_cost_per_hour": 123,
          "lateness_cost_per_hour": 123
        }
      ]
    }
  ],
  "locations": [
    {
      "coordinate": [
        123
      ],
      "id": "<string>"
    }
  ],
  "objective": {
    "balance": {
      "cost_per_unit_spread": 123
    },
    "costs": {
      "currency": "<string>",
      "per_late_hour": 123,
      "per_overtime_hour": 123,
      "per_service_hour": 123,
      "per_travel_hour": 123,
      "per_travel_km": 123,
      "per_wait_hour": 123
    },
    "priorities": [],
    "unassigned_cost": 123
  },
  "options": {
    "async": {
      "webhook_url": "<string>"
    },
    "output": {
      "arrival_snap_s": 1,
      "polylines": true
    },
    "runtime": {
      "matrix": {
        "distances": [
          [
            123
          ]
        ],
        "durations": [
          [
            123
          ]
        ]
      },
      "seed": 1,
      "time_limit_ms": 1,
      "traffic": {
        "departure_time": "<string>"
      }
    }
  },
  "relations": [
    {
      "type": "ordered",
      "group": "<string>",
      "id": "<string>",
      "job_ids": [
        "<string>"
      ],
      "max_interval_s": 123,
      "min_interval_s": 123,
      "violation_cost": 123
    }
  ]
}
'
import requests

url = "https://api.example.com/v3/routing/solve"

payload = {
"jobs": [
{
"id": "<string>",
"break_interruptible": True,
"delivery": {
"location": { "coordinate": [123] },
"break_interruptible": True,
"id": "<string>",
"service_duration_s": 123,
"setup_duration_s": 123,
"time_windows": [
{
"from": "<string>",
"to": "<string>",
"earliness_cost_per_hour": 123,
"lateness_cost_per_hour": 123
}
]
},
"demand": {},
"eligible_vehicles": {
"allowed": ["<string>"],
"excluded": ["<string>"]
},
"location": { "coordinate": [123] },
"mandatory": True,
"pickup": {
"location": { "coordinate": [123] },
"break_interruptible": True,
"id": "<string>",
"service_duration_s": 123,
"setup_duration_s": 123,
"time_windows": [
{
"from": "<string>",
"to": "<string>",
"earliness_cost_per_hour": 123,
"lateness_cost_per_hour": 123
}
]
},
"preferences": [
{
"vehicle": "<string>",
"violation_cost": 123
}
],
"service_duration_s": 123,
"setup_duration_s": 123,
"skills": [
{
"name": "<string>",
"violation_cost": 123
}
],
"tags": ["<string>"],
"time_windows": [
{
"from": "<string>",
"to": "<string>",
"earliness_cost_per_hour": 123,
"lateness_cost_per_hour": 123
}
],
"unassigned_cost": 123
}
],
"vehicles": [
{
"id": "<string>",
"shifts": [
{
"from": "<string>",
"to": "<string>",
"breaks": [
{
"duration_s": 123,
"type": "floating",
"location": { "coordinate": [123] },
"paid": True,
"trigger": {
"threshold_s": 123,
"resets_accumulator": True
},
"windows": [
{
"from": "<string>",
"to": "<string>",
"earliness_cost_per_hour": 123,
"lateness_cost_per_hour": 123
}
]
}
],
"capacity": {},
"end": { "coordinate": [123] },
"max_overtime_s": 123,
"max_tasks": 1,
"reloads": [
{
"depot": "<string>",
"max_reloads": 1
}
],
"serves_tags": ["<string>"],
"start": { "coordinate": [123] },
"unload_before_end": True
}
],
"capacity": {},
"cost": {
"fixed": 123,
"per_km": 123,
"per_overtime_hour": 123,
"per_service_hour": 123,
"per_shift": 123,
"per_stop": 123,
"per_travel_hour": 123,
"per_wait_hour": 123,
"standby": 123
},
"count": 1,
"incompatible_dimensions": [["<string>"]],
"limits": {
"max_distance_m": 123,
"max_drive_time_s": 123,
"max_duty_time_s": 123,
"max_leg_drive_time_s": 123
},
"preferred_tags": [
{
"tag": "<string>",
"violation_cost": 123
}
],
"profile": "<string>",
"skills": ["<string>"]
}
],
"depots": [
{
"id": "<string>",
"location": [123],
"cost_per_visit": 123,
"service_duration_s": 123,
"throughput": {},
"windows": [
{
"from": "<string>",
"to": "<string>",
"earliness_cost_per_hour": 123,
"lateness_cost_per_hour": 123
}
]
}
],
"locations": [
{
"coordinate": [123],
"id": "<string>"
}
],
"objective": {
"balance": { "cost_per_unit_spread": 123 },
"costs": {
"currency": "<string>",
"per_late_hour": 123,
"per_overtime_hour": 123,
"per_service_hour": 123,
"per_travel_hour": 123,
"per_travel_km": 123,
"per_wait_hour": 123
},
"priorities": [],
"unassigned_cost": 123
},
"options": {
"async": { "webhook_url": "<string>" },
"output": {
"arrival_snap_s": 1,
"polylines": True
},
"runtime": {
"matrix": {
"distances": [[123]],
"durations": [[123]]
},
"seed": 1,
"time_limit_ms": 1,
"traffic": { "departure_time": "<string>" }
}
},
"relations": [
{
"type": "ordered",
"group": "<string>",
"id": "<string>",
"job_ids": ["<string>"],
"max_interval_s": 123,
"min_interval_s": 123,
"violation_cost": 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({
jobs: [
{
id: '<string>',
break_interruptible: true,
delivery: {
location: {coordinate: [123]},
break_interruptible: true,
id: '<string>',
service_duration_s: 123,
setup_duration_s: 123,
time_windows: [
{
from: '<string>',
to: '<string>',
earliness_cost_per_hour: 123,
lateness_cost_per_hour: 123
}
]
},
demand: {},
eligible_vehicles: {allowed: ['<string>'], excluded: ['<string>']},
location: {coordinate: [123]},
mandatory: true,
pickup: {
location: {coordinate: [123]},
break_interruptible: true,
id: '<string>',
service_duration_s: 123,
setup_duration_s: 123,
time_windows: [
{
from: '<string>',
to: '<string>',
earliness_cost_per_hour: 123,
lateness_cost_per_hour: 123
}
]
},
preferences: [{vehicle: '<string>', violation_cost: 123}],
service_duration_s: 123,
setup_duration_s: 123,
skills: [{name: '<string>', violation_cost: 123}],
tags: ['<string>'],
time_windows: [
{
from: '<string>',
to: '<string>',
earliness_cost_per_hour: 123,
lateness_cost_per_hour: 123
}
],
unassigned_cost: 123
}
],
vehicles: [
{
id: '<string>',
shifts: [
{
from: '<string>',
to: '<string>',
breaks: [
{
duration_s: 123,
type: 'floating',
location: {coordinate: [123]},
paid: true,
trigger: {threshold_s: 123, resets_accumulator: true},
windows: [
{
from: '<string>',
to: '<string>',
earliness_cost_per_hour: 123,
lateness_cost_per_hour: 123
}
]
}
],
capacity: {},
end: {coordinate: [123]},
max_overtime_s: 123,
max_tasks: 1,
reloads: [{depot: '<string>', max_reloads: 1}],
serves_tags: ['<string>'],
start: {coordinate: [123]},
unload_before_end: true
}
],
capacity: {},
cost: {
fixed: 123,
per_km: 123,
per_overtime_hour: 123,
per_service_hour: 123,
per_shift: 123,
per_stop: 123,
per_travel_hour: 123,
per_wait_hour: 123,
standby: 123
},
count: 1,
incompatible_dimensions: [['<string>']],
limits: {
max_distance_m: 123,
max_drive_time_s: 123,
max_duty_time_s: 123,
max_leg_drive_time_s: 123
},
preferred_tags: [{tag: '<string>', violation_cost: 123}],
profile: '<string>',
skills: ['<string>']
}
],
depots: [
{
id: '<string>',
location: [123],
cost_per_visit: 123,
service_duration_s: 123,
throughput: {},
windows: [
{
from: '<string>',
to: '<string>',
earliness_cost_per_hour: 123,
lateness_cost_per_hour: 123
}
]
}
],
locations: [{coordinate: [123], id: '<string>'}],
objective: {
balance: {cost_per_unit_spread: 123},
costs: {
currency: '<string>',
per_late_hour: 123,
per_overtime_hour: 123,
per_service_hour: 123,
per_travel_hour: 123,
per_travel_km: 123,
per_wait_hour: 123
},
priorities: [],
unassigned_cost: 123
},
options: {
async: {webhook_url: '<string>'},
output: {arrival_snap_s: 1, polylines: true},
runtime: {
matrix: {distances: [[123]], durations: [[123]]},
seed: 1,
time_limit_ms: 1,
traffic: {departure_time: '<string>'}
}
},
relations: [
{
type: 'ordered',
group: '<string>',
id: '<string>',
job_ids: ['<string>'],
max_interval_s: 123,
min_interval_s: 123,
violation_cost: 123
}
]
})
};

fetch('https://api.example.com/v3/routing/solve', 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://api.example.com/v3/routing/solve",
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([
'jobs' => [
[
'id' => '<string>',
'break_interruptible' => true,
'delivery' => [
'location' => [
'coordinate' => [
123
]
],
'break_interruptible' => true,
'id' => '<string>',
'service_duration_s' => 123,
'setup_duration_s' => 123,
'time_windows' => [
[
'from' => '<string>',
'to' => '<string>',
'earliness_cost_per_hour' => 123,
'lateness_cost_per_hour' => 123
]
]
],
'demand' => [

],
'eligible_vehicles' => [
'allowed' => [
'<string>'
],
'excluded' => [
'<string>'
]
],
'location' => [
'coordinate' => [
123
]
],
'mandatory' => true,
'pickup' => [
'location' => [
'coordinate' => [
123
]
],
'break_interruptible' => true,
'id' => '<string>',
'service_duration_s' => 123,
'setup_duration_s' => 123,
'time_windows' => [
[
'from' => '<string>',
'to' => '<string>',
'earliness_cost_per_hour' => 123,
'lateness_cost_per_hour' => 123
]
]
],
'preferences' => [
[
'vehicle' => '<string>',
'violation_cost' => 123
]
],
'service_duration_s' => 123,
'setup_duration_s' => 123,
'skills' => [
[
'name' => '<string>',
'violation_cost' => 123
]
],
'tags' => [
'<string>'
],
'time_windows' => [
[
'from' => '<string>',
'to' => '<string>',
'earliness_cost_per_hour' => 123,
'lateness_cost_per_hour' => 123
]
],
'unassigned_cost' => 123
]
],
'vehicles' => [
[
'id' => '<string>',
'shifts' => [
[
'from' => '<string>',
'to' => '<string>',
'breaks' => [
[
'duration_s' => 123,
'type' => 'floating',
'location' => [
'coordinate' => [
123
]
],
'paid' => true,
'trigger' => [
'threshold_s' => 123,
'resets_accumulator' => true
],
'windows' => [
[
'from' => '<string>',
'to' => '<string>',
'earliness_cost_per_hour' => 123,
'lateness_cost_per_hour' => 123
]
]
]
],
'capacity' => [

],
'end' => [
'coordinate' => [
123
]
],
'max_overtime_s' => 123,
'max_tasks' => 1,
'reloads' => [
[
'depot' => '<string>',
'max_reloads' => 1
]
],
'serves_tags' => [
'<string>'
],
'start' => [
'coordinate' => [
123
]
],
'unload_before_end' => true
]
],
'capacity' => [

],
'cost' => [
'fixed' => 123,
'per_km' => 123,
'per_overtime_hour' => 123,
'per_service_hour' => 123,
'per_shift' => 123,
'per_stop' => 123,
'per_travel_hour' => 123,
'per_wait_hour' => 123,
'standby' => 123
],
'count' => 1,
'incompatible_dimensions' => [
[
'<string>'
]
],
'limits' => [
'max_distance_m' => 123,
'max_drive_time_s' => 123,
'max_duty_time_s' => 123,
'max_leg_drive_time_s' => 123
],
'preferred_tags' => [
[
'tag' => '<string>',
'violation_cost' => 123
]
],
'profile' => '<string>',
'skills' => [
'<string>'
]
]
],
'depots' => [
[
'id' => '<string>',
'location' => [
123
],
'cost_per_visit' => 123,
'service_duration_s' => 123,
'throughput' => [

],
'windows' => [
[
'from' => '<string>',
'to' => '<string>',
'earliness_cost_per_hour' => 123,
'lateness_cost_per_hour' => 123
]
]
]
],
'locations' => [
[
'coordinate' => [
123
],
'id' => '<string>'
]
],
'objective' => [
'balance' => [
'cost_per_unit_spread' => 123
],
'costs' => [
'currency' => '<string>',
'per_late_hour' => 123,
'per_overtime_hour' => 123,
'per_service_hour' => 123,
'per_travel_hour' => 123,
'per_travel_km' => 123,
'per_wait_hour' => 123
],
'priorities' => [

],
'unassigned_cost' => 123
],
'options' => [
'async' => [
'webhook_url' => '<string>'
],
'output' => [
'arrival_snap_s' => 1,
'polylines' => true
],
'runtime' => [
'matrix' => [
'distances' => [
[
123
]
],
'durations' => [
[
123
]
]
],
'seed' => 1,
'time_limit_ms' => 1,
'traffic' => [
'departure_time' => '<string>'
]
]
],
'relations' => [
[
'type' => 'ordered',
'group' => '<string>',
'id' => '<string>',
'job_ids' => [
'<string>'
],
'max_interval_s' => 123,
'min_interval_s' => 123,
'violation_cost' => 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://api.example.com/v3/routing/solve"

payload := strings.NewReader("{\n \"jobs\": [\n {\n \"id\": \"<string>\",\n \"break_interruptible\": true,\n \"delivery\": {\n \"location\": {\n \"coordinate\": [\n 123\n ]\n },\n \"break_interruptible\": true,\n \"id\": \"<string>\",\n \"service_duration_s\": 123,\n \"setup_duration_s\": 123,\n \"time_windows\": [\n {\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"earliness_cost_per_hour\": 123,\n \"lateness_cost_per_hour\": 123\n }\n ]\n },\n \"demand\": {},\n \"eligible_vehicles\": {\n \"allowed\": [\n \"<string>\"\n ],\n \"excluded\": [\n \"<string>\"\n ]\n },\n \"location\": {\n \"coordinate\": [\n 123\n ]\n },\n \"mandatory\": true,\n \"pickup\": {\n \"location\": {\n \"coordinate\": [\n 123\n ]\n },\n \"break_interruptible\": true,\n \"id\": \"<string>\",\n \"service_duration_s\": 123,\n \"setup_duration_s\": 123,\n \"time_windows\": [\n {\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"earliness_cost_per_hour\": 123,\n \"lateness_cost_per_hour\": 123\n }\n ]\n },\n \"preferences\": [\n {\n \"vehicle\": \"<string>\",\n \"violation_cost\": 123\n }\n ],\n \"service_duration_s\": 123,\n \"setup_duration_s\": 123,\n \"skills\": [\n {\n \"name\": \"<string>\",\n \"violation_cost\": 123\n }\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"time_windows\": [\n {\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"earliness_cost_per_hour\": 123,\n \"lateness_cost_per_hour\": 123\n }\n ],\n \"unassigned_cost\": 123\n }\n ],\n \"vehicles\": [\n {\n \"id\": \"<string>\",\n \"shifts\": [\n {\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"breaks\": [\n {\n \"duration_s\": 123,\n \"type\": \"floating\",\n \"location\": {\n \"coordinate\": [\n 123\n ]\n },\n \"paid\": true,\n \"trigger\": {\n \"threshold_s\": 123,\n \"resets_accumulator\": true\n },\n \"windows\": [\n {\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"earliness_cost_per_hour\": 123,\n \"lateness_cost_per_hour\": 123\n }\n ]\n }\n ],\n \"capacity\": {},\n \"end\": {\n \"coordinate\": [\n 123\n ]\n },\n \"max_overtime_s\": 123,\n \"max_tasks\": 1,\n \"reloads\": [\n {\n \"depot\": \"<string>\",\n \"max_reloads\": 1\n }\n ],\n \"serves_tags\": [\n \"<string>\"\n ],\n \"start\": {\n \"coordinate\": [\n 123\n ]\n },\n \"unload_before_end\": true\n }\n ],\n \"capacity\": {},\n \"cost\": {\n \"fixed\": 123,\n \"per_km\": 123,\n \"per_overtime_hour\": 123,\n \"per_service_hour\": 123,\n \"per_shift\": 123,\n \"per_stop\": 123,\n \"per_travel_hour\": 123,\n \"per_wait_hour\": 123,\n \"standby\": 123\n },\n \"count\": 1,\n \"incompatible_dimensions\": [\n [\n \"<string>\"\n ]\n ],\n \"limits\": {\n \"max_distance_m\": 123,\n \"max_drive_time_s\": 123,\n \"max_duty_time_s\": 123,\n \"max_leg_drive_time_s\": 123\n },\n \"preferred_tags\": [\n {\n \"tag\": \"<string>\",\n \"violation_cost\": 123\n }\n ],\n \"profile\": \"<string>\",\n \"skills\": [\n \"<string>\"\n ]\n }\n ],\n \"depots\": [\n {\n \"id\": \"<string>\",\n \"location\": [\n 123\n ],\n \"cost_per_visit\": 123,\n \"service_duration_s\": 123,\n \"throughput\": {},\n \"windows\": [\n {\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"earliness_cost_per_hour\": 123,\n \"lateness_cost_per_hour\": 123\n }\n ]\n }\n ],\n \"locations\": [\n {\n \"coordinate\": [\n 123\n ],\n \"id\": \"<string>\"\n }\n ],\n \"objective\": {\n \"balance\": {\n \"cost_per_unit_spread\": 123\n },\n \"costs\": {\n \"currency\": \"<string>\",\n \"per_late_hour\": 123,\n \"per_overtime_hour\": 123,\n \"per_service_hour\": 123,\n \"per_travel_hour\": 123,\n \"per_travel_km\": 123,\n \"per_wait_hour\": 123\n },\n \"priorities\": [],\n \"unassigned_cost\": 123\n },\n \"options\": {\n \"async\": {\n \"webhook_url\": \"<string>\"\n },\n \"output\": {\n \"arrival_snap_s\": 1,\n \"polylines\": true\n },\n \"runtime\": {\n \"matrix\": {\n \"distances\": [\n [\n 123\n ]\n ],\n \"durations\": [\n [\n 123\n ]\n ]\n },\n \"seed\": 1,\n \"time_limit_ms\": 1,\n \"traffic\": {\n \"departure_time\": \"<string>\"\n }\n }\n },\n \"relations\": [\n {\n \"type\": \"ordered\",\n \"group\": \"<string>\",\n \"id\": \"<string>\",\n \"job_ids\": [\n \"<string>\"\n ],\n \"max_interval_s\": 123,\n \"min_interval_s\": 123,\n \"violation_cost\": 123\n }\n ]\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://api.example.com/v3/routing/solve")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"jobs\": [\n {\n \"id\": \"<string>\",\n \"break_interruptible\": true,\n \"delivery\": {\n \"location\": {\n \"coordinate\": [\n 123\n ]\n },\n \"break_interruptible\": true,\n \"id\": \"<string>\",\n \"service_duration_s\": 123,\n \"setup_duration_s\": 123,\n \"time_windows\": [\n {\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"earliness_cost_per_hour\": 123,\n \"lateness_cost_per_hour\": 123\n }\n ]\n },\n \"demand\": {},\n \"eligible_vehicles\": {\n \"allowed\": [\n \"<string>\"\n ],\n \"excluded\": [\n \"<string>\"\n ]\n },\n \"location\": {\n \"coordinate\": [\n 123\n ]\n },\n \"mandatory\": true,\n \"pickup\": {\n \"location\": {\n \"coordinate\": [\n 123\n ]\n },\n \"break_interruptible\": true,\n \"id\": \"<string>\",\n \"service_duration_s\": 123,\n \"setup_duration_s\": 123,\n \"time_windows\": [\n {\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"earliness_cost_per_hour\": 123,\n \"lateness_cost_per_hour\": 123\n }\n ]\n },\n \"preferences\": [\n {\n \"vehicle\": \"<string>\",\n \"violation_cost\": 123\n }\n ],\n \"service_duration_s\": 123,\n \"setup_duration_s\": 123,\n \"skills\": [\n {\n \"name\": \"<string>\",\n \"violation_cost\": 123\n }\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"time_windows\": [\n {\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"earliness_cost_per_hour\": 123,\n \"lateness_cost_per_hour\": 123\n }\n ],\n \"unassigned_cost\": 123\n }\n ],\n \"vehicles\": [\n {\n \"id\": \"<string>\",\n \"shifts\": [\n {\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"breaks\": [\n {\n \"duration_s\": 123,\n \"type\": \"floating\",\n \"location\": {\n \"coordinate\": [\n 123\n ]\n },\n \"paid\": true,\n \"trigger\": {\n \"threshold_s\": 123,\n \"resets_accumulator\": true\n },\n \"windows\": [\n {\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"earliness_cost_per_hour\": 123,\n \"lateness_cost_per_hour\": 123\n }\n ]\n }\n ],\n \"capacity\": {},\n \"end\": {\n \"coordinate\": [\n 123\n ]\n },\n \"max_overtime_s\": 123,\n \"max_tasks\": 1,\n \"reloads\": [\n {\n \"depot\": \"<string>\",\n \"max_reloads\": 1\n }\n ],\n \"serves_tags\": [\n \"<string>\"\n ],\n \"start\": {\n \"coordinate\": [\n 123\n ]\n },\n \"unload_before_end\": true\n }\n ],\n \"capacity\": {},\n \"cost\": {\n \"fixed\": 123,\n \"per_km\": 123,\n \"per_overtime_hour\": 123,\n \"per_service_hour\": 123,\n \"per_shift\": 123,\n \"per_stop\": 123,\n \"per_travel_hour\": 123,\n \"per_wait_hour\": 123,\n \"standby\": 123\n },\n \"count\": 1,\n \"incompatible_dimensions\": [\n [\n \"<string>\"\n ]\n ],\n \"limits\": {\n \"max_distance_m\": 123,\n \"max_drive_time_s\": 123,\n \"max_duty_time_s\": 123,\n \"max_leg_drive_time_s\": 123\n },\n \"preferred_tags\": [\n {\n \"tag\": \"<string>\",\n \"violation_cost\": 123\n }\n ],\n \"profile\": \"<string>\",\n \"skills\": [\n \"<string>\"\n ]\n }\n ],\n \"depots\": [\n {\n \"id\": \"<string>\",\n \"location\": [\n 123\n ],\n \"cost_per_visit\": 123,\n \"service_duration_s\": 123,\n \"throughput\": {},\n \"windows\": [\n {\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"earliness_cost_per_hour\": 123,\n \"lateness_cost_per_hour\": 123\n }\n ]\n }\n ],\n \"locations\": [\n {\n \"coordinate\": [\n 123\n ],\n \"id\": \"<string>\"\n }\n ],\n \"objective\": {\n \"balance\": {\n \"cost_per_unit_spread\": 123\n },\n \"costs\": {\n \"currency\": \"<string>\",\n \"per_late_hour\": 123,\n \"per_overtime_hour\": 123,\n \"per_service_hour\": 123,\n \"per_travel_hour\": 123,\n \"per_travel_km\": 123,\n \"per_wait_hour\": 123\n },\n \"priorities\": [],\n \"unassigned_cost\": 123\n },\n \"options\": {\n \"async\": {\n \"webhook_url\": \"<string>\"\n },\n \"output\": {\n \"arrival_snap_s\": 1,\n \"polylines\": true\n },\n \"runtime\": {\n \"matrix\": {\n \"distances\": [\n [\n 123\n ]\n ],\n \"durations\": [\n [\n 123\n ]\n ]\n },\n \"seed\": 1,\n \"time_limit_ms\": 1,\n \"traffic\": {\n \"departure_time\": \"<string>\"\n }\n }\n },\n \"relations\": [\n {\n \"type\": \"ordered\",\n \"group\": \"<string>\",\n \"id\": \"<string>\",\n \"job_ids\": [\n \"<string>\"\n ],\n \"max_interval_s\": 123,\n \"min_interval_s\": 123,\n \"violation_cost\": 123\n }\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v3/routing/solve")

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 \"jobs\": [\n {\n \"id\": \"<string>\",\n \"break_interruptible\": true,\n \"delivery\": {\n \"location\": {\n \"coordinate\": [\n 123\n ]\n },\n \"break_interruptible\": true,\n \"id\": \"<string>\",\n \"service_duration_s\": 123,\n \"setup_duration_s\": 123,\n \"time_windows\": [\n {\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"earliness_cost_per_hour\": 123,\n \"lateness_cost_per_hour\": 123\n }\n ]\n },\n \"demand\": {},\n \"eligible_vehicles\": {\n \"allowed\": [\n \"<string>\"\n ],\n \"excluded\": [\n \"<string>\"\n ]\n },\n \"location\": {\n \"coordinate\": [\n 123\n ]\n },\n \"mandatory\": true,\n \"pickup\": {\n \"location\": {\n \"coordinate\": [\n 123\n ]\n },\n \"break_interruptible\": true,\n \"id\": \"<string>\",\n \"service_duration_s\": 123,\n \"setup_duration_s\": 123,\n \"time_windows\": [\n {\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"earliness_cost_per_hour\": 123,\n \"lateness_cost_per_hour\": 123\n }\n ]\n },\n \"preferences\": [\n {\n \"vehicle\": \"<string>\",\n \"violation_cost\": 123\n }\n ],\n \"service_duration_s\": 123,\n \"setup_duration_s\": 123,\n \"skills\": [\n {\n \"name\": \"<string>\",\n \"violation_cost\": 123\n }\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"time_windows\": [\n {\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"earliness_cost_per_hour\": 123,\n \"lateness_cost_per_hour\": 123\n }\n ],\n \"unassigned_cost\": 123\n }\n ],\n \"vehicles\": [\n {\n \"id\": \"<string>\",\n \"shifts\": [\n {\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"breaks\": [\n {\n \"duration_s\": 123,\n \"type\": \"floating\",\n \"location\": {\n \"coordinate\": [\n 123\n ]\n },\n \"paid\": true,\n \"trigger\": {\n \"threshold_s\": 123,\n \"resets_accumulator\": true\n },\n \"windows\": [\n {\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"earliness_cost_per_hour\": 123,\n \"lateness_cost_per_hour\": 123\n }\n ]\n }\n ],\n \"capacity\": {},\n \"end\": {\n \"coordinate\": [\n 123\n ]\n },\n \"max_overtime_s\": 123,\n \"max_tasks\": 1,\n \"reloads\": [\n {\n \"depot\": \"<string>\",\n \"max_reloads\": 1\n }\n ],\n \"serves_tags\": [\n \"<string>\"\n ],\n \"start\": {\n \"coordinate\": [\n 123\n ]\n },\n \"unload_before_end\": true\n }\n ],\n \"capacity\": {},\n \"cost\": {\n \"fixed\": 123,\n \"per_km\": 123,\n \"per_overtime_hour\": 123,\n \"per_service_hour\": 123,\n \"per_shift\": 123,\n \"per_stop\": 123,\n \"per_travel_hour\": 123,\n \"per_wait_hour\": 123,\n \"standby\": 123\n },\n \"count\": 1,\n \"incompatible_dimensions\": [\n [\n \"<string>\"\n ]\n ],\n \"limits\": {\n \"max_distance_m\": 123,\n \"max_drive_time_s\": 123,\n \"max_duty_time_s\": 123,\n \"max_leg_drive_time_s\": 123\n },\n \"preferred_tags\": [\n {\n \"tag\": \"<string>\",\n \"violation_cost\": 123\n }\n ],\n \"profile\": \"<string>\",\n \"skills\": [\n \"<string>\"\n ]\n }\n ],\n \"depots\": [\n {\n \"id\": \"<string>\",\n \"location\": [\n 123\n ],\n \"cost_per_visit\": 123,\n \"service_duration_s\": 123,\n \"throughput\": {},\n \"windows\": [\n {\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"earliness_cost_per_hour\": 123,\n \"lateness_cost_per_hour\": 123\n }\n ]\n }\n ],\n \"locations\": [\n {\n \"coordinate\": [\n 123\n ],\n \"id\": \"<string>\"\n }\n ],\n \"objective\": {\n \"balance\": {\n \"cost_per_unit_spread\": 123\n },\n \"costs\": {\n \"currency\": \"<string>\",\n \"per_late_hour\": 123,\n \"per_overtime_hour\": 123,\n \"per_service_hour\": 123,\n \"per_travel_hour\": 123,\n \"per_travel_km\": 123,\n \"per_wait_hour\": 123\n },\n \"priorities\": [],\n \"unassigned_cost\": 123\n },\n \"options\": {\n \"async\": {\n \"webhook_url\": \"<string>\"\n },\n \"output\": {\n \"arrival_snap_s\": 1,\n \"polylines\": true\n },\n \"runtime\": {\n \"matrix\": {\n \"distances\": [\n [\n 123\n ]\n ],\n \"durations\": [\n [\n 123\n ]\n ]\n },\n \"seed\": 1,\n \"time_limit_ms\": 1,\n \"traffic\": {\n \"departure_time\": \"<string>\"\n }\n }\n },\n \"relations\": [\n {\n \"type\": \"ordered\",\n \"group\": \"<string>\",\n \"id\": \"<string>\",\n \"job_ids\": [\n \"<string>\"\n ],\n \"max_interval_s\": 123,\n \"min_interval_s\": 123,\n \"violation_cost\": 123\n }\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "routes": [
    {
      "distance_m": 123,
      "duration_s": 123,
      "overtime_s": 123,
      "stops": [
        {
          "location": [
            123
          ],
          "arrival": "<string>",
          "departure": "<string>",
          "depot": "<string>",
          "id": "<string>",
          "lateness_s": 123,
          "load_after": {},
          "service_s": 123,
          "snapped_location": [
            123
          ],
          "travel_distance_m": 123,
          "travel_time_s": 123,
          "wait_s": 123
        }
      ],
      "vehicle": {
        "instance": 1,
        "type": "<string>"
      },
      "load_peak": {}
    }
  ],
  "summary": {
    "elapsed_ms": 1,
    "estimated_cost": {
      "components": {
        "imbalance": 123,
        "lateness": 123,
        "overtime": 123,
        "preferences": 123,
        "travel": 123,
        "unassigned": 123,
        "vehicles_fixed": 123,
        "waiting": 123
      },
      "total": 123,
      "currency": "<string>"
    },
    "iterations": 1,
    "jobs_assigned": 1,
    "jobs_unassigned": 1,
    "total_distance_m": 123,
    "total_duration_s": 123,
    "vehicles_used": 1,
    "balance": {
      "max": 123,
      "min": 123,
      "stdev": 123
    }
  },
  "unassigned": [
    {
      "job_id": "<string>",
      "reasons": [
        {
          "code": "<string>",
          "message": "<string>",
          "detail": "<unknown>"
        }
      ],
      "relaxations": [
        {
          "field": "<string>",
          "suggestion": "<string>"
        }
      ]
    }
  ]
}
{
"message": "<string>",
"status": "<string>",
"code": "<string>",
"field": "<string>",
"value": "<unknown>"
}
{
"message": "<string>",
"status": "<string>",
"code": "<string>",
"field": "<string>",
"value": "<unknown>"
}
{
"message": "<string>",
"status": "<string>",
"code": "<string>",
"field": "<string>",
"value": "<unknown>"
}
{
"message": "<string>",
"status": "<string>",
"code": "<string>",
"field": "<string>",
"value": "<unknown>"
}
{
"message": "<string>",
"status": "<string>",
"code": "<string>",
"field": "<string>",
"value": "<unknown>"
}
{
"message": "<string>",
"status": "<string>",
"code": "<string>",
"field": "<string>",
"value": "<unknown>"
}

Authorizations

Authorization
string
header
required

Body

application/json

Top-level request body for POST /v3/routing/solve (schema v2).

jobs
object[]
required

Jobs to serve (replaces jobs[] + shipments[]).

vehicles
object[]
required

Available vehicles.

depots
object[] | null

Named depots.

locations
object[] | null

Optional shared location table; tasks/depots/shifts may reference by id.

objective
null | object

Objective configuration.

options
null | object

Solver runtime / output / async options.

relations
object[] | null

Ordering, grouping, and synchronization constraints.

A constraint between tasks. Tagged union; each variant carries only its valid fields. Each relation references either explicit job_ids or a group (tag) — validated not-both. violation_cost absent = hard.

Response

Solution found

Top-level response body for POST /v3/routing/solve (schema v2).

routes
object[]
required

One entry per non-empty route.

summary
object
required

Aggregate statistics for the solve run.

unassigned
object[]
required

Tasks that could not be feasibly assigned.