> ## 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.

# List Routes (Cross-Session)

> List routes across all sessions, newest first, for a driver app or a dispatch board. `scope` chooses whose routes: `assigned_to_me` (routes you are a driver of, in any company, the default), `my_company`, or `company_tree` (your company and its child companies). `status` filters by route status (see `status` in the response); `late` routes are also `active`, and `expiration_threshold_minutes` sets how long after its last estimated arrival a route stops being `active`. Routes without operations are never listed.

**Pagination:** pass the `next_cursor` of a page as `cursor` to get the next one; `has_more` is `false` on the last page.

**Failure Modes:**
- **401**: Token is missing or invalid
- **403**: Insufficient permissions
- **422**: Invalid parameters

**Required Auth Scopes:**
- `routing-operations:read`



## OpenAPI

````yaml /api-reference/openapi.json get /operations/routes
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:
  /operations/routes:
    get:
      tags:
        - Routing Sessions
      summary: List Routes (Cross-Session)
      description: >-
        List routes across all sessions, newest first, for a driver app or a
        dispatch board. `scope` chooses whose routes: `assigned_to_me` (routes
        you are a driver of, in any company, the default), `my_company`, or
        `company_tree` (your company and its child companies). `status` filters
        by route status (see `status` in the response); `late` routes are also
        `active`, and `expiration_threshold_minutes` sets how long after its
        last estimated arrival a route stops being `active`. Routes without
        operations are never listed.


        **Pagination:** pass the `next_cursor` of a page as `cursor` to get the
        next one; `has_more` is `false` on the last page.


        **Failure Modes:**

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

        - **403**: Insufficient permissions

        - **422**: Invalid parameters


        **Required Auth Scopes:**

        - `routing-operations:read`
      operationId: list_routes
      parameters:
        - name: cursor
          in: query
          required: false
          schema:
            type:
              - integer
              - 'null'
            description: >-
              `next_cursor` of the previous page; omit for the first page.
              Returns routes with an ID up to this value.
            title: Cursor
          description: >-
            `next_cursor` of the previous page; omit for the first page. Returns
            routes with an ID up to this value.
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 100
            minimum: 1
            description: Routes per page (1-100).
            default: 5
            title: Limit
          description: Routes per page (1-100).
        - name: status
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/RouteStatusFilter'
            description: Only routes with this status; `all` for every status.
            default: all
          description: Only routes with this status; `all` for every status.
        - name: expiration_threshold_minutes
          in: query
          required: false
          schema:
            type: integer
            exclusiveMinimum: 0
            description: >-
              How long, in minutes, a route stays `active` after its last
              estimated arrival before it becomes `expired`. Defaults to 24
              hours.
            default: 1440
            title: Expiration Threshold Minutes
          description: >-
            How long, in minutes, a route stays `active` after its last
            estimated arrival before it becomes `expired`. Defaults to 24 hours.
        - name: scope
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/RouteListScope'
            description: >-
              Whose routes: `assigned_to_me` (you are a driver), `my_company` or
              `company_tree` (your company and its child companies).
            default: assigned_to_me
          description: >-
            Whose routes: `assigned_to_me` (you are a driver), `my_company` or
            `company_tree` (your company and its child companies).
      responses:
        '200':
          description: >-
            Routes retrieved. Returns a cursor-paginated list with computed
            status, progress, driver names, and operation counts.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CursorPage'
        '401':
          description: Unauthorized. Token is missing or invalid.
        '403':
          description: Forbidden. Insufficient permissions.
        '422':
          description: Unprocessable Entity. Invalid parameters.
        '500':
          description: Internal Server Error.
      security:
        - HTTPBearer: []
        - HTTPBearer: []
