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

# Get Zone Shortage Mapping

> Per-zone shortage rate (share of hours with no vehicle in the zone), the shortage rate by hour for weekdays and weekends, and the average number of vehicles over time, for the network and per zone.

**Failure Modes:**
- **400**: `precision` given with a zoning system other than `geohash7`
- **401**: Token is missing or invalid
- **403**: Insufficient permissions
- **404**: `no_data_binding` when the provider or location is not enabled for your company
- **422**: Invalid filter parameters

**Required Auth Scopes:**
- `copilot:analytics`



## OpenAPI

````yaml /api-reference/openapi.json get /copilot/zone-based/{provider}/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://api.getswitch.io
    description: Production
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/zone-based/{provider}/shortage_mapping:
    get:
      tags:
        - Zone Based Analytics
      summary: Get Zone Shortage Mapping
      description: >-
        Per-zone shortage rate (share of hours with no vehicle in the zone), the
        shortage rate by hour for weekdays and weekends, and the average number
        of vehicles over time, for the network and per zone.


        **Failure Modes:**

        - **400**: `precision` given with a zoning system other than `geohash7`

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

        - **403**: Insufficient permissions

        - **404**: `no_data_binding` when the provider or location is not
        enabled for your company

        - **422**: Invalid filter parameters


        **Required Auth Scopes:**

        - `copilot:analytics`
      operationId: get_zone_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 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.
            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 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.
        - 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 zone-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 zone-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: >-
              First day of the analysis period (ISO 8601, e.g.
              `2026-10-01T00:00:00Z`). Only the date part is used, as a UTC day.
            title: Start Date
          description: >-
            First day of the analysis period (ISO 8601, e.g.
            `2026-10-01T00:00:00Z`). Only the date part is used, as a UTC day.
        - name: end_date
          in: query
          required: true
          schema:
            type: string
            format: date-time
            description: >-
              Last day of the analysis period, included (ISO 8601, e.g.
              `2026-10-31T00:00:00Z`). Only the date part is used, as a UTC day.
            title: End Date
          description: >-
            Last day of the analysis period, included (ISO 8601, e.g.
            `2026-10-31T00:00:00Z`). Only the date part is used, as a UTC day.
        - 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, UTC), both bounds
              included. Applied only together with `end_hour`, and only by trip
              volume and shortage mapping.
            title: Start Hour
          description: >-
            First hour of the day to include (0-23, UTC), both bounds included.
            Applied only together with `end_hour`, and only by trip volume and
            shortage mapping.
        - 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, UTC). Applied only together
              with `start_hour`, and only by trip volume and shortage mapping.
            title: End Hour
          description: >-
            Last hour of the day to include (0-23, UTC). Applied only together
            with `start_hour`, and only by trip volume and shortage mapping.
        - name: zoning_system_id
          in: query
          required: false
          schema:
            type: string
            description: >-
              Zoning system the zones belong to. Defaults to `geohash7` (geohash
              cells, whose size `precision` sets).
            default: geohash7
            title: Zoning System Id
          description: >-
            Zoning system the zones belong to. Defaults to `geohash7` (geohash
            cells, whose size `precision` sets).
        - name: precision
          in: query
          required: false
          schema:
            type:
              - integer
              - 'null'
            maximum: 7
            minimum: 4
            description: >-
              Geohash precision to aggregate to (4-7). Only valid when
              zoning_system_id='geohash7', where it defaults to 7. Passing it
              with any other zoning system returns HTTP 400.
            title: Precision
          description: >-
            Geohash precision to aggregate to (4-7). Only valid when
            zoning_system_id='geohash7', where it defaults to 7. Passing it with
            any other zoning system returns HTTP 400.
      responses:
        '200':
          description: Shortage mapping retrieved. Hourly patterns, zone shortage, history.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ShortageMappingResponse'
        '400':
          description: Bad Request. `precision` needs `geohash7` zoning.
        '401':
          description: Unauthorized. Token is missing or invalid.
        '403':
          description: Forbidden. Insufficient permissions.
        '404':
          description: Not Found. Provider or location not enabled.
        '422':
          description: Unprocessable Entity. Validation failed.
      security:
        - HTTPBearer: []
        - HTTPBearer: []
components:
  schemas:
    ShortageMappingResponse:
      properties:
        hourly_patterns:
          items:
            $ref: '#/components/schemas/HourlyZoneShortage'
          type: array
          title: Hourly Patterns
        zone_shortage:
          items:
            $ref: '#/components/schemas/ZoneShortageData'
          type: array
          title: Zone Shortage
        historical_availability:
          items:
            $ref: '#/components/schemas/ZoneHistoricalAvailability'
          type: array
          title: Historical Availability
      type: object
      required:
        - hourly_patterns
        - zone_shortage
        - historical_availability
      title: ShortageMappingResponse
      examples:
        - historical_availability:
            - avg_availability: 3.7
              period: '2026-10-01T00:00:00Z'
            - avg_availability: 3.4
              period: '2026-10-16T00:00:00Z'
          hourly_patterns:
            - day_type: Weekday
              hour: 8
              is_weekend: false
              shortage_rate: 0.27
            - day_type: Weekend
              hour: 8
              is_weekend: true
              shortage_rate: 0.19
          zone_shortage:
            - avg_vehicle_count: 1.3
              context:
                population: 980
                top_pois:
                  - category: sustenance
                    count: 47
                  - category: leisure
                    count: 6
                transit_stops_total: 4
              geom:
                coordinates:
                  - - - 9.17496
                      - 45.45181
                    - - 9.17633
                      - 45.45181
                    - - 9.17633
                      - 45.45319
                    - - 9.17496
                      - 45.45319
                    - - 9.17496
                      - 45.45181
                type: Polygon
              historical_availability:
                - avg_availability: 1.6
                  period: '2026-10-01T00:00:00Z'
                - avg_availability: 1.1
                  period: '2026-10-16T00:00:00Z'
              shortage_rate: 0.42
              zone_id: u0nd8f3
              zone_label: u0nd8f3
              zone_latitude: 45.4525
              zone_longitude: 9.17564
            - avg_vehicle_count: 8.9
              context:
                population: 412
                top_pois:
                  - category: sustenance
                    count: 64
                  - category: shop
                    count: 51
                  - category: tourism
                    count: 12
                transit_stops_total: 9
              geom:
                coordinates:
                  - - - 9.18869
                      - 45.46417
                    - - 9.19006
                      - 45.46417
                    - - 9.19006
                      - 45.46555
                    - - 9.18869
                      - 45.46555
                    - - 9.18869
                      - 45.46417
                type: Polygon
              historical_availability:
                - avg_availability: 9.4
                  period: '2026-10-01T00:00:00Z'
                - avg_availability: 8.3
                  period: '2026-10-16T00:00:00Z'
              shortage_rate: 0.08
              zone_id: u0nd9he
              zone_label: u0nd9he
              zone_latitude: 45.46486
              zone_longitude: 9.18938
    HourlyZoneShortage:
      properties:
        hour:
          type: integer
          maximum: 23
          minimum: 0
          title: Hour
        shortage_rate:
          type: number
          maximum: 1
          minimum: 0
          title: Shortage Rate
        is_weekend:
          type: boolean
          title: Is Weekend
        day_type:
          type: string
          title: Day Type
          examples:
            - Weekday
            - Weekend
      type: object
      required:
        - hour
        - shortage_rate
        - is_weekend
        - day_type
      title: HourlyZoneShortage
    ZoneShortageData:
      properties:
        zone_id:
          type: string
          title: Zone Id
          description: Geohash7 zone id
          examples:
            - u33db27
        zone_label:
          type: string
          title: Zone Label
          description: Human label (falls back to zone_id)
        zone_latitude:
          type: number
          maximum: 90
          minimum: -90
          title: Zone Latitude
          examples:
            - 52.52
        zone_longitude:
          type: number
          maximum: 180
          minimum: -180
          title: Zone Longitude
          examples:
            - 13.4
        geom:
          additionalProperties: true
          type:
            - object
            - 'null'
          title: Geom
          description: >-
            Zone boundary as a GeoJSON geometry object (e.g. Polygon /
            MultiPolygon with WGS84 lon/lat coordinates). Null when the zone has
            no stored geometry.
          examples:
            - coordinates:
                - - - 13.4
                    - 52.52
                  - - 13.41
                    - 52.52
                  - - 13.41
                    - 52.53
                  - - 13.4
                    - 52.52
              type: Polygon
        context:
          $ref: '#/components/schemas/ZoneContext'
          description: Enriched zone metadata, when available
        shortage_rate:
          type: number
          maximum: 1
          minimum: 0
          title: Shortage Rate
        avg_vehicle_count:
          type: number
          minimum: 0
          title: Avg Vehicle Count
        historical_availability:
          items:
            $ref: '#/components/schemas/ZoneHistoricalAvailability'
          type: array
          title: Historical Availability
      type: object
      required:
        - zone_id
        - zone_label
        - zone_latitude
        - zone_longitude
        - shortage_rate
        - avg_vehicle_count
      title: ZoneShortageData
    ZoneHistoricalAvailability:
      properties:
        period:
          type: string
          format: date-time
          title: Period
        avg_availability:
          type: number
          minimum: 0
          title: Avg Availability
      type: object
      required:
        - period
        - avg_availability
      title: ZoneHistoricalAvailability
    ZoneContext:
      properties:
        population:
          type:
            - number
            - 'null'
          title: Population
          description: WorldPop latest population estimate for the zone
        transit_stops_total:
          type:
            - integer
            - 'null'
          title: Transit Stops Total
          description: Combined public-transit stop count in the zone
        top_pois:
          items:
            $ref: '#/components/schemas/ZonePoiCount'
          type: array
          title: Top Pois
          description: Top POI categories by count (max 3)
      type: object
      title: ZoneContext
      description: Key context stats enriched from the SQL layer (standard_zoning_system).
    ZonePoiCount:
      properties:
        category:
          type: string
          title: Category
          examples:
            - sustenance
            - transportation
            - education
        count:
          type: integer
          minimum: 0
          title: Count
          examples:
            - 42
            - 18
            - 7
      type: object
      required:
        - category
        - count
      title: ZonePoiCount
      description: One POI category with its count (top categories per zone).
  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.