Skip to main content
POST
/
v2
/
vrp
/
solve
Solve
curl --request POST \
  --url https://api.solvice.io/v2/vrp/solve \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "resources": [
    {
      "name": "<string>",
      "shifts": [
        {
          "from": "<string>",
          "to": "<string>",
          "start": {
            "latitude": 123,
            "longitude": 123,
            "h3Index": 123
          },
          "end": {
            "latitude": 123,
            "longitude": 123,
            "h3Index": 123
          },
          "ignoreTravelTimeToFirstJob": true,
          "ignoreTravelTimeFromLastJob": true,
          "overtime": "<unknown>",
          "overtimeEnd": "<string>",
          "breaks": [
            {}
          ],
          "tags": [
            "<string>"
          ],
          "jobTypeLimitations": {}
        }
      ],
      "start": {
        "latitude": 123,
        "longitude": 123,
        "h3Index": 123
      },
      "end": {
        "latitude": 123,
        "longitude": 123,
        "h3Index": 123
      },
      "maxDriveTimeInSeconds": "<unknown>",
      "maxDriveDistance": 123,
      "region": {
        "latitude": 123,
        "longitude": 123,
        "h3Index": 123
      },
      "tags": [
        "<string>"
      ],
      "category": "CAR",
      "rules": [
        {
          "period": {
            "from": "2024-01-01T08:00:00Z",
            "to": "2024-01-07T17:00:00Z"
          },
          "minWorkTime": 123,
          "maxWorkTime": 123,
          "minServiceTime": 123,
          "maxServiceTime": 123,
          "minDriveTime": 123,
          "maxDriveTime": 123,
          "minJobComplexity": 123,
          "maxJobComplexity": 123,
          "jobTypeLimitations": {},
          "groupTag": "<string>"
        }
      ],
      "capacity": [
        123
      ],
      "loadCompatibility": [
        {}
      ],
      "hourlyCost": 1,
      "compatibleResources": [
        "<string>"
      ],
      "maxDriveTime": 123,
      "maxDriveTimeJob": 123
    }
  ],
  "jobs": [
    {
      "name": "<string>",
      "duration": 1,
      "location": {
        "latitude": 123,
        "longitude": 123,
        "h3Index": 123
      },
      "priority": 1,
      "urgency": 1,
      "tags": [
        {
          "name": "<string>",
          "hard": true,
          "weight": 123
        }
      ],
      "rankings": [
        {
          "name": "<string>",
          "ranking": 50
        }
      ],
      "proficiency": [
        {
          "resource": "<string>",
          "durationModifier": 1
        }
      ],
      "windows": [
        {
          "from": "<string>",
          "to": "<string>",
          "weight": 1,
          "hard": true
        }
      ],
      "durationSquash": 123,
      "plannedDate": "<string>",
      "plannedResource": "<string>",
      "plannedArrival": "<string>",
      "hard": true,
      "hardWeight": 123,
      "padding": 1,
      "load": [
        123
      ],
      "allowedResources": [
        "<string>"
      ],
      "initialResource": "<string>",
      "initialArrival": "<string>",
      "initialDepot": "<string>",
      "disallowedResources": [
        "<string>"
      ],
      "complexity": 123,
      "resumable": true,
      "jobTypes": [
        "<string>"
      ]
    }
  ],
  "options": {
    "euclidian": false,
    "routingEngine": "OSM",
    "partialPlanning": true,
    "minimizeResources": true,
    "traffic": 1.1,
    "polylines": true,
    "fairWorkloadPerTrip": false,
    "fairWorkloadPerResource": false,
    "workloadSensitivity": 0.1,
    "snapUnit": 300,
    "maxSuggestions": 3,
    "onlyFeasibleSuggestions": true,
    "explanation": {
      "enabled": true,
      "filterHardConstraints": true
    }
  },
  "weights": {
    "priorityWeight": 100,
    "workloadSpreadWeight": 10,
    "travelTimeWeight": 1,
    "plannedWeight": 1000,
    "asapWeight": 5,
    "minimizeResourcesWeight": 3600,
    "allowedResourcesWeight": 500,
    "waitTimeWeight": 1,
    "urgencyWeight": 50,
    "driveTimeWeight": 1,
    "clusteringWeight": 1
  },
  "costs": {
    "drivingCostPerHour": 25,
    "waitingCostPerHour": 15,
    "distanceCostPerKm": 0.35,
    "priorityCostPerPointPerHour": 5,
    "preferredResourceViolationCost": 20
  },
  "hook": "<string>",
  "customDistanceMatrices": {
    "profileMatrices": {
      "CAR": {
        "6": "matrix-car-morning-123",
        "9": "matrix-car-midday-456",
        "16": "matrix-car-evening-789"
      },
      "TRUCK": {
        "6": "matrix-truck-morning-abc",
        "9": "matrix-truck-midday-def"
      }
    },
    "matrixServiceUrl": "https://custom-matrix-service.com/api"
  },
  "depots": [
    {
      "name": "<string>",
      "location": {
        "latitude": 123,
        "longitude": 123,
        "h3Index": 123
      },
      "windows": [
        {
          "from": "<string>",
          "to": "<string>",
          "weight": 1,
          "hard": true
        }
      ],
      "cost": 1,
      "duration": 1,
      "capacity": [
        123
      ]
    }
  ],
  "label": "<string>",
  "relations": [
    {
      "jobs": [
        "<string>"
      ],
      "resource": "<string>",
      "minTimeInterval": 123,
      "maxTimeInterval": 123,
      "partialPlanning": true,
      "maxWaitingTime": 123,
      "tags": [
        "<string>"
      ],
      "enforceCompatibility": true,
      "hardMinWait": true,
      "weight": 123
    }
  ]
}
'
import requests

url = "https://api.solvice.io/v2/vrp/solve"

