> ## 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 Deployment Window Optimization

> Analyze optimal times to deploy vehicles by identifying hourly shortage patterns across the network. Returns recommended deployment windows, shortage rates by hour, station-level deployment priority metrics, and efficiency scores.

Use this to schedule vehicle deployment and rebalancing at the most impactful times.

**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}/deployment_windows
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/station-based/{provider}/deployment_windows:
    get:
      tags:
        - Station Based Analytics
      summary: Get Deployment Window Optimization
      description: >-
        Analyze optimal times to deploy vehicles by identifying hourly shortage
        patterns across the network. Returns recommended deployment windows,
        shortage rates by hour, station-level deployment priority metrics, and
        efficiency scores.


        Use this to schedule vehicle deployment and rebalancing at the most
        impactful times.


        **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_deployment_windows
      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: >-
            Deployment window data retrieved. Returns optimal deployment
            windows, hourly shortage patterns, and station-level priority
            metrics.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeploymentWindowsResponse'
        '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:
    DeploymentWindowsResponse:
      properties:
        system_shortage_by_hour:
          items:
            $ref: '#/components/schemas/HourlyShortageData'
          type: array
          title: System Shortage By Hour
          description: >-
            Hourly shortage patterns across the system showing when vehicle
            shortages are most likely to occur
          examples:
            - - avg_vehicles: 8.5
                day_type: Weekday
                hour: 8
                is_weekend: false
                shortage_rate: 0.25
        optimal_hours:
          items:
            type: integer
          type: array
          title: Optimal Hours
          description: >-
            List of hours (0-23) identified as optimal for vehicle deployment
            based on high shortage rates requiring immediate attention
          examples:
            - - 8
              - 9
              - 17
              - 18
              - 19
            - - 12
              - 13
              - 14
            - - 7
              - 8
              - 16
              - 17
        window_stats:
          $ref: '#/components/schemas/WindowStats'
          description: >-
            Statistical summary of deployment windows including optimal time
            ranges and system-wide efficiency metrics
        station_metrics:
          items:
            $ref: '#/components/schemas/DeploymentStationMetrics'
          type: array
          title: Station Metrics
          description: >-
            Station-level deployment metrics including coordinates, availability
            patterns, and priority indicators for targeted deployment
      type: object
      required:
        - system_shortage_by_hour
        - optimal_hours
        - window_stats
        - station_metrics
      title: DeploymentWindowsResponse
      description: >-
        Deployment windows analysis response with optimal timing and station
        metrics.
      examples:
        - optimal_hours:
            - 7
            - 8
          station_metrics:
            - avg_capacity: 30
              avg_shortage_rate: 0.34
              avg_vehicles_available: 3.1
              deployment_priority: High
              ebike_ratio: 0.28
              station_id: 245
              station_latitude: 45.4859
              station_longitude: 9.2045
              station_name: Stazione Centrale
              total_observations: 8928
            - avg_capacity: 24
              avg_shortage_rate: 0.12
              avg_vehicles_available: 8.6
              deployment_priority: Low
              ebike_ratio: 0.35
              station_id: 101
              station_latitude: 45.4642
              station_longitude: 9.19
              station_name: Duomo
              total_observations: 8928
          system_shortage_by_hour:
            - hour: 7
              is_weekend: false
              shortage_rate: 0.18
            - hour: 8
              is_weekend: false
              shortage_rate: 0.24
          window_stats:
            avg_shortage_rate: 0.14
            deployment_efficiency: 0.86
            optimal_end_hour: 8
            optimal_start_hour: 7
    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.
    WindowStats:
      properties:
        optimal_start_hour:
          type: integer
          maximum: 23
          minimum: 0
          title: Optimal Start Hour
          description: Starting hour of the optimal deployment window
          examples:
            - 8
            - 14
            - 18
        optimal_end_hour:
          type: integer
          maximum: 23
          minimum: 0
          title: Optimal End Hour
          description: Ending hour of the optimal deployment window
          examples:
            - 10
            - 16
            - 20
        avg_shortage_rate:
          type: number
          maximum: 1
          minimum: 0
          title: Avg Shortage Rate
          description: Average shortage rate across all stations and hours
          examples:
            - 0.15
            - 0.23
            - 0.08
        deployment_efficiency:
          type: number
          maximum: 1
          minimum: 0
          title: Deployment Efficiency
          description: Deployment efficiency score (higher is better)
          examples:
            - 0.85
            - 0.77
            - 0.92
      type: object
      required:
        - optimal_start_hour
        - optimal_end_hour
        - avg_shortage_rate
        - deployment_efficiency
      title: WindowStats
      description: Deployment window statistics with optimal timing and efficiency metrics.
    DeploymentStationMetrics:
      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
        avg_shortage_rate:
          type: number
          maximum: 1
          minimum: 0
          title: Avg Shortage Rate
          description: Average shortage rate for this specific station
          examples:
            - 0.05
            - 0.18
            - 0.42
        avg_vehicles_available:
          type: number
          minimum: 0
          title: Avg Vehicles Available
          description: Average number of vehicles available at this station
          examples:
            - 8.5
            - 12.3
            - 15.7
        avg_capacity:
          type: number
          exclusiveMinimum: 0
          title: Avg Capacity
          description: Average total capacity (docks) of this station
          examples:
            - 20
            - 30
            - 40
        deployment_priority:
          type: string
          title: Deployment Priority
          description: Deployment priority level based on shortage patterns
          examples:
            - High
            - Medium
            - Low
        total_observations:
          type: integer
          exclusiveMinimum: 0
          title: Total Observations
          description: Total number of data points used in calculations
          examples:
            - 1000
            - 1500
            - 2000
        ebike_ratio:
          type: number
          maximum: 1
          minimum: 0
          title: Ebike Ratio
          description: >-
            Average proportion of available bikes that are e-bikes at this
            station
          examples:
            - 0.32
            - 0.45
            - 0.67
      type: object
      required:
        - station_id
        - station_name
        - station_latitude
        - station_longitude
        - avg_shortage_rate
        - avg_vehicles_available
        - avg_capacity
        - deployment_priority
        - total_observations
        - ebike_ratio
      title: DeploymentStationMetrics
      description: Station-level deployment metrics with priority and capacity information.
  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.