> ## 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 Commuting Station Analysis

> Identify stations with strong commuting patterns by analyzing morning versus evening demand differences. Returns station-level classification (Morning Hotspot, Evening Hotspot, or Balanced) along with demand patterns, morning/evening ratios, and a summary by station type.

**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}/commuting_stations
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}/commuting_stations:
    get:
      tags:
        - Station Based Analytics
      summary: Get Commuting Station Analysis
      description: >-
        Identify stations with strong commuting patterns by analyzing morning
        versus evening demand differences. Returns station-level classification
        (Morning Hotspot, Evening Hotspot, or Balanced) along with demand
        patterns, morning/evening ratios, and a summary by station type.


        **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_commuting_stations
      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: >-
            Commuting analysis retrieved. Returns per-station commuting
            classification and aggregated type summary.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommutingStationsResponse'
        '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:
    CommutingStationsResponse:
      properties:
        commuting_analysis:
          items:
            $ref: '#/components/schemas/CommutingStationData'
          type: array
          title: Commuting Analysis
          description: >-
            Station-level commuting analysis showing demand patterns and type
            classification based on morning vs evening usage
          examples:
            - - evening_demand: 4.2
                latitude: 45.464664
                longitude: 9.18854
                morning_demand: 8.5
                morning_evening_ratio: 2.02
                station_id: 123
                station_name: Central Station
                station_type: Morning Hotspot
                total_demand: 12.7
        station_type_summary:
          items:
            $ref: '#/components/schemas/StationTypeSummaryData'
          type: array
          title: Station Type Summary
          description: >-
            Summary statistics grouped by station type, showing distribution and
            average metrics across categories
          examples:
            - - avg_morning_evening_ratio: 2.1
                avg_total_demand: 15.2
                count: 45
                station_type: Morning Hotspot
      type: object
      required:
        - commuting_analysis
        - station_type_summary
      title: CommutingStationsResponse
      description: >-
        Commuting stations analysis response with station-level and summary
        data.
      examples:
        - commuting_analysis:
            - ebike_ratio: 0.28
              evening_demand: 6.8
              morning_demand: 14.2
              morning_evening_ratio: 2.09
              station_id: 245
              station_latitude: 45.4859
              station_longitude: 9.2045
              station_name: Stazione Centrale
              station_type: Morning Hotspot
              total_demand: 21
            - ebike_ratio: 0.4
              evening_demand: 9.6
              morning_demand: 4.1
              morning_evening_ratio: 0.43
              station_id: 318
              station_latitude: 45.4532
              station_longitude: 9.176
              station_name: Darsena
              station_type: Evening Hotspot
              total_demand: 13.7
          station_type_summary:
            - avg_morning_evening_ratio: 1.86
              avg_total_demand: 17.3
              count: 48
              station_type: Morning Hotspot
            - avg_morning_evening_ratio: 0.52
              avg_total_demand: 14.9
              count: 39
              station_type: Evening Hotspot
            - avg_morning_evening_ratio: 1.02
              avg_total_demand: 9.8
              count: 225
              station_type: Balanced
    CommutingStationData:
      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
        morning_demand:
          type: number
          minimum: 0
          title: Morning Demand
          description: Average demand proxy during morning rush hours (7-9 AM)
          examples:
            - 2.5
            - 8.3
            - 12.7
        evening_demand:
          type: number
          minimum: 0
          title: Evening Demand
          description: Average demand proxy during evening rush hours (5-7 PM)
          examples:
            - 1.8
            - 6.9
            - 9.4
        morning_evening_ratio:
          type: number
          minimum: 0
          title: Morning Evening Ratio
          description: Ratio of morning to evening demand (higher = more residential)
          examples:
            - 1.39
            - 0.48
            - 1.85
        total_demand:
          type: number
          minimum: 0
          title: Total Demand
          description: Combined morning and evening demand proxy
          examples:
            - 4.3
            - 15.2
            - 22.1
        station_type:
          type: string
          title: Station Type
          description: Classification based on commuting patterns
          examples:
            - Morning Hotspot
            - Evening Hotspot
            - Balanced
        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
        - morning_demand
        - evening_demand
        - morning_evening_ratio
        - total_demand
        - station_type
        - ebike_ratio
      title: CommutingStationData
      description: Commuting station analysis data with demand patterns and classification.
    StationTypeSummaryData:
      properties:
        station_type:
          type: string
          title: Station Type
          description: Station type classification
          examples:
            - Morning Hotspot
            - Evening Hotspot
            - Balanced
        count:
          type: integer
          exclusiveMinimum: 0
          title: Count
          description: Number of stations in this category
          examples:
            - 45
            - 28
            - 67
        avg_total_demand:
          type: number
          minimum: 0
          title: Avg Total Demand
          description: Average total demand across stations in this category
          examples:
            - 8.5
            - 12.3
            - 15.7
        avg_morning_evening_ratio:
          type: number
          minimum: 0
          title: Avg Morning Evening Ratio
          description: Average morning/evening ratio for stations in this category
          examples:
            - 1.85
            - 0.48
            - 1.02
      type: object
      required:
        - station_type
        - count
        - avg_total_demand
        - avg_morning_evening_ratio
      title: StationTypeSummaryData
      description: Station type summary statistics aggregated across all stations.
  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.