> ## 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 Station Refill Time Analysis

> Analyze how long stations remain empty and identify slow refill patterns. Returns average refill times by hour and station, stations with the longest shortage durations, refill efficiency metrics, and peak-hour refill ratios.

Use this to optimize rebalancing operations and reduce empty-station downtime.

**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}/refill_times
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}/refill_times:
    get:
      tags:
        - Station Based Analytics
      summary: Get Station Refill Time Analysis
      description: >-
        Analyze how long stations remain empty and identify slow refill
        patterns. Returns average refill times by hour and station, stations
        with the longest shortage durations, refill efficiency metrics, and
        peak-hour refill ratios.


        Use this to optimize rebalancing operations and reduce empty-station
        downtime.


        **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_refill_times
      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: >-
            Refill time data retrieved. Returns hourly refill patterns and
            per-station refill efficiency metrics.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RefillTimesResponse'
        '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:
    RefillTimesResponse:
      properties:
        hourly_refill:
          items:
            $ref: '#/components/schemas/HourlyRefillData'
          type: array
          title: Hourly Refill
          description: >-
            Hourly breakdown of refill patterns showing timing and frequency
            metrics for each hour of the day
          examples:
            - - avg_refill_time_min: 45.2
                count: 5
                hour: 8
        summary_stats:
          additionalProperties:
            type: number
          type: object
          title: Summary Stats
          description: >-
            Overall summary statistics including total events, average times,
            and system-wide efficiency metrics
          examples:
            - avg_refill_time: 52.3
              median_refill_time: 47.8
              total_refill_events: 1250
        station_metrics:
          items:
            $ref: '#/components/schemas/RefillStationMetrics'
          type: array
          title: Station Metrics
          description: >-
            Station-level refill metrics including coordinates, timing
            statistics, and performance indicators for individual stations
      type: object
      required:
        - hourly_refill
        - summary_stats
        - station_metrics
      title: RefillTimesResponse
      description: Refill times analysis response with timing and efficiency metrics.
      examples:
        - hourly_refill:
            - avg_refill_time_min: 38.5
              count: 214
              hour: 7
            - avg_refill_time_min: 24
              count: 166
              hour: 12
          station_metrics:
            - afternoon_refills: 48
              avg_refill_time_min: 47.3
              ebike_ratio: 0.28
              evening_refills: 52
              max_refill_time_min: 212
              median_refill_time_min: 35
              min_refill_time_min: 5
              morning_refills: 71
              night_refills: 15
              peak_hour_ratio: 0.66
              quick_refill_ratio: 0.42
              quick_refills_30min: 79
              refill_consistency_score: 0.45
              shortage_rate: 0.34
              slow_refills_60min: 44
              station_id: 245
              station_latitude: 45.4859
              station_longitude: 9.2045
              station_name: Stazione Centrale
              std_refill_time_min: 38.1
              total_refill_events: 186
          summary_stats:
            avg_refill_time: 31.2
            median_refill_time: 22
            total_refill_events: 5320
    HourlyRefillData:
      properties:
        hour:
          type: integer
          maximum: 23
          minimum: 0
          title: Hour
          description: Hour of day (0-23)
          examples:
            - 8
            - 14
            - 20
        avg_refill_time_min:
          type: number
          minimum: 0
          title: Avg Refill Time Min
          description: Average time to refill stations during this hour (in minutes)
          examples:
            - 45.2
            - 62.7
            - 38.9
        count:
          type: integer
          minimum: 0
          title: Count
          description: Number of refill events during this hour
          examples:
            - 3
            - 7
            - 12
      type: object
      required:
        - hour
        - avg_refill_time_min
        - count
      title: HourlyRefillData
      description: Hourly refill pattern data with timing and frequency metrics.
    RefillStationMetrics:
      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
        total_refill_events:
          type: integer
          minimum: 0
          title: Total Refill Events
          description: Total number of refill events at this station
          examples:
            - 25
            - 150
            - 300
        avg_refill_time_min:
          type: number
          minimum: 0
          title: Avg Refill Time Min
          description: Average time to refill this station (in minutes)
          examples:
            - 45.2
            - 62.7
            - 38.9
        median_refill_time_min:
          type: number
          minimum: 0
          title: Median Refill Time Min
          description: Median time to refill this station (in minutes)
          examples:
            - 42.1
            - 58.3
            - 35.6
        min_refill_time_min:
          type: number
          minimum: 0
          title: Min Refill Time Min
          description: Minimum time to refill this station (in minutes)
          examples:
            - 5.2
            - 15.1
            - 8.7
        max_refill_time_min:
          type: number
          minimum: 0
          title: Max Refill Time Min
          description: Maximum time to refill this station (in minutes)
          examples:
            - 180.5
            - 245.7
            - 120.3
        std_refill_time_min:
          type: number
          minimum: 0
          title: Std Refill Time Min
          description: Standard deviation of refill times (in minutes)
          examples:
            - 25.4
            - 38.9
            - 15.2
        morning_refills:
          type: integer
          minimum: 0
          title: Morning Refills
          description: Number of refill events during morning hours (6-11 AM)
          examples:
            - 8
            - 15
            - 25
        afternoon_refills:
          type: integer
          minimum: 0
          title: Afternoon Refills
          description: Number of refill events during afternoon hours (12-17 PM)
          examples:
            - 12
            - 22
            - 35
        evening_refills:
          type: integer
          minimum: 0
          title: Evening Refills
          description: Number of refill events during evening hours (18-23 PM)
          examples:
            - 5
            - 18
            - 28
        night_refills:
          type: integer
          minimum: 0
          title: Night Refills
          description: Number of refill events during night hours (0-5 AM)
          examples:
            - 2
            - 8
            - 12
        quick_refills_30min:
          type: integer
          minimum: 0
          title: Quick Refills 30Min
          description: Number of refill events completed within 30 minutes
          examples:
            - 15
            - 35
            - 55
        slow_refills_60min:
          type: integer
          minimum: 0
          title: Slow Refills 60Min
          description: Number of refill events taking longer than 60 minutes
          examples:
            - 3
            - 12
            - 20
        refill_consistency_score:
          type: number
          maximum: 1
          minimum: 0
          title: Refill Consistency Score
          description: >-
            Consistency score based on refill time variability (0-1, higher is
            more consistent)
          examples:
            - 0.75
            - 0.82
            - 0.91
        peak_hour_ratio:
          type: number
          maximum: 1
          minimum: 0
          title: Peak Hour Ratio
          description: >-
            Ratio of refills during peak hours (morning + evening) to total
            refills
          examples:
            - 0.45
            - 0.62
            - 0.78
        quick_refill_ratio:
          type: number
          maximum: 1
          minimum: 0
          title: Quick Refill Ratio
          description: Ratio of quick refills (<=30 min) to total refills
          examples:
            - 0.6
            - 0.73
            - 0.85
        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
        shortage_rate:
          type: number
          maximum: 1
          minimum: 0
          title: Shortage Rate
          description: Proportion of time this station has zero vehicles available
          examples:
            - 0.05
            - 0.18
            - 0.42
      type: object
      required:
        - station_id
        - station_name
        - station_latitude
        - station_longitude
        - total_refill_events
        - avg_refill_time_min
        - median_refill_time_min
        - min_refill_time_min
        - max_refill_time_min
        - std_refill_time_min
        - morning_refills
        - afternoon_refills
        - evening_refills
        - night_refills
        - quick_refills_30min
        - slow_refills_60min
        - refill_consistency_score
        - peak_hour_ratio
        - quick_refill_ratio
        - ebike_ratio
        - shortage_rate
      title: RefillStationMetrics
      description: Comprehensive refill station metrics.
  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.