PubliBike
App · Travel & Places · 10 actions
Check live bike availability across PubliBike, Switzerland's national bike-sharing network, through its keyless public API: every station's position, address and city; how many bikes, e-bikes, cargo bikes and e-scooters are standing at each; the nearest station to a point, or the nearest bike someone can actually take; and availability totals for a city or the whole network. Covers the PubliBike and Velospot halves of the network in one place. No account or API key required.
Actions
| Action | What it does |
|---|---|
| Find nearby stations | List the stations closest to a point, nearest first, with the distance to each and the vehicles standing there. |
| Find the nearest available bike | Find the closest station that has a bike someone can take right now (optionally an e-bike, optionally one charged above a level you set). |
| Get availability summary | Summarise availability across the whole network, or across one city or network of it: how many stations there are, how many have anything to rent, the split between pedal bikes and e-bikes, and the average e-bike charge. |
| Get station | Get one station by its id, its printed number or its name: where it is, what is available there right now, and the id of each bike standing at it, with the charge left on the electric ones, as a percentage or as the kilometres it is good for, depending on which the station publishes. |
| List cities | List the cities PubliBike serves, with how many stations and how many bikes and e-bikes are in each. |
| List networks | List the local networks PubliBike stations belong to (a city's scheme, a campus, an employer's fleet) with their size, the cities they cover and their sponsors. |
| List stations | List every station in the network: position, address, what is standing there, and the station id the other actions take. |
| List stations with vehicles | List stations together with what is available at each of them, in one request. |
| List vehicles at a station | List the bikes available at one station, best-charged first, with the id of each and the range left on an e-bike. |
| Search stations | Find stations by name, address, zip code or city: the way to turn 'Bern Bahnhof' or a postcode into a station id, with the vehicles currently there. |
Find nearby stations
List the stations closest to a point, nearest first, with the distance to each and the vehicles standing there. Optionally keep only stations within a radius, or only those with the kind of bike you want.
Inputs
- Latitude
latitudenumberRequired - Latitude of the point to search from, in decimal degrees (for example, 46.948 for Bern).From -90 to 90.
- Longitude
longitudenumberRequired - Longitude of the point to search from, in decimal degrees (for example, 7.447 for Bern).From -180 to 180.
- Search radius (km)
radius_kmnumber - Only include stations within this many kilometres of the point. Leave blank to search the whole network and rank by distance.From 0.01 to 500.
- Vehicle type
vehicle_typetext - Only count vehicles of this type. The categories ('ebike', 'bike', 'cargo', 'escooter', 'glider') work everywhere. A specific type name or id (run 'Get availability summary' to see the ones in use) only matches stations that name their individual bikes. Stations with none of the wanted kind are left out.
- Minimum battery level
min_battery_levelnumber - Only count e-bikes charged to at least this percentage (0-100). E-bikes whose charge the API doesn't report are left out, since an unknown charge is no evidence of a charged battery: that's true for most of the network today, where stations publish counts rather than individual bikes.From 0 to 100.
- Only stations with vehicles
only_with_vehiclestrue/false - Leave out stations that are standing empty. Filtering by vehicle type or battery level already implies this.Default:
false. - Maximum stations
limitnumber - Return at most this many stations. Defaults to 10.From 1 to 200. Default:
10.
Outputs
countnumber- Stations returned.
latitudenumber- Latitude that was searched from.
longitudenumber- Longitude that was searched from.
matchednumber- Stations that matched, before the limit.
radius_kmnumber- The radius applied, if any.
stationslist- The matching stations, nearest first, each with its distance from the point.
totalnumber- Stations the API returned, before any filter.
Example output
{
"count": 1,
"latitude": 46.9481,
"longitude": 7.4474,
"matched": 1,
"radius_km": 1.0,
"stations": [
{
"address": "Grand' Rue 57, 1820 Montreux, Suisse",
"availability": {
"bikes": 4,
"by_type": [
{
"count": 4,
"type_id": null,
"type_name": "Bike"
},
{
"count": 2,
"type_id": null,
"type_name": "E-Bike"
},
{
"count": 1,
"type_id": null,
"type_name": "Cargo bike"
}
],
"capacity": null,
"cargo_bikes": 1,
"ebikes": 2,
"ebikes_with_battery_level": 0,
"escooters": 0,
"free_docks": null,
"gliders": 0,
"max_ebike_battery_level": null,
"min_ebike_battery_level": null,
"reported_total_bikes": 6,
"total_vehicles": 7
},
"capacity": null,
"city": "Montreux",
"details_url": "https://www.velospot.info/customer/public/getStationInfo/a0plWVF5a3k2T2RuNWs2LzhYMTd3Zz09/SElvRkxlVnpsMjVFeiswQjVBR3JuZz09",
"distance_km": 0.184,
"distance_meters": 184,
"has_vehicle_detail": false,
"id": "SElvRkxlVnpsMjVFeiswQjVBR3JuZz09",
"is_virtual_station": null,
"latitude": 46.434918464696615,
"longitude": 6.909835004160314,
"map_icon_url": "https://www.velospot.info/customer/public/images/stationIcons/theme_1/stationAvailableWithBike.png",
"matching_vehicle_count": 2,
"matching_vehicles": [],
"name": "1820 Restaurant & Cocktails Bar - Montreux",
"network": {
"id": "a0plWVF5a3k2T2RuNWs2LzhYMTd3Zz09",
"name": null,
"sponsors": []
},
"source": "velospot",
"sponsors": [],
"state": null,
"state_id": null,
"state_name": null,
"station_number": "600654",
"zip": "1820"
}
],
"total": 2
}Find the nearest available bike
Find the closest station that has a bike someone can take right now (optionally an e-bike, optionally one charged above a level you set). Answers 'found: false' instead of failing when nothing qualifies, so a workflow can branch on it, and returns a few runner-up stations as a fallback.
Inputs
- Latitude
latitudenumberRequired - Latitude of the point to search from, in decimal degrees (for example, 46.948 for Bern).From -90 to 90.
- Longitude
longitudenumberRequired - Longitude of the point to search from, in decimal degrees (for example, 7.447 for Bern).From -180 to 180.
- Vehicle type
vehicle_typetext - Only count vehicles of this type. The categories ('ebike', 'bike', 'cargo', 'escooter', 'glider') work everywhere. A specific type name or id (run 'Get availability summary' to see the ones in use) only matches stations that name their individual bikes. Stations with none of the wanted kind are left out.
- Minimum battery level
min_battery_levelnumber - Only count e-bikes charged to at least this percentage (0-100). E-bikes whose charge the API doesn't report are left out, since an unknown charge is no evidence of a charged battery: that's true for most of the network today, where stations publish counts rather than individual bikes.From 0 to 100.
- Search radius (km)
radius_kmnumber - Only include stations within this many kilometres of the point. Leave blank to search the whole network and rank by distance.From 0.01 to 500.
- Runner-up stations
max_alternativesnumber - How many next-closest matching stations to return alongside the nearest one, for the rider whose bike is taken by the time they get there. Defaults to 3.From 0 to 10. Default:
3. - Include individual bikes
include_vehicle_idstrue/false - Also read the station's own page for the id of each bike standing there, and the range left on each e-bike. On by default; it costs one extra request, and only applies to stations that publish counts rather than bikes. If the page can't be read, the counts still come back.Default:
true.
Outputs
alternativeslist- The next-closest matching stations.
distance_kmnumber- How far that station is, in kilometres.
distance_metersnumber- The same distance in metres.
foundtrue/false- Whether any station matched. False means nothing qualified; it is not an error.
has_vehicle_detailtrue/false- Whether that station names its individual bikes.
matchednumber- Stations that matched in total.
stationobject- The closest matching station.
totalnumber- Stations in the network.
vehicle_countnumber- How many vehicles at that station match, whether or not it lists them individually.
vehicleslist- The matching vehicles at that station, best-charged first. Empty at a station that only publishes counts: read 'vehicle_count' there.
Example output
{
"alternatives": [],
"distance_km": 0.184,
"distance_meters": 184,
"found": true,
"has_vehicle_detail": false,
"matched": 1,
"station": {
"address": "Grand' Rue 57, 1820 Montreux, Suisse",
"availability": {
"bikes": 4,
"by_type": [
{
"count": 4,
"type_id": null,
"type_name": "Bike"
},
{
"count": 2,
"type_id": null,
"type_name": "E-Bike"
},
{
"count": 1,
"type_id": null,
"type_name": "Cargo bike"
}
],
"capacity": null,
"cargo_bikes": 1,
"ebikes": 2,
"ebikes_with_battery_level": 0,
"escooters": 0,
"free_docks": null,
"gliders": 0,
"max_ebike_battery_level": null,
"min_ebike_battery_level": null,
"reported_total_bikes": 6,
"total_vehicles": 7
},
"capacity": null,
"city": "Montreux",
"details_url": "https://www.velospot.info/customer/public/getStationInfo/a0plWVF5a3k2T2RuNWs2LzhYMTd3Zz09/SElvRkxlVnpsMjVFeiswQjVBR3JuZz09",
"distance_km": 0.184,
"distance_meters": 184,
"has_vehicle_detail": false,
"id": "SElvRkxlVnpsMjVFeiswQjVBR3JuZz09",
"is_virtual_station": null,
"latitude": 46.434918464696615,
"longitude": 6.909835004160314,
"map_icon_url": "https://www.velospot.info/customer/public/images/stationIcons/theme_1/stationAvailableWithBike.png",
"matching_vehicle_count": 2,
"matching_vehicles": [],
"name": "1820 Restaurant & Cocktails Bar - Montreux",
"network": {
"id": "a0plWVF5a3k2T2RuNWs2LzhYMTd3Zz09",
"name": null,
"sponsors": []
},
"source": "velospot",
"sponsors": [],
"state": null,
"state_id": null,
"state_name": null,
"station_number": "600654",
"zip": "1820"
},
"total": 2,
"vehicle_count": 2,
"vehicles": []
}Get availability summary
Summarise availability across the whole network, or across one city or network of it: how many stations there are, how many have anything to rent, the split between pedal bikes and e-bikes, and the average e-bike charge. One request, no walking the stations yourself.
Inputs
- City
citytext - Only include stations in this city. Matches part of the name, so 'Bern' also finds 'Bern Bümpliz'. Run 'List cities' to see the spellings the network uses. Leave blank for the whole network.
- Network
networktext - Only include stations in this network, by its name or its id. Use 'List networks' to see them. Leave blank for every network.
Outputs
average_ebike_battery_levelnumber- Mean charge of the e-bikes that report one.
bikesnumber- Of those, pedal bikes.
by_sourcelist- How many stations came from each half of the feed.
by_statelist- How many stations are in each state.
by_typelist- How many vehicles of each type, most common first.
capacitynumber- Total capacity of the stations that publish one.
cargo_bikesnumber- Of those, cargo bikes.
citiesnumber- Distinct cities covered.
ebikesnumber- Of those, e-bikes.
escootersnumber- Of those, e-scooters.
filtersobject- The filters that were applied.
free_docksnumber- That capacity minus the vehicles standing there.
glidersnumber- Of those, gliders.
networksnumber- Distinct networks covered.
stationsnumber- Stations covered by the summary.
stations_with_capacitynumber- How many stations that is.
stations_with_vehiclesnumber- Of those, ones with at least one bike.
stations_without_vehicle_detailnumber- Stations that publish counts rather than naming each bike, so no charge is known at them.
stations_without_vehiclesnumber- Of those, ones standing empty.
total_stations_in_networknumber- Stations before the city/network filter.
total_vehiclesnumber- Vehicles available across them.
virtual_stationsnumber- Of those, ones with no physical docks.
Example output
{
"average_ebike_battery_level": 71.4,
"bikes": 373,
"by_source": [
{
"source": "velospot",
"station_count": 131
},
{
"source": "publibike",
"station_count": 5
}
],
"by_state": [
{
"state_id": 1,
"state_name": "Active",
"station_count": 131
},
{
"state_id": 2,
"state_name": "Inactive",
"station_count": 5
}
],
"by_type": [
{
"count": 373,
"type_id": 1,
"type_name": "Bike"
},
{
"count": 246,
"type_id": 2,
"type_name": "E-Bike"
},
{
"count": 11,
"type_id": null,
"type_name": "Cargo bike"
},
{
"count": 3,
"type_id": null,
"type_name": "E-scooter"
}
],
"capacity": 62,
"cargo_bikes": 11,
"cities": 2,
"ebikes": 246,
"escooters": 3,
"filters": {
"city": null,
"network": null
},
"free_docks": 41,
"gliders": 0,
"networks": 1,
"stations": 136,
"stations_with_capacity": 5,
"stations_with_vehicles": 115,
"stations_without_vehicle_detail": 131,
"stations_without_vehicles": 21,
"total_stations_in_network": 136,
"total_vehicles": 633,
"virtual_stations": 4
}Get station
Get one station by its id, its printed number or its name: where it is, what is available there right now, and the id of each bike standing at it, with the charge left on the electric ones, as a percentage or as the kilometres it is good for, depending on which the station publishes.
Inputs
- Station
station_idtextRequired - The station's id, the number printed on it, or its exact name (for example, 'Kornhausplatz - Bern'). Ids are long opaque strings for most of the network, so the name is usually the easier thing to type: the listing actions show all three.
- Include individual bikes
include_vehicle_idstrue/false - Also read the station's own page for the id of each bike standing there, and the range left on each e-bike. On by default; it costs one extra request, and only applies to stations that publish counts rather than bikes. If the page can't be read, the counts still come back.Default:
true.
Outputs
stationobject
Example output
{
"station": {
"address": "Grand' Rue 57, 1820 Montreux, Suisse",
"availability": {
"bikes": 4,
"by_type": [
{
"count": 4,
"type_id": null,
"type_name": "Bike"
},
{
"count": 2,
"type_id": null,
"type_name": "E-Bike"
},
{
"count": 1,
"type_id": null,
"type_name": "Cargo bike"
}
],
"capacity": null,
"cargo_bikes": 1,
"ebikes": 2,
"ebikes_with_battery_level": 0,
"escooters": 0,
"free_docks": null,
"gliders": 0,
"max_ebike_battery_level": null,
"min_ebike_battery_level": null,
"reported_total_bikes": 6,
"total_vehicles": 7
},
"capacity": null,
"city": "Montreux",
"details_url": "https://www.velospot.info/customer/public/getStationInfo/a0plWVF5a3k2T2RuNWs2LzhYMTd3Zz09/SElvRkxlVnpsMjVFeiswQjVBR3JuZz09",
"has_vehicle_detail": true,
"id": "SElvRkxlVnpsMjVFeiswQjVBR3JuZz09",
"is_virtual_station": null,
"latitude": 46.434918464696615,
"listed_vehicle_count": 2,
"longitude": 6.909835004160314,
"map_icon_url": "https://www.velospot.info/customer/public/images/stationIcons/theme_1/stationAvailableWithBike.png",
"name": "1820 Restaurant & Cocktails Bar - Montreux",
"network": {
"id": "a0plWVF5a3k2T2RuNWs2LzhYMTd3Zz09",
"name": null,
"sponsors": []
},
"source": "velospot",
"sponsors": [],
"state": null,
"state_id": null,
"state_name": null,
"station_number": "600654",
"vehicles": [
{
"ebike_battery_level": null,
"id": null,
"is_ebike": false,
"name": "000582h",
"range_km": null,
"type_id": null,
"type_name": "Bike"
},
{
"ebike_battery_level": null,
"id": null,
"is_ebike": true,
"name": "002108e",
"range_km": 32.0,
"type_id": null,
"type_name": "E-Bike"
}
],
"zip": "1820"
}
}List cities
List the cities PubliBike serves, with how many stations and how many bikes and e-bikes are in each. Also the place to get the exact city spelling the other actions filter on.
Inputs
None.
Outputs
citieslist- Cities, busiest first.
countnumber- Cities returned.
stations_without_citynumber- Stations the API filed under no city.
totalnumber- Stations in the network.
Example output
{
"cities": [
{
"bikes": 233,
"city": "Bern",
"ebikes": 169,
"station_count": 84,
"stations_with_vehicles": 71,
"total_vehicles": 402
},
{
"bikes": 140,
"city": "Lausanne",
"ebikes": 91,
"station_count": 52,
"stations_with_vehicles": 44,
"total_vehicles": 231
}
],
"count": 2,
"stations_without_city": 0,
"total": 136
}List networks
List the local networks PubliBike stations belong to (a city's scheme, a campus, an employer's fleet) with their size, the cities they cover and their sponsors.
Inputs
None.
Outputs
countnumber- Networks returned.
networkslist- Networks, largest first.
stations_without_networknumber- Stations that named no network.
totalnumber- Stations in the network.
Example output
{
"count": 1,
"networks": [
{
"background_img": null,
"bikes": 233,
"cities": [
"Bern",
"K\u00f6niz"
],
"city_count": 2,
"ebikes": 169,
"id": 8,
"logo_img": "https://api.publibike.ch/images/networks/8/logo.png",
"name": "PubliBike Bern",
"sponsors": [],
"station_count": 84,
"stations_with_vehicles": 71,
"total_vehicles": 402
}
],
"stations_without_network": 0,
"total": 136
}List stations
List every station in the network: position, address, what is standing there, and the station id the other actions take. Use 'List stations with vehicles' to narrow the same list by city, vehicle type or availability.
Inputs
- Station state
statetext - Only include stations whose state matches this id or name (the API publishes both, and the name comes back translated). Only part of the network publishes a state at all, and stations that publish none are left out when this is set. Leave blank for every station.
- Maximum stations
limitnumber - Return at most this many stations. Leave blank for every match.From 1 to 2000.
Outputs
countnumber- Stations returned.
matchednumber- Stations that matched, before the limit.
stationslist- Every station in the network, in name order, with what is standing at each.
totalnumber- Stations the API returned, before any filter.
Example output
{
"count": 2,
"matched": 2,
"stations": [
{
"address": "Grand' Rue 57, 1820 Montreux, Suisse",
"availability": {
"bikes": 4,
"by_type": [
{
"count": 4,
"type_id": null,
"type_name": "Bike"
},
{
"count": 2,
"type_id": null,
"type_name": "E-Bike"
},
{
"count": 1,
"type_id": null,
"type_name": "Cargo bike"
}
],
"capacity": null,
"cargo_bikes": 1,
"ebikes": 2,
"ebikes_with_battery_level": 0,
"escooters": 0,
"free_docks": null,
"gliders": 0,
"max_ebike_battery_level": null,
"min_ebike_battery_level": null,
"reported_total_bikes": 6,
"total_vehicles": 7
},
"capacity": null,
"city": "Montreux",
"details_url": "https://www.velospot.info/customer/public/getStationInfo/a0plWVF5a3k2T2RuNWs2LzhYMTd3Zz09/SElvRkxlVnpsMjVFeiswQjVBR3JuZz09",
"has_vehicle_detail": false,
"id": "SElvRkxlVnpsMjVFeiswQjVBR3JuZz09",
"is_virtual_station": null,
"latitude": 46.434918464696615,
"longitude": 6.909835004160314,
"map_icon_url": "https://www.velospot.info/customer/public/images/stationIcons/theme_1/stationAvailableWithBike.png",
"name": "1820 Restaurant & Cocktails Bar - Montreux",
"network": {
"id": "a0plWVF5a3k2T2RuNWs2LzhYMTd3Zz09",
"name": null,
"sponsors": []
},
"source": "velospot",
"sponsors": [],
"state": null,
"state_id": null,
"state_name": null,
"station_number": "600654",
"zip": "1820"
},
{
"address": "Bahnhofplatz 10",
"availability": {
"bikes": 1,
"by_type": [
{
"count": 1,
"type_id": 1,
"type_name": "Bike"
},
{
"count": 1,
"type_id": 2,
"type_name": "E-Bike"
}
],
"capacity": 12,
"cargo_bikes": 0,
"ebikes": 1,
"ebikes_with_battery_level": 1,
"escooters": 0,
"free_docks": 10,
"gliders": 0,
"max_ebike_battery_level": 86.0,
"min_ebike_battery_level": 86.0,
"reported_total_bikes": null,
"total_vehicles": 2
},
"capacity": 12,
"city": "Bern",
"details_url": null,
"has_vehicle_detail": true,
"id": 195,
"is_virtual_station": false,
"latitude": 46.94883,
"longitude": 7.43913,
"map_icon_url": null,
"name": "Bern Bahnhof",
"network": {
"background_img": null,
"id": 8,
"logo_img": "https://api.publibike.ch/images/networks/8/logo.png",
"name": "PubliBike Bern",
"sponsors": []
},
"source": "publibike",
"sponsors": [],
"state": {
"id": 1,
"name": "Active"
},
"state_id": 1,
"state_name": "Active",
"station_number": null,
"vehicles": [
{
"ebike_battery_level": 86.0,
"id": 331207,
"is_ebike": true,
"name": "310442",
"type": {
"id": 2,
"name": "E-Bike"
},
"type_id": 2,
"type_name": "E-Bike"
},
{
"ebike_battery_level": null,
"id": 214880,
"is_ebike": false,
"name": "220301",
"type": {
"id": 1,
"name": "Bike"
},
"type_id": 1,
"type_name": "Bike"
}
],
"zip": "3011"
}
],
"total": 2
}List stations with vehicles
List stations together with what is available at each of them, in one request. Narrow by city, network, state, text, vehicle type or battery level. This is the action for anything that spans more than one station.
Inputs
- City
citytext - Only include stations in this city. Matches part of the name, so 'Bern' also finds 'Bern Bümpliz'. Run 'List cities' to see the spellings the network uses. Leave blank for the whole network.
- Network
networktext - Only include stations in this network, by its name or its id. Use 'List networks' to see them. Leave blank for every network.
- Station state
statetext - Only include stations whose state matches this id or name (the API publishes both, and the name comes back translated). Only part of the network publishes a state at all, and stations that publish none are left out when this is set. Leave blank for every station.
- Search text
querytext - Only include stations whose name, address, zip code or city contains this text.
- Vehicle type
vehicle_typetext - Only count vehicles of this type. The categories ('ebike', 'bike', 'cargo', 'escooter', 'glider') work everywhere. A specific type name or id (run 'Get availability summary' to see the ones in use) only matches stations that name their individual bikes. Stations with none of the wanted kind are left out.
- Minimum battery level
min_battery_levelnumber - Only count e-bikes charged to at least this percentage (0-100). E-bikes whose charge the API doesn't report are left out, since an unknown charge is no evidence of a charged battery: that's true for most of the network today, where stations publish counts rather than individual bikes.From 0 to 100.
- Only stations with vehicles
only_with_vehiclestrue/false - Leave out stations that are standing empty. Filtering by vehicle type or battery level already implies this.Default:
false. - Maximum stations
limitnumber - Return at most this many stations. Leave blank for every match.From 1 to 2000.
Outputs
countnumber- Stations returned.
matchednumber- Stations that matched, before the limit.
stationslist- The matching stations, in name order, each with its vehicles.
totalnumber- Stations the API returned, before any filter.
Example output
{
"count": 1,
"matched": 1,
"stations": [
{
"address": "Bahnhofplatz 10",
"availability": {
"bikes": 1,
"by_type": [
{
"count": 1,
"type_id": 1,
"type_name": "Bike"
},
{
"count": 1,
"type_id": 2,
"type_name": "E-Bike"
}
],
"capacity": 12,
"cargo_bikes": 0,
"ebikes": 1,
"ebikes_with_battery_level": 1,
"escooters": 0,
"free_docks": 10,
"gliders": 0,
"max_ebike_battery_level": 86.0,
"min_ebike_battery_level": 86.0,
"reported_total_bikes": null,
"total_vehicles": 2
},
"capacity": 12,
"city": "Bern",
"details_url": null,
"has_vehicle_detail": true,
"id": 195,
"is_virtual_station": false,
"latitude": 46.94883,
"longitude": 7.43913,
"map_icon_url": null,
"name": "Bern Bahnhof",
"network": {
"background_img": null,
"id": 8,
"logo_img": "https://api.publibike.ch/images/networks/8/logo.png",
"name": "PubliBike Bern",
"sponsors": []
},
"source": "publibike",
"sponsors": [],
"state": {
"id": 1,
"name": "Active"
},
"state_id": 1,
"state_name": "Active",
"station_number": null,
"vehicles": [
{
"ebike_battery_level": 86.0,
"id": 331207,
"is_ebike": true,
"name": "310442",
"type": {
"id": 2,
"name": "E-Bike"
},
"type_id": 2,
"type_name": "E-Bike"
},
{
"ebike_battery_level": null,
"id": 214880,
"is_ebike": false,
"name": "220301",
"type": {
"id": 1,
"name": "Bike"
},
"type_id": 1,
"type_name": "Bike"
}
],
"zip": "3011"
}
],
"total": 2
}List vehicles at a station
List the bikes available at one station, best-charged first, with the id of each and the range left on an e-bike. Where a station lists its bikes without saying which are electric, the ids still come back and the counts in 'availability' answer for how many of each kind are there; 'has_vehicle_detail' says which of the two you got.
Inputs
- Station
station_idtextRequired - The station's id, the number printed on it, or its exact name (for example, 'Kornhausplatz - Bern'). Ids are long opaque strings for most of the network, so the name is usually the easier thing to type: the listing actions show all three.
- Vehicle type
vehicle_typetext - Only count vehicles of this type. The categories ('ebike', 'bike', 'cargo', 'escooter', 'glider') work everywhere. A specific type name or id (run 'Get availability summary' to see the ones in use) only matches stations that name their individual bikes. Stations with none of the wanted kind are left out.
- Minimum battery level
min_battery_levelnumber - Only count e-bikes charged to at least this percentage (0-100). E-bikes whose charge the API doesn't report are left out, since an unknown charge is no evidence of a charged battery: that's true for most of the network today, where stations publish counts rather than individual bikes.From 0 to 100.
- Include individual bikes
include_vehicle_idstrue/false - Also read the station's own page for the id of each bike standing there, and the range left on each e-bike. On by default; it costs one extra request, and only applies to stations that publish counts rather than bikes. If the page can't be read, the counts still come back.Default:
true.
Outputs
availabilityobject- What is standing at the station right now.
countnumber- Matching vehicles listed below. Zero at a station that only publishes counts: read 'matching_count' there.
has_vehicle_detailtrue/false- Whether this station names its individual bikes. When false, 'vehicles' is empty by nature, not because the station is.
listed_vehicleslist- Every bike the station lists by id, before the filters (empty when its page wasn't read).
matching_countnumber- How many vehicles match, whether or not the station lists them individually.
stationobjectstation_idnumber- Station id.
station_nametext- Public name of the station.
total_vehiclesnumber- Vehicles at the station, before filtering.
vehicleslist- The matching vehicles, best-charged first.
Example output
{
"availability": {
"bikes": 1,
"by_type": [
{
"count": 1,
"type_id": 1,
"type_name": "Bike"
},
{
"count": 1,
"type_id": 2,
"type_name": "E-Bike"
}
],
"capacity": 12,
"cargo_bikes": 0,
"ebikes": 1,
"ebikes_with_battery_level": 1,
"escooters": 0,
"free_docks": 10,
"gliders": 0,
"max_ebike_battery_level": 86.0,
"min_ebike_battery_level": 86.0,
"reported_total_bikes": null,
"total_vehicles": 2
},
"count": 1,
"has_vehicle_detail": true,
"listed_vehicles": [
{
"ebike_battery_level": 86.0,
"id": 331207,
"is_ebike": true,
"name": "310442",
"type": {
"id": 2,
"name": "E-Bike"
},
"type_id": 2,
"type_name": "E-Bike"
},
{
"ebike_battery_level": null,
"id": 214880,
"is_ebike": false,
"name": "220301",
"type": {
"id": 1,
"name": "Bike"
},
"type_id": 1,
"type_name": "Bike"
}
],
"matching_count": 1,
"station": {
"address": "Bahnhofplatz 10",
"availability": {
"bikes": 1,
"by_type": [
{
"count": 1,
"type_id": 1,
"type_name": "Bike"
},
{
"count": 1,
"type_id": 2,
"type_name": "E-Bike"
}
],
"capacity": 12,
"cargo_bikes": 0,
"ebikes": 1,
"ebikes_with_battery_level": 1,
"escooters": 0,
"free_docks": 10,
"gliders": 0,
"max_ebike_battery_level": 86.0,
"min_ebike_battery_level": 86.0,
"reported_total_bikes": null,
"total_vehicles": 2
},
"capacity": 12,
"city": "Bern",
"details_url": null,
"has_vehicle_detail": true,
"id": 195,
"is_virtual_station": false,
"latitude": 46.94883,
"longitude": 7.43913,
"map_icon_url": null,
"name": "Bern Bahnhof",
"network": {
"background_img": null,
"id": 8,
"logo_img": "https://api.publibike.ch/images/networks/8/logo.png",
"name": "PubliBike Bern",
"sponsors": []
},
"source": "publibike",
"sponsors": [],
"state": {
"id": 1,
"name": "Active"
},
"state_id": 1,
"state_name": "Active",
"station_number": null,
"vehicles": [
{
"ebike_battery_level": 86.0,
"id": 331207,
"is_ebike": true,
"name": "310442",
"type": {
"id": 2,
"name": "E-Bike"
},
"type_id": 2,
"type_name": "E-Bike"
},
{
"ebike_battery_level": null,
"id": 214880,
"is_ebike": false,
"name": "220301",
"type": {
"id": 1,
"name": "Bike"
},
"type_id": 1,
"type_name": "Bike"
}
],
"zip": "3011"
},
"station_id": 195,
"station_name": "Bern Bahnhof",
"total_vehicles": 2,
"vehicles": [
{
"ebike_battery_level": 86.0,
"id": 331207,
"is_ebike": true,
"name": "310442",
"type": {
"id": 2,
"name": "E-Bike"
},
"type_id": 2,
"type_name": "E-Bike"
}
]
}Search stations
Find stations by name, address, zip code or city: the way to turn 'Bern Bahnhof' or a postcode into a station id, with the vehicles currently there.
Inputs
- Search text
querytextRequired - Text to look for in a station's name, address, zip code or city (for example, 'Bahnhof' or '3011').
- Vehicle type
vehicle_typetext - Only count vehicles of this type. The categories ('ebike', 'bike', 'cargo', 'escooter', 'glider') work everywhere. A specific type name or id (run 'Get availability summary' to see the ones in use) only matches stations that name their individual bikes. Stations with none of the wanted kind are left out.
- Minimum battery level
min_battery_levelnumber - Only count e-bikes charged to at least this percentage (0-100). E-bikes whose charge the API doesn't report are left out, since an unknown charge is no evidence of a charged battery: that's true for most of the network today, where stations publish counts rather than individual bikes.From 0 to 100.
- Only stations with vehicles
only_with_vehiclestrue/false - Leave out stations that are standing empty. Filtering by vehicle type or battery level already implies this.Default:
false. - Maximum stations
limitnumber - Return at most this many stations. Leave blank for every match.From 1 to 2000.
Outputs
countnumber- Stations returned.
matchednumber- Stations that matched, before the limit.
querytext- The text that was searched for.
stationslist- The matching stations, in name order, each with its vehicles.
totalnumber- Stations the API returned, before any filter.
Example output
{
"count": 1,
"matched": 1,
"query": "Bahnhof",
"stations": [
{
"address": "Bahnhofplatz 10",
"availability": {
"bikes": 1,
"by_type": [
{
"count": 1,
"type_id": 1,
"type_name": "Bike"
},
{
"count": 1,
"type_id": 2,
"type_name": "E-Bike"
}
],
"capacity": 12,
"cargo_bikes": 0,
"ebikes": 1,
"ebikes_with_battery_level": 1,
"escooters": 0,
"free_docks": 10,
"gliders": 0,
"max_ebike_battery_level": 86.0,
"min_ebike_battery_level": 86.0,
"reported_total_bikes": null,
"total_vehicles": 2
},
"capacity": 12,
"city": "Bern",
"details_url": null,
"has_vehicle_detail": true,
"id": 195,
"is_virtual_station": false,
"latitude": 46.94883,
"longitude": 7.43913,
"map_icon_url": null,
"name": "Bern Bahnhof",
"network": {
"background_img": null,
"id": 8,
"logo_img": "https://api.publibike.ch/images/networks/8/logo.png",
"name": "PubliBike Bern",
"sponsors": []
},
"source": "publibike",
"sponsors": [],
"state": {
"id": 1,
"name": "Active"
},
"state_id": 1,
"state_name": "Active",
"station_number": null,
"vehicles": [
{
"ebike_battery_level": 86.0,
"id": 331207,
"is_ebike": true,
"name": "310442",
"type": {
"id": 2,
"name": "E-Bike"
},
"type_id": 2,
"type_name": "E-Bike"
},
{
"ebike_battery_level": null,
"id": 214880,
"is_ebike": false,
"name": "220301",
"type": {
"id": 1,
"name": "Bike"
},
"type_id": 1,
"type_name": "Bike"
}
],
"zip": "3011"
}
],
"total": 2
}