payload = {
    "resources": [
        {
            "name": "<string>",
            "shifts": [
                {
                    "from": "<string>",
                    "to": "<string>",
                    "start": {
                        "latitude": 123,
                        "longitude": 123,
                        "h3Index": 123
                    },
                    "end": {
                        "latitude": 123,
                        "longitude": 123,
                        "h3Index": 123
                    },
                    "ignoreTravelTimeToFirstJob": True,
                    "ignoreTravelTimeFromLastJob": True,
                    "overtime": "<unknown>",
                    "overtimeEnd": "<string>",
                    "breaks": [{}],
                    "tags": ["<string>"],
                    "jobTypeLimitations": {}
                }
            ],
            "start": {
                "latitude": 123,
                "longitude": 123,
                "h3Index": 123
            },
            "end": {
                "latitude": 123,
                "longitude": 123,
                "h3Index": 123
            },
            "maxDriveTimeInSeconds": "<unknown>",
            "maxDriveDistance": 123,
            "region": {
                "latitude": 123,
                "longitude": 123,
                "h3Index": 123
            },
            "tags": ["<string>"],
            "category": "CAR",
            "rules": [
                {
                    "period": {
                        "from": "2024-01-01T08:00:00Z",
                        "to": "2024-01-07T17:00:00Z"
                    },
                    "minWorkTime": 123,
                    "maxWorkTime": 123,
                    "minServiceTime": 123,
                    "maxServiceTime": 123,
                    "minDriveTime": 123,
                    "maxDriveTime": 123,
                    "minJobComplexity": 123,
                    "maxJobComplexity": 123,
                    "jobTypeLimitations": {},
                    "groupTag": "<string>"
                }
            ],
            "capacity": [123],
            "loadCompatibility": [{}],
            "hourlyCost": 1,
            "compatibleResources": ["<string>"],
            "maxDriveTime": 123,
            "maxDriveTimeJob": 123
        }
    ],
    "jobs": [
        {
            "name": "<string>",
            "duration": 1,
            "location": {
                "latitude": 123,
                "longitude": 123,
                "h3Index": 123
            },
            "priority": 1,
            "urgency": 1,
            "tags": [
                {
                    "name": "<string>",
                    "hard": True,
                    "weight": 123
                }
            ],
            "rankings": [
                {
                    "name": "<string>",
                    "ranking": 50
                }
            ],
            "proficiency": [
                {
                    "resource": "<string>",
                    "durationModifier": 1
                }
            ],
            "windows": [
                {
                    "from": "<string>",
                    "to": "<string>",
                    "weight": 1,
                    "hard": True
                }
            ],
            "durationSquash": 123,
            "plannedDate": "<string>",
            "plannedResource": "<string>",
            "plannedArrival": "<string>",
            "hard": True,
            "hardWeight": 123,
            "padding": 1,
            "load": [123],
            "allowedResources": ["<string>"],
            "initialResource": "<string>",
            "initialArrival": "<string>",
            "initialDepot": "<string>",
            "disallowedResources": ["<string>"],
            "complexity": 123,
            "resumable": True,
            "jobTypes": ["<string>"]
        }
    ],
    "options": {
        "euclidian": False,
        "routingEngine": "OSM",
        "partialPlanning": True,
        "minimizeResources": True,
        "traffic": 1.1,
        "polylines": True,
        "fairWorkloadPerTrip": False,
        "fairWorkloadPerResource": False,
        "workloadSensitivity": 0.1,
        "snapUnit": 300,
        "maxSuggestions": 3,
        "onlyFeasibleSuggestions": True,
        "explanation": {
            "enabled": True,
            "filterHardConstraints": True
        }
    },
    "weights": {
        "priorityWeight": 100,
        "workloadSpreadWeight": 10,
        "travelTimeWeight": 1,
        "plannedWeight": 1000,
        "asapWeight": 5,
        "minimizeResourcesWeight": 3600,
        "allowedResourcesWeight": 500,
        "waitTimeWeight": 1,
        "urgencyWeight": 50,
        "driveTimeWeight": 1,
        "clusteringWeight": 1
    },
    "costs": {
        "drivingCostPerHour": 25,
        "waitingCostPerHour": 15,
        "distanceCostPerKm": 0.35,
        "priorityCostPerPointPerHour": 5,
        "preferredResourceViolationCost": 20
    },
    "hook": "<string>",
    "customDistanceMatrices": {
        "profileMatrices": {
            "CAR": {
                "6": "matrix-car-morning-123",
                "9": "matrix-car-midday-456",
                "16": "matrix-car-evening-789"
            },
            "TRUCK": {
                "6": "matrix-truck-morning-abc",
                "9": "matrix-truck-midday-def"
            }
        },
        "matrixServiceUrl": "https://custom-matrix-service.com/api"
    },
    "depots": [
        {
            "name": "<string>",
            "location": {
                "latitude": 123,
                "longitude": 123,
                "h3Index": 123
            },
            "windows": [
                {
                    "from": "<string>",
                    "to": "<string>",
                    "weight": 1,
                    "hard": True
                }
            ],
            "cost": 1,
            "duration": 1,
            "capacity": [123]
        }
    ],
    "label": "<string>",
    "relations": [
        {
            "jobs": ["<string>"],
            "resource": "<string>",
            "minTimeInterval": 123,
            "maxTimeInterval": 123,
            "partialPlanning": True,
            "maxWaitingTime": 123,
            "tags": ["<string>"],
            "enforceCompatibility": True,
            "hardMinWait": True,
            "weight": 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({
    resources: [
      {
        name: '<string>',
        shifts: [
          {
            from: '<string>',
            to: '<string>',
            start: {latitude: 123, longitude: 123, h3Index: 123},
            end: {latitude: 123, longitude: 123, h3Index: 123},
            ignoreTravelTimeToFirstJob: true,
            ignoreTravelTimeFromLastJob: true,
            overtime: '<unknown>',
            overtimeEnd: '<string>',
            breaks: [{}],
            tags: ['<string>'],
            jobTypeLimitations: {}
          }
        ],
        start: {latitude: 123, longitude: 123, h3Index: 123},
        end: {latitude: 123, longitude: 123, h3Index: 123},
        maxDriveTimeInSeconds: '<unknown>',
        maxDriveDistance: 123,
        region: {latitude: 123, longitude: 123, h3Index: 123},
        tags: ['<string>'],
        category: 'CAR',
        rules: [
          {
            period: {from: '2024-01-01T08:00:00Z', to: '2024-01-07T17:00:00Z'},
            minWorkTime: 123,
            maxWorkTime: 123,
            minServiceTime: 123,
            maxServiceTime: 123,
            minDriveTime: 123,
            maxDriveTime: 123,
            minJobComplexity: 123,
            maxJobComplexity: 123,
            jobTypeLimitations: {},
            groupTag: '<string>'
          }
        ],
        capacity: [123],
        loadCompatibility: [{}],
        hourlyCost: 1,
        compatibleResources: ['<string>'],
        maxDriveTime: 123,
        maxDriveTimeJob: 123
      }
    ],
    jobs: [
      {
        name: '<string>',
        duration: 1,
        location: {latitude: 123, longitude: 123, h3Index: 123},
        priority: 1,
        urgency: 1,
        tags: [{name: '<string>', hard: true, weight: 123}],
        rankings: [{name: '<string>', ranking: 50}],
        proficiency: [{resource: '<string>', durationModifier: 1}],
        windows: [{from: '<string>', to: '<string>', weight: 1, hard: true}],
        durationSquash: 123,
        plannedDate: '<string>',
        plannedResource: '<string>',
        plannedArrival: '<string>',
        hard: true,
        hardWeight: 123,
        padding: 1,
        load: [123],
        allowedResources: ['<string>'],
        initialResource: '<string>',
        initialArrival: '<string>',
        initialDepot: '<string>',
        disallowedResources: ['<string>'],
        complexity: 123,
        resumable: true,
        jobTypes: ['<string>']
      }
    ],
    options: {
      euclidian: false,
      routingEngine: 'OSM',
      partialPlanning: true,
      minimizeResources: true,
      traffic: 1.1,
      polylines: true,
      fairWorkloadPerTrip: false,
      fairWorkloadPerResource: false,
      workloadSensitivity: 0.1,
      snapUnit: 300,
      maxSuggestions: 3,
      onlyFeasibleSuggestions: true,
      explanation: {enabled: true, filterHardConstraints: true}
    },
    weights: {
      priorityWeight: 100,
      workloadSpreadWeight: 10,
      travelTimeWeight: 1,
      plannedWeight: 1000,
      asapWeight: 5,
      minimizeResourcesWeight: 3600,
      allowedResourcesWeight: 500,
      waitTimeWeight: 1,
      urgencyWeight: 50,
      driveTimeWeight: 1,
      clusteringWeight: 1
    },
    costs: {
      drivingCostPerHour: 25,
      waitingCostPerHour: 15,
      distanceCostPerKm: 0.35,
      priorityCostPerPointPerHour: 5,
      preferredResourceViolationCost: 20
    },
    hook: '<string>',
    customDistanceMatrices: {
      profileMatrices: {
        CAR: {
          '6': 'matrix-car-morning-123',
          '9': 'matrix-car-midday-456',
          '16': 'matrix-car-evening-789'
        },
        TRUCK: {'6': 'matrix-truck-morning-abc', '9': 'matrix-truck-midday-def'}
      },
      matrixServiceUrl: 'https://custom-matrix-service.com/api'
    },
    depots: [
      {
        name: '<string>',
        location: {latitude: 123, longitude: 123, h3Index: 123},
        windows: [{from: '<string>', to: '<string>', weight: 1, hard: true}],
        cost: 1,
        duration: 1,
        capacity: [123]
      }
    ],
    label: '<string>',
    relations: [
      {
        jobs: ['<string>'],
        resource: '<string>',
        minTimeInterval: 123,
        maxTimeInterval: 123,
        partialPlanning: true,
        maxWaitingTime: 123,
        tags: ['<string>'],
        enforceCompatibility: true,
        hardMinWait: true,
        weight: 123
      }
    ]
  })
};

fetch('https://api.solvice.io/v2/vrp/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.solvice.io/v2/vrp/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([
    'resources' => [
        [
                'name' => '<string>',
                'shifts' => [
                                [
                                                                'from' => '<string>',
                                                                'to' => '<string>',
                                                                'start' => [
                                                                                                                                'latitude' => 123,
                                                                                                                                'longitude' => 123,
                                                                                                                                'h3Index' => 123
                                                                ],
                                                                'end' => [
                                                                                                                                'latitude' => 123,
                                                                                                                                'longitude' => 123,
                                                                                                                                'h3Index' => 123
                                                                ],
                                                                'ignoreTravelTimeToFirstJob' => true,
                                                                'ignoreTravelTimeFromLastJob' => true,
                                                                'overtime' => '<unknown>',
                                                                'overtimeEnd' => '<string>',
                                                                'breaks' => [
                                                                                                                                [
                                                                                                                                                                                                                                                                
                                                                                                                                ]
                                                                ],
                                                                'tags' => [
                                                                                                                                '<string>'
                                                                ],
                                                                'jobTypeLimitations' => [
                                                                                                                                
                                                                ]
                                ]
                ],
                'start' => [
                                'latitude' => 123,
                                'longitude' => 123,
                                'h3Index' => 123
                ],
                'end' => [
                                'latitude' => 123,
                                'longitude' => 123,
                                'h3Index' => 123
                ],
                'maxDriveTimeInSeconds' => '<unknown>',
                'maxDriveDistance' => 123,
                'region' => [
                                'latitude' => 123,
                                'longitude' => 123,
                                'h3Index' => 123
                ],
                'tags' => [
                                '<string>'
                ],
                'category' => 'CAR',
                'rules' => [
                                [
                                                                'period' => [
                                                                                                                                'from' => '2024-01-01T08:00:00Z',
                                                                                                                                'to' => '2024-01-07T17:00:00Z'
                                                                ],
                                                                'minWorkTime' => 123,
                                                                'maxWorkTime' => 123,
                                                                'minServiceTime' => 123,
                                                                'maxServiceTime' => 123,
                                                                'minDriveTime' => 123,
                                                                'maxDriveTime' => 123,
                                                                'minJobComplexity' => 123,
                                                                'maxJobComplexity' => 123,
                                                                'jobTypeLimitations' => [
                                                                                                                                
                                                                ],
                                                                'groupTag' => '<string>'
                                ]
                ],
                'capacity' => [
                                123
                ],
                'loadCompatibility' => [
                                [
                                                                
                                ]
                ],
                'hourlyCost' => 1,
                'compatibleResources' => [
                                '<string>'
                ],
                'maxDriveTime' => 123,
                'maxDriveTimeJob' => 123
        ]
    ],
    'jobs' => [
        [
                'name' => '<string>',
                'duration' => 1,
                'location' => [
                                'latitude' => 123,
                                'longitude' => 123,
                                'h3Index' => 123
                ],
                'priority' => 1,
                'urgency' => 1,
                'tags' => [
                                [
                                                                'name' => '<string>',
                                                                'hard' => true,
                                                                'weight' => 123
                                ]
                ],
                'rankings' => [
                                [
                                                                'name' => '<string>',
                                                                'ranking' => 50
                                ]
                ],
                'proficiency' => [
                                [
                                                                'resource' => '<string>',
                                                                'durationModifier' => 1
                                ]
                ],
                'windows' => [
                                [
                                                                'from' => '<string>',
                                                                'to' => '<string>',
                                                                'weight' => 1,
                                                                'hard' => true
                                ]
                ],
                'durationSquash' => 123,
                'plannedDate' => '<string>',
                'plannedResource' => '<string>',
                'plannedArrival' => '<string>',
                'hard' => true,
                'hardWeight' => 123,
                'padding' => 1,
                'load' => [
                                123
                ],
                'allowedResources' => [
                                '<string>'
                ],
                'initialResource' => '<string>',
                'initialArrival' => '<string>',
                'initialDepot' => '<string>',
                'disallowedResources' => [
                                '<string>'
                ],
                'complexity' => 123,
                'resumable' => true,
                'jobTypes' => [
                                '<string>'
                ]
        ]
    ],
    'options' => [
        'euclidian' => false,
        'routingEngine' => 'OSM',
        'partialPlanning' => true,
        'minimizeResources' => true,
        'traffic' => 1.1,
        'polylines' => true,
        'fairWorkloadPerTrip' => false,
        'fairWorkloadPerResource' => false,
        'workloadSensitivity' => 0.1,
        'snapUnit' => 300,
        'maxSuggestions' => 3,
        'onlyFeasibleSuggestions' => true,
        'explanation' => [
                'enabled' => true,
                'filterHardConstraints' => true
        ]
    ],
    'weights' => [
        'priorityWeight' => 100,
        'workloadSpreadWeight' => 10,
        'travelTimeWeight' => 1,
        'plannedWeight' => 1000,
        'asapWeight' => 5,
        'minimizeResourcesWeight' => 3600,
        'allowedResourcesWeight' => 500,
        'waitTimeWeight' => 1,
        'urgencyWeight' => 50,
        'driveTimeWeight' => 1,
        'clusteringWeight' => 1
    ],
    'costs' => [
        'drivingCostPerHour' => 25,
        'waitingCostPerHour' => 15,
        'distanceCostPerKm' => 0.35,
        'priorityCostPerPointPerHour' => 5,
        'preferredResourceViolationCost' => 20
    ],
    'hook' => '<string>',
    'customDistanceMatrices' => [
        'profileMatrices' => [
                'CAR' => [
                                '6' => 'matrix-car-morning-123',
                                '9' => 'matrix-car-midday-456',
                                '16' => 'matrix-car-evening-789'
                ],
                'TRUCK' => [
                                '6' => 'matrix-truck-morning-abc',
                                '9' => 'matrix-truck-midday-def'
                ]
        ],
        'matrixServiceUrl' => 'https://custom-matrix-service.com/api'
    ],
    'depots' => [
        [
                'name' => '<string>',
                'location' => [
                                'latitude' => 123,
                                'longitude' => 123,
                                'h3Index' => 123
                ],
                'windows' => [
                                [
                                                                'from' => '<string>',
                                                                'to' => '<string>',
                                                                'weight' => 1,
                                                                'hard' => true
                                ]
                ],
                'cost' => 1,
                'duration' => 1,
                'capacity' => [
                                123
                ]
        ]
    ],
    'label' => '<string>',
    'relations' => [
        [
                'jobs' => [
                                '<string>'
                ],
                'resource' => '<string>',
                'minTimeInterval' => 123,
                'maxTimeInterval' => 123,
                'partialPlanning' => true,
                'maxWaitingTime' => 123,
                'tags' => [
                                '<string>'
                ],
                'enforceCompatibility' => true,
                'hardMinWait' => true,
                'weight' => 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.solvice.io/v2/vrp/solve"

	payload := strings.NewReader("{\n  \"resources\": [\n    {\n      \"name\": \"<string>\",\n      \"shifts\": [\n        {\n          \"from\": \"<string>\",\n          \"to\": \"<string>\",\n          \"start\": {\n            \"latitude\": 123,\n            \"longitude\": 123,\n            \"h3Index\": 123\n          },\n          \"end\": {\n            \"latitude\": 123,\n            \"longitude\": 123,\n            \"h3Index\": 123\n          },\n          \"ignoreTravelTimeToFirstJob\": true,\n          \"ignoreTravelTimeFromLastJob\": true,\n          \"overtime\": \"<unknown>\",\n          \"overtimeEnd\": \"<string>\",\n          \"breaks\": [\n            {}\n          ],\n          \"tags\": [\n            \"<string>\"\n          ],\n          \"jobTypeLimitations\": {}\n        }\n      ],\n      \"start\": {\n        \"latitude\": 123,\n        \"longitude\": 123,\n        \"h3Index\": 123\n      },\n      \"end\": {\n        \"latitude\": 123,\n        \"longitude\": 123,\n        \"h3Index\": 123\n      },\n      \"maxDriveTimeInSeconds\": \"<unknown>\",\n      \"maxDriveDistance\": 123,\n      \"region\": {\n        \"latitude\": 123,\n        \"longitude\": 123,\n        \"h3Index\": 123\n      },\n      \"tags\": [\n        \"<string>\"\n      ],\n      \"category\": \"CAR\",\n      \"rules\": [\n        {\n          \"period\": {\n            \"from\": \"2024-01-01T08:00:00Z\",\n            \"to\": \"2024-01-07T17:00:00Z\"\n          },\n          \"minWorkTime\": 123,\n          \"maxWorkTime\": 123,\n          \"minServiceTime\": 123,\n          \"maxServiceTime\": 123,\n          \"minDriveTime\": 123,\n          \"maxDriveTime\": 123,\n          \"minJobComplexity\": 123,\n          \"maxJobComplexity\": 123,\n          \"jobTypeLimitations\": {},\n          \"groupTag\": \"<string>\"\n        }\n      ],\n      \"capacity\": [\n        123\n      ],\n      \"loadCompatibility\": [\n        {}\n      ],\n      \"hourlyCost\": 1,\n      \"compatibleResources\": [\n        \"<string>\"\n      ],\n      \"maxDriveTime\": 123,\n      \"maxDriveTimeJob\": 123\n    }\n  ],\n  \"jobs\": [\n    {\n      \"name\": \"<string>\",\n      \"duration\": 1,\n      \"location\": {\n        \"latitude\": 123,\n        \"longitude\": 123,\n        \"h3Index\": 123\n      },\n      \"priority\": 1,\n      \"urgency\": 1,\n      \"tags\": [\n        {\n          \"name\": \"<string>\",\n          \"hard\": true,\n          \"weight\": 123\n        }\n      ],\n      \"rankings\": [\n        {\n          \"name\": \"<string>\",\n          \"ranking\": 50\n        }\n      ],\n      \"proficiency\": [\n        {\n          \"resource\": \"<string>\",\n          \"durationModifier\": 1\n        }\n      ],\n      \"windows\": [\n        {\n          \"from\": \"<string>\",\n          \"to\": \"<string>\",\n          \"weight\": 1,\n          \"hard\": true\n        }\n      ],\n      \"durationSquash\": 123,\n      \"plannedDate\": \"<string>\",\n      \"plannedResource\": \"<string>\",\n      \"plannedArrival\": \"<string>\",\n      \"hard\": true,\n      \"hardWeight\": 123,\n      \"padding\": 1,\n      \"load\": [\n        123\n      ],\n      \"allowedResources\": [\n        \"<string>\"\n      ],\n      \"initialResource\": \"<string>\",\n      \"initialArrival\": \"<string>\",\n      \"initialDepot\": \"<string>\",\n      \"disallowedResources\": [\n        \"<string>\"\n      ],\n      \"complexity\": 123,\n      \"resumable\": true,\n      \"jobTypes\": [\n        \"<string>\"\n      ]\n    }\n  ],\n  \"options\": {\n    \"euclidian\": false,\n    \"routingEngine\": \"OSM\",\n    \"partialPlanning\": true,\n    \"minimizeResources\": true,\n    \"traffic\": 1.1,\n    \"polylines\": true,\n    \"fairWorkloadPerTrip\": false,\n    \"fairWorkloadPerResource\": false,\n    \"workloadSensitivity\": 0.1,\n    \"snapUnit\": 300,\n    \"maxSuggestions\": 3,\n    \"onlyFeasibleSuggestions\": true,\n    \"explanation\": {\n      \"enabled\": true,\n      \"filterHardConstraints\": true\n    }\n  },\n  \"weights\": {\n    \"priorityWeight\": 100,\n    \"workloadSpreadWeight\": 10,\n    \"travelTimeWeight\": 1,\n    \"plannedWeight\": 1000,\n    \"asapWeight\": 5,\n    \"minimizeResourcesWeight\": 3600,\n    \"allowedResourcesWeight\": 500,\n    \"waitTimeWeight\": 1,\n    \"urgencyWeight\": 50,\n    \"driveTimeWeight\": 1,\n    \"clusteringWeight\": 1\n  },\n  \"costs\": {\n    \"drivingCostPerHour\": 25,\n    \"waitingCostPerHour\": 15,\n    \"distanceCostPerKm\": 0.35,\n    \"priorityCostPerPointPerHour\": 5,\n    \"preferredResourceViolationCost\": 20\n  },\n  \"hook\": \"<string>\",\n  \"customDistanceMatrices\": {\n    \"profileMatrices\": {\n      \"CAR\": {\n        \"6\": \"matrix-car-morning-123\",\n        \"9\": \"matrix-car-midday-456\",\n        \"16\": \"matrix-car-evening-789\"\n      },\n      \"TRUCK\": {\n        \"6\": \"matrix-truck-morning-abc\",\n        \"9\": \"matrix-truck-midday-def\"\n      }\n    },\n    \"matrixServiceUrl\": \"https://custom-matrix-service.com/api\"\n  },\n  \"depots\": [\n    {\n      \"name\": \"<string>\",\n      \"location\": {\n        \"latitude\": 123,\n        \"longitude\": 123,\n        \"h3Index\": 123\n      },\n      \"windows\": [\n        {\n          \"from\": \"<string>\",\n          \"to\": \"<string>\",\n          \"weight\": 1,\n          \"hard\": true\n        }\n      ],\n      \"cost\": 1,\n      \"duration\": 1,\n      \"capacity\": [\n        123\n      ]\n    }\n  ],\n  \"label\": \"<string>\",\n  \"relations\": [\n    {\n      \"jobs\": [\n        \"<string>\"\n      ],\n      \"resource\": \"<string>\",\n      \"minTimeInterval\": 123,\n      \"maxTimeInterval\": 123,\n      \"partialPlanning\": true,\n      \"maxWaitingTime\": 123,\n      \"tags\": [\n        \"<string>\"\n      ],\n      \"enforceCompatibility\": true,\n      \"hardMinWait\": true,\n      \"weight\": 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.solvice.io/v2/vrp/solve")
  .header("Authorization", "<api-key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"resources\": [\n    {\n      \"name\": \"<string>\",\n      \"shifts\": [\n        {\n          \"from\": \"<string>\",\n          \"to\": \"<string>\",\n          \"start\": {\n            \"latitude\": 123,\n            \"longitude\": 123,\n            \"h3Index\": 123\n          },\n          \"end\": {\n            \"latitude\": 123,\n            \"longitude\": 123,\n            \"h3Index\": 123\n          },\n          \"ignoreTravelTimeToFirstJob\": true,\n          \"ignoreTravelTimeFromLastJob\": true,\n          \"overtime\": \"<unknown>\",\n          \"overtimeEnd\": \"<string>\",\n          \"breaks\": [\n            {}\n          ],\n          \"tags\": [\n            \"<string>\"\n          ],\n          \"jobTypeLimitations\": {}\n        }\n      ],\n      \"start\": {\n        \"latitude\": 123,\n        \"longitude\": 123,\n        \"h3Index\": 123\n      },\n      \"end\": {\n        \"latitude\": 123,\n        \"longitude\": 123,\n        \"h3Index\": 123\n      },\n      \"maxDriveTimeInSeconds\": \"<unknown>\",\n      \"maxDriveDistance\": 123,\n      \"region\": {\n        \"latitude\": 123,\n        \"longitude\": 123,\n        \"h3Index\": 123\n      },\n      \"tags\": [\n        \"<string>\"\n      ],\n      \"category\": \"CAR\",\n      \"rules\": [\n        {\n          \"period\": {\n            \"from\": \"2024-01-01T08:00:00Z\",\n            \"to\": \"2024-01-07T17:00:00Z\"\n          },\n          \"minWorkTime\": 123,\n          \"maxWorkTime\": 123,\n          \"minServiceTime\": 123,\n          \"maxServiceTime\": 123,\n          \"minDriveTime\": 123,\n          \"maxDriveTime\": 123,\n          \"minJobComplexity\": 123,\n          \"maxJobComplexity\": 123,\n          \"jobTypeLimitations\": {},\n          \"groupTag\": \"<string>\"\n        }\n      ],\n      \"capacity\": [\n        123\n      ],\n      \"loadCompatibility\": [\n        {}\n      ],\n      \"hourlyCost\": 1,\n      \"compatibleResources\": [\n        \"<string>\"\n      ],\n      \"maxDriveTime\": 123,\n      \"maxDriveTimeJob\": 123\n    }\n  ],\n  \"jobs\": [\n    {\n      \"name\": \"<string>\",\n      \"duration\": 1,\n      \"location\": {\n        \"latitude\": 123,\n        \"longitude\": 123,\n        \"h3Index\": 123\n      },\n      \"priority\": 1,\n      \"urgency\": 1,\n      \"tags\": [\n        {\n          \"name\": \"<string>\",\n          \"hard\": true,\n          \"weight\": 123\n        }\n      ],\n      \"rankings\": [\n        {\n          \"name\": \"<string>\",\n          \"ranking\": 50\n        }\n      ],\n      \"proficiency\": [\n        {\n          \"resource\": \"<string>\",\n          \"durationModifier\": 1\n        }\n      ],\n      \"windows\": [\n        {\n          \"from\": \"<string>\",\n          \"to\": \"<string>\",\n          \"weight\": 1,\n          \"hard\": true\n        }\n      ],\n      \"durationSquash\": 123,\n      \"plannedDate\": \"<string>\",\n      \"plannedResource\": \"<string>\",\n      \"plannedArrival\": \"<string>\",\n      \"hard\": true,\n      \"hardWeight\": 123,\n      \"padding\": 1,\n      \"load\": [\n        123\n      ],\n      \"allowedResources\": [\n        \"<string>\"\n      ],\n      \"initialResource\": \"<string>\",\n      \"initialArrival\": \"<string>\",\n      \"initialDepot\": \"<string>\",\n      \"disallowedResources\": [\n        \"<string>\"\n      ],\n      \"complexity\": 123,\n      \"resumable\": true,\n      \"jobTypes\": [\n        \"<string>\"\n      ]\n    }\n  ],\n  \"options\": {\n    \"euclidian\": false,\n    \"routingEngine\": \"OSM\",\n    \"partialPlanning\": true,\n    \"minimizeResources\": true,\n    \"traffic\": 1.1,\n    \"polylines\": true,\n    \"fairWorkloadPerTrip\": false,\n    \"fairWorkloadPerResource\": false,\n    \"workloadSensitivity\": 0.1,\n    \"snapUnit\": 300,\n    \"maxSuggestions\": 3,\n    \"onlyFeasibleSuggestions\": true,\n    \"explanation\": {\n      \"enabled\": true,\n      \"filterHardConstraints\": true\n    }\n  },\n  \"weights\": {\n    \"priorityWeight\": 100,\n    \"workloadSpreadWeight\": 10,\n    \"travelTimeWeight\": 1,\n    \"plannedWeight\": 1000,\n    \"asapWeight\": 5,\n    \"minimizeResourcesWeight\": 3600,\n    \"allowedResourcesWeight\": 500,\n    \"waitTimeWeight\": 1,\n    \"urgencyWeight\": 50,\n    \"driveTimeWeight\": 1,\n    \"clusteringWeight\": 1\n  },\n  \"costs\": {\n    \"drivingCostPerHour\": 25,\n    \"waitingCostPerHour\": 15,\n    \"distanceCostPerKm\": 0.35,\n    \"priorityCostPerPointPerHour\": 5,\n    \"preferredResourceViolationCost\": 20\n  },\n  \"hook\": \"<string>\",\n  \"customDistanceMatrices\": {\n    \"profileMatrices\": {\n      \"CAR\": {\n        \"6\": \"matrix-car-morning-123\",\n        \"9\": \"matrix-car-midday-456\",\n        \"16\": \"matrix-car-evening-789\"\n      },\n      \"TRUCK\": {\n        \"6\": \"matrix-truck-morning-abc\",\n        \"9\": \"matrix-truck-midday-def\"\n      }\n    },\n    \"matrixServiceUrl\": \"https://custom-matrix-service.com/api\"\n  },\n  \"depots\": [\n    {\n      \"name\": \"<string>\",\n      \"location\": {\n        \"latitude\": 123,\n        \"longitude\": 123,\n        \"h3Index\": 123\n      },\n      \"windows\": [\n        {\n          \"from\": \"<string>\",\n          \"to\": \"<string>\",\n          \"weight\": 1,\n          \"hard\": true\n        }\n      ],\n      \"cost\": 1,\n      \"duration\": 1,\n      \"capacity\": [\n        123\n      ]\n    }\n  ],\n  \"label\": \"<string>\",\n  \"relations\": [\n    {\n      \"jobs\": [\n        \"<string>\"\n      ],\n      \"resource\": \"<string>\",\n      \"minTimeInterval\": 123,\n      \"maxTimeInterval\": 123,\n      \"partialPlanning\": true,\n      \"maxWaitingTime\": 123,\n      \"tags\": [\n        \"<string>\"\n      ],\n      \"enforceCompatibility\": true,\n      \"hardMinWait\": true,\n      \"weight\": 123\n    }\n  ]\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.solvice.io/v2/vrp/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  \"resources\": [\n    {\n      \"name\": \"<string>\",\n      \"shifts\": [\n        {\n          \"from\": \"<string>\",\n          \"to\": \"<string>\",\n          \"start\": {\n            \"latitude\": 123,\n            \"longitude\": 123,\n            \"h3Index\": 123\n          },\n          \"end\": {\n            \"latitude\": 123,\n            \"longitude\": 123,\n            \"h3Index\": 123\n          },\n          \"ignoreTravelTimeToFirstJob\": true,\n          \"ignoreTravelTimeFromLastJob\": true,\n          \"overtime\": \"<unknown>\",\n          \"overtimeEnd\": \"<string>\",\n          \"breaks\": [\n            {}\n          ],\n          \"tags\": [\n            \"<string>\"\n          ],\n          \"jobTypeLimitations\": {}\n        }\n      ],\n      \"start\": {\n        \"latitude\": 123,\n        \"longitude\": 123,\n        \"h3Index\": 123\n      },\n      \"end\": {\n        \"latitude\": 123,\n        \"longitude\": 123,\n        \"h3Index\": 123\n      },\n      \"maxDriveTimeInSeconds\": \"<unknown>\",\n      \"maxDriveDistance\": 123,\n      \"region\": {\n        \"latitude\": 123,\n        \"longitude\": 123,\n        \"h3Index\": 123\n      },\n      \"tags\": [\n        \"<string>\"\n      ],\n      \"category\": \"CAR\",\n      \"rules\": [\n        {\n          \"period\": {\n            \"from\": \"2024-01-01T08:00:00Z\",\n            \"to\": \"2024-01-07T17:00:00Z\"\n          },\n          \"minWorkTime\": 123,\n          \"maxWorkTime\": 123,\n          \"minServiceTime\": 123,\n          \"maxServiceTime\": 123,\n          \"minDriveTime\": 123,\n          \"maxDriveTime\": 123,\n          \"minJobComplexity\": 123,\n          \"maxJobComplexity\": 123,\n          \"jobTypeLimitations\": {},\n          \"groupTag\": \"<string>\"\n        }\n      ],\n      \"capacity\": [\n        123\n      ],\n      \"loadCompatibility\": [\n        {}\n      ],\n      \"hourlyCost\": 1,\n      \"compatibleResources\": [\n        \"<string>\"\n      ],\n      \"maxDriveTime\": 123,\n      \"maxDriveTimeJob\": 123\n    }\n  ],\n  \"jobs\": [\n    {\n      \"name\": \"<string>\",\n      \"duration\": 1,\n      \"location\": {\n        \"latitude\": 123,\n        \"longitude\": 123,\n        \"h3Index\": 123\n      },\n      \"priority\": 1,\n      \"urgency\": 1,\n      \"tags\": [\n        {\n          \"name\": \"<string>\",\n          \"hard\": true,\n          \"weight\": 123\n        }\n      ],\n      \"rankings\": [\n        {\n          \"name\": \"<string>\",\n          \"ranking\": 50\n        }\n      ],\n      \"proficiency\": [\n        {\n          \"resource\": \"<string>\",\n          \"durationModifier\": 1\n        }\n      ],\n      \"windows\": [\n        {\n          \"from\": \"<string>\",\n          \"to\": \"<string>\",\n          \"weight\": 1,\n          \"hard\": true\n        }\n      ],\n      \"durationSquash\": 123,\n      \"plannedDate\": \"<string>\",\n      \"plannedResource\": \"<string>\",\n      \"plannedArrival\": \"<string>\",\n      \"hard\": true,\n      \"hardWeight\": 123,\n      \"padding\": 1,\n      \"load\": [\n        123\n      ],\n      \"allowedResources\": [\n        \"<string>\"\n      ],\n      \"initialResource\": \"<string>\",\n      \"initialArrival\": \"<string>\",\n      \"initialDepot\": \"<string>\",\n      \"disallowedResources\": [\n        \"<string>\"\n      ],\n      \"complexity\": 123,\n      \"resumable\": true,\n      \"jobTypes\": [\n        \"<string>\"\n      ]\n    }\n  ],\n  \"options\": {\n    \"euclidian\": false,\n    \"routingEngine\": \"OSM\",\n    \"partialPlanning\": true,\n    \"minimizeResources\": true,\n    \"traffic\": 1.1,\n    \"polylines\": true,\n    \"fairWorkloadPerTrip\": false,\n    \"fairWorkloadPerResource\": false,\n    \"workloadSensitivity\": 0.1,\n    \"snapUnit\": 300,\n    \"maxSuggestions\": 3,\n    \"onlyFeasibleSuggestions\": true,\n    \"explanation\": {\n      \"enabled\": true,\n      \"filterHardConstraints\": true\n    }\n  },\n  \"weights\": {\n    \"priorityWeight\": 100,\n    \"workloadSpreadWeight\": 10,\n    \"travelTimeWeight\": 1,\n    \"plannedWeight\": 1000,\n    \"asapWeight\": 5,\n    \"minimizeResourcesWeight\": 3600,\n    \"allowedResourcesWeight\": 500,\n    \"waitTimeWeight\": 1,\n    \"urgencyWeight\": 50,\n    \"driveTimeWeight\": 1,\n    \"clusteringWeight\": 1\n  },\n  \"costs\": {\n    \"drivingCostPerHour\": 25,\n    \"waitingCostPerHour\": 15,\n    \"distanceCostPerKm\": 0.35,\n    \"priorityCostPerPointPerHour\": 5,\n    \"preferredResourceViolationCost\": 20\n  },\n  \"hook\": \"<string>\",\n  \"customDistanceMatrices\": {\n    \"profileMatrices\": {\n      \"CAR\": {\n        \"6\": \"matrix-car-morning-123\",\n        \"9\": \"matrix-car-midday-456\",\n        \"16\": \"matrix-car-evening-789\"\n      },\n      \"TRUCK\": {\n        \"6\": \"matrix-truck-morning-abc\",\n        \"9\": \"matrix-truck-midday-def\"\n      }\n    },\n    \"matrixServiceUrl\": \"https://custom-matrix-service.com/api\"\n  },\n  \"depots\": [\n    {\n      \"name\": \"<string>\",\n      \"location\": {\n        \"latitude\": 123,\n        \"longitude\": 123,\n        \"h3Index\": 123\n      },\n      \"windows\": [\n        {\n          \"from\": \"<string>\",\n          \"to\": \"<string>\",\n          \"weight\": 1,\n          \"hard\": true\n        }\n      ],\n      \"cost\": 1,\n      \"duration\": 1,\n      \"capacity\": [\n        123\n      ]\n    }\n  ],\n  \"label\": \"<string>\",\n  \"relations\": [\n    {\n      \"jobs\": [\n        \"<string>\"\n      ],\n      \"resource\": \"<string>\",\n      \"minTimeInterval\": 123,\n      \"maxTimeInterval\": 123,\n      \"partialPlanning\": true,\n      \"maxWaitingTime\": 123,\n      \"tags\": [\n        \"<string>\"\n      ],\n      \"enforceCompatibility\": true,\n      \"hardMinWait\": true,\n      \"weight\": 123\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
{
  "id": "<string>",
  "solveDuration": 123,
  "errors": [
    {
      "message": "<string>",
      "code": 123
    }
  ],
  "warnings": [
    {
      "message": "<string>",
      "code": 123
    }
  ]
}
{
  "message": "<string>"
}
{
  "message": "<string>"
}
{
  "message": "<string>"
}

Authorizations

Authorization
string
header
required

Api Key based authentication (apikey)

Headers

instance
string | null

Query Parameters

millis
string | null

Body

application/json

OnRoute Request for solving, evaluating

resources
object[]
required

List of available resources (vehicles, drivers, workers) that can be assigned to perform jobs. Each resource defines their working schedules, location constraints, capacity limits, and capabilities. At least one resource is required, with a maximum of 2000 resources per request.

Required array length: 1 - 2000 elements
jobs
object[]
required

List of jobs/tasks to be assigned to resources. Each job specifies service requirements, location, time constraints, duration, and resource preferences. Jobs represent the work that needs to be scheduled and optimized. At least one job is required, with a maximum of 10,000 jobs per request.

Required array length: 1 - 10000 elements
options
object

Options to tweak the routing engine

Example:
{
  "euclidian": false,
  "routingEngine": "OSM",
  "partialPlanning": true,
  "minimizeResources": true,
  "traffic": 1.1,
  "polylines": true,
  "fairWorkloadPerTrip": false,
  "fairWorkloadPerResource": false,
  "workloadSensitivity": 0.1,
  "snapUnit": 300,
  "maxSuggestions": 3,
  "onlyFeasibleSuggestions": true,
  "explanation": {
    "enabled": true,
    "filterHardConstraints": true
  }
}
weights
object

OnRoute Weights

Example:
{
  "priorityWeight": 100,
  "workloadSpreadWeight": 10,
  "travelTimeWeight": 1,
  "plannedWeight": 1000,
  "asapWeight": 5,
  "minimizeResourcesWeight": 3600,
  "allowedResourcesWeight": 500,
  "waitTimeWeight": 1,
  "urgencyWeight": 50,
  "driveTimeWeight": 1,
  "clusteringWeight": 1
}
costs
object

Cost configuration for financial-based optimization. When provided, the solver derives internal weights from these cost values, allowing optimization decisions to be expressed in monetary terms. All costs are in EUR (or your preferred currency - treated as unitless by the solver).

Example:
{
  "drivingCostPerHour": 25,
  "waitingCostPerHour": 15,
  "distanceCostPerKm": 0.35,
  "priorityCostPerPointPerHour": 5,
  "preferredResourceViolationCost": 20
}
hook
string<uri> | null

Optional webhook URL that will receive a POST request with the job ID when the optimization is complete. This enables asynchronous processing where you can submit a request and be notified when results are ready, rather than waiting for the synchronous response.

customDistanceMatrices
object

Custom distance matrix configuration for multi-profile and multi-slice scenarios

Example:
{
  "profileMatrices": {
    "CAR": {
      "6": "matrix-car-morning-123",
      "9": "matrix-car-midday-456",
      "16": "matrix-car-evening-789"
    },
    "TRUCK": {
      "6": "matrix-truck-morning-abc",
      "9": "matrix-truck-midday-def"
    }
  },
  "matrixServiceUrl": "https://custom-matrix-service.com/api"
}
depots
object[] | null

Optional list of depots or disposal sites. Each depot defines location, opening hours, cost, duration, and capacity. Depot names must be unique.

label
string | null
Maximum string length: 255
Pattern: ^(?!.*\$\{).*$
relations
object[] | null

Response

Status

Status of a solve job

id
string
required

Job ID

status
enum<string> | null

Status of the solve.

Available options:
QUEUED,
SOLVING,
SOLVED,
ERROR
Example:

"SOLVING"

solveDuration
integer<int32> | null

Duration of the solve in seconds

errors
object[] | null

List of errors

warnings
object[] | null

List of warnings