Update Route
curl --request PUT \
--url https://api.getswitch.io/operations/routes/{route_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reroute_enabled": true,
"routing_parameters": {
"end_coords": {
"latitude": 45.4887,
"longitude": 9.2415
},
"max_capacities": {
"charged_battery": 40,
"empty_battery": 40,
"vehicles": 12
},
"max_duration": 150,
"start_capacities": {
"charged_battery": 40,
"empty_battery": 0,
"vehicles": 0
},
"start_coords": {
"latitude": 45.4887,
"longitude": 9.2415
},
"start_time": "2026-11-30T08:00:00Z"
}
}
'import requests
url = "https://api.getswitch.io/operations/routes/{route_id}"
payload = {
"reroute_enabled": True,
"routing_parameters": {
"end_coords": {
"latitude": 45.4887,
"longitude": 9.2415
},
"max_capacities": {
"charged_battery": 40,
"empty_battery": 40,
"vehicles": 12
},
"max_duration": 150,
"start_capacities": {
"charged_battery": 40,
"empty_battery": 0,
"vehicles": 0
},
"start_coords": {
"latitude": 45.4887,
"longitude": 9.2415
},
"start_time": "2026-11-30T08:00:00Z"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
reroute_enabled: true,
routing_parameters: {
end_coords: {latitude: 45.4887, longitude: 9.2415},
max_capacities: {charged_battery: 40, empty_battery: 40, vehicles: 12},
max_duration: 150,
start_capacities: {charged_battery: 40, empty_battery: 0, vehicles: 0},
start_coords: {latitude: 45.4887, longitude: 9.2415},
start_time: '2026-11-30T08:00:00Z'
}
})
};
fetch('https://api.getswitch.io/operations/routes/{route_id}', 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://api.getswitch.io/operations/routes/{route_id}"
payload := strings.NewReader("{\n \"reroute_enabled\": true,\n \"routing_parameters\": {\n \"end_coords\": {\n \"latitude\": 45.4887,\n \"longitude\": 9.2415\n },\n \"max_capacities\": {\n \"charged_battery\": 40,\n \"empty_battery\": 40,\n \"vehicles\": 12\n },\n \"max_duration\": 150,\n \"start_capacities\": {\n \"charged_battery\": 40,\n \"empty_battery\": 0,\n \"vehicles\": 0\n },\n \"start_coords\": {\n \"latitude\": 45.4887,\n \"longitude\": 9.2415\n },\n \"start_time\": \"2026-11-30T08:00:00Z\"\n }\n}")
req, _ := http.NewRequest("PUT", 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))
}{
"completed_operations": 1,
"drivers": [
{
"email": "marco.bianchi@acme-mobility.com",
"full_name": "Marco Bianchi",
"id": 57
}
],
"end_at": "2026-11-30T09:40:00Z",
"id": 412,
"operations": [
{
"additional_notes": "Battery level (12.0%) below threshold (20.0%)",
"address": "Via Torino 2, 20123 Milano MI",
"completed_at": "2026-11-30T08:17:42Z",
"estimated_arrive": "2026-11-30T08:14:00Z",
"id": 9031,
"latitude": 45.4642,
"longitude": 9.1856,
"provider": "acme-mobility",
"routing_parameters": {
"capacity_delta": {
"charged_battery": -1,
"empty_battery": 1
},
"profit": 2.4
},
"step": 1,
"task_type": "battery_swap",
"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"
}
},
{
"additional_notes": "Zone surplus 1.0 vehicles (threshold: 1.5)",
"address": "Via Mazzini 9, 20123 Milano MI",
"estimated_arrive": "2026-11-30T08:23:00Z",
"id": 9032,
"latitude": 45.4671,
"longitude": 9.1883,
"provider": "acme-mobility",
"routing_parameters": {
"capacity_delta": {
"vehicles": 1
},
"profit": 2.1
},
"step": 2,
"task_type": "pickup"
}
],
"operations_parameters": {
"strategies": [
{
"slug": "battery-threshold",
"strat_params": {
"threshold": 20
}
}
]
},
"progress": 0.5,
"reroute_enabled": true,
"route_identifier": "R1",
"routing_parameters": {
"end_coords": {
"latitude": 45.4887,
"longitude": 9.2415
},
"max_capacities": {
"charged_battery": 40,
"empty_battery": 40,
"vehicles": 12
},
"max_duration": 120,
"start_capacities": {
"charged_battery": 40,
"empty_battery": 0,
"vehicles": 0
},
"start_coords": {
"latitude": 45.4887,
"longitude": 9.2415
},
"start_time": "2026-11-30T08:00:00Z"
},
"session_slug": "3f6c2a9e-8d41-4b7a-9c2e-5a1f0e7d9b13",
"start_at": "2026-11-30T08:00:00Z",
"status": "active",
"total_distance": 14.2,
"total_operations": 2
}Routing Sessions
Update Route
Update a route’s reroute_enabled, routing_parameters or operations_parameters. Only the fields you send change; the two parameter objects are replaced as a whole and cannot be null.
Failure Modes:
- 401: Token is missing or invalid
- 403: Insufficient permissions, or you cannot manage the route’s company
- 404: No route with this ID
- 422: Invalid request body, e.g. a parameter object set to null
Required Auth Scopes:
routing-operations:manage
PUT
/
operations
/
routes
/
{route_id}
Update Route
curl --request PUT \
--url https://api.getswitch.io/operations/routes/{route_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reroute_enabled": true,
"routing_parameters": {
"end_coords": {
"latitude": 45.4887,
"longitude": 9.2415
},
"max_capacities": {
"charged_battery": 40,
"empty_battery": 40,
"vehicles": 12
},
"max_duration": 150,
"start_capacities": {
"charged_battery": 40,
"empty_battery": 0,
"vehicles": 0
},
"start_coords": {
"latitude": 45.4887,
"longitude": 9.2415
},
"start_time": "2026-11-30T08:00:00Z"
}
}
'import requests
url = "https://api.getswitch.io/operations/routes/{route_id}"
payload = {
"reroute_enabled": True,
"routing_parameters": {
"end_coords": {
"latitude": 45.4887,
"longitude": 9.2415
},
"max_capacities": {
"charged_battery": 40,
"empty_battery": 40,
"vehicles": 12
},
"max_duration": 150,
"start_capacities": {
"charged_battery": 40,
"empty_battery": 0,
"vehicles": 0
},
"start_coords": {
"latitude": 45.4887,
"longitude": 9.2415
},
"start_time": "2026-11-30T08:00:00Z"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
reroute_enabled: true,
routing_parameters: {
end_coords: {latitude: 45.4887, longitude: 9.2415},
max_capacities: {charged_battery: 40, empty_battery: 40, vehicles: 12},
max_duration: 150,
start_capacities: {charged_battery: 40, empty_battery: 0, vehicles: 0},
start_coords: {latitude: 45.4887, longitude: 9.2415},
start_time: '2026-11-30T08:00:00Z'
}
})
};
fetch('https://api.getswitch.io/operations/routes/{route_id}', 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://api.getswitch.io/operations/routes/{route_id}"
payload := strings.NewReader("{\n \"reroute_enabled\": true,\n \"routing_parameters\": {\n \"end_coords\": {\n \"latitude\": 45.4887,\n \"longitude\": 9.2415\n },\n \"max_capacities\": {\n \"charged_battery\": 40,\n \"empty_battery\": 40,\n \"vehicles\": 12\n },\n \"max_duration\": 150,\n \"start_capacities\": {\n \"charged_battery\": 40,\n \"empty_battery\": 0,\n \"vehicles\": 0\n },\n \"start_coords\": {\n \"latitude\": 45.4887,\n \"longitude\": 9.2415\n },\n \"start_time\": \"2026-11-30T08:00:00Z\"\n }\n}")
req, _ := http.NewRequest("PUT", 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))
}{
"completed_operations": 1,
"drivers": [
{
"email": "marco.bianchi@acme-mobility.com",
"full_name": "Marco Bianchi",
"id": 57
}
],
"end_at": "2026-11-30T09:40:00Z",
"id": 412,
"operations": [
{
"additional_notes": "Battery level (12.0%) below threshold (20.0%)",
"address": "Via Torino 2, 20123 Milano MI",
"completed_at": "2026-11-30T08:17:42Z",
"estimated_arrive": "2026-11-30T08:14:00Z",
"id": 9031,
"latitude": 45.4642,
"longitude": 9.1856,
"provider": "acme-mobility",
"routing_parameters": {
"capacity_delta": {
"charged_battery": -1,
"empty_battery": 1
},
"profit": 2.4
},
"step": 1,
"task_type": "battery_swap",
"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"
}
},
{
"additional_notes": "Zone surplus 1.0 vehicles (threshold: 1.5)",
"address": "Via Mazzini 9, 20123 Milano MI",
"estimated_arrive": "2026-11-30T08:23:00Z",
"id": 9032,
"latitude": 45.4671,
"longitude": 9.1883,
"provider": "acme-mobility",
"routing_parameters": {
"capacity_delta": {
"vehicles": 1
},
"profit": 2.1
},
"step": 2,
"task_type": "pickup"
}
],
"operations_parameters": {
"strategies": [
{
"slug": "battery-threshold",
"strat_params": {
"threshold": 20
}
}
]
},
"progress": 0.5,
"reroute_enabled": true,
"route_identifier": "R1",
"routing_parameters": {
"end_coords": {
"latitude": 45.4887,
"longitude": 9.2415
},
"max_capacities": {
"charged_battery": 40,
"empty_battery": 40,
"vehicles": 12
},
"max_duration": 120,
"start_capacities": {
"charged_battery": 40,
"empty_battery": 0,
"vehicles": 0
},
"start_coords": {
"latitude": 45.4887,
"longitude": 9.2415
},
"start_time": "2026-11-30T08:00:00Z"
},
"session_slug": "3f6c2a9e-8d41-4b7a-9c2e-5a1f0e7d9b13",
"start_at": "2026-11-30T08:00:00Z",
"status": "active",
"total_distance": 14.2,
"total_operations": 2
}Authorizations
HTTPBearerHTTPBearer
Body
application/json
Partial update for a route. Only the three mutable fields are exposed.
Response
Route updated. Returns the updated route detail.
Full route detail response (includes operations + drivers).
completed when no operation is left open. Otherwise expired when the route's last estimated arrival is older than the expiration window (24 hours by default), late when an open operation is past its estimated arrival, and active otherwise.
Available options:
active, late, expired, completed 