> ## 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 Live Transit Status

> The public-transit vehicles in service in one location right now, from the network's realtime feed matched with its timetable: position, line, next stop and delay of each vehicle, a punctuality summary, the five lines with the highest average delay, and active service alerts.

Each vehicle's delay falls in a bucket: `early`, `on_time` (inside `on_time_window_seconds`, by default 1 minute early to 3 minutes late), `late` (up to 10 minutes), `very_late`, or `unknown` when no delay could be computed (`delay_reason` says why). Positions older than 2 minutes are marked `stale`; positions older than 15 minutes are dropped and counted in `dropped_stale_positions`.

**Failure Modes:**
- **401**: Token is missing or invalid
- **403**: Insufficient permissions, live transit not enabled, or the location is not configured for it
- **422**: `location` is missing or empty
- **502**: The realtime feed did not answer
- **503**: Live transit is not fully configured for the location

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



## OpenAPI

````yaml /api-reference/openapi.json get /copilot/live/transit/status
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/live/transit/status:
    get:
      tags:
        - Live
      summary: Get Live Transit Status
      description: >-
        The public-transit vehicles in service in one location right now, from
        the network's realtime feed matched with its timetable: position, line,
        next stop and delay of each vehicle, a punctuality summary, the five
        lines with the highest average delay, and active service alerts.


        Each vehicle's delay falls in a bucket: `early`, `on_time` (inside
        `on_time_window_seconds`, by default 1 minute early to 3 minutes late),
        `late` (up to 10 minutes), `very_late`, or `unknown` when no delay could
        be computed (`delay_reason` says why). Positions older than 2 minutes
        are marked `stale`; positions older than 15 minutes are dropped and
        counted in `dropped_stale_positions`.


        **Failure Modes:**

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

        - **403**: Insufficient permissions, live transit not enabled, or the
        location is not configured for it

        - **422**: `location` is missing or empty

        - **502**: The realtime feed did not answer

        - **503**: Live transit is not fully configured for the location


        **Required Auth Scopes:**

        - `copilot:live`
      operationId: transit_status_copilot_live_transit_status_get
      parameters:
        - name: location
          in: query
          required: true
          schema:
            type: string
            minLength: 1
            description: >-
              Transit network location, e.g. `milan`: one of the locations
              configured for your company's live transit.
            title: Location
          description: >-
            Transit network location, e.g. `milan`: one of the locations
            configured for your company's live transit.
      responses:
        '200':
          description: Transit status retrieved. Vehicles, summary, alerts.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransitStatusResponse'
        '401':
          description: Unauthorized. Token is missing or invalid.
        '403':
          description: Forbidden. Live transit not enabled for location.
        '422':
          description: Unprocessable Entity. Validation failed.
        '502':
          description: Bad Gateway. Live transit provider unavailable.
        '503':
          description: Service Unavailable. Live transit not configured.
      security:
        - HTTPBearer: []
        - HTTPBearer: []
components:
  schemas:
    TransitStatusResponse:
      properties:
        location:
          type: string
          title: Location
        generated_at:
          type: string
          format: date-time
          title: Generated At
        feed_timestamp:
          type:
            - string
            - 'null'
          format: date-time
          title: Feed Timestamp
        schedule_snapshot:
          type:
            - string
            - 'null'
          format: date-time
          title: Schedule Snapshot
        on_time_window_seconds:
          prefixItems:
            - type: integer
            - type: integer
          type: array
          maxItems: 2
          minItems: 2
          title: On Time Window Seconds
        dropped_stale_positions:
          type: integer
          title: Dropped Stale Positions
        vehicles:
          items:
            $ref: '#/components/schemas/TransitVehicle'
          type: array
          title: Vehicles
        summary:
          $ref: '#/components/schemas/TransitSummary'
        lines_delay:
          items:
            $ref: '#/components/schemas/TransitLineDelay'
          type: array
          title: Lines Delay
        alerts:
          items:
            $ref: '#/components/schemas/TransitAlert'
          type: array
          title: Alerts
        trip_updates_stale:
          type: boolean
          title: Trip Updates Stale
          default: false
        trip_updates_age_seconds:
          type:
            - integer
            - 'null'
          title: Trip Updates Age Seconds
      type: object
      required:
        - location
        - generated_at
        - feed_timestamp
        - schedule_snapshot
        - on_time_window_seconds
        - dropped_stale_positions
        - vehicles
        - summary
        - lines_delay
        - alerts
      title: TransitStatusResponse
      examples:
        - alerts:
            - active_from: '2026-11-25T05:00:00Z'
              active_until: '2026-12-05T23:00:00Z'
              alert_id: alert-5531
              description: The Piazzale Lodi stop is moved 50 m for roadworks.
              effect: STOP_MOVED
              header: Stop moved
              route_short_names:
                - '90'
              severity: WARNING
              stop_names:
                - Piazzale Lodi
          dropped_stale_positions: 1
          feed_timestamp: '2026-11-29T09:14:58Z'
          generated_at: '2026-11-29T09:15:02Z'
          lines_delay:
            - average_delay_seconds: 245
              route_id: R90
              route_short_name: '90'
              vehicles: 1
            - average_delay_seconds: 35
              route_id: R73
              route_short_name: '73'
              vehicles: 1
          location: milan
          on_time_window_seconds:
            - -60
            - 180
          schedule_snapshot: '2026-11-28T03:00:00Z'
          summary:
            early: 0
            in_service: 2
            late: 1
            on_time: 1
            on_time_pct: 50
            unknown: 0
            unknown_share_pct: 0
            very_late: 0
          trip_updates_age_seconds: 18
          trip_updates_stale: false
          vehicles:
            - bearing: 84
              bucket: late
              delay_reason: ''
              delay_seconds: 245
              direction_id: 0
              headsign: Lotto
              label: '2207'
              latitude: 45.4781
              license_plate: FX123AB
              longitude: 9.1913
              next_stop_id: S1123
              next_stop_name: Piazzale Lodi
              occupancy_status: MANY_SEATS_AVAILABLE
              position_age_seconds: 12
              route_color: C8102E
              route_id: R90
              route_short_name: '90'
              speed_kmh: 21.6
              stale: false
              trip_id: T90-0815-0
              vehicle_id: bus-2207
            - bearing: 270
              bucket: on_time
              delay_reason: ''
              delay_seconds: 35
              direction_id: 1
              headsign: Duomo
              label: '1180'
              latitude: 45.4699
              license_plate: FX456CD
              longitude: 9.2101
              next_stop_id: S2041
              next_stop_name: Corso XXII Marzo
              occupancy_status: FEW_SEATS_AVAILABLE
              position_age_seconds: 20
              route_color: 0072CE
              route_id: R73
              route_short_name: '73'
              speed_kmh: 14.4
              stale: false
              trip_id: T73-0832-1
              vehicle_id: bus-1180
    TransitVehicle:
      properties:
        vehicle_id:
          type: string
          title: Vehicle Id
        label:
          type:
            - string
            - 'null'
          title: Label
        license_plate:
          type:
            - string
            - 'null'
          title: License Plate
        latitude:
          type: number
          title: Latitude
        longitude:
          type: number
          title: Longitude
        bearing:
          type:
            - number
            - 'null'
          title: Bearing
        speed_kmh:
          type:
            - number
            - 'null'
          title: Speed Kmh
        route_id:
          type:
            - string
            - 'null'
          title: Route Id
        route_short_name:
          type:
            - string
            - 'null'
          title: Route Short Name
        route_color:
          type:
            - string
            - 'null'
          title: Route Color
        direction_id:
          type:
            - integer
            - 'null'
          title: Direction Id
        headsign:
          type:
            - string
            - 'null'
          title: Headsign
        trip_id:
          type:
            - string
            - 'null'
          title: Trip Id
        next_stop_id:
          type:
            - string
            - 'null'
          title: Next Stop Id
        next_stop_name:
          type:
            - string
            - 'null'
          title: Next Stop Name
        delay_seconds:
          type:
            - integer
            - 'null'
          title: Delay Seconds
        delay_reason:
          type:
            - string
            - 'null'
          title: Delay Reason
        bucket:
          type: string
          enum:
            - early
            - on_time
            - late
            - very_late
            - unknown
          title: Bucket
        position_age_seconds:
          type:
            - integer
            - 'null'
          title: Position Age Seconds
        stale:
          type: boolean
          title: Stale
        occupancy_status:
          type:
            - string
            - 'null'
          title: Occupancy Status
      type: object
      required:
        - vehicle_id
        - label
        - license_plate
        - latitude
        - longitude
        - bearing
        - speed_kmh
        - route_id
        - route_short_name
        - route_color
        - direction_id
        - headsign
        - trip_id
        - next_stop_id
        - next_stop_name
        - delay_seconds
        - delay_reason
        - bucket
        - position_age_seconds
        - stale
        - occupancy_status
      title: TransitVehicle
    TransitSummary:
      properties:
        in_service:
          type: integer
          title: In Service
        on_time_pct:
          type:
            - number
            - 'null'
          title: On Time Pct
        early:
          type: integer
          title: Early
        on_time:
          type: integer
          title: On Time
        late:
          type: integer
          title: Late
        very_late:
          type: integer
          title: Very Late
        unknown:
          type: integer
          title: Unknown
        unknown_share_pct:
          type:
            - number
            - 'null'
          title: Unknown Share Pct
      type: object
      required:
        - in_service
        - on_time_pct
        - early
        - on_time
        - late
        - very_late
        - unknown
        - unknown_share_pct
      title: TransitSummary
    TransitLineDelay:
      properties:
        route_id:
          type: string
          title: Route Id
        route_short_name:
          type:
            - string
            - 'null'
          title: Route Short Name
        average_delay_seconds:
          type: integer
          title: Average Delay Seconds
        vehicles:
          type: integer
          title: Vehicles
      type: object
      required:
        - route_id
        - route_short_name
        - average_delay_seconds
        - vehicles
      title: TransitLineDelay
    TransitAlert:
      properties:
        alert_id:
          type: string
          title: Alert Id
        header:
          type: string
          title: Header
        description:
          type: string
          title: Description
        effect:
          type:
            - string
            - 'null'
          title: Effect
        severity:
          type:
            - string
            - 'null'
          title: Severity
        stop_names:
          items:
            type: string
          type: array
          title: Stop Names
        route_short_names:
          items:
            type: string
          type: array
          title: Route Short Names
        active_from:
          type:
            - string
            - 'null'
          format: date-time
          title: Active From
        active_until:
          type:
            - string
            - 'null'
          format: date-time
          title: Active Until
      type: object
      required:
        - alert_id
        - header
        - description
        - effect
        - severity
        - stop_names
        - route_short_names
        - active_from
        - active_until
      title: TransitAlert
  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.