Create Cargo Vehicle
curl --request POST \
--url https://api.getswitch.io/operations/cargo-vehicles \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"company_slug": "acme-mobility",
"icon": "Truck",
"name": "Cargo Van 01"
}
'import requests
url = "https://api.getswitch.io/operations/cargo-vehicles"
payload = {
"company_slug": "acme-mobility",
"icon": "Truck",
"name": "Cargo Van 01"
}
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', icon: 'Truck', name: 'Cargo Van 01'})
};
fetch('https://api.getswitch.io/operations/cargo-vehicles', 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/cargo-vehicles"
payload := strings.NewReader("{\n \"company_slug\": \"acme-mobility\",\n \"icon\": \"Truck\",\n \"name\": \"Cargo Van 01\"\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))
}{
"capacities": {
"batteries": 40,
"scooters": 12
},
"company_slug": "acme-mobility",
"created_at": "2026-10-02T09:15:00Z",
"icon": "Truck",
"id": 3,
"name": "Cargo Van 01",
"updated_at": "2026-11-12T16:40:00Z"
}Fleet Management
Create Cargo Vehicle
Add a cargo vehicle to your fleet: the van or cargo bike your operators drive, with how many items of each kind it carries.
Failure Modes:
- 401: Token is missing or invalid
- 403: Insufficient permissions, or
company_slugis a company you cannot manage - 422: Invalid request body
Required Auth Scopes:
cargo-vehicles:manage
POST
/
operations
/
cargo-vehicles
Create Cargo Vehicle
curl --request POST \
--url https://api.getswitch.io/operations/cargo-vehicles \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"company_slug": "acme-mobility",
"icon": "Truck",
"name": "Cargo Van 01"
}
'import requests
url = "https://api.getswitch.io/operations/cargo-vehicles"
payload = {
"company_slug": "acme-mobility",
"icon": "Truck",
"name": "Cargo Van 01"
}
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', icon: 'Truck', name: 'Cargo Van 01'})
};
fetch('https://api.getswitch.io/operations/cargo-vehicles', 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/cargo-vehicles"
payload := strings.NewReader("{\n \"company_slug\": \"acme-mobility\",\n \"icon\": \"Truck\",\n \"name\": \"Cargo Van 01\"\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))
}{
"capacities": {
"batteries": 40,
"scooters": 12
},
"company_slug": "acme-mobility",
"created_at": "2026-10-02T09:15:00Z",
"icon": "Truck",
"id": 3,
"name": "Cargo Van 01",
"updated_at": "2026-11-12T16:40:00Z"
}Authorizations
HTTPBearerHTTPBearer
Body
application/json
Schema for creating a new cargo vehicle.
All required fields must be provided. Capacities default to an empty dict when omitted.
Response
Cargo vehicle created successfully. Returns the complete vehicle profile including capacity specs and company ownership.
Public schema for a cargo vehicle resource.
Exposes cargo vehicle details to API consumers, including capacity specs and company ownership.
