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

> List your company's routing sessions, paginated with `page` and `size`, with their status, planned duration and operation counts. Set `include_children_companies` to also list those of your child companies.

**Failure Modes:**
- **401**: Token is missing or invalid
- **403**: Insufficient permissions
- **422**: Invalid filter, sort field or page parameters

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



## OpenAPI

````yaml /api-reference/openapi.json get /operations/sessions
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/sessions:
    get:
      tags:
        - Routing Sessions
      summary: List Sessions
      description: >-
        List your company's routing sessions, paginated with `page` and `size`,
        with their status, planned duration and operation counts. Set
        `include_children_companies` to also list those of your child companies.


        **Failure Modes:**

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

        - **403**: Insufficient permissions

        - **422**: Invalid filter, sort field or page parameters


        **Required Auth Scopes:**

        - `routing-sessions:read`
      operationId: list_sessions
      parameters:
        - name: include_children_companies
          in: query
          required: false
          schema:
            type: boolean
            description: Also include the records of your child companies.
            default: false
            title: Include Children Companies
          description: Also include the records of your child companies.
        - name: order_by
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
            description: >-
              Comma-separated fields to sort by; prefix a field with `-` for
              descending order, e.g. `-created_at,name`.
            title: Order By
          description: >-
            Comma-separated fields to sort by; prefix a field with `-` for
            descending order, e.g. `-created_at,name`.
        - name: search
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
            description: Case-insensitive text matched anywhere in the session slug.
            title: Search
          description: Case-insensitive text matched anywhere in the session slug.
        - name: company_slug
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
            description: Only records of this company (exact slug).
            title: Company Slug
          description: Only records of this company (exact slug).
        - name: company_slug__in
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
            description: Only records of these companies (comma-separated slugs).
            title: Company Slug  In
          description: Only records of these companies (comma-separated slugs).
        - name: created_at__gte
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
            format: date-time
            description: Sessions created at or after this time (ISO 8601).
            title: Created At  Gte
          description: Sessions created at or after this time (ISO 8601).
        - name: created_at__lte
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
            format: date-time
            description: Sessions created at or before this time (ISO 8601).
            title: Created At  Lte
          description: Sessions created at or before this time (ISO 8601).
      responses:
        '200':
          description: >-
            Sessions retrieved. Returns a paginated list with computed status,
            duration, route count, and operation counts.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Page__T_Customized_SessionListItem_'
              example:
                items:
                  - slug: 3f6c2a9e-8d41-4b7a-9c2e-5a1f0e7d9b13
                    company_slug: acme-mobility
                    created_at: '2026-11-30T07:58:10Z'
                    status: in-progress
                    duration_seconds: 6000
                    route_count: 1
                    total_operations: 2
                    completed_operations: 1
                    operation_type_counts:
                      - task_type: battery_swap
                        count: 1
                      - task_type: pickup
                        count: 1
                total: 1
                page: 1
                size: 10
                pages: 1
        '401':
          description: Unauthorized. Token is missing or invalid.
        '403':
          description: Forbidden. Insufficient permissions.
        '422':
          description: Unprocessable Entity. Invalid filter.
        '500':
          description: Internal Server Error.
      security:
        - HTTPBearer: []
        - HTTPBearer: []
components:
  schemas:
    Page__T_Customized_SessionListItem_:
      properties:
        items:
          items:
            $ref: '#/components/schemas/SessionListItem'
          type: array
          title: Items
        total:
          type: integer
          minimum: 0
          title: Total
        page:
          type: integer
          minimum: 1
          title: Page
        size:
          type: integer
          minimum: 1
          title: Size
        pages:
          type: integer
          minimum: 0
          title: Pages
      type: object
      required:
        - items
        - total
        - page
        - size
        - pages
      title: Page[~T]Customized[SessionListItem]
    SessionListItem:
      properties:
        slug:
          type: string
          title: Slug
          description: Session identifier.
        company_slug:
          type: string
          title: Company Slug
          description: Owning company.
        created_at:
          type: string
          format: date-time
          title: Created At
          description: When the session was dispatched.
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
          title: Updated At
          description: Last update, if any.
        status:
          $ref: '#/components/schemas/SessionStatus'
          description: >-
            `completed` when every operation is completed or cancelled (or there
            are none); `interrupted` when operations are still open after the
            last route's planned end; `in-progress` otherwise.
        duration_seconds:
          type:
            - number
            - 'null'
          title: Duration Seconds
          description: >-
            Planned duration in seconds, from the first route start to the last
            route end.
        route_count:
          type: integer
          title: Route Count
          description: Number of routes.
        total_operations:
          type: integer
          title: Total Operations
          description: Number of operations.
        completed_operations:
          type: integer
          title: Completed Operations
          description: Completed operations.
        operation_type_counts:
          items:
            $ref: '#/components/schemas/OperationTypeCounts'
          type: array
          title: Operation Type Counts
          description: Number of operations per type.
          default: []
      type: object
      required:
        - slug
        - company_slug
        - created_at
        - status
        - route_count
        - total_operations
        - completed_operations
      title: SessionListItem
      description: Session as it appears in the paginated list (with computed metadata).
    SessionStatus:
      type: string
      enum:
        - completed
        - in-progress
        - interrupted
      title: SessionStatus
      description: Derived session status based on operation completion state.
    OperationTypeCounts:
      properties:
        task_type:
          type: string
          title: Task Type
          description: Operation type.
        count:
          type: integer
          title: Count
          description: Operations of this type in the session.
      type: object
      required:
        - task_type
        - count
      title: OperationTypeCounts
      description: Count of operations grouped by task_type.
  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.