> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getswitch.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate Operations Based on Strategies

> Generate a list of tasks based on provided strategies, sorting criteria, and filtering conditions. This endpoint processes multiple strategies to create actionable tasks for vehicle operations and zone management.

Each strategy can define:
- Zone filtering with whitelist/blacklist
- Vehicle and zone conditions using logical operators
- Custom sorting criteria
- Strategy-specific parameters

**Failure Modes:**
- **400**: Location, granularity or grid not enabled for your company
- **401**: Invalid or missing authentication credentials
- **403**: Insufficient permissions
- **404**: Your company has no fleet or forecasts configured
- **422**: Invalid request data that fails validation
- **500**: Internal server error during task generation

**Required Auth Scopes:**
- `rebalance:read`



## OpenAPI

````yaml /api-reference/openapi.json post /operations/suggest
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://api.getswitch.io
    description: Production
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/suggest:
    post:
      tags:
        - Operations
      summary: Generate Operations Based on Strategies
      description: >-
        Generate a list of tasks based on provided strategies, sorting criteria,
        and filtering conditions. This endpoint processes multiple strategies to
        create actionable tasks for vehicle operations and zone management.


        Each strategy can define:

        - Zone filtering with whitelist/blacklist

        - Vehicle and zone conditions using logical operators

        - Custom sorting criteria

        - Strategy-specific parameters


        **Failure Modes:**

        - **400**: Location, granularity or grid not enabled for your company

        - **401**: Invalid or missing authentication credentials

        - **403**: Insufficient permissions

        - **404**: Your company has no fleet or forecasts configured

        - **422**: Invalid request data that fails validation

        - **500**: Internal server error during task generation


        **Required Auth Scopes:**

        - `rebalance:read`
      operationId: generate_tasks
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OperationsGenerationConfiguration'
        required: true
      responses:
        '200':
          description: Operations generated successfully from provided strategies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OperationsGenerationResponse'
        '400':
          description: >-
            Bad Request. Location, granularity or grid not enabled for your
            company.
        '401':
          description: Unauthorized. Invalid or missing credentials.
        '403':
          description: Forbidden. Insufficient permissions.
        '422':
          description: Unprocessable Entity. Invalid request data that fails validation.
        '500':
          description: >-
            Internal Server Error. Operation generation failed or system error
            occurred.
      security:
        - HTTPBearer: []
        - HTTPBearer: []
components:
  schemas:
    OperationsGenerationConfiguration:
      properties:
        time_granularity_minutes:
          type: integer
          title: Time Granularity Minutes
          description: >-
            Length of each forecast time bucket in minutes, e.g. 60. Together
            with `prediction_horizon_size` it must match one of the horizons
            enabled for your company; a 400 response lists them.
        prediction_horizon_size:
          type: integer
          title: Prediction Horizon Size
          description: >-
            Size of the prediction horizon in time steps (each one long
            `time_granularity_minutes` minutes)
        grid:
          $ref: '#/components/schemas/GridFilters'
          description: Grid schema defining the spatial structure for the forecast
        zones_whitelist:
          items:
            type: string
          type:
            - array
            - 'null'
          title: Zones Whitelist
          description: >-
            Optional list of zone IDs to include in the response. If provided,
            only zones in this list will be returned.
        zones_blacklist:
          items:
            type: string
          type:
            - array
            - 'null'
          title: Zones Blacklist
          description: >-
            Optional list of zone IDs to exclude from the response. Takes
            precedence over zones_whitelist when both are provided.
        upstream_tasks:
          items:
            $ref: '#/components/schemas/UpstreamTask'
          type:
            - array
            - 'null'
          title: Upstream Tasks
          description: >-
            Optional list of upstream tasks to be converted into operations.
            These tasks will be enriched with spatial and zone information from
            the retrieved vehicles and included in the suggestions list.
        vehicle_pool:
          items:
            type: string
          type:
            - array
            - 'null'
          title: Vehicle Pool
          description: >-
            Optional list of vehicle IDs to restrict operation generation to.
            When specified, strategy-generated operations will only target
            vehicles whose ID is present in this list. Upstream tasks are not
            affected by this filter and may reference any vehicle.
        strategies:
          items:
            anyOf:
              - $ref: '#/components/schemas/BatteryThresholdStrategy'
              - $ref: '#/components/schemas/IdleTimeStrategy'
              - $ref: '#/components/schemas/ImbalanceDropoffsStrategy'
              - $ref: '#/components/schemas/ImbalancePickupsStrategy'
              - $ref: '#/components/schemas/MasterRechargeStrategy'
              - $ref: '#/components/schemas/RechargeThresholdStrategy'
          type: array
          minItems: 1
          title: Strategies
          description: Array of strategies to be applied for operation generation
        include_zones_data:
          type: boolean
          title: Include Zones Data
          description: Include zones data in the response
          default: false
        include_vehicles_data:
          type: boolean
          title: Include Vehicles Data
          description: Include vehicles data in the response
          default: false
      type: object
      required:
        - time_granularity_minutes
        - prediction_horizon_size
        - grid
        - strategies
      title: OperationsGenerationConfiguration
      description: Request schema for operation generation with multiple strategies.
      examples:
        - grid:
            grid_type: squares
            location: milan
            tile_size: 1000
          include_vehicles_data: false
          include_zones_data: false
          prediction_horizon_size: 3
          strategies:
            - slug: battery-threshold
              strat_params:
                threshold: 20
            - slug: imbalance-pickups
              strat_params:
                threshold: 1.5
          time_granularity_minutes: 60
          zones_whitelist:
            - '1042'
            - '1043'
    OperationsGenerationResponse:
      properties:
        suggestions:
          additionalProperties:
            items:
              $ref: '#/components/schemas/Operation'
            type: array
          type: object
          title: Suggestions
          description: >-
            Operations suggested by each strategy, keyed by strategy slug;
            operations built from `upstream_tasks` are under `upstream`.
          examples:
            - imbalance-pickups:
                - additional_notes: 'Zone surplus 1.0 vehicles (threshold: 1.5)'
                  generated_at: '2026-11-30T07:55:00Z'
                  latitude: 45.4671
                  longitude: 9.1883
                  operation_type: pickup
                  priority: medium
                  priority_value: 2.1
                  valid_from: '2026-11-30T08:00:00Z'
                  valid_until: '2026-11-30T09:00:00Z'
                  vehicle_id: acme-sc-0457
                  zone_id: '1042'
        zones:
          items:
            $ref: '#/components/schemas/GridFeature'
          type:
            - array
            - 'null'
          title: Zones
          description: >-
            Unique zones used during operation generation (if requested). Each
            zone is a GeoJSON feature with geometry and properties.
          examples:
            - - geometry:
                  coordinates:
                    - - - 9.18
                        - 45.46
                      - - 9.1928
                        - 45.46
                      - - 9.1928
                        - 45.469
                      - - 9.18
                        - 45.469
                      - - 9.18
                        - 45.46
                  type: Polygon
                properties:
                  zone_id: '1042'
                type: Feature
              - geometry:
                  coordinates:
                    - - - 9.1928
                        - 45.46
                      - - 9.2056
                        - 45.46
                      - - 9.2056
                        - 45.469
                      - - 9.1928
                        - 45.469
                      - - 9.1928
                        - 45.46
                  type: Polygon
                properties:
                  zone_id: '1043'
                type: Feature
        vehicles:
          items:
            $ref: '#/components/schemas/Vehicle'
          type:
            - array
            - 'null'
          title: Vehicles
          description: Unique vehicles used during operation generation (if requested)
          examples:
            - - battery_level: 12
                id: acme-sc-0193
                last_moved: '2026-11-30T06:41:03Z'
                last_seen: '2026-11-30T07:50:12Z'
                lat: 45.4642
                licence_plate: SC0193
                lon: 9.1856
                status: available
                vehicle_model: S-200
                vehicle_type: scooter
                zone_id: '1042'
      type: object
      required:
        - suggestions
      title: OperationsGenerationResponse
      description: Response schema for operation generation.
      examples:
        - suggestions:
            battery-threshold:
              - additional_notes: Battery level (12.0%) below threshold (20.0%)
                generated_at: '2026-11-30T07:55:00Z'
                latitude: 45.4642
                longitude: 9.1856
                operation_type: battery_swap
                priority: high
                priority_value: 2.4
                vehicle_id: acme-sc-0193
                vehicle_properties:
                  battery_level: 12
                  id: acme-sc-0193
                  last_moved: '2026-11-30T06:41:03Z'
                  last_seen: '2026-11-30T07:50:12Z'
                  lat: 45.4642
                  licence_plate: SC0193
                  lon: 9.1856
                  status: available
                  vehicle_model: S-200
                  vehicle_type: scooter
                zone_id: '1042'
            imbalance-pickups:
              - additional_notes: 'Zone surplus 1.0 vehicles (threshold: 1.5)'
                generated_at: '2026-11-30T07:55:00Z'
                latitude: 45.4671
                longitude: 9.1883
                operation_type: pickup
                priority: medium
                priority_value: 2.1
                valid_from: '2026-11-30T08:00:00Z'
                valid_until: '2026-11-30T09:00:00Z'
                vehicle_id: acme-sc-0457
                zone_id: '1042'
    GridFilters:
      properties:
        grid_type:
          type: string
          enum:
            - squares
            - categorical
            - hdbscan
            - agent-3
            - agent-2
            - agent-1
            - agent-4
            - agent-5
            - agent-6
            - agent-7
            - agent-8
            - agent-9
            - custom-polygons
          title: Grid Type
          description: >-
            Type of spatial grid, e.g. `squares` for a regular grid of square
            tiles. Only the grid types (and tile sizes) enabled for your company
            are accepted; a 400 response lists them.
        tile_size:
          type:
            - integer
            - 'null'
          title: Tile Size
          description: >-
            Side of each square tile in meters, e.g. 1000 for the `squares`
            grid. Leave empty for grid types without a tile size.
        location:
          type: string
          title: Location
          description: >-
            Location (city) of the grid, e.g. `milan`. Only the locations
            enabled for your company are accepted; a 400 response lists them.
      type: object
      required:
        - grid_type
        - location
      title: GridFilters
      description: >-
        Schema for filtering grid forecasts.

        This schema defines the parameters used to filter grid forecasts based
        on

        grid type, tile size, and location. It is used to ensure that the
        forecast

        requests are structured correctly and contain all necessary information.
    UpstreamTask:
      properties:
        vehicle_id:
          type: string
          title: Vehicle Id
          description: Vehicle ID associated with the task
        operation_type:
          type: string
          title: Operation Type
          description: Type of operation, e.g., pickup, dropoff, or battery swap
        priority:
          type: string
          enum:
            - low
            - medium
            - high
            - must
          title: Priority
          description: Priority level of the task, e.g., low, medium, or high
        priority_value:
          type:
            - number
            - 'null'
          minimum: 0
          title: Priority Value
          description: >-
            Continuous profit value (see Operation.priority_value). Optional:
            when omitted, the suggest service computes a default using the
            operation type's base profit at neutral urgency (1.0).
        additional_notes:
          type:
            - string
            - 'null'
          title: Additional Notes
          description: Free-text notes about the task, e.g. imbalance deficit or idle time.
        generated_at:
          type: string
          format: date-time
          title: Generated At
          description: Timestamp when the task was generated
        valid_from:
          type:
            - string
            - 'null'
          format: date-time
          title: Valid From
          description: Start of the validity window for this task
        valid_until:
          type:
            - string
            - 'null'
          format: date-time
          title: Valid Until
          description: End of the validity window for this task
        title:
          type: string
          title: Title
          description: Title or description of the task
      type: object
      required:
        - vehicle_id
        - operation_type
        - priority
        - generated_at
        - title
      title: UpstreamTask
      description: >-
        Represents an upstream task to be converted into an operation.


        This schema includes details from an external task that will be
        transformed

        into a full operation with spatial and zone information.
      examples:
        - additional_notes: 'Reported by a customer: battery not charging'
          generated_at: '2026-11-30T07:30:00Z'
          operation_type: battery_swap
          priority: must
          title: Check battery of acme-sc-0311
          valid_until: '2026-11-30T12:00:00Z'
          vehicle_id: acme-sc-0311
    BatteryThresholdStrategy:
      properties:
        slug:
          type: string
          const: battery-threshold
          title: Slug
          description: Strategy identifier
          default: battery-threshold
        enabled:
          type: boolean
          title: Enabled
          description: Whether this strategy is active
          default: true
        zones:
          $ref: '#/components/schemas/ZoneFilter'
          description: Zone filtering configuration
        conditions:
          $ref: '#/components/schemas/ConditionGroup'
          description: Conditions to filter vehicles and zones
        sorting:
          items:
            anyOf:
              - $ref: '#/components/schemas/VehicleSortCriterion'
              - $ref: '#/components/schemas/ZoneSortCriterion'
              - $ref: '#/components/schemas/OperationSortCriterion'
          type:
            - array
            - 'null'
          title: Sorting
          description: >-
            Ordered list of sorting criteria for tasks generated by this
            strategy
        strat_params:
          $ref: '#/components/schemas/BatteryThresholdStratParams'
          description: Strategy-specific parameters
      type: object
      required:
        - strat_params
      title: BatteryThresholdStrategy
      description: Strategy that generates tasks based on battery level threshold.
    IdleTimeStrategy:
      properties:
        slug:
          type: string
          const: idle-time
          title: Slug
          description: Strategy identifier
          default: idle-time
        enabled:
          type: boolean
          title: Enabled
          description: Whether this strategy is active
          default: true
        zones:
          $ref: '#/components/schemas/ZoneFilter'
          description: Zone filtering configuration
        conditions:
          $ref: '#/components/schemas/ConditionGroup'
          description: Conditions to filter vehicles and zones
        sorting:
          items:
            anyOf:
              - $ref: '#/components/schemas/VehicleSortCriterion'
              - $ref: '#/components/schemas/ZoneSortCriterion'
              - $ref: '#/components/schemas/OperationSortCriterion'
          type:
            - array
            - 'null'
          title: Sorting
          description: >-
            Ordered list of sorting criteria for tasks generated by this
            strategy
        strat_params:
          $ref: '#/components/schemas/IdleTimeStratParams'
          description: Strategy-specific parameters
      type: object
      required:
        - strat_params
      title: IdleTimeStrategy
      description: Strategy that generates tasks based on vehicle idle time threshold.
    ImbalanceDropoffsStrategy:
      properties:
        slug:
          type: string
          const: imbalance-dropoffs
          title: Slug
          description: Strategy identifier
          default: imbalance-dropoffs
        enabled:
          type: boolean
          title: Enabled
          description: Whether this strategy is active
          default: true
        zones:
          $ref: '#/components/schemas/ZoneFilter'
          description: Zone filtering configuration
        conditions:
          $ref: '#/components/schemas/ConditionGroup'
          description: Conditions to filter vehicles and zones
        sorting:
          items:
            anyOf:
              - $ref: '#/components/schemas/VehicleSortCriterion'
              - $ref: '#/components/schemas/ZoneSortCriterion'
              - $ref: '#/components/schemas/OperationSortCriterion'
          type:
            - array
            - 'null'
          title: Sorting
          description: >-
            Ordered list of sorting criteria for tasks generated by this
            strategy
        strat_params:
          $ref: '#/components/schemas/ImbalanceDropoffsStratParams'
          description: Strategy-specific parameters
      type: object
      required:
        - strat_params
      title: ImbalanceDropoffsStrategy
      description: Strategy that generates dropoff tasks based on zone imbalance.
    ImbalancePickupsStrategy:
      properties:
        slug:
          type: string
          const: imbalance-pickups
          title: Slug
          description: Strategy identifier
          default: imbalance-pickups
        enabled:
          type: boolean
          title: Enabled
          description: Whether this strategy is active
          default: true
        zones:
          $ref: '#/components/schemas/ZoneFilter'
          description: Zone filtering configuration
        conditions:
          $ref: '#/components/schemas/ConditionGroup'
          description: Conditions to filter vehicles and zones
        sorting:
          items:
            anyOf:
              - $ref: '#/components/schemas/VehicleSortCriterion'
              - $ref: '#/components/schemas/ZoneSortCriterion'
              - $ref: '#/components/schemas/OperationSortCriterion'
          type:
            - array
            - 'null'
          title: Sorting
          description: >-
            Ordered list of sorting criteria for tasks generated by this
            strategy
        strat_params:
          $ref: '#/components/schemas/ImbalancePickupsStratParams'
          description: Strategy-specific parameters
      type: object
      required:
        - strat_params
      title: ImbalancePickupsStrategy
      description: Strategy that generates pickup tasks based on zone imbalance.
    MasterRechargeStrategy:
      properties:
        slug:
          type: string
          const: master-recharge
          title: Slug
          description: Strategy identifier
          default: master-recharge
        enabled:
          type: boolean
          title: Enabled
          description: Whether this strategy is active
          default: true
        zones:
          $ref: '#/components/schemas/ZoneFilter'
          description: Zone filtering configuration
        conditions:
          $ref: '#/components/schemas/ConditionGroup'
          description: Conditions to filter vehicles and zones
        sorting:
          items:
            anyOf:
              - $ref: '#/components/schemas/VehicleSortCriterion'
              - $ref: '#/components/schemas/ZoneSortCriterion'
              - $ref: '#/components/schemas/OperationSortCriterion'
          type:
            - array
            - 'null'
          title: Sorting
          description: >-
            Ordered list of sorting criteria for tasks generated by this
            strategy
        strat_params:
          $ref: '#/components/schemas/MasterRechargeStratParams'
          description: Strategy-specific parameters
      type: object
      required:
        - strat_params
      title: MasterRechargeStrategy
      description: >-
        Strategy that generates master_recharge tasks based on master battery
        level.


        Creates master_recharge operations for vehicles whose master battery

        is at or below the configured threshold.
    RechargeThresholdStrategy:
      properties:
        slug:
          type: string
          const: recharge-threshold
          title: Slug
          description: Strategy identifier
          default: recharge-threshold
        enabled:
          type: boolean
          title: Enabled
          description: Whether this strategy is active
          default: true
        zones:
          $ref: '#/components/schemas/ZoneFilter'
          description: Zone filtering configuration
        conditions:
          $ref: '#/components/schemas/ConditionGroup'
          description: Conditions to filter vehicles and zones
        sorting:
          items:
            anyOf:
              - $ref: '#/components/schemas/VehicleSortCriterion'
              - $ref: '#/components/schemas/ZoneSortCriterion'
              - $ref: '#/components/schemas/OperationSortCriterion'
          type:
            - array
            - 'null'
          title: Sorting
          description: >-
            Ordered list of sorting criteria for tasks generated by this
            strategy
        strat_params:
          $ref: '#/components/schemas/RechargeThresholdStratParams'
          description: Strategy-specific parameters
      type: object
      required:
        - strat_params
      title: RechargeThresholdStrategy
      description: |-
        Strategy that generates recharge pickup tasks based on battery level.

        Creates recharge_pickup operations for vehicles below threshold.
    Operation:
      properties:
        vehicle_id:
          type:
            - string
            - 'null'
          title: Vehicle Id
          description: >-
            Vehicle ID associated with the operation. Null for dropoffs
            generated by the suggestion strategies: a dropoff targets a zone,
            not a vehicle.
        latitude:
          type: number
          title: Latitude
          description: Latitude of the operation's location
        longitude:
          type: number
          title: Longitude
          description: Longitude of the operation's location
        zone_id:
          type: string
          title: Zone Id
          description: Zone ID where the operation is located
        operation_type:
          type: string
          title: Operation Type
          description: Type of operation, e.g., pickup, dropoff, or battery swap
        priority:
          type: string
          enum:
            - low
            - medium
            - high
            - must
          title: Priority
          description: Priority level of the operation, e.g., low, medium, or high
        priority_value:
          type: number
          minimum: 0
          title: Priority Value
          description: >-
            Continuous profit value used by the routing solver. Computed by
            suggest strategies as base_profit_for_op_type * urgency_factor
            (urgency in [1.0, 2.0]). The 'priority' enum is metadata only,
            except 'must' which still triggers hard-include.
        additional_notes:
          type:
            - string
            - 'null'
          title: Additional Notes
          description: >-
            Free-text notes about the operation, e.g. imbalance deficit or idle
            time.
        battery_level:
          type:
            - number
            - 'null'
          title: Battery Level
          description: Current battery level of the vehicle, if applicable
        generated_at:
          type: string
          format: date-time
          title: Generated At
          description: Timestamp when the operation was generated
        valid_from:
          type:
            - string
            - 'null'
          format: date-time
          title: Valid From
          description: Start of the validity window for this operation
        valid_until:
          type:
            - string
            - 'null'
          format: date-time
          title: Valid Until
          description: End of the validity window for this operation
        vehicle_properties:
          $ref: '#/components/schemas/VehicleWithoutZone'
          description: >-
            Full vehicle snapshot at the time the operation was generated.
            Serializable to VehicleWithoutZone. Populated by suggest strategies
            and preserved through the routing response so callers can persist it
            to the DB.
      type: object
      required:
        - vehicle_id
        - latitude
        - longitude
        - zone_id
        - operation_type
        - priority
        - priority_value
        - generated_at
      title: Operation
      description: |-
        Represents an operation to be performed.

        This schema includes details such as the operation's location, type,
        priority, and associated vehicle.
      examples:
        - additional_notes: 'Zone surplus 1.0 vehicles (threshold: 1.5)'
          generated_at: '2026-11-30T07:55:00Z'
          latitude: 45.4671
          longitude: 9.1883
          operation_type: pickup
          priority: medium
          priority_value: 2.1
          valid_from: '2026-11-30T08:00:00Z'
          valid_until: '2026-11-30T09:00:00Z'
          vehicle_id: acme-sc-0457
          zone_id: '1042'
    GridFeature:
      properties:
        type:
          type: string
          const: Feature
          title: Type
          description: Feature type
        geometry:
          $ref: '#/components/schemas/GeoJSONPolygonGeometry'
          description: Polygon geometry
        properties:
          $ref: '#/components/schemas/GridFeatureProperties'
          description: Feature properties including zone_id
      type: object
      required:
        - type
        - geometry
        - properties
      title: GridFeature
      description: A single feature in the grid GeoJSON.
    Vehicle:
      properties:
        id:
          type: string
          title: Id
          description: Unique identifier for the vehicle
        licence_plate:
          type: string
          title: Licence Plate
          description: Licence plate number of the vehicle
        lat:
          type: number
          title: Lat
          description: Latitude of the vehicle's current location
        lon:
          type: number
          title: Lon
          description: Longitude of the vehicle's current location
        vehicle_type:
          type:
            - string
            - 'null'
          title: Vehicle Type
          description: Type of the vehicle, e.g., 'scooter', 'bike', 'car'
        vehicle_model:
          type:
            - string
            - 'null'
          title: Vehicle Model
          description: Model of the vehicle, e.g., 'Model X', 'Model Y'
        battery_level:
          type:
            - integer
            - 'null'
          title: Battery Level
          description: Battery level of the vehicle, e.g., 100 for 100%
        battery_level_master:
          type:
            - integer
            - 'null'
          title: Battery Level Master
          description: >-
            Master battery level percentage (custom MDS setup only). None when
            not reported by the provider.
        last_seen:
          type:
            - string
            - 'null'
          format: date-time
          title: Last Seen
          description: Timestamp of the last time the vehicle was seen in the system
        last_moved:
          type:
            - string
            - 'null'
          format: date-time
          title: Last Moved
          description: Timestamp of the last time the vehicle moved
        status:
          type:
            - string
            - 'null'
          title: Status
          description: Current status of the vehicle, e.g., 'available', 'in-use'
        zone_id:
          type: string
          title: Zone Id
          description: Zone ID where the vehicle is currently located
      type: object
      required:
        - id
        - licence_plate
        - lat
        - lon
        - battery_level
        - zone_id
      title: Vehicle
      description: >-
        Represents a vehicle and its attributes.


        This schema includes details such as the vehicle's location, battery
        level,

        the last time it moved, and the mapped zone within the spatial grid.
    ZoneFilter:
      properties:
        whitelist:
          items:
            type: string
          type:
            - array
            - 'null'
          title: Whitelist
          description: >-
            List of allowed zone IDs (if specified, only these zones are
            allowed)
          examples:
            - - zone-1
              - zone-2
              - zone-3
        blacklist:
          items:
            type: string
          type:
            - array
            - 'null'
          title: Blacklist
          description: List of excluded zone IDs (these zones are always excluded)
          examples:
            - - restricted-zone-1
        use_regex:
          type: boolean
          title: Use Regex
          description: Whether to interpret zone IDs as regex patterns
          default: false
      type: object
      title: ZoneFilter
      description: Zone filtering configuration with whitelist/blacklist.
    ConditionGroup:
      properties:
        operator:
          $ref: '#/components/schemas/LogicalOperator'
          description: Logical operator to combine conditions
          default: AND
        conditions:
          items:
            anyOf:
              - $ref: '#/components/schemas/VehicleCondition'
              - $ref: '#/components/schemas/ZoneCondition'
              - $ref: '#/components/schemas/OperationCondition'
              - $ref: '#/components/schemas/ConditionGroup'
          type: array
          title: Conditions
          description: List of conditions or nested condition groups
      type: object
      title: ConditionGroup
      description: Logical grouping of conditions with AND/OR operators.
      examples: []
    VehicleSortCriterion:
      properties:
        direction:
          $ref: '#/components/schemas/SortDirection'
          description: Sort direction
          examples:
            - desc
        null_handling:
          $ref: '#/components/schemas/NullHandling'
          description: How to handle null/undefined values
          default: last
        entity:
          type: string
          const: vehicle
          title: Entity
          description: Entity type - always vehicle
          default: vehicle
        field:
          type: string
          enum:
            - licence_plate
            - lat
            - lon
            - battery_level
            - last_moved
            - status
            - vehicle_type
            - vehicle_model
            - zone_id
          title: Field
          description: Vehicle field to sort by
          examples:
            - battery_level
      type: object
      required:
        - direction
        - field
      title: VehicleSortCriterion
      description: Sorting criterion for vehicle fields.
    ZoneSortCriterion:
      properties:
        direction:
          $ref: '#/components/schemas/SortDirection'
          description: Sort direction
          examples:
            - desc
        null_handling:
          $ref: '#/components/schemas/NullHandling'
          description: How to handle null/undefined values
          default: last
        entity:
          type: string
          const: zone
          title: Entity
          description: Entity type - always zone
          default: zone
        field:
          type: string
          const: poi_count
          title: Field
          description: Zone field to sort by
          examples:
            - poi_count
      type: object
      required:
        - direction
        - field
      title: ZoneSortCriterion
      description: Sorting criterion for zone fields.
    OperationSortCriterion:
      properties:
        direction:
          $ref: '#/components/schemas/SortDirection'
          description: Sort direction
          examples:
            - desc
        null_handling:
          $ref: '#/components/schemas/NullHandling'
          description: How to handle null/undefined values
          default: last
        entity:
          type: string
          const: operation
          title: Entity
          description: Entity type - always operation
          default: operation
        field:
          type: string
          enum:
            - latitude
            - longitude
            - operation_type
            - priority
            - additional_notes
            - generated_at
            - valid_from
            - valid_until
          title: Field
          description: Operation field to sort by
          examples:
            - priority
      type: object
      required:
        - direction
        - field
      title: OperationSortCriterion
      description: Sorting criterion for operation fields.
    BatteryThresholdStratParams:
      properties:
        threshold:
          type: number
          exclusiveMaximum: 100
          exclusiveMinimum: 0
          title: Threshold
          description: Battery level threshold for triggering tasks
          default: 30
          examples:
            - 20
        high_priority_threshold:
          type:
            - number
            - 'null'
          title: High Priority Threshold
          description: >-
            Battery level below which operations get high priority. When both
            medium and high priority thresholds are set, labels are computed via
            raw-domain comparison; otherwise per-strategy 33/66 percentile
            binning is used.
        medium_priority_threshold:
          type:
            - number
            - 'null'
          title: Medium Priority Threshold
          description: >-
            Battery level below which operations get medium priority. When both
            medium and high priority thresholds are set, labels are computed via
            raw-domain comparison; otherwise per-strategy 33/66 percentile
            binning is used.
        master_battery_threshold:
          type:
            - number
            - 'null'
          exclusiveMaximum: 100
          exclusiveMinimum: 0
          title: Master Battery Threshold
          description: >-
            When set, vehicles whose master battery is below this threshold are
            skipped (they need a master recharge, not a battery swap). Set to
            None to disable the check.
          default: 5
        fixed_urgency:
          type:
            - number
            - 'null'
          maximum: 2
          minimum: 1
          title: Fixed Urgency
          description: >-
            When set, overrides the battery-based urgency with this constant for
            all generated operations, so every vehicle below threshold gets the
            same priority_value. Disables battery-level weighting. In mixed
            pools the chosen value sets the weight of battery swaps relative to
            operations from other strategies.
      type: object
      title: BatteryThresholdStratParams
      description: Parameters for battery threshold strategy.
    IdleTimeStratParams:
      properties:
        threshold:
          type: number
          title: Threshold
          description: Idle time threshold in minutes for triggering pickup operations
          default: 1440
          examples:
            - 1440
        medium_priority_threshold:
          type:
            - number
            - 'null'
          title: Medium Priority Threshold
          description: >-
            Idle time threshold in minutes for medium priority operations. When
            both medium and high priority thresholds are set, labels are
            computed via raw-domain comparison; otherwise per-strategy 33/66
            percentile binning is used.
          examples:
            - 2880
        high_priority_threshold:
          type:
            - number
            - 'null'
          title: High Priority Threshold
          description: >-
            Idle time threshold in minutes for high priority operations. When
            both medium and high priority thresholds are set, labels are
            computed via raw-domain comparison; otherwise per-strategy 33/66
            percentile binning is used.
          examples:
            - 4320
      type: object
      title: IdleTimeStratParams
      description: Parameters for idle time strategy.
    ImbalanceDropoffsStratParams:
      properties:
        threshold:
          type: number
          title: Threshold
          description: >-
            Imbalance threshold for triggering dropoffs (negative value for
            deficit)
          default: -3
          examples:
            - -3
        medium_priority_threshold:
          type:
            - number
            - 'null'
          title: Medium Priority Threshold
          description: >-
            Imbalance threshold for medium priority operations. When both medium
            and high priority thresholds are set, labels are computed via
            raw-domain comparison (more negative = higher priority); otherwise
            per-strategy 33/66 percentile binning is used.
          examples:
            - -5
        high_priority_threshold:
          type:
            - number
            - 'null'
          title: High Priority Threshold
          description: >-
            Imbalance threshold for high priority operations. When both medium
            and high priority thresholds are set, labels are computed via
            raw-domain comparison (more negative = higher priority); otherwise
            per-strategy 33/66 percentile binning is used.
          examples:
            - -7
        match_pickups:
          type: boolean
          title: Match Pickups
          description: >-
            When True, after threshold-based generation a cross-strategy
            post-processing pass tops up dropoff operations until their count is
            at least the total number of pickup operations across the full plan
            (every strategy's output plus upstream tasks). Top-up cells are
            picked from the remaining (sub-threshold) imbalance, sorted
            most-negative first; their priority_value is scaled below the
            threshold-triggered band to preserve a continuous gradient across
            deficit and surplus.
          default: false
        extra_dropoffs:
          type: integer
          minimum: 0
          title: Extra Dropoffs
          description: >-
            Additional dropoffs to emit on top of whatever threshold-based
            generation and `match_pickups` produce. Stacks additively: the final
            count target is max(threshold_count, pickup_count if match_pickups
            else 0) + extra_dropoffs. Use this to seed dropoffs for vehicles
            that need a destination but aren't covered by imbalance demand
            (e.g., depot vehicles in a full rebalance). Top-up cells follow the
            same selection and gradient rules as match_pickups.
          default: 0
          examples:
            - 0
            - 10
      type: object
      title: ImbalanceDropoffsStratParams
      description: Parameters for imbalance dropoffs strategy.
    ImbalancePickupsStratParams:
      properties:
        threshold:
          type: number
          title: Threshold
          description: Imbalance threshold for triggering pickups
          default: 3
          examples:
            - 3
        medium_priority_threshold:
          type:
            - number
            - 'null'
          title: Medium Priority Threshold
          description: >-
            Imbalance threshold for medium priority operations. When both medium
            and high priority thresholds are set, labels are computed via
            raw-domain comparison; otherwise per-strategy 33/66 percentile
            binning is used.
          examples:
            - 5
        high_priority_threshold:
          type:
            - number
            - 'null'
          title: High Priority Threshold
          description: >-
            Imbalance threshold for high priority operations. When both medium
            and high priority thresholds are set, labels are computed via
            raw-domain comparison; otherwise per-strategy 33/66 percentile
            binning is used.
          examples:
            - 7
      type: object
      title: ImbalancePickupsStratParams
      description: Parameters for imbalance pickups strategy.
    MasterRechargeStratParams:
      properties:
        threshold:
          type: number
          exclusiveMaximum: 100
          exclusiveMinimum: 0
          title: Threshold
          description: >-
            Master battery percentage at or below which a master_recharge task
            is generated
          default: 5
          examples:
            - 5
        override_battery_swap:
          type: boolean
          title: Override Battery Swap
          description: >-
            When enabled, vehicles that receive a master_recharge operation will
            have their battery_swap operations removed from other strategies
          default: false
      type: object
      title: MasterRechargeStratParams
      description: Parameters for master recharge strategy.
    RechargeThresholdStratParams:
      properties:
        threshold:
          type: number
          exclusiveMaximum: 100
          exclusiveMinimum: 0
          title: Threshold
          description: Battery level threshold for triggering recharge pickup tasks
          default: 30
          examples:
            - 20
        high_priority_threshold:
          type:
            - number
            - 'null'
          title: High Priority Threshold
          description: >-
            Battery level below which operations get high priority. When both
            medium and high priority thresholds are set, labels are computed via
            raw-domain comparison; otherwise per-strategy 33/66 percentile
            binning is used.
        medium_priority_threshold:
          type:
            - number
            - 'null'
          title: Medium Priority Threshold
          description: >-
            Battery level below which operations get medium priority. When both
            medium and high priority thresholds are set, labels are computed via
            raw-domain comparison; otherwise per-strategy 33/66 percentile
            binning is used.
      type: object
      title: RechargeThresholdStratParams
      description: Parameters for recharge threshold strategy.
    VehicleWithoutZone:
      properties:
        id:
          type: string
          title: Id
          description: Unique identifier for the vehicle
        licence_plate:
          type:
            - string
            - 'null'
          title: Licence Plate
          description: Licence plate number of the vehicle
        lat:
          type:
            - number
            - 'null'
          title: Lat
          description: Latitude of the vehicle's current location
        lon:
          type:
            - number
            - 'null'
          title: Lon
          description: Longitude of the vehicle's current location
        vehicle_type:
          type:
            - string
            - 'null'
          title: Vehicle Type
          description: Type of the vehicle, e.g., 'scooter', 'bike', 'car'
        vehicle_model:
          type:
            - string
            - 'null'
          title: Vehicle Model
          description: Model of the vehicle, e.g., 'Model X', 'Model Y'
        battery_level:
          type:
            - integer
            - 'null'
          title: Battery Level
          description: Battery level of the vehicle, e.g., 100 for 100%
        battery_level_master:
          type:
            - integer
            - 'null'
          title: Battery Level Master
          description: >-
            Master battery level percentage (custom MDS setup only). None when
            not reported by the provider.
        last_seen:
          type:
            - string
            - 'null'
          format: date-time
          title: Last Seen
          description: Timestamp of the last time the vehicle was seen in the system
        last_moved:
          type:
            - string
            - 'null'
          format: date-time
          title: Last Moved
          description: Timestamp of the last time the vehicle moved
        status:
          type:
            - string
            - 'null'
          title: Status
          description: Current status of the vehicle, e.g., 'available', 'in-use'
      type: object
      required:
        - id
        - battery_level
      title: VehicleWithoutZone
      description: >-
        Represents a vehicle without zone assignment.


        Base schema containing all vehicle attributes except zone_id.

        Used when a grid service is not available and spatial zone mapping is
        skipped.
    GeoJSONPolygonGeometry:
      properties:
        type:
          type: string
          enum:
            - Polygon
            - MultiPolygon
          title: Type
          description: Geometry type
        coordinates:
          anyOf:
            - items:
                items:
                  items:
                    type: number
                  type: array
                type: array
              type: array
            - items:
                items:
                  items:
                    items:
                      type: number
                    type: array
                  type: array
                type: array
              type: array
          title: Coordinates
          description: Polygon or MultiPolygon coordinates
      type: object
      required:
        - type
        - coordinates
      title: GeoJSONPolygonGeometry
      description: GeoJSON Polygon or MultiPolygon geometry.
    GridFeatureProperties:
      properties:
        zone_id:
          type: string
          title: Zone Id
          description: Unique identifier for the zone (required, always as string)
      additionalProperties: true
      type: object
      required:
        - zone_id
      title: GridFeatureProperties
      description: |-
        Properties for a grid feature.

        This includes the required zone_id and allows any additional properties.
    LogicalOperator:
      type: string
      enum:
        - AND
        - OR
      title: LogicalOperator
      description: Logical operators for condition groups.
    VehicleCondition:
      properties:
        operator:
          $ref: '#/components/schemas/ConditionOperator'
          description: Comparison operator to apply
          examples:
            - gte
        value:
          title: Value
          description: Value to compare against
          examples:
            - 50
        entity:
          type: string
          const: vehicle
          title: Entity
          description: Entity type - always vehicle
          default: vehicle
        field:
          type: string
          enum:
            - licence_plate
            - lat
            - lon
            - battery_level
            - last_moved
            - status
            - vehicle_type
            - vehicle_model
            - zone_id
          title: Field
          description: Vehicle field to evaluate
          examples:
            - battery_level
      type: object
      required:
        - operator
        - value
        - field
      title: VehicleCondition
      description: A condition for filtering vehicles.
    ZoneCondition:
      properties:
        operator:
          $ref: '#/components/schemas/ConditionOperator'
          description: Comparison operator to apply
          examples:
            - eq
        value:
          title: Value
          description: Value to compare against
          examples:
            - downtown
        entity:
          type: string
          const: zone
          title: Entity
          description: Entity type - always zone
          default: zone
        field:
          type: string
          const: poi_count
          title: Field
          description: Zone field to evaluate
          examples:
            - poi_count
      type: object
      required:
        - operator
        - value
        - field
      title: ZoneCondition
      description: A condition for filtering zones.
    OperationCondition:
      properties:
        operator:
          $ref: '#/components/schemas/ConditionOperator'
          description: Comparison operator to apply
          examples:
            - eq
        value:
          title: Value
          description: Value to compare against
          examples:
            - pickup
        entity:
          type: string
          const: operation
          title: Entity
          description: Entity type - always operation
          default: operation
        field:
          type: string
          enum:
            - latitude
            - longitude
            - operation_type
            - priority
            - additional_notes
            - generated_at
            - valid_from
            - valid_until
          title: Field
          description: Operation field to evaluate
          examples:
            - operation_type
      type: object
      required:
        - operator
        - value
        - field
      title: OperationCondition
      description: A condition for filtering operations.
    SortDirection:
      type: string
      enum:
        - asc
        - desc
      title: SortDirection
      description: Sort direction.
    NullHandling:
      type: string
      enum:
        - first
        - last
      title: NullHandling
      description: How to handle null/undefined values in sorting.
    ConditionOperator:
      type: string
      enum:
        - eq
        - neq
        - gt
        - gte
        - lt
        - lte
        - in
        - nin
        - contains
        - regex
        - exists
      title: ConditionOperator
      description: Operators for simple conditions.
  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.