Your First API Call
Test the VRP solver with a single command:
curl https://api.solvice.io/v2/vrp/demo -H "Authorization: YOUR_API_KEY" | \
curl https://api.solvice.io/v2/vrp/solve -H "Authorization: YOUR_API_KEY" \
-X POST -H "Content-Type: application/json" -d @-
This fetches a demo problem and solves it immediately. Replace YOUR_API_KEY
with your actual API key.
Basic VRP Request
A VRP request needs two things: resources (vehicles) and jobs (deliveries).
{
"resources": [{
"name": "vehicle-1",
"start": {
"latitude": 51.0535,
"longitude": 3.7264
},
"shifts": [{
"from": "2023-08-23T08:00:00",
"to": "2023-08-23T17:00:00"
}]
}],
"jobs": [{
"name": "delivery-1",
"location": {
"latitude": 50.8456,
"longitude": 4.3526
},
"duration": 3600
}]
}
Understanding the Response
The solver returns an optimized route plan:
{
"score": {
"hardScore": 0,
"softScore": -1655,
"feasible": true
},
"trips": [{
"resource": "vehicle-1",
"visits": [{
"arrival": "2023-08-23T08:27:32",
"job": "delivery-1"
}]
}],
"status": "SOLVED"
}
true
if all hard constraints are satisfied
Optimized routes for each vehicle
Next Steps