Solve Multi-Fleet Routing (Two-Phase Greedy)
curl --request POST \
--url https://stage-api.getswitch.io/operations/routing/multi-fleet \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fleets": [
{
"end_point": {
"latitude": 45.4781,
"longitude": 9.2272
},
"id": "van-1",
"max_capacities": {
"charged_battery": 10,
"empty_battery": 10,
"vehicles": 4
},
"max_duration": 120,
"start_capacities": {
"charged_battery": 10,
"empty_battery": 0,
"vehicles": 0
},
"start_point": {
"latitude": 45.4781,
"longitude": 9.2272
},
"start_time": "2026-11-30T08:00:00Z"
},
{
"end_point": {
"latitude": 45.4781,
"longitude": 9.2272
},
"id": "van-2",
"max_capacities": {
"vehicles": 6
},
"max_duration": 90,
"start_capacities": {
"vehicles": 0
},
"start_point": {
"latitude": 45.4781,
"longitude": 9.2272
},
"start_time": "2026-11-30T08:00:00Z"
}
],
"operation_pool": [
{
"additional_notes": "Battery level (12.0%) below threshold (20.0%)",
"generated_at": "2026-11-30T07:55:00Z",
"latitude": 45.4642,
"longitude": 9.1856,
"operation_type": "battery_swap",
"priority": "high",
"priority_value": 2.4,
"vehicle_id": "acme-sc-0193",
"vehicle_properties": {
"battery_level": 12,
"id": "acme-sc-0193",
"last_moved": "2026-11-30T06:41:03Z",
"last_seen": "2026-11-30T07:50:12Z",
"lat": 45.4642,
"licence_plate": "SC0193",
"lon": 9.1856,
"status": "available",
"vehicle_model": "S-200",
"vehicle_type": "scooter"
},
"zone_id": "1042"
},
{
"additional_notes": "Zone surplus 1.0 vehicles (threshold: 1.5)",
"generated_at": "2026-11-30T07:55:00Z",
"latitude": 45.4671,
"longitude": 9.1883,
"operation_type": "pickup",
"priority": "medium",
"priority_value": 2.1,
"valid_from": "2026-11-30T08:00:00Z",
"valid_until": "2026-11-30T09:00:00Z",
"vehicle_id": "acme-sc-0457",
"zone_id": "1042"
},
{
"additional_notes": "Zone deficit 1.2 vehicles (threshold: -2.0)",
"generated_at": "2026-11-30T07:55:00Z",
"latitude": 45.4645,
"longitude": 9.1992,
"operation_type": "dropoff",
"priority": "high",
"priority_value": 4.8,
"valid_from": "2026-11-30T09:00:00Z",
"vehicle_id": "acme-sc-0457",
"zone_id": "1043"
}
]
}
'import requests
url = "https://stage-api.getswitch.io/operations/routing/multi-fleet"
payload = {
"fleets": [
{
"end_point": {
"latitude": 45.4781,
"longitude": 9.2272
},
"id": "van-1",
"max_capacities": {
"charged_battery": 10,
"empty_battery": 10,
"vehicles": 4
},
"max_duration": 120,
"start_capacities": {
"charged_battery": 10,
"empty_battery": 0,
"vehicles": 0
},
"start_point": {
"latitude": 45.4781,
"longitude": 9.2272
},
"start_time": "2026-11-30T08:00:00Z"
},
{
"end_point": {
"latitude": 45.4781,
"longitude": 9.2272
},
"id": "van-2",
"max_capacities": { "vehicles": 6 },
"max_duration": 90,
"start_capacities": { "vehicles": 0 },
"start_point": {
"latitude": 45.4781,
"longitude": 9.2272
},
"start_time": "2026-11-30T08:00:00Z"
}
],
"operation_pool": [
{
"additional_notes": "Battery level (12.0%) below threshold (20.0%)",
"generated_at": "2026-11-30T07:55:00Z",
"latitude": 45.4642,
"longitude": 9.1856,
"operation_type": "battery_swap",
"priority": "high",
"priority_value": 2.4,
"vehicle_id": "acme-sc-0193",
"vehicle_properties": {
"battery_level": 12,
"id": "acme-sc-0193",
"last_moved": "2026-11-30T06:41:03Z",
"last_seen": "2026-11-30T07:50:12Z",
"lat": 45.4642,
"licence_plate": "SC0193",
"lon": 9.1856,
"status": "available",
"vehicle_model": "S-200",
"vehicle_type": "scooter"
},
"zone_id": "1042"
},
{
"additional_notes": "Zone surplus 1.0 vehicles (threshold: 1.5)",
"generated_at": "2026-11-30T07:55:00Z",
"latitude": 45.4671,
"longitude": 9.1883,
"operation_type": "pickup",
"priority": "medium",
"priority_value": 2.1,
"valid_from": "2026-11-30T08:00:00Z",
"valid_until": "2026-11-30T09:00:00Z",
"vehicle_id": "acme-sc-0457",
"zone_id": "1042"
},
{
"additional_notes": "Zone deficit 1.2 vehicles (threshold: -2.0)",
"generated_at": "2026-11-30T07:55:00Z",
"latitude": 45.4645,
"longitude": 9.1992,
"operation_type": "dropoff",
"priority": "high",
"priority_value": 4.8,
"valid_from": "2026-11-30T09:00:00Z",
"vehicle_id": "acme-sc-0457",
"zone_id": "1043"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
fleets: [
{
end_point: {latitude: 45.4781, longitude: 9.2272},
id: 'van-1',
max_capacities: {charged_battery: 10, empty_battery: 10, vehicles: 4},
max_duration: 120,
start_capacities: {charged_battery: 10, empty_battery: 0, vehicles: 0},
start_point: {latitude: 45.4781, longitude: 9.2272},
start_time: '2026-11-30T08:00:00Z'
},
{
end_point: {latitude: 45.4781, longitude: 9.2272},
id: 'van-2',
max_capacities: {vehicles: 6},
max_duration: 90,
start_capacities: {vehicles: 0},
start_point: {latitude: 45.4781, longitude: 9.2272},
start_time: '2026-11-30T08:00:00Z'
}
],
operation_pool: [
{
additional_notes: 'Battery level (12.0%) below threshold (20.0%)',
generated_at: '2026-11-30T07:55:00Z',
latitude: 45.4642,
longitude: 9.1856,
operation_type: 'battery_swap',
priority: 'high',
priority_value: 2.4,
vehicle_id: 'acme-sc-0193',
vehicle_properties: {
battery_level: 12,
id: 'acme-sc-0193',
last_moved: '2026-11-30T06:41:03Z',
last_seen: '2026-11-30T07:50:12Z',
lat: 45.4642,
licence_plate: 'SC0193',
lon: 9.1856,
status: 'available',
vehicle_model: 'S-200',
vehicle_type: 'scooter'
},
zone_id: '1042'
},
{
additional_notes: 'Zone surplus 1.0 vehicles (threshold: 1.5)',
generated_at: '2026-11-30T07:55:00Z',
latitude: 45.4671,
longitude: 9.1883,
operation_type: 'pickup',
priority: 'medium',
priority_value: 2.1,
valid_from: '2026-11-30T08:00:00Z',
valid_until: '2026-11-30T09:00:00Z',
vehicle_id: 'acme-sc-0457',
zone_id: '1042'
},
{
additional_notes: 'Zone deficit 1.2 vehicles (threshold: -2.0)',
generated_at: '2026-11-30T07:55:00Z',
latitude: 45.4645,
longitude: 9.1992,
operation_type: 'dropoff',
priority: 'high',
priority_value: 4.8,
valid_from: '2026-11-30T09:00:00Z',
vehicle_id: 'acme-sc-0457',
zone_id: '1043'
}
]
})
};
fetch('https://stage-api.getswitch.io/operations/routing/multi-fleet', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://stage-api.getswitch.io/operations/routing/multi-fleet"
payload := strings.NewReader("{\n \"fleets\": [\n {\n \"end_point\": {\n \"latitude\": 45.4781,\n \"longitude\": 9.2272\n },\n \"id\": \"van-1\",\n \"max_capacities\": {\n \"charged_battery\": 10,\n \"empty_battery\": 10,\n \"vehicles\": 4\n },\n \"max_duration\": 120,\n \"start_capacities\": {\n \"charged_battery\": 10,\n \"empty_battery\": 0,\n \"vehicles\": 0\n },\n \"start_point\": {\n \"latitude\": 45.4781,\n \"longitude\": 9.2272\n },\n \"start_time\": \"2026-11-30T08:00:00Z\"\n },\n {\n \"end_point\": {\n \"latitude\": 45.4781,\n \"longitude\": 9.2272\n },\n \"id\": \"van-2\",\n \"max_capacities\": {\n \"vehicles\": 6\n },\n \"max_duration\": 90,\n \"start_capacities\": {\n \"vehicles\": 0\n },\n \"start_point\": {\n \"latitude\": 45.4781,\n \"longitude\": 9.2272\n },\n \"start_time\": \"2026-11-30T08:00:00Z\"\n }\n ],\n \"operation_pool\": [\n {\n \"additional_notes\": \"Battery level (12.0%) below threshold (20.0%)\",\n \"generated_at\": \"2026-11-30T07:55:00Z\",\n \"latitude\": 45.4642,\n \"longitude\": 9.1856,\n \"operation_type\": \"battery_swap\",\n \"priority\": \"high\",\n \"priority_value\": 2.4,\n \"vehicle_id\": \"acme-sc-0193\",\n \"vehicle_properties\": {\n \"battery_level\": 12,\n \"id\": \"acme-sc-0193\",\n \"last_moved\": \"2026-11-30T06:41:03Z\",\n \"last_seen\": \"2026-11-30T07:50:12Z\",\n \"lat\": 45.4642,\n \"licence_plate\": \"SC0193\",\n \"lon\": 9.1856,\n \"status\": \"available\",\n \"vehicle_model\": \"S-200\",\n \"vehicle_type\": \"scooter\"\n },\n \"zone_id\": \"1042\"\n },\n {\n \"additional_notes\": \"Zone surplus 1.0 vehicles (threshold: 1.5)\",\n \"generated_at\": \"2026-11-30T07:55:00Z\",\n \"latitude\": 45.4671,\n \"longitude\": 9.1883,\n \"operation_type\": \"pickup\",\n \"priority\": \"medium\",\n \"priority_value\": 2.1,\n \"valid_from\": \"2026-11-30T08:00:00Z\",\n \"valid_until\": \"2026-11-30T09:00:00Z\",\n \"vehicle_id\": \"acme-sc-0457\",\n \"zone_id\": \"1042\"\n },\n {\n \"additional_notes\": \"Zone deficit 1.2 vehicles (threshold: -2.0)\",\n \"generated_at\": \"2026-11-30T07:55:00Z\",\n \"latitude\": 45.4645,\n \"longitude\": 9.1992,\n \"operation_type\": \"dropoff\",\n \"priority\": \"high\",\n \"priority_value\": 4.8,\n \"valid_from\": \"2026-11-30T09:00:00Z\",\n \"vehicle_id\": \"acme-sc-0457\",\n \"zone_id\": \"1043\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}{
"fleet_plans": [
{
"fleet_id": "van-1",
"plan": [
{
"expected_arrival": "2026-11-30T08:14:00Z",
"operation": {
"additional_notes": "Battery level (12.0%) below threshold (20.0%)",
"generated_at": "2026-11-30T07:55:00Z",
"latitude": 45.4642,
"longitude": 9.1856,
"operation_type": "battery_swap",
"priority": "high",
"priority_value": 2.4,
"vehicle_id": "acme-sc-0193",
"vehicle_properties": {
"battery_level": 12,
"id": "acme-sc-0193",
"last_moved": "2026-11-30T06:41:03Z",
"last_seen": "2026-11-30T07:50:12Z",
"lat": 45.4642,
"licence_plate": "SC0193",
"lon": 9.1856,
"status": "available",
"vehicle_model": "S-200",
"vehicle_type": "scooter"
},
"zone_id": "1042"
},
"routing_parameters": {
"capacity_delta": {
"charged_battery": -1,
"empty_battery": 1
},
"profit": 2.4
},
"step": 0
}
],
"total_distance": 7.9,
"total_duration": 41,
"total_profit": 2.4,
"utilization": {
"charged_battery": 10,
"empty_battery": 1,
"vehicles": 0
}
},
{
"fleet_id": "van-2",
"plan": [
{
"expected_arrival": "2026-11-30T08:23:00Z",
"operation": {
"additional_notes": "Zone surplus 1.0 vehicles (threshold: 1.5)",
"generated_at": "2026-11-30T07:55:00Z",
"latitude": 45.4671,
"longitude": 9.1883,
"operation_type": "pickup",
"priority": "medium",
"priority_value": 2.1,
"valid_from": "2026-11-30T08:00:00Z",
"valid_until": "2026-11-30T09:00:00Z",
"vehicle_id": "acme-sc-0457",
"zone_id": "1042"
},
"routing_parameters": {
"capacity_delta": {
"vehicles": 1
},
"profit": 2.1
},
"step": 0
},
{
"expected_arrival": "2026-11-30T09:02:00Z",
"operation": {
"additional_notes": "Zone deficit 1.2 vehicles (threshold: -2.0)",
"generated_at": "2026-11-30T07:55:00Z",
"latitude": 45.4645,
"longitude": 9.1992,
"operation_type": "dropoff",
"priority": "high",
"priority_value": 4.8,
"valid_from": "2026-11-30T09:00:00Z",
"vehicle_id": "acme-sc-0457",
"zone_id": "1043"
},
"routing_parameters": {
"capacity_delta": {
"vehicles": -1
},
"profit": 4.8
},
"step": 1
}
],
"total_distance": 10.6,
"total_duration": 63.5,
"total_profit": 6.9,
"utilization": {
"vehicles": 1
}
}
],
"total_profit": 9.3,
"unassigned_operations": []
}Routing
Solve Multi-Fleet Routing (Two-Phase Greedy)
Distribute a pool of operations across multiple vehicles (fleets) and compute an optimized route for each vehicle using a two-phase greedy approach:
- Greedy assignment of tasks to vehicles with an affinity score
- Single-vehicle route optimization reusing the existing solver
Constraints on capacities, time and space are preserved per-vehicle.
Failure Modes:
- 401: Missing or invalid authentication credentials
- 403: Insufficient permissions
- 422: Invalid request data (coordinates, capacities, fleet config)
- 500: Routing optimization failure or internal error
Required Auth Scopes:
redistribution:read
POST
/
operations
/
routing
/
multi-fleet
Solve Multi-Fleet Routing (Two-Phase Greedy)
curl --request POST \
--url https://stage-api.getswitch.io/operations/routing/multi-fleet \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fleets": [
{
"end_point": {
"latitude": 45.4781,
"longitude": 9.2272
},
"id": "van-1",
"max_capacities": {
"charged_battery": 10,
"empty_battery": 10,
"vehicles": 4
},
"max_duration": 120,
"start_capacities": {
"charged_battery": 10,
"empty_battery": 0,
"vehicles": 0
},
"start_point": {
"latitude": 45.4781,
"longitude": 9.2272
},
"start_time": "2026-11-30T08:00:00Z"
},
{
"end_point": {
"latitude": 45.4781,
"longitude": 9.2272
},
"id": "van-2",
"max_capacities": {
"vehicles": 6
},
"max_duration": 90,
"start_capacities": {
"vehicles": 0
},
"start_point": {
"latitude": 45.4781,
"longitude": 9.2272
},
"start_time": "2026-11-30T08:00:00Z"
}
],
"operation_pool": [
{
"additional_notes": "Battery level (12.0%) below threshold (20.0%)",
"generated_at": "2026-11-30T07:55:00Z",
"latitude": 45.4642,
"longitude": 9.1856,
"operation_type": "battery_swap",
"priority": "high",
"priority_value": 2.4,
"vehicle_id": "acme-sc-0193",
"vehicle_properties": {
"battery_level": 12,
"id": "acme-sc-0193",
"last_moved": "2026-11-30T06:41:03Z",
"last_seen": "2026-11-30T07:50:12Z",
"lat": 45.4642,
"licence_plate": "SC0193",
"lon": 9.1856,
"status": "available",
"vehicle_model": "S-200",
"vehicle_type": "scooter"
},
"zone_id": "1042"
},
{
"additional_notes": "Zone surplus 1.0 vehicles (threshold: 1.5)",
"generated_at": "2026-11-30T07:55:00Z",
"latitude": 45.4671,
"longitude": 9.1883,
"operation_type": "pickup",
"priority": "medium",
"priority_value": 2.1,
"valid_from": "2026-11-30T08:00:00Z",
"valid_until": "2026-11-30T09:00:00Z",
"vehicle_id": "acme-sc-0457",
"zone_id": "1042"
},
{
"additional_notes": "Zone deficit 1.2 vehicles (threshold: -2.0)",
"generated_at": "2026-11-30T07:55:00Z",
"latitude": 45.4645,
"longitude": 9.1992,
"operation_type": "dropoff",
"priority": "high",
"priority_value": 4.8,
"valid_from": "2026-11-30T09:00:00Z",
"vehicle_id": "acme-sc-0457",
"zone_id": "1043"
}
]
}
'import requests
url = "https://stage-api.getswitch.io/operations/routing/multi-fleet"
payload = {
"fleets": [
{
"end_point": {
"latitude": 45.4781,
"longitude": 9.2272
},
"id": "van-1",
"max_capacities": {
"charged_battery": 10,
"empty_battery": 10,
"vehicles": 4
},
"max_duration": 120,
"start_capacities": {
"charged_battery": 10,
"empty_battery": 0,
"vehicles": 0
},
"start_point": {
"latitude": 45.4781,
"longitude": 9.2272
},
"start_time": "2026-11-30T08:00:00Z"
},
{
"end_point": {
"latitude": 45.4781,
"longitude": 9.2272
},
"id": "van-2",
"max_capacities": { "vehicles": 6 },
"max_duration": 90,
"start_capacities": { "vehicles": 0 },
"start_point": {
"latitude": 45.4781,
"longitude": 9.2272
},
"start_time": "2026-11-30T08:00:00Z"
}
],
"operation_pool": [
{
"additional_notes": "Battery level (12.0%) below threshold (20.0%)",
"generated_at": "2026-11-30T07:55:00Z",
"latitude": 45.4642,
"longitude": 9.1856,
"operation_type": "battery_swap",
"priority": "high",
"priority_value": 2.4,
"vehicle_id": "acme-sc-0193",
"vehicle_properties": {
"battery_level": 12,
"id": "acme-sc-0193",
"last_moved": "2026-11-30T06:41:03Z",
"last_seen": "2026-11-30T07:50:12Z",
"lat": 45.4642,
"licence_plate": "SC0193",
"lon": 9.1856,
"status": "available",
"vehicle_model": "S-200",
"vehicle_type": "scooter"
},
"zone_id": "1042"
},
{
"additional_notes": "Zone surplus 1.0 vehicles (threshold: 1.5)",
"generated_at": "2026-11-30T07:55:00Z",
"latitude": 45.4671,
"longitude": 9.1883,
"operation_type": "pickup",
"priority": "medium",
"priority_value": 2.1,
"valid_from": "2026-11-30T08:00:00Z",
"valid_until": "2026-11-30T09:00:00Z",
"vehicle_id": "acme-sc-0457",
"zone_id": "1042"
},
{
"additional_notes": "Zone deficit 1.2 vehicles (threshold: -2.0)",
"generated_at": "2026-11-30T07:55:00Z",
"latitude": 45.4645,
"longitude": 9.1992,
"operation_type": "dropoff",
"priority": "high",
"priority_value": 4.8,
"valid_from": "2026-11-30T09:00:00Z",
"vehicle_id": "acme-sc-0457",
"zone_id": "1043"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
fleets: [
{
end_point: {latitude: 45.4781, longitude: 9.2272},
id: 'van-1',
max_capacities: {charged_battery: 10, empty_battery: 10, vehicles: 4},
max_duration: 120,
start_capacities: {charged_battery: 10, empty_battery: 0, vehicles: 0},
start_point: {latitude: 45.4781, longitude: 9.2272},
start_time: '2026-11-30T08:00:00Z'
},
{
end_point: {latitude: 45.4781, longitude: 9.2272},
id: 'van-2',
max_capacities: {vehicles: 6},
max_duration: 90,
start_capacities: {vehicles: 0},
start_point: {latitude: 45.4781, longitude: 9.2272},
start_time: '2026-11-30T08:00:00Z'
}
],
operation_pool: [
{
additional_notes: 'Battery level (12.0%) below threshold (20.0%)',
generated_at: '2026-11-30T07:55:00Z',
latitude: 45.4642,
longitude: 9.1856,
operation_type: 'battery_swap',
priority: 'high',
priority_value: 2.4,
vehicle_id: 'acme-sc-0193',
vehicle_properties: {
battery_level: 12,
id: 'acme-sc-0193',
last_moved: '2026-11-30T06:41:03Z',
last_seen: '2026-11-30T07:50:12Z',
lat: 45.4642,
licence_plate: 'SC0193',
lon: 9.1856,
status: 'available',
vehicle_model: 'S-200',
vehicle_type: 'scooter'
},
zone_id: '1042'
},
{
additional_notes: 'Zone surplus 1.0 vehicles (threshold: 1.5)',
generated_at: '2026-11-30T07:55:00Z',
latitude: 45.4671,
longitude: 9.1883,
operation_type: 'pickup',
priority: 'medium',
priority_value: 2.1,
valid_from: '2026-11-30T08:00:00Z',
valid_until: '2026-11-30T09:00:00Z',
vehicle_id: 'acme-sc-0457',
zone_id: '1042'
},
{
additional_notes: 'Zone deficit 1.2 vehicles (threshold: -2.0)',
generated_at: '2026-11-30T07:55:00Z',
latitude: 45.4645,
longitude: 9.1992,
operation_type: 'dropoff',
priority: 'high',
priority_value: 4.8,
valid_from: '2026-11-30T09:00:00Z',
vehicle_id: 'acme-sc-0457',
zone_id: '1043'
}
]
})
};
fetch('https://stage-api.getswitch.io/operations/routing/multi-fleet', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://stage-api.getswitch.io/operations/routing/multi-fleet"
payload := strings.NewReader("{\n \"fleets\": [\n {\n \"end_point\": {\n \"latitude\": 45.4781,\n \"longitude\": 9.2272\n },\n \"id\": \"van-1\",\n \"max_capacities\": {\n \"charged_battery\": 10,\n \"empty_battery\": 10,\n \"vehicles\": 4\n },\n \"max_duration\": 120,\n \"start_capacities\": {\n \"charged_battery\": 10,\n \"empty_battery\": 0,\n \"vehicles\": 0\n },\n \"start_point\": {\n \"latitude\": 45.4781,\n \"longitude\": 9.2272\n },\n \"start_time\": \"2026-11-30T08:00:00Z\"\n },\n {\n \"end_point\": {\n \"latitude\": 45.4781,\n \"longitude\": 9.2272\n },\n \"id\": \"van-2\",\n \"max_capacities\": {\n \"vehicles\": 6\n },\n \"max_duration\": 90,\n \"start_capacities\": {\n \"vehicles\": 0\n },\n \"start_point\": {\n \"latitude\": 45.4781,\n \"longitude\": 9.2272\n },\n \"start_time\": \"2026-11-30T08:00:00Z\"\n }\n ],\n \"operation_pool\": [\n {\n \"additional_notes\": \"Battery level (12.0%) below threshold (20.0%)\",\n \"generated_at\": \"2026-11-30T07:55:00Z\",\n \"latitude\": 45.4642,\n \"longitude\": 9.1856,\n \"operation_type\": \"battery_swap\",\n \"priority\": \"high\",\n \"priority_value\": 2.4,\n \"vehicle_id\": \"acme-sc-0193\",\n \"vehicle_properties\": {\n \"battery_level\": 12,\n \"id\": \"acme-sc-0193\",\n \"last_moved\": \"2026-11-30T06:41:03Z\",\n \"last_seen\": \"2026-11-30T07:50:12Z\",\n \"lat\": 45.4642,\n \"licence_plate\": \"SC0193\",\n \"lon\": 9.1856,\n \"status\": \"available\",\n \"vehicle_model\": \"S-200\",\n \"vehicle_type\": \"scooter\"\n },\n \"zone_id\": \"1042\"\n },\n {\n \"additional_notes\": \"Zone surplus 1.0 vehicles (threshold: 1.5)\",\n \"generated_at\": \"2026-11-30T07:55:00Z\",\n \"latitude\": 45.4671,\n \"longitude\": 9.1883,\n \"operation_type\": \"pickup\",\n \"priority\": \"medium\",\n \"priority_value\": 2.1,\n \"valid_from\": \"2026-11-30T08:00:00Z\",\n \"valid_until\": \"2026-11-30T09:00:00Z\",\n \"vehicle_id\": \"acme-sc-0457\",\n \"zone_id\": \"1042\"\n },\n {\n \"additional_notes\": \"Zone deficit 1.2 vehicles (threshold: -2.0)\",\n \"generated_at\": \"2026-11-30T07:55:00Z\",\n \"latitude\": 45.4645,\n \"longitude\": 9.1992,\n \"operation_type\": \"dropoff\",\n \"priority\": \"high\",\n \"priority_value\": 4.8,\n \"valid_from\": \"2026-11-30T09:00:00Z\",\n \"vehicle_id\": \"acme-sc-0457\",\n \"zone_id\": \"1043\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}{
"fleet_plans": [
{
"fleet_id": "van-1",
"plan": [
{
"expected_arrival": "2026-11-30T08:14:00Z",
"operation": {
"additional_notes": "Battery level (12.0%) below threshold (20.0%)",
"generated_at": "2026-11-30T07:55:00Z",
"latitude": 45.4642,
"longitude": 9.1856,
"operation_type": "battery_swap",
"priority": "high",
"priority_value": 2.4,
"vehicle_id": "acme-sc-0193",
"vehicle_properties": {
"battery_level": 12,
"id": "acme-sc-0193",
"last_moved": "2026-11-30T06:41:03Z",
"last_seen": "2026-11-30T07:50:12Z",
"lat": 45.4642,
"licence_plate": "SC0193",
"lon": 9.1856,
"status": "available",
"vehicle_model": "S-200",
"vehicle_type": "scooter"
},
"zone_id": "1042"
},
"routing_parameters": {
"capacity_delta": {
"charged_battery": -1,
"empty_battery": 1
},
"profit": 2.4
},
"step": 0
}
],
"total_distance": 7.9,
"total_duration": 41,
"total_profit": 2.4,
"utilization": {
"charged_battery": 10,
"empty_battery": 1,
"vehicles": 0
}
},
{
"fleet_id": "van-2",
"plan": [
{
"expected_arrival": "2026-11-30T08:23:00Z",
"operation": {
"additional_notes": "Zone surplus 1.0 vehicles (threshold: 1.5)",
"generated_at": "2026-11-30T07:55:00Z",
"latitude": 45.4671,
"longitude": 9.1883,
"operation_type": "pickup",
"priority": "medium",
"priority_value": 2.1,
"valid_from": "2026-11-30T08:00:00Z",
"valid_until": "2026-11-30T09:00:00Z",
"vehicle_id": "acme-sc-0457",
"zone_id": "1042"
},
"routing_parameters": {
"capacity_delta": {
"vehicles": 1
},
"profit": 2.1
},
"step": 0
},
{
"expected_arrival": "2026-11-30T09:02:00Z",
"operation": {
"additional_notes": "Zone deficit 1.2 vehicles (threshold: -2.0)",
"generated_at": "2026-11-30T07:55:00Z",
"latitude": 45.4645,
"longitude": 9.1992,
"operation_type": "dropoff",
"priority": "high",
"priority_value": 4.8,
"valid_from": "2026-11-30T09:00:00Z",
"vehicle_id": "acme-sc-0457",
"zone_id": "1043"
},
"routing_parameters": {
"capacity_delta": {
"vehicles": -1
},
"profit": 4.8
},
"step": 1
}
],
"total_distance": 10.6,
"total_duration": 63.5,
"total_profit": 6.9,
"utilization": {
"vehicles": 1
}
}
],
"total_profit": 9.3,
"unassigned_operations": []
}Authorizations
HTTPBearerHTTPBearer
Body
application/json
Payload for multi-fleet routing optimization.
Response
Multi-fleet routing plan generated. Returns per-vehicle optimized routes with operation sequencing, timing, and a list of unassigned operations.
Response for multi-fleet routing optimization.
