Skip to main content
POST
Generate Operations Based on Strategies

Authorizations

Authorization
string
header
required

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.

Body

application/json

Request schema for operation generation with multiple strategies.

time_granularity_minutes
integer
required

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
integer
required

Size of the prediction horizon in time steps (each one long time_granularity_minutes minutes)

grid
GridFilters · object
required

Grid schema defining the spatial structure for the forecast

strategies
(BatteryThresholdStrategy · object | IdleTimeStrategy · object | ImbalanceDropoffsStrategy · object | ImbalancePickupsStrategy · object | MasterRechargeStrategy · object | RechargeThresholdStrategy · object)[]
required

Array of strategies to be applied for operation generation

Minimum array length: 1

Strategy that generates tasks based on battery level threshold.

zones_whitelist
string[] | null

Optional list of zone IDs to include in the response. If provided, only zones in this list will be returned.

zones_blacklist
string[] | null

Optional list of zone IDs to exclude from the response. Takes precedence over zones_whitelist when both are provided.

upstream_tasks
UpstreamTask · object[] | null

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
string[] | null

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.

include_zones_data
boolean
default:false

Include zones data in the response

include_vehicles_data
boolean
default:false

Include vehicles data in the response

Response

Operations generated successfully from provided strategies

Response schema for operation generation.

suggestions
Suggestions · object
required

Operations suggested by each strategy, keyed by strategy slug; operations built from upstream_tasks are under upstream.

Example:
zones
GridFeature · object[] | null

Unique zones used during operation generation (if requested). Each zone is a GeoJSON feature with geometry and properties.

Example:
vehicles
Vehicle · object[] | null

Unique vehicles used during operation generation (if requested)

Example: