curl --request GET \
--url https://api.getswitch.io/copilot/station-based/{provider}/after_hours_demand \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.getswitch.io/copilot/station-based/{provider}/after_hours_demand"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.getswitch.io/copilot/station-based/{provider}/after_hours_demand', 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/copilot/station-based/{provider}/after_hours_demand"
req, _ := http.NewRequest("GET", 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))
}{
"after_hours_metrics": {
"avg_after_hours_availability": 7.3,
"demand_vs_avg_hourly": 38.5,
"opportunity_ratio": 0.27,
"total_estimated_demand": 118
},
"hourly_patterns": [
{
"avg_trips": 6.1,
"demand_level": 58,
"hour": 23,
"peak_indicator": false
},
{
"avg_trips": 14.8,
"demand_level": 131,
"hour": 18,
"peak_indicator": true
}
],
"service_hours": {
"end_hour": 23,
"is_24_hour": false,
"start_hour": 6
},
"simulation_df": [
{
"current_availability": 7.2,
"estimated_demand": 42,
"hour": 0
},
{
"current_availability": 7.4,
"estimated_demand": 25,
"hour": 1
}
],
"station_analysis": [
{
"avg_after_hours_availability": 6.3,
"ebike_ratio": 0.4,
"estimated_after_hours_demand": 11.5,
"opportunity_score": 1.83,
"station_id": 318,
"station_latitude": 45.4532,
"station_longitude": 9.176,
"station_name": "Darsena"
},
{
"avg_after_hours_availability": 9,
"ebike_ratio": 0.35,
"estimated_after_hours_demand": 8.2,
"opportunity_score": 0.91,
"station_id": 101,
"station_latitude": 45.4642,
"station_longitude": 9.19,
"station_name": "Duomo"
}
]
}Get After-Hours Demand Analysis
Analyze mobility demand occurring outside the standard operating hours of the station-based system. Returns hour-by-hour demand simulation, 24-hour demand patterns for comparison, station-level after-hours metrics with opportunity scores, summary metrics, and the current service hours configuration.
Use this to evaluate whether extending operating hours would capture significant additional demand.
Failure Modes:
- 401: Token is missing or invalid
- 403: Insufficient permissions
- 404:
no_data_bindingwhen the provider or location is not enabled for your company, or no data for that location and period - 422: Invalid filter parameters
- 500: Internal server error
Required Auth Scopes:
copilot:analytics
curl --request GET \
--url https://api.getswitch.io/copilot/station-based/{provider}/after_hours_demand \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.getswitch.io/copilot/station-based/{provider}/after_hours_demand"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.getswitch.io/copilot/station-based/{provider}/after_hours_demand', 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/copilot/station-based/{provider}/after_hours_demand"
req, _ := http.NewRequest("GET", 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))
}{
"after_hours_metrics": {
"avg_after_hours_availability": 7.3,
"demand_vs_avg_hourly": 38.5,
"opportunity_ratio": 0.27,
"total_estimated_demand": 118
},
"hourly_patterns": [
{
"avg_trips": 6.1,
"demand_level": 58,
"hour": 23,
"peak_indicator": false
},
{
"avg_trips": 14.8,
"demand_level": 131,
"hour": 18,
"peak_indicator": true
}
],
"service_hours": {
"end_hour": 23,
"is_24_hour": false,
"start_hour": 6
},
"simulation_df": [
{
"current_availability": 7.2,
"estimated_demand": 42,
"hour": 0
},
{
"current_availability": 7.4,
"estimated_demand": 25,
"hour": 1
}
],
"station_analysis": [
{
"avg_after_hours_availability": 6.3,
"ebike_ratio": 0.4,
"estimated_after_hours_demand": 11.5,
"opportunity_score": 1.83,
"station_id": 318,
"station_latitude": 45.4532,
"station_longitude": 9.176,
"station_name": "Darsena"
},
{
"avg_after_hours_availability": 9,
"ebike_ratio": 0.35,
"estimated_after_hours_demand": 8.2,
"opportunity_score": 0.91,
"station_id": 101,
"station_latitude": 45.4642,
"station_longitude": 9.19,
"station_name": "Duomo"
}
]
}Authorizations
Path Parameters
Identifier of the mobility provider whose data you analyse, e.g. acme-bikes. It must be the provider of a data source enabled for your company's station-based analytics; any other value is refused with 404 no_data_binding (kind: source). Your SWITCH contact tells you the provider identifiers and locations enabled for your company.
Query Parameters
Response
After-hours demand data retrieved. Returns demand simulation, hourly patterns, station metrics, opportunity assessment, and service hours configuration.
After hours demand analysis response with comprehensive demand simulation.
