Onfleet Route Plans API

Create and manage route plans — ordered sequences of tasks assigned to a worker for a time window — and kick off asynchronous route optimization jobs (task-based, vehicle-based, or auto-dispatch). Optimization endpoints are an Enterprise plan feature; results delivered via the routeOptimizationJobCompleted webhook.

OpenAPI Specification

onfleet-route-plans-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Onfleet Destinations Route Plans API
  description: 'The Destinations API manages physical addresses associated with tasks.

    Destinations include parsed address fields and a GeoJSON location, and can

    be reused across tasks. Onfleet geocodes addresses on creation; you can

    also supply an `unparsed` address.

    '
  version: '2.7'
  contact:
    name: Onfleet Support
    email: support@onfleet.com
  license:
    name: Onfleet Terms of Service
    url: https://onfleet.com/legal
servers:
- url: https://onfleet.com/api/v2
  description: Production
security:
- basicAuth: []
tags:
- name: Route Plans
paths:
  /routePlans:
    get:
      tags:
      - Route Plans
      summary: List Route Plans
      operationId: listRoutePlans
      parameters:
      - name: from
        in: query
        required: true
        schema:
          type: integer
          format: int64
      - name: to
        in: query
        schema:
          type: integer
          format: int64
      - name: teams
        in: query
        schema:
          type: string
      - name: workers
        in: query
        schema:
          type: string
      responses:
        '200':
          description: Route plans
          content:
            application/json:
              schema:
                type: object
                properties:
                  routePlans:
                    type: array
                    items:
                      $ref: '#/components/schemas/RoutePlan'
    post:
      tags:
      - Route Plans
      summary: Create Route Plan
      operationId: createRoutePlan
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RoutePlanCreate'
      responses:
        '200':
          description: Route plan created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoutePlan'
  /routePlans/{routePlanId}:
    parameters:
    - name: routePlanId
      in: path
      required: true
      schema:
        type: string
    get:
      tags:
      - Route Plans
      summary: Get Route Plan By ID
      operationId: getRoutePlan
      responses:
        '200':
          description: Route plan
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoutePlan'
    put:
      tags:
      - Route Plans
      summary: Update Route Plan
      operationId: updateRoutePlan
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RoutePlanCreate'
      responses:
        '200':
          description: Updated route plan
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoutePlan'
    delete:
      tags:
      - Route Plans
      summary: Delete Route Plan
      operationId: deleteRoutePlan
      responses:
        '200':
          description: Deleted
  /routePlans/{routePlanId}/tasks:
    put:
      tags:
      - Route Plans
      summary: Add Tasks To Route Plan
      operationId: addTasksToRoutePlan
      parameters:
      - name: routePlanId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                tasks:
                  type: array
                  items:
                    type: string
      responses:
        '200':
          description: Updated route plan
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoutePlan'
components:
  schemas:
    RoutePlanCreate:
      type: object
      required:
      - name
      - startTime
      - worker
      properties:
        name:
          type: string
        startTime:
          type: integer
          format: int64
        endTime:
          type: integer
          format: int64
        worker:
          type: string
        team:
          type: string
        vehicleType:
          type: string
          enum:
          - CAR
          - MOTORCYCLE
          - BICYCLE
          - TRUCK
        startAt:
          type: string
          enum:
          - HUB
          - WORKER_LOCATION
          - WORKER_ADDRESS
        endAt:
          type: string
          enum:
          - HUB
          - WORKER_LOCATION
          - WORKER_ADDRESS
          - ANYWHERE
        startingHubId:
          type: string
        endingHubId:
          type: string
        color:
          type: string
        tasks:
          type: array
          items:
            type: string
    RoutePlan:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        organization:
          type: string
        timeCreated:
          type: integer
          format: int64
        timeLastModified:
          type: integer
          format: int64
        startTime:
          type: integer
          format: int64
        endTime:
          type: integer
          format: int64
          nullable: true
        team:
          type: string
          nullable: true
        worker:
          type: string
          nullable: true
        vehicleType:
          type: string
          nullable: true
        startAt:
          type: string
          enum:
          - HUB
          - WORKER_LOCATION
          - WORKER_ADDRESS
        endAt:
          type: string
          enum:
          - HUB
          - WORKER_LOCATION
          - WORKER_ADDRESS
          - ANYWHERE
        startingHubId:
          type: string
          nullable: true
        endingHubId:
          type: string
          nullable: true
        color:
          type: string
          nullable: true
        tasks:
          type: array
          items:
            type: string
        state:
          type: string
          enum:
          - DRAFT
          - ACTIVE
          - COMPLETED
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic