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

# Submit route optimization

> Submit a route for optimization. The request is processed asynchronously and returns HTTP 202 with identifiers to track the job.

Use the returned `job_id` to poll `GET /planner/jobs/{job_id}` for status. Once status is `succeeded`, retrieve the result via `GET /planner/optimizations/{optimization_id}/result`.



## OpenAPI

````yaml /openapi.json post /planner/v2
openapi: 3.1.0
info:
  title: FRYTE Planner API
  version: 2.0.0
servers:
  - url: https://api.fryte.eu
security: []
paths:
  /planner/v2:
    post:
      tags:
        - planner
      summary: Submit route optimization
      description: >-
        Submit a route for optimization. The request is processed asynchronously
        and returns HTTP 202 with identifiers to track the job.


        Use the returned `job_id` to poll `GET /planner/jobs/{job_id}` for
        status. Once status is `succeeded`, retrieve the result via `GET
        /planner/optimizations/{optimization_id}/result`.
      operationId: plan_tour_v2_planner_v2_post
      parameters:
        - name: corridor
          in: query
          required: false
          schema:
            type: integer
            maximum: 20000
            minimum: 1000
            description: >-
              Search corridor width in meters around the route for finding
              charging stations.
            default: 8000
            title: Corridor
          description: >-
            Search corridor width in meters around the route for finding
            charging stations.
        - name: tenant_id
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
              - type: 'null'
            description: Tenant ID
            title: Tenant Id
          description: Tenant ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlannerRequest'
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlannerV2SubmitResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HybridAuthBearer: []
        - HTTPBearer: []
components:
  schemas:
    PlannerRequest:
      properties:
        vehicle_id:
          type: string
          title: Vehicle Id
          description: The unique identifier of the vehicle.
        battery_level_start:
          type: number
          maximum: 1
          minimum: 0.1
          title: Battery Level Start
          description: The starting battery level of the vehicle (from 0.1 to 1.0).
        battery_level_end:
          anyOf:
            - type: number
              maximum: 0.8
              minimum: 0.1
            - type: 'null'
          title: Battery Level End
          description: The desired battery level at the end of the tour (from 0.1 to 0.8).
          default: 0.2
        section_list:
          items:
            $ref: '#/components/schemas/SectionRequest'
          type: array
          title: Section List
          description: A list of route sections to be processed.
        poi_info:
          $ref: '#/components/schemas/api__features__poi__schemas__POIInfo'
          description: Filter criteria for charging stations along the route.
        service_time_departure_min:
          anyOf:
            - type: number
            - type: 'null'
          title: Service Time Departure Min
          description: Service time at departure in minutes. Added to total tour duration.
          default: 0
        start_time_tour:
          anyOf:
            - type: string
            - type: 'null'
          title: Start Time Tour
          description: Start time of the tour in HH:MM:SS or ISO-8601 format.
        include_available_charging_stations:
          type: boolean
          title: Include Available Charging Stations
          description: >-
            When true, the response includes all charging stations along the
            corridor.
          default: false
      type: object
      required:
        - vehicle_id
        - battery_level_start
        - section_list
        - poi_info
      title: PlannerRequest
      description: Top-level request body schema for the planner.
      example:
        battery_level_end: 0.2
        battery_level_start: 0.8
        poi_info:
          connector_pos: RIGHT
          connector_type:
            - CCS
          min_kW: 150
          truck_approved: T
        section_list:
          - payload_kg: 19300
            section_id: section_0
            service_time_min: 30
            start_pos:
              - 48.7758
              - 9.1829
            stop_pos:
              - 49.4521
              - 11.0767
        start_time_tour: '08:00:00'
        vehicle_id: '010160700001'
    PlannerV2SubmitResponse:
      properties:
        message:
          type: string
          title: Message
          description: Human-readable status message.
        optimization_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Optimization Id
          description: >-
            Optimization identifier. Use this to retrieve the result via GET
            /planner/optimizations/{optimization_id}/result.
        job_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Job Id
          description: >-
            Job identifier (UUID). Use this to poll for status via GET
            /planner/jobs/{job_id}.
        tour_id:
          type: integer
          title: Tour Id
          description: Tour identifier.
        warnings:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Warnings
          description: Warnings about the request, if any.
      type: object
      required:
        - message
        - tour_id
      title: PlannerV2SubmitResponse
      example:
        job_id: c3f1c944-a44c-4c07-ab52-7df7ba94024a
        message: 202 - Job submitted.
        optimization_id: 7658
        tour_id: 7615
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SectionRequest:
      properties:
        section_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Section Id
          description: A unique identifier for the section.
        polyline:
          anyOf:
            - type: string
            - type: 'null'
          title: Polyline
          description: >-
            Encoded polyline string representing the route section. Uses HERE
            Flexible Polyline encoding (see
            https://github.com/heremaps/flexible-polyline).
        start_pos:
          anyOf:
            - items:
                type: number
                maximum: 180
                minimum: -180
              type: array
              minItems: 2
            - type: 'null'
          title: Start Pos
          description: Starting coordinates for the section [latitude, longitude].
        stop_pos:
          anyOf:
            - items:
                type: number
                maximum: 180
                minimum: -180
              type: array
              minItems: 2
            - type: 'null'
          title: Stop Pos
          description: Ending coordinates for the section [latitude, longitude].
        payload_kg:
          anyOf:
            - type: number
            - type: 'null'
          title: Payload Kg
          description: The payload in kg for this section.
          default: 19300
        opening_time:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Opening Time
          description: >-
            Opening times of the section end, e.g. ['9:00:00', '10:00:00'] in
            hh:mm:ss format.
        power_available_kW:
          anyOf:
            - type: number
            - type: 'null'
          title: Power Available Kw
          description: The available charging power (in kW) at the end of the section.
          default: 0
        service_time_min:
          anyOf:
            - type: number
            - type: 'null'
          title: Service Time Min
          description: The service time (in minutes) at the end of the section.
          default: 0
      type: object
      title: SectionRequest
      description: Fields for each section in the *request*.
    api__features__poi__schemas__POIInfo:
      properties:
        min_kW:
          anyOf:
            - type: number
            - type: 'null'
          title: Min Kw
          description: Minimum required power (in kW) for a charging station.
        max_kW:
          anyOf:
            - type: number
            - type: 'null'
          title: Max Kw
          description: Maximum acceptable power (in kW) for a charging station.
        cpo:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Cpo
          description: A list of Charge Point Operators (CPO) to filter by.
        truck_approved:
          anyOf:
            - $ref: '#/components/schemas/api__features__poi__schemas__TruckApproved'
            - type: 'null'
          description: >-
            Truck-ready stations: T (tractor-only) or TT (truck and trailer). TT
            is a subset of T.
        connector_type:
          anyOf:
            - items:
                $ref: >-
                  #/components/schemas/api__features__poi__schemas__ConnectorType
              type: array
            - type: 'null'
          title: Connector Type
          description: List of connector types (e.g., CCS, MCS).
        connector_pos:
          anyOf:
            - $ref: '#/components/schemas/api__features__poi__schemas__ConnectorPos'
            - type: 'null'
          description: Position of the connector on the vehicle (e.g., LEFT, RIGHT).
        bookable:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Bookable
          description: Only return bookable charging stations.
      type: object
      title: POIInfo
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    api__features__poi__schemas__TruckApproved:
      type: string
      enum:
        - T
        - TT
      title: TruckApproved
    api__features__poi__schemas__ConnectorType:
      type: string
      enum:
        - MCS
        - CCS
      title: ConnectorType
    api__features__poi__schemas__ConnectorPos:
      type: string
      enum:
        - LEFT
        - RIGHT
      title: ConnectorPos
  securitySchemes:
    HybridAuthBearer:
      type: http
      scheme: bearer
    HTTPBearer:
      type: http
      scheme: bearer

````