Routes API

Complete reference for the Routes API endpoints, including route planning, optimization, and real-time tracking.

Route Parameters

Required parameters for route planning

pickup_location
Object

Pickup coordinates (latitude, longitude)

dropoff_location
Object

Dropoff coordinates (latitude, longitude)

vehicle_id
Integer

ID of the assigned vehicle

estimated_duration
Integer

Estimated trip duration in minutes

Endpoints

Available API endpoints for route management

MethodEndpointDescription
POST
/api/routes/planCreate a new route plan
GET
/api/routes/{id}Get route details
POST
/api/routes/{id}/updateUpdate route progress
GET
/api/routes/activeList all active routes
POST
/api/routes/{id}/optimizeOptimize existing route

Route Planning

Intelligent route planning with real-time optimization.

  • Traffic-aware routing
  • Multiple waypoint support
  • Alternative route suggestions
  • Battery-aware planning

Real-time Updates

Live tracking and route progress monitoring.

  • Live location tracking
  • ETA updates
  • Route deviation alerts
  • Progress notifications

Example Request

Sample route planning request

{
  "pickup_location": {
    "latitude": 34.0522,
    "longitude": -118.2437
  },
  "dropoff_location": {
    "latitude": 34.0689,
    "longitude": -118.4452
  },
  "vehicle_id": 123,
  "preferences": {
    "avoid_highways": false,
    "minimize_charging_stops": true
  }
}

WebSocket Updates

Real-time route updates via WebSocket

Connect to the WebSocket endpoint to receive real-time updates:

ws://your-domain/ws/routes/{route_id}

Update Types:

  • Location updates
  • ETA changes
  • Route modifications
  • Status changes