> ## 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 Free-Float Trip History

> Retrieve completed trip history data for a free-floating vehicle provider. Returns spatial start/end events, hourly start/end events, completed trip totals, and calendar-period trip counts.

Use this to understand usage patterns, identify high-demand zones, and plan fleet distribution.

**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/free-float/{provider}/trip_history
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/free-float/{provider}/trip_history:
    get:
      tags:
        - Free Float Analytics
      summary: Get Free-Float Trip History
      description: >-
        Retrieve completed trip history data for a free-floating vehicle
        provider. Returns spatial start/end events, hourly start/end events,
        completed trip totals, and calendar-period trip counts.


        Use this to understand usage patterns, identify high-demand zones, and
        plan fleet distribution.


        **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_free_float_trip_history
      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 free-floating trip-history 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 free-floating trip-history 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
            minLength: 1
            description: >-
              Location to analyse, e.g. `milan`: one of the locations (or their
              geolabels) that your company's trip-history analytics are enabled
              for with this provider. Any other value is refused (404
              `no_data_binding`, or 403 for providers whose trips are stored per
              location).
            examples:
              - milan
              - turin
            title: Geolabel
          description: >-
            Location to analyse, e.g. `milan`: one of the locations (or their
            geolabels) that your company's trip-history analytics are enabled
            for with this provider. Any other value is refused (404
            `no_data_binding`, or 403 for providers whose trips are stored per
            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, e.g.
              `2026-10-01T00:00:00Z`.
            examples:
              - '2026-10-01T00:00:00Z'
            title: Start Date
          description: >-
            Start of the analysis period, an ISO 8601 date-time, 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, e.g.
              `2026-10-31T23:59:59Z`.
            examples:
              - '2026-10-31T23:59:59Z'
            title: End Date
          description: >-
            End of the analysis period, an ISO 8601 date-time, e.g.
            `2026-10-31T23:59:59Z`.
        - name: start_hour
          in: query
          required: false
          schema:
            type:
              - integer
              - 'null'
            maximum: 23
            minimum: 0
            description: >-
              Keep only trips starting at or after this hour of the day (0-23,
              in the data source's time zone, UTC unless configured otherwise).
            examples:
              - 7
            title: Start Hour
          description: >-
            Keep only trips starting at or after this hour of the day (0-23, in
            the data source's time zone, UTC unless configured otherwise).
        - name: end_hour
          in: query
          required: false
          schema:
            type:
              - integer
              - 'null'
            maximum: 23
            minimum: 0
            description: >-
              Keep only trips ending at or before this hour of the day (0-23,
              same time zone as `start_hour`). Alone, it applies to the trip
              start hour.
            examples:
              - 10
            title: End Hour
          description: >-
            Keep only trips ending at or before this hour of the day (0-23, same
            time zone as `start_hour`). Alone, it applies to the trip start
            hour.
      responses:
        '200':
          description: >-
            Trip history retrieved. Returns spatial distribution, temporal
            patterns, trip counts, and usage statistics.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TripHistoryResponse'
        '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:
    TripHistoryResponse:
      properties:
        trip_locations:
          items:
            $ref: '#/components/schemas/TripLocationCount'
          type: array
          title: Trip Locations
          description: >-
            Spatial distribution of trips aggregated by rounded coordinates.
            Each location represents a cluster of nearby trip
            origins/destinations.
          examples:
            - - end_count: 18
                latitude: 45.4642
                longitude: 9.19
                start_count: 15
                total_count: 33
        hourly_distribution:
          items:
            $ref: '#/components/schemas/HourlyDistribution'
          type: array
          title: Hourly Distribution
          description: >-
            Temporal distribution showing trip patterns by hour of day. Useful
            for identifying peak usage periods and demand planning.
          examples:
            - - end_count: 142
                hour: 9
                start_count: 156
                total_count: 298
        date_distribution:
          items:
            $ref: '#/components/schemas/DateDistribution'
          type: array
          title: Date Distribution
          description: >-
            Trip volume by calendar period over the analysis range. The date is
            the bucket label for each period.
          examples:
            - - date: '2023-01-15'
                trip_count: 1456
        total_trips:
          type: integer
          minimum: 0
          title: Total Trips
          description: Completed rides in the selected data set
        date_bucket:
          type: string
          enum:
            - day
            - week
            - fortnight
            - month
            - quarter
          title: Date Bucket
          description: Calendar period represented by each date-distribution point
        feasibility:
          type: string
          title: Feasibility
          description: Analysis execution status indicating success or error state
          examples:
            - success
            - error
            - partial
        message:
          type: string
          title: Message
          description: Human-readable message describing analysis results or errors
          examples:
            - >-
              Analysis completed successfully. Found 1,234 locations with trip
              data.
            - 'Error during trip history analysis: Invalid date range provided.'
      type: object
      required:
        - trip_locations
        - hourly_distribution
        - date_distribution
        - total_trips
        - date_bucket
        - feasibility
        - message
      title: TripHistoryResponse
      description: |-
        Comprehensive trip history analysis response containing spatial,
        temporal, and usage pattern insights for free-floating vehicle systems.
      examples:
        - date_bucket: day
          date_distribution:
            - date: '2026-10-01'
              trip_count: 1462
            - date: '2026-10-02'
              trip_count: 1518
          feasibility: success
          hourly_distribution:
            - end_count: 1655
              hour: 8
              start_count: 1820
              total_count: 3475
            - end_count: 2190
              hour: 18
              start_count: 2104
              total_count: 4294
          message: >-
            Analysis completed successfully. Found 2318 locations with trip
            data.
          total_trips: 45230
          trip_locations:
            - end_count: 388
              latitude: 45.4859
              longitude: 9.2045
              start_count: 412
              total_count: 800
            - end_count: 371
              latitude: 45.4642
              longitude: 9.19
              start_count: 356
              total_count: 727
    TripLocationCount:
      properties:
        latitude:
          type: number
          maximum: 90
          minimum: -90
          title: Latitude
          description: Latitude coordinate rounded to 4 decimal places for aggregation
          examples:
            - 45.4642
            - 41.9028
            - 52.3676
        longitude:
          type: number
          maximum: 180
          minimum: -180
          title: Longitude
          description: Longitude coordinate rounded to 4 decimal places for aggregation
          examples:
            - 9.19
            - 12.4964
            - 4.9041
        start_count:
          type: integer
          minimum: 0
          title: Start Count
          description: Number of trips starting at this location
          examples:
            - 15
            - 42
            - 128
        end_count:
          type: integer
          minimum: 0
          title: End Count
          description: Number of trips ending at this location
          examples:
            - 18
            - 39
            - 135
        total_count:
          type: integer
          minimum: 0
          title: Total Count
          description: Combined trip-start and trip-end events at this location
          examples:
            - 33
            - 81
            - 263
      type: object
      required:
        - latitude
        - longitude
        - start_count
        - end_count
        - total_count
      title: TripLocationCount
      description: |-
        Trip count data for a specific geographic location coordinate.
        Aggregates trip starts and ends at rounded coordinate precision.
    HourlyDistribution:
      properties:
        hour:
          type: integer
          maximum: 23
          minimum: 0
          title: Hour
          description: Hour of the day in 24-hour format
          examples:
            - 0
            - 9
            - 18
            - 23
        start_count:
          type: integer
          minimum: 0
          title: Start Count
          description: Number of trips starting during this hour
          examples:
            - 45
            - 156
            - 89
        end_count:
          type: integer
          minimum: 0
          title: End Count
          description: Number of trips ending during this hour
          examples:
            - 42
            - 163
            - 92
        total_count:
          type: integer
          minimum: 0
          title: Total Count
          description: Combined trip-start and trip-end events during this hour
          examples:
            - 87
            - 319
            - 181
      type: object
      required:
        - hour
        - start_count
        - end_count
        - total_count
      title: HourlyDistribution
      description: |-
        Trip count distribution aggregated by hour of the day.
        Useful for identifying peak usage patterns and demand forecasting.
    DateDistribution:
      properties:
        date:
          type: string
          pattern: ^\d{4}-\d{2}-\d{2}$
          title: Date
          description: Date in ISO 8601 YYYY-MM-DD format
          examples:
            - '2023-01-15'
            - '2023-12-31'
            - '2024-06-15'
        trip_count:
          type: integer
          minimum: 0
          title: Trip Count
          description: Total trips in the calendar period labelled by this date
          examples:
            - 234
            - 1456
            - 892
      type: object
      required:
        - date
        - trip_count
      title: DateDistribution
      description: |-
        Trip count distribution by calendar period for temporal analysis.
        Shows trip volume trends over time.
  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.