Vehicles

Update Vehicle by ID

Updates one vehicle in your depot. This is a partial update: only the fields you send change. The same rules as POST /vehicles apply to the fields you do send. For example, switching start_location to other requires start_lat and start_lng in the same request, and setting break: true requires the break times and duration. Sending capacities or skills replaces the vehicle's whole set (an empty array clears it), and leaving them out keeps the existing set.

Changes to availability, shift times and break are applied to the vehicle's default shift. If the vehicle has a per-day or multi-shift schedule set up in the SmartRoutes web app, that schedule is left unchanged. The updated vehicle is returned under vehicle. An id that doesn't belong to a vehicle in your depot returns 400 INVALID_INPUT.

put/vehicles/{id}

Request

  • Base URL: https://api.smartroutes.io/v2
  • URL: https://api.smartroutes.io/v2/vehicles/{id}
  • Auth: none declared

Path parameters

idnumber required

ID of the vehicle to update.

Request body

namestring

Name of the vehicle.

availability'shift' | 'full_day' | 'always' required

Availability status of the vehicle.

shift_startstring time nullable

Start time of the vehicle's shift (if availability is 'shift').

shift_endstring time nullable

End time of the vehicle's shift (if availability is 'shift').

start_location'depot' | 'other' | 'app-location' required

Location type where the vehicle starts.

start_addressstring nullable

Address where the vehicle starts (if location is 'other').

start_lngnumber nullable

Longitude of the starting location (if location is 'other').

start_latnumber nullable

Latitude of the starting location (if location is 'other').

end_location'depot' | 'other' | 'none' required

Location type where the vehicle ends.

end_addressstring nullable

Address where the vehicle ends (if location is 'other').

end_lngnumber nullable

Longitude of the ending location (if location is 'other').

end_latnumber nullable

Latitude of the ending location (if location is 'other').

breakboolean

Flag indicating whether the vehicle has a break.

break_startstring time nullable

Start time of the vehicle's break (if it has a break).

break_endstring time nullable

End time of the vehicle's break (if it has a break).

break_durationnumber nullable

Duration of the vehicle's break in minutes (if it has a break).

activeboolean

Flag indicating whether the vehicle is active.

skillsstring[]

Array of skills associated with the vehicle.

Example request

{
  "name": "Vehicle Name",
  "availability": "shift",
  "shift_start": "08:00",
  "shift_end": "17:30",
  "start_location": "depot",
  "end_location": "none",
  "break": false,
  "capacities": [
    {
      "id": 1,
      "capacity": 500
    }
  ]
}

Response

Successful response

Changes

No recorded changes to this operation across all 1 revision of this API.