Skip to main content

Creating a Vehicle

Register a vehicle for use in contracts or trips in the Optimize Everything API system.

Endpoint

POST /vehicle/create

Required Fields

NameTypeRequiredDescriptionDefault
last_known_positionobjectYesCurrent GPS coordinates of the vehicle
last_known_position_timedatetimeYesTimestamp of the current position (ISO 8601 format)
capacityobjectYesVehicle capacity and seating configuration. See schema below.
typestringYesType of vehicle (e.g., Sedan, SUV, Van)
makestringYesVehicle manufacturer (e.g., Toyota, Ford)
modelstringYesVehicle model name

capacity Object Schema

FieldTypeDescription
height_in_mmintegerHeight of the container in millimeters
width_in_mmintegerWidth of the container in millimeters
length_in_mmintegerLength of the container in millimeters
weight_in_gintegerWeight capacity in grams
child_seat_countintegerNumber of seats that can be used by children
regular_seat_countintegerNumber of regular seats available
small_seat_countintegerNumber of small seats available (i.e. middle seat)
accessible_seat_countintegerNumber of accessible seats available
additional_detailsobjectAdditional container specifications

Example for last_known_position

  • latitude (float): Latitude coordinate
  • longitude (float): Longitude coordinate

Example for capacity (ContainerSize)

  • height_in_mm (integer)
  • width_in_mm (integer)
  • length_in_mm (integer)
  • length_tolerance_in_mm (integer)
  • weight_in_g (integer)
  • weight_tolerance_in_g (integer)
  • child_passenger_count (integer)
  • oversize_passenger_count (integer)
  • other_passenger_count (integer)

Example Request

{
"last_known_position": {"latitude": 40.7128, "longitude": -74.0060},
"last_known_position_time": "2024-06-01T10:00:00Z",
"capacity": {
"height_in_mm": 1500,
"width_in_mm": 1800,
"length_in_mm": 4000,
"length_tolerance_in_mm": 100,
"weight_in_g": 2000000,
"weight_tolerance_in_g": 50000,
"child_passenger_count": 2,
"oversize_passenger_count": 0,
"other_passenger_count": 3
},
"type": "Sedan",
"make": "Toyota",
"model": "Camry"
}

For more details, see the API documentation or the schema in schemas/vehicle.py.