> ## Documentation Index
> Fetch the complete documentation index at: https://stage-docs.getswitch.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Vehicle Shortage Mapping

> Map station-level vehicle shortage rates and identify chronic shortage locations. Returns hourly shortage patterns by day type (weekday vs weekend), per-station shortage metrics with geographic coordinates, and historical availability time series.

Use this analysis to visualize where and when shortages occur across the station network.

**Failure Modes:**
- **401**: Token is missing or invalid
- **403**: Insufficient permissions
- **404**: `no_data_binding` when 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`



## OpenAPI

````yaml /api-reference/openapi.json get /copilot/station-based/{provider}/vehicle_shortage_mapping
openapi: 3.1.0
info:
  title: SWITCH API
  version: '1.0'
  description: >-
    The SWITCH API gives mobility and logistics teams programmatic access to
    SWITCH forecasts, fleet operations, routing and analytics. Every request is
    authenticated with an API key sent as a bearer token.
servers:
  - url: https://stage-api.getswitch.io
    description: Stage
security: []
tags:
  - name: Forecast
    description: Demand forecasts per zone and time window.
  - name: Operations
    description: Fleet imbalance, rebalancing suggestions and generated tasks.
  - name: Routing
    description: Route optimisation for single and multiple fleets.
  - name: Routing Sessions
    description: Saved routing sessions, their routes and drivers.
  - name: Routing Operations
    description: Complete, undo and re-route the stops of a route.
  - name: Fleet Management
    description: Your depots, stations, drivers and cargo vehicles.
  - name: Integrations
    description: Vehicles, statuses and commands on your fleet platform.
  - name: Station Based Analytics
    description: Analytics for station-based (docked) services.
  - name: Zone Based Analytics
    description: Analytics for free-floating services, by zone.
  - name: Free Float Analytics
    description: Trip history for free-floating services.
  - name: Transit Analytics
    description: Punctuality and service delivery for public transit.
  - name: Live
    description: Real-time fleet, delivery and transit status.
  - name: Grids
    description: Spatial grids used by forecasts and analytics.
  - name: API Keys
    description: Create and manage the API keys you call this API with.
paths:
  /copilot/station-based/{provider}/vehicle_shortage_mapping:
    get:
      tags:
        - Station Based Analytics
      summary: Get Vehicle Shortage Mapping
      description: >-
        Map station-level vehicle shortage rates and identify chronic shortage
        locations. Returns hourly shortage patterns by day type (weekday vs
        weekend), per-station shortage metrics with geographic coordinates, and
        historical availability time series.


        Use this analysis to visualize where and when shortages occur across the
        station network.


        **Failure Modes:**

        - **401**: Token is missing or invalid

        - **403**: Insufficient permissions

        - **404**: `no_data_binding` when 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`
      operationId: get_vehicle_shortage_mapping
      parameters:
        - name: provider
          in: path
          required: true
          schema:
            type: string
            description: >-
              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.
            title: Provider
          description: >-
            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.
        - name: geolabel
          in: query
          required: true
          schema:
            type: string
            description: >-
              Location to analyse, e.g. `milan`: one of the locations (or their
              geolabels) that your company's station-based analytics are enabled
              for with this provider. Any other value is refused with 404
              `no_data_binding` (`kind: location`).
            title: Geolabel
          description: >-
            Location to analyse, e.g. `milan`: one of the locations (or their
            geolabels) that your company's station-based analytics are enabled
            for with this provider. Any other value is refused with 404
            `no_data_binding` (`kind: location`).
        - name: start_date
          in: query
          required: true
          schema:
            type: string
            format: date-time
            description: >-
              Start of the analysis period, an ISO 8601 date-time with a time
              zone, e.g. `2026-10-01T00:00:00Z`.
            title: Start Date
          description: >-
            Start of the analysis period, an ISO 8601 date-time with a time
            zone, e.g. `2026-10-01T00:00:00Z`.
        - name: end_date
          in: query
          required: true
          schema:
            type: string
            format: date-time
            description: >-
              End of the analysis period, an ISO 8601 date-time with a time
              zone, e.g. `2026-10-31T23:59:59Z`. Must be after `start_date`, at
              most 366 days later.
            title: End Date
          description: >-
            End of the analysis period, an ISO 8601 date-time with a time zone,
            e.g. `2026-10-31T23:59:59Z`. Must be after `start_date`, at most 366
            days later.
        - name: start_hour
          in: query
          required: false
          schema:
            type:
              - integer
              - 'null'
            maximum: 23
            minimum: 0
            description: >-
              First hour of the day to include (0-23, local time of the city).
              Set together with `end_hour`; both bounds are included.
            title: Start Hour
          description: >-
            First hour of the day to include (0-23, local time of the city). Set
            together with `end_hour`; both bounds are included.
        - name: end_hour
          in: query
          required: false
          schema:
            type:
              - integer
              - 'null'
            maximum: 23
            minimum: 0
            description: >-
              Last hour of the day to include (0-23, local time of the city),
              not before `start_hour`. Set together with `start_hour`.
            title: End Hour
          description: >-
            Last hour of the day to include (0-23, local time of the city), not
            before `start_hour`. Set together with `start_hour`.
      responses:
        '200':
          description: >-
            Shortage mapping retrieved. Returns hourly shortage patterns,
            station-level shortage metrics with coordinates, and historical
            availability data.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VehicleShortageMappingResponse'
        '401':
          description: Unauthorized. Token is missing or invalid.
        '403':
          description: Forbidden. Insufficient permissions.
        '422':
          description: Unprocessable Entity. Validation failed.
        '500':
          description: Internal Server Error.
      security:
        - HTTPBearer: []
        - HTTPBearer: []
components:
  schemas:
    VehicleShortageMappingResponse:
      properties:
        hourly_patterns:
          items:
            $ref: '#/components/schemas/HourlyShortageData'
          type: array
          title: Hourly Patterns
          description: >-
            Hourly shortage patterns showing how shortages vary by hour and day
            type (weekday vs weekend)
          examples:
            - - day_type: Weekday
                hour: 8
                is_weekend: false
                shortage_rate: 0.15
        station_shortage:
          items:
            $ref: '#/components/schemas/StationShortageMetrics'
          type: array
          title: Station Shortage
          description: >-
            Station-level shortage metrics showing which stations experience the
            most frequent shortages
          examples:
            - - capacity: 20
                latitude: 45.464664
                longitude: 9.18854
                shortage_rate: 0.25
                station_id: 123
                station_name: Central Station
                total_vehicles_available: 8.5
        historical_availability:
          items:
            $ref: '#/components/schemas/HistoricalAvailability'
          type: array
          title: Historical Availability
          description: >-
            Historical availability data showing average vehicle availability
            over time with dynamic time bucketing (always 24 periods)
          examples:
            - - avg_availability: 12.5
                period: '2024-01-15T08:00:00Z'
              - avg_availability: 8.7
                period: '2024-01-15T12:00:00Z'
      type: object
      required:
        - hourly_patterns
        - station_shortage
        - historical_availability
      title: VehicleShortageMappingResponse
      description: Vehicle shortage mapping analysis response.
      examples:
        - historical_availability:
            - avg_availability: 7.8
              period: '2026-10-01T00:00:00Z'
            - avg_availability: 6.4
              period: '2026-10-02T07:00:00Z'
          hourly_patterns:
            - day_type: Weekday
              hour: 8
              is_weekend: false
              shortage_rate: 0.21
            - day_type: Weekend
              hour: 8
              is_weekend: true
              shortage_rate: 0.09
          station_shortage:
            - capacity: 30
              historical_availability:
                - avg_availability: 4.2
                  period: '2026-10-01T00:00:00Z'
                - avg_availability: 2
                  period: '2026-10-02T07:00:00Z'
              shortage_rate: 0.34
              station_id: 245
              station_latitude: 45.4859
              station_longitude: 9.2045
              station_name: Stazione Centrale
              total_vehicles_available: 3.1
            - capacity: 24
              historical_availability:
                - avg_availability: 9.1
                  period: '2026-10-01T00:00:00Z'
                - avg_availability: 7.5
                  period: '2026-10-02T07:00:00Z'
              shortage_rate: 0.12
              station_id: 101
              station_latitude: 45.4642
              station_longitude: 9.19
              station_name: Duomo
              total_vehicles_available: 8.6
    HourlyShortageData:
      properties:
        hour:
          type: integer
          maximum: 23
          minimum: 0
          title: Hour
          description: Hour of day (0-23)
          examples:
            - 9
            - 17
            - 22
        shortage_rate:
          type: number
          maximum: 1
          minimum: 0
          title: Shortage Rate
          description: Proportion of station-time records with zero vehicles available
          examples:
            - 0.15
            - 0.23
            - 0.45
        is_weekend:
          type: boolean
          title: Is Weekend
          description: Whether this data represents weekend patterns
          examples:
            - true
            - false
        day_type:
          type:
            - string
            - 'null'
          title: Day Type
          description: Human-readable day type classification
          examples:
            - Weekend
            - Weekday
      type: object
      required:
        - hour
        - shortage_rate
        - is_weekend
      title: HourlyShortageData
      description: Hourly shortage pattern data.
    StationShortageMetrics:
      properties:
        station_id:
          anyOf:
            - type: integer
            - type: string
          title: Station Id
          description: Unique identifier for the bike sharing station
          examples:
            - 123
            - station_456
            - ST_789
        station_name:
          type: string
          minLength: 1
          title: Station Name
          description: Human-readable name of the station
          examples:
            - Central Station
            - Park Avenue
            - Main Square
        station_latitude:
          type: number
          maximum: 90
          minimum: -90
          title: Station Latitude
          description: Station latitude in decimal degrees
          examples:
            - 45.464664
            - 40.7128
            - 51.5074
        station_longitude:
          type: number
          maximum: 180
          minimum: -180
          title: Station Longitude
          description: Station longitude in decimal degrees
          examples:
            - 9.18854
            - -74.006
            - -0.1278
        shortage_rate:
          type: number
          maximum: 1
          minimum: 0
          title: Shortage Rate
          description: Proportion of time this station has zero vehicles available
          examples:
            - 0.05
            - 0.18
            - 0.42
        total_vehicles_available:
          type: number
          minimum: 0
          title: Total Vehicles Available
          description: Average number of vehicles available at this station
          examples:
            - 8.5
            - 12.3
            - 15.7
        capacity:
          type: integer
          exclusiveMinimum: 0
          title: Capacity
          description: Total capacity (docks) of this station
          examples:
            - 20
            - 30
            - 40
        historical_availability:
          items:
            $ref: '#/components/schemas/HistoricalAvailability'
          type: array
          title: Historical Availability
          description: >-
            Historical availability time series for this specific station with
            dynamic time bucketing (always 24 periods)
          examples:
            - - avg_availability: 5.2
                period: '2024-01-15T08:00:00Z'
              - avg_availability: 3.8
                period: '2024-01-15T12:00:00Z'
      type: object
      required:
        - station_id
        - station_name
        - station_latitude
        - station_longitude
        - shortage_rate
        - total_vehicles_available
        - capacity
        - historical_availability
      title: StationShortageMetrics
      description: Station shortage-specific metrics.
    HistoricalAvailability:
      properties:
        period:
          type: string
          format: date-time
          title: Period
          description: Time period for this availability measurement
          examples:
            - '2024-01-15T08:00:00Z'
            - '2024-01-15T12:00:00Z'
            - '2024-01-15T18:00:00Z'
        avg_availability:
          type: number
          minimum: 0
          title: Avg Availability
          description: >-
            Average number of vehicles available across all stations during this
            period
          examples:
            - 12.5
            - 8.7
            - 15.3
      type: object
      required:
        - period
        - avg_availability
      title: HistoricalAvailability
      description: Historical availability data point with temporal aggregation.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer
      description: >-
        An API key, sent as `Authorization: Bearer <key>`. Create one in the
        SWITCH Copilot under **Settings → API keys** (needs the API keys
        permission in your company), or with `POST /auth/api-keys`. The key is
        shown once, at creation.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.