Assign Drivers to Route
curl --request POST \
--url https://stage-api.getswitch.io/operations/routes/{route_id}/drivers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"driver_ids": [
57,
63
]
}
'import requests
url = "https://stage-api.getswitch.io/operations/routes/{route_id}/drivers"
payload = { "driver_ids": [57, 63] }
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({driver_ids: [57, 63]})
};
fetch('https://stage-api.getswitch.io/operations/routes/{route_id}/drivers', 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/routes/{route_id}/drivers"
payload := strings.NewReader("{\n \"driver_ids\": [\n 57,\n 63\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))
}[
{
"id": 880,
"route_id": 412,
"driver_id": 57,
"created_at": "2026-11-30T07:58:11Z"
},
{
"id": 881,
"route_id": 412,
"driver_id": 63,
"created_at": "2026-11-30T07:58:11Z"
}
]Routing Sessions
Assign Drivers to Route
Assign one or more drivers to a route. Each must be an active user of your company or its child companies; if one fails, none is assigned.
Failure Modes:
- 401: Token is missing or invalid
- 403: Insufficient permissions, you cannot manage the route’s company, or a driver is outside your company tree
- 404: No route with this ID, or a driver does not exist
- 409: A driver is already assigned to this route
- 422: Invalid request body
Required Auth Scopes:
routing-operations:manage
POST
/
operations
/
routes
/
{route_id}
/
drivers
Assign Drivers to Route
curl --request POST \
--url https://stage-api.getswitch.io/operations/routes/{route_id}/drivers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"driver_ids": [
57,
63
]
}
'import requests
url = "https://stage-api.getswitch.io/operations/routes/{route_id}/drivers"
payload = { "driver_ids": [57, 63] }
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({driver_ids: [57, 63]})
};
fetch('https://stage-api.getswitch.io/operations/routes/{route_id}/drivers', 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/routes/{route_id}/drivers"
payload := strings.NewReader("{\n \"driver_ids\": [\n 57,\n 63\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))
}[
{
"id": 880,
"route_id": 412,
"driver_id": 57,
"created_at": "2026-11-30T07:58:11Z"
},
{
"id": 881,
"route_id": 412,
"driver_id": 63,
"created_at": "2026-11-30T07:58:11Z"
}
]Authorizations
HTTPBearerHTTPBearer
Body
application/json
