Get Zone Growth Trends
curl --request GET \
--url https://api.getswitch.io/copilot/zone-based/{provider}/growth_trends \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.getswitch.io/copilot/zone-based/{provider}/growth_trends"
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/zone-based/{provider}/growth_trends', 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/zone-based/{provider}/growth_trends"
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))
}{
"declining_zones": [
{
"confidence_score": 0.44,
"context": {
"population": 412,
"top_pois": [
{
"category": "sustenance",
"count": 64
},
{
"category": "shop",
"count": 51
},
{
"category": "tourism",
"count": 12
}
],
"transit_stops_total": 9
},
"data_points": 31,
"geom": {
"coordinates": [
[
[
9.18869,
45.46417
],
[
9.19006,
45.46417
],
[
9.19006,
45.46555
],
[
9.18869,
45.46555
],
[
9.18869,
45.46417
]
]
],
"type": "Polygon"
},
"growth_rate": -2.1,
"trend_direction": "declining",
"zone_id": "u0nd9he",
"zone_label": "u0nd9he",
"zone_latitude": 45.46486,
"zone_longitude": 9.18938
}
],
"feasibility": "limited",
"growing_zones": [
{
"confidence_score": 0.68,
"context": {
"population": 980,
"top_pois": [
{
"category": "sustenance",
"count": 47
},
{
"category": "leisure",
"count": 6
}
],
"transit_stops_total": 4
},
"data_points": 31,
"geom": {
"coordinates": [
[
[
9.17496,
45.45181
],
[
9.17633,
45.45181
],
[
9.17633,
45.45319
],
[
9.17496,
45.45319
],
[
9.17496,
45.45181
]
]
],
"type": "Polygon"
},
"growth_rate": 3.4,
"trend_direction": "growing",
"zone_id": "u0nd8f3",
"zone_label": "u0nd8f3",
"zone_latitude": 45.4525,
"zone_longitude": 9.17564
}
],
"message": "Growth from daily trip-activity regression (weekly rate, R²>0.3, min 3 days). Confidence improves as history accumulates."
}Zone Based Analytics
Get Zone Growth Trends
Zones whose daily trip activity is growing or declining, from a linear regression over the period. growth_rate is the weekly change of daily trips and confidence_score the R² of the fit; only zones with a clear trend (R² above 0.3) are listed. feasibility is limited while zones need less than 7 days of history to be included.
Failure Modes:
- 400:
precisiongiven with a zoning system other thangeohash7 - 401: Token is missing or invalid
- 403: Insufficient permissions
- 404:
no_data_bindingwhen the provider or location is not enabled for your company - 422: Invalid filter parameters
Required Auth Scopes:
copilot:analytics
GET
/
copilot
/
zone-based
/
{provider}
/
growth_trends
Get Zone Growth Trends
curl --request GET \
--url https://api.getswitch.io/copilot/zone-based/{provider}/growth_trends \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.getswitch.io/copilot/zone-based/{provider}/growth_trends"
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/zone-based/{provider}/growth_trends', 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/zone-based/{provider}/growth_trends"
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))
}{
"declining_zones": [
{
"confidence_score": 0.44,
"context": {
"population": 412,
"top_pois": [
{
"category": "sustenance",
"count": 64
},
{
"category": "shop",
"count": 51
},
{
"category": "tourism",
"count": 12
}
],
"transit_stops_total": 9
},
"data_points": 31,
"geom": {
"coordinates": [
[
[
9.18869,
45.46417
],
[
9.19006,
45.46417
],
[
9.19006,
45.46555
],
[
9.18869,
45.46555
],
[
9.18869,
45.46417
]
]
],
"type": "Polygon"
},
"growth_rate": -2.1,
"trend_direction": "declining",
"zone_id": "u0nd9he",
"zone_label": "u0nd9he",
"zone_latitude": 45.46486,
"zone_longitude": 9.18938
}
],
"feasibility": "limited",
"growing_zones": [
{
"confidence_score": 0.68,
"context": {
"population": 980,
"top_pois": [
{
"category": "sustenance",
"count": 47
},
{
"category": "leisure",
"count": 6
}
],
"transit_stops_total": 4
},
"data_points": 31,
"geom": {
"coordinates": [
[
[
9.17496,
45.45181
],
[
9.17633,
45.45181
],
[
9.17633,
45.45319
],
[
9.17496,
45.45319
],
[
9.17496,
45.45181
]
]
],
"type": "Polygon"
},
"growth_rate": 3.4,
"trend_direction": "growing",
"zone_id": "u0nd8f3",
"zone_label": "u0nd8f3",
"zone_latitude": 45.4525,
"zone_longitude": 9.17564
}
],
"message": "Growth from daily trip-activity regression (weekly rate, R²>0.3, min 3 days). Confidence improves as history accumulates."
}Authorizations
HTTPBearerHTTPBearer
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 zone-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.