components:
  schemas:
    RouteStatusFilter:
      type: string
      enum:
        - all
        - active
        - late
        - expired
        - completed
      title: RouteStatusFilter
      description: |-
        Route status to list; ``all`` lists every route with operations.

        ``late`` routes are also ``active``; ``completed`` routes can also be
        ``active`` or ``expired`` by time.
    RouteListScope:
      type: string
      enum:
        - assigned_to_me
        - my_company
        - company_tree
      title: RouteListScope
      description: >-
        Which routes to list: those you drive, your company's, or your company
        tree's.


        ``assigned_to_me`` matches routes you are a driver of, in any company.

        ``company_tree`` adds your child companies to ``my_company``.
    CursorPage:
      properties:
        items:
          items:
            $ref: '#/components/schemas/RouteListItem'
          type: array
          title: Items
          description: Routes, newest first.
        next_cursor:
          type:
            - integer
            - 'null'
          title: Next Cursor
          description: Pass as `cursor` to get the next page; absent on the last page.
        has_more:
          type: boolean
          title: Has More
          description: Whether more results exist beyond this page.
      type: object
      required:
        - items
        - has_more
      title: CursorPage
      description: A page of routes, newest first, with the cursor of the next page.
      examples:
        - has_more: true
          items:
            - completed_operations: 1
              drivers:
                - email: marco.bianchi@acme-mobility.com
                  full_name: Marco Bianchi
                  id: 57
              end_at: '2026-11-30T09:40:00Z'
              id: 412
              progress: 0.5
              reroute_enabled: true
              route_identifier: R1
              session_slug: 3f6c2a9e-8d41-4b7a-9c2e-5a1f0e7d9b13
              start_at: '2026-11-30T08:00:00Z'
              status: active
              total_distance: 14.2
              total_operations: 2
            - completed_operations: 6
              drivers:
                - email: marco.bianchi@acme-mobility.com
                  full_name: Marco Bianchi
                  id: 57
              end_at: '2026-11-29T10:10:00Z'
              id: 409
              progress: 1
              reroute_enabled: true
              route_identifier: R1
              session_slug: b07e41d2-5c9a-4f3e-8a61-2d9c7f1e0a44
              start_at: '2026-11-29T08:00:00Z'
              status: completed
              total_distance: 18.6
              total_operations: 6
          next_cursor: 408
    RouteListItem:
      properties:
        id:
          type: integer
          title: Id
          description: Route ID.
        session_slug:
          type: string
          title: Session Slug
          description: Session the route belongs to.
        route_identifier:
          type: string
          title: Route Identifier
          description: Your name for the route.
        reroute_enabled:
          type: boolean
          title: Reroute Enabled
          description: Whether the route can be re-optimized while it runs.
        start_at:
          type:
            - string
            - 'null'
          format: date-time
          title: Start At
          description: Planned start.
        end_at:
          type:
            - string
            - 'null'
          format: date-time
          title: End At
          description: Planned end.
        total_distance:
          type:
            - number
            - 'null'
          title: Total Distance
          description: Total planned distance in kilometres.
        status:
          $ref: '#/components/schemas/RouteStatus'
          description: >-
            `completed` when no operation is left open. Otherwise `expired` when
            the route's last estimated arrival is older than the expiration
            window (24 hours by default), `late` when an open operation is past
            its estimated arrival, and `active` otherwise.
        total_operations:
          type: integer
          title: Total Operations
          description: Number of operations.
        completed_operations:
          type: integer
          title: Completed Operations
          description: Completed operations.
        progress:
          type: number
          title: Progress
          description: 'Completion ratio: completed/total (0.0–1.0).'
        drivers:
          items:
            $ref: '#/components/schemas/RouteDriverPublic'
          type: array
          title: Drivers
          description: Assigned drivers.
          default: []
      type: object
      required:
        - id
        - session_slug
        - route_identifier
        - reroute_enabled
        - status
        - total_operations
        - completed_operations
        - progress
      title: RouteListItem
      description: >-
        Route as it appears in paginated list endpoints (with computed
        metadata).
      examples:
        - completed_operations: 1
          drivers:
            - email: marco.bianchi@acme-mobility.com
              full_name: Marco Bianchi
              id: 57
          end_at: '2026-11-30T09:40:00Z'
          id: 412
          progress: 0.5
          reroute_enabled: true
          route_identifier: R1
          session_slug: 3f6c2a9e-8d41-4b7a-9c2e-5a1f0e7d9b13
          start_at: '2026-11-30T08:00:00Z'
          status: active
          total_distance: 14.2
          total_operations: 2
    RouteStatus:
      type: string
      enum:
        - active
        - late
        - expired
        - completed
      title: RouteStatus
      description: |-
        Computed route status based on operation state and timing.

        Assigned per-route in list responses. Display priority is
        ``completed > late > active > expired``.
    RouteDriverPublic:
      properties:
        id:
          type: integer
          title: Id
          description: User ID of the driver.
        full_name:
          type: string
          title: Full Name
          description: Driver's full name.
        email:
          type: string
          title: Email
          description: Driver's email.
      type: object
      required:
        - id
        - full_name
        - email
      title: RouteDriverPublic
      description: Driver assigned to a route.
      examples:
        - email: marco.bianchi@acme-mobility.com
          full_name: Marco Bianchi
          id: 57
  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.