# PubliBike

> 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.

App · Travel & Places · 10 actions. Web page: https://docs.lodol.com/docs/integrations/publibike

## Actions

### 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 (`latitude`, number, required): Latitude of the point to search from, in decimal degrees (for example, 46.948 for Bern). From -90 to 90.
- Longitude (`longitude`, number, required): Longitude of the point to search from, in decimal degrees (for example, 7.447 for Bern). From -180 to 180.
- Search radius (km) (`radius_km`, number): 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_type`, text): 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_level`, number): 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_vehicles`, true/false): Leave out stations that are standing empty. Filtering by vehicle type or battery level already implies this. Default: `false`.
- Maximum stations (`limit`, number): Return at most this many stations. Defaults to 10. From 1 to 200. Default: `10`.

**Outputs**

- `count` (number): Stations returned.
- `latitude` (number): Latitude that was searched from.
- `longitude` (number): Longitude that was searched from.
- `matched` (number): Stations that matched, before the limit.
- `radius_km` (number): The radius applied, if any.
- `stations` (list): The matching stations, nearest first, each with its distance from the point.
- `total` (number): Stations the API returned, before any filter.

**Example output**

```json
{
  "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 (`latitude`, number, required): Latitude of the point to search from, in decimal degrees (for example, 46.948 for Bern). From -90 to 90.
- Longitude (`longitude`, number, required): Longitude of the point to search from, in decimal degrees (for example, 7.447 for Bern). From -180 to 180.
- Vehicle type (`vehicle_type`, text): 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_level`, number): 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_km`, number): 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_alternatives`, number): 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_ids`, true/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**

- `alternatives` (list): The next-closest matching stations.
- `distance_km` (number): How far that station is, in kilometres.
- `distance_meters` (number): The same distance in metres.
- `found` (true/false): Whether any station matched. False means nothing qualified; it is not an error.
- `has_vehicle_detail` (true/false): Whether that station names its individual bikes.
- `matched` (number): Stations that matched in total.
- `station` (object): The closest matching station.
- `total` (number): Stations in the network.
- `vehicle_count` (number): How many vehicles at that station match, whether or not it lists them individually.
- `vehicles` (list): The matching vehicles at that station, best-charged first. Empty at a station that only publishes counts: read 'vehicle_count' there.

**Example output**

```json
{
  "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 (`city`, text): 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 (`network`, text): 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_level` (number): Mean charge of the e-bikes that report one.
- `bikes` (number): Of those, pedal bikes.
- `by_source` (list): How many stations came from each half of the feed.
- `by_state` (list): How many stations are in each state.
- `by_type` (list): How many vehicles of each type, most common first.
- `capacity` (number): Total capacity of the stations that publish one.
- `cargo_bikes` (number): Of those, cargo bikes.
- `cities` (number): Distinct cities covered.
- `ebikes` (number): Of those, e-bikes.
- `escooters` (number): Of those, e-scooters.
- `filters` (object): The filters that were applied.
- `free_docks` (number): That capacity minus the vehicles standing there.
- `gliders` (number): Of those, gliders.
- `networks` (number): Distinct networks covered.
- `stations` (number): Stations covered by the summary.
- `stations_with_capacity` (number): How many stations that is.
- `stations_with_vehicles` (number): Of those, ones with at least one bike.
- `stations_without_vehicle_detail` (number): Stations that publish counts rather than naming each bike, so no charge is known at them.
- `stations_without_vehicles` (number): Of those, ones standing empty.
- `total_stations_in_network` (number): Stations before the city/network filter.
- `total_vehicles` (number): Vehicles available across them.
- `virtual_stations` (number): Of those, ones with no physical docks.

**Example output**

```json
{
  "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_id`, text, required): 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_ids`, true/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**

- `station` (object)

**Example output**

```json
{
  "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**

- `cities` (list): Cities, busiest first.
- `count` (number): Cities returned.
- `stations_without_city` (number): Stations the API filed under no city.
- `total` (number): Stations in the network.

**Example output**

```json
{
  "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**

- `count` (number): Networks returned.
- `networks` (list): Networks, largest first.
- `stations_without_network` (number): Stations that named no network.
- `total` (number): Stations in the network.

**Example output**

```json
{
  "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 (`state`, text): 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 (`limit`, number): Return at most this many stations. Leave blank for every match. From 1 to 2000.

**Outputs**

- `count` (number): Stations returned.
- `matched` (number): Stations that matched, before the limit.
- `stations` (list): Every station in the network, in name order, with what is standing at each.
- `total` (number): Stations the API returned, before any filter.

**Example output**

```json
{
  "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 (`city`, text): 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 (`network`, text): 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 (`state`, text): 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 (`query`, text): Only include stations whose name, address, zip code or city contains this text.
- Vehicle type (`vehicle_type`, text): 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_level`, number): 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_vehicles`, true/false): Leave out stations that are standing empty. Filtering by vehicle type or battery level already implies this. Default: `false`.
- Maximum stations (`limit`, number): Return at most this many stations. Leave blank for every match. From 1 to 2000.

**Outputs**

- `count` (number): Stations returned.
- `matched` (number): Stations that matched, before the limit.
- `stations` (list): The matching stations, in name order, each with its vehicles.
- `total` (number): Stations the API returned, before any filter.

**Example output**

```json
{
  "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_id`, text, required): 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_type`, text): 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_level`, number): 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_ids`, true/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**

- `availability` (object): What is standing at the station right now.
- `count` (number): Matching vehicles listed below. Zero at a station that only publishes counts: read 'matching_count' there.
- `has_vehicle_detail` (true/false): Whether this station names its individual bikes. When false, 'vehicles' is empty by nature, not because the station is.
- `listed_vehicles` (list): Every bike the station lists by id, before the filters (empty when its page wasn't read).
- `matching_count` (number): How many vehicles match, whether or not the station lists them individually.
- `station` (object)
- `station_id` (number): Station id.
- `station_name` (text): Public name of the station.
- `total_vehicles` (number): Vehicles at the station, before filtering.
- `vehicles` (list): The matching vehicles, best-charged first.

**Example output**

```json
{
  "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 (`query`, text, required): Text to look for in a station's name, address, zip code or city (for example, 'Bahnhof' or '3011').
- Vehicle type (`vehicle_type`, text): 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_level`, number): 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_vehicles`, true/false): Leave out stations that are standing empty. Filtering by vehicle type or battery level already implies this. Default: `false`.
- Maximum stations (`limit`, number): Return at most this many stations. Leave blank for every match. From 1 to 2000.

**Outputs**

- `count` (number): Stations returned.
- `matched` (number): Stations that matched, before the limit.
- `query` (text): The text that was searched for.
- `stations` (list): The matching stations, in name order, each with its vehicles.
- `total` (number): Stations the API returned, before any filter.

**Example output**

```json
{
  "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
}
```
