Dispatch Session
curl --request POST \
--url https://stage-api.getswitch.io/operations/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"company_slug": "acme-mobility",
"routes": [
{
"drivers": [
{
"driver_id": 57
}
],
"end_at": "2026-11-30T09:40:00Z",
"operations": [
{
"additional_notes": "Battery level (12.0%) below threshold (20.0%)",
"address": "Via Torino 2, 20123 Milano MI",
"estimated_arrive": "2026-11-30T08:14:00Z",
"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",
"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
}
}
]
},
"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"
},
"start_at": "2026-11-30T08:00:00Z",
"total_distance": 14.2
}
],
"slug": "3f6c2a9e-8d41-4b7a-9c2e-5a1f0e7d9b13"
}
'import requests
url = "https://stage-api.getswitch.io/operations/sessions"
payload = {
"company_slug": "acme-mobility",
"routes": [
{
"drivers": [{ "driver_id": 57 }],
"end_at": "2026-11-30T09:40:00Z",
"operations": [
{
"additional_notes": "Battery level (12.0%) below threshold (20.0%)",
"address": "Via Torino 2, 20123 Milano MI",
"estimated_arrive": "2026-11-30T08:14:00Z",
"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",
"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 }
}
] },
"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"
},
"start_at": "2026-11-30T08:00:00Z",
"total_distance": 14.2
}
],
"slug": "3f6c2a9e-8d41-4b7a-9c2e-5a1f0e7d9b13"
}
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({
company_slug: 'acme-mobility',
routes: [
{
drivers: [{driver_id: 57}],
end_at: '2026-11-30T09:40:00Z',
operations: [
{
additional_notes: 'Battery level (12.0%) below threshold (20.0%)',
address: 'Via Torino 2, 20123 Milano MI',
estimated_arrive: '2026-11-30T08:14:00Z',
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',
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}}]},
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'
},
start_at: '2026-11-30T08:00:00Z',
total_distance: 14.2
}
],
slug: '3f6c2a9e-8d41-4b7a-9c2e-5a1f0e7d9b13'
})
};
fetch('https://stage-api.getswitch.io/operations/sessions', 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/sessions"
payload := strings.NewReader("{\n \"company_slug\": \"acme-mobility\",\n \"routes\": [\n {\n \"drivers\": [\n {\n \"driver_id\": 57\n }\n ],\n \"end_at\": \"2026-11-30T09:40:00Z\",\n \"operations\": [\n {\n \"additional_notes\": \"Battery level (12.0%) below threshold (20.0%)\",\n \"address\": \"Via Torino 2, 20123 Milano MI\",\n \"estimated_arrive\": \"2026-11-30T08:14:00Z\",\n \"latitude\": 45.4642,\n \"longitude\": 9.1856,\n \"provider\": \"acme-mobility\",\n \"routing_parameters\": {\n \"capacity_delta\": {\n \"charged_battery\": -1,\n \"empty_battery\": 1\n },\n \"profit\": 2.4\n },\n \"step\": 1,\n \"task_type\": \"battery_swap\",\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 },\n {\n \"additional_notes\": \"Zone surplus 1.0 vehicles (threshold: 1.5)\",\n \"address\": \"Via Mazzini 9, 20123 Milano MI\",\n \"estimated_arrive\": \"2026-11-30T08:23:00Z\",\n \"latitude\": 45.4671,\n \"longitude\": 9.1883,\n \"provider\": \"acme-mobility\",\n \"routing_parameters\": {\n \"capacity_delta\": {\n \"vehicles\": 1\n },\n \"profit\": 2.1\n },\n \"step\": 2,\n \"task_type\": \"pickup\"\n }\n ],\n \"operations_parameters\": {\n \"strategies\": [\n {\n \"slug\": \"battery-threshold\",\n \"strat_params\": {\n \"threshold\": 20\n }\n }\n ]\n },\n \"reroute_enabled\": true,\n \"route_identifier\": \"R1\",\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\": 120,\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 \"start_at\": \"2026-11-30T08:00:00Z\",\n \"total_distance\": 14.2\n }\n ],\n \"slug\": \"3f6c2a9e-8d41-4b7a-9c2e-5a1f0e7d9b13\"\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))
}{
"company_slug": "acme-mobility",
"created_at": "2026-11-30T07:58:10Z",
"routes": [
{
"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
}
}
]
},
"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"
},
"start_at": "2026-11-30T08:00:00Z",
"total_distance": 14.2
}
],
"slug": "3f6c2a9e-8d41-4b7a-9c2e-5a1f0e7d9b13"
}Routing Sessions
Dispatch Session
Dispatch a routing session: its routes, their operations in order, and the drivers of each route, in one transaction. Typically the body is built from a routing plan (POST /operations/routing or /operations/routing/multi-fleet). Routes without operations are skipped. Drivers then see their routes in GET /operations/routes.
Failure Modes:
- 401: Token is missing or invalid
- 403: Insufficient permissions,
company_slugis a company you cannot manage, or a driver is outside your company and its child companies - 404: A driver does not exist
- 409: A session with this
slugalready exists - 422: Invalid request body
Required Auth Scopes:
routing-sessions:manage
POST
/
operations
/
sessions
Dispatch Session
curl --request POST \
--url https://stage-api.getswitch.io/operations/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"company_slug": "acme-mobility",
"routes": [
{
"drivers": [
{
"driver_id": 57
}
],
"end_at": "2026-11-30T09:40:00Z",
"operations": [
{
"additional_notes": "Battery level (12.0%) below threshold (20.0%)",
"address": "Via Torino 2, 20123 Milano MI",
"estimated_arrive": "2026-11-30T08:14:00Z",
"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",
"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
}
}
]
},
"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"
},
"start_at": "2026-11-30T08:00:00Z",
"total_distance": 14.2
}
],
"slug": "3f6c2a9e-8d41-4b7a-9c2e-5a1f0e7d9b13"
}
'import requests
url = "https://stage-api.getswitch.io/operations/sessions"
payload = {
"company_slug": "acme-mobility",
"routes": [
{
"drivers": [{ "driver_id": 57 }],
"end_at": "2026-11-30T09:40:00Z",
"operations": [
{
"additional_notes": "Battery level (12.0%) below threshold (20.0%)",
"address": "Via Torino 2, 20123 Milano MI",
"estimated_arrive": "2026-11-30T08:14:00Z",
"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",
"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 }
}
] },
"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"
},
"start_at": "2026-11-30T08:00:00Z",
"total_distance": 14.2
}
],
"slug": "3f6c2a9e-8d41-4b7a-9c2e-5a1f0e7d9b13"
}
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({
company_slug: 'acme-mobility',
routes: [
{
drivers: [{driver_id: 57}],
end_at: '2026-11-30T09:40:00Z',
operations: [
{
additional_notes: 'Battery level (12.0%) below threshold (20.0%)',
address: 'Via Torino 2, 20123 Milano MI',
estimated_arrive: '2026-11-30T08:14:00Z',
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',
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}}]},
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'
},
start_at: '2026-11-30T08:00:00Z',
total_distance: 14.2
}
],
slug: '3f6c2a9e-8d41-4b7a-9c2e-5a1f0e7d9b13'
})
};
fetch('https://stage-api.getswitch.io/operations/sessions', 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/sessions"
payload := strings.NewReader("{\n \"company_slug\": \"acme-mobility\",\n \"routes\": [\n {\n \"drivers\": [\n {\n \"driver_id\": 57\n }\n ],\n \"end_at\": \"2026-11-30T09:40:00Z\",\n \"operations\": [\n {\n \"additional_notes\": \"Battery level (12.0%) below threshold (20.0%)\",\n \"address\": \"Via Torino 2, 20123 Milano MI\",\n \"estimated_arrive\": \"2026-11-30T08:14:00Z\",\n \"latitude\": 45.4642,\n \"longitude\": 9.1856,\n \"provider\": \"acme-mobility\",\n \"routing_parameters\": {\n \"capacity_delta\": {\n \"charged_battery\": -1,\n \"empty_battery\": 1\n },\n \"profit\": 2.4\n },\n \"step\": 1,\n \"task_type\": \"battery_swap\",\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 },\n {\n \"additional_notes\": \"Zone surplus 1.0 vehicles (threshold: 1.5)\",\n \"address\": \"Via Mazzini 9, 20123 Milano MI\",\n \"estimated_arrive\": \"2026-11-30T08:23:00Z\",\n \"latitude\": 45.4671,\n \"longitude\": 9.1883,\n \"provider\": \"acme-mobility\",\n \"routing_parameters\": {\n \"capacity_delta\": {\n \"vehicles\": 1\n },\n \"profit\": 2.1\n },\n \"step\": 2,\n \"task_type\": \"pickup\"\n }\n ],\n \"operations_parameters\": {\n \"strategies\": [\n {\n \"slug\": \"battery-threshold\",\n \"strat_params\": {\n \"threshold\": 20\n }\n }\n ]\n },\n \"reroute_enabled\": true,\n \"route_identifier\": \"R1\",\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\": 120,\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 \"start_at\": \"2026-11-30T08:00:00Z\",\n \"total_distance\": 14.2\n }\n ],\n \"slug\": \"3f6c2a9e-8d41-4b7a-9c2e-5a1f0e7d9b13\"\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))
}{
"company_slug": "acme-mobility",
"created_at": "2026-11-30T07:58:10Z",
"routes": [
{
"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
}
}
]
},
"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"
},
"start_at": "2026-11-30T08:00:00Z",
"total_distance": 14.2
}
],
"slug": "3f6c2a9e-8d41-4b7a-9c2e-5a1f0e7d9b13"
}Authorizations
HTTPBearerHTTPBearer
Body
application/json
Top-level dispatch payload — creates session + routes + operations + drivers.
Response
Session created successfully. Returns the complete session with routes, operations, and driver assignments.
Full session detail response (includes routes + operations).
