Synchronize Company Stations
curl --request POST \
--url https://api.getswitch.io/operations/stations/sync \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.getswitch.io/operations/stations/sync"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.getswitch.io/operations/stations/sync', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.getswitch.io/operations/stations/sync"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"stations_replaced": 148
}Fleet Management
Synchronize Company Stations
Replace all your company’s stations with the ones your connected fleet platform publishes, for every location configured for your operations. The import is all or nothing: if any station cannot be read or is invalid (missing name, address or capacity, bad coordinates or polygon), nothing changes. Only some fleet integrations publish stations.
Failure Modes:
- 401: Token is missing or invalid
- 403: Insufficient permissions
- 422: No operations fleet or locations configured, or your fleet integration does not publish stations
- 502: The fleet platform could not be read, or returned an invalid station
Required Auth Scopes:
copilot:optimize
POST
/
operations
/
stations
/
sync
Synchronize Company Stations
curl --request POST \
--url https://api.getswitch.io/operations/stations/sync \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.getswitch.io/operations/stations/sync"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.getswitch.io/operations/stations/sync', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.getswitch.io/operations/stations/sync"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"stations_replaced": 148
}Authorizations
HTTPBearerHTTPBearer
