Vehicles

Add Vehicle

Adds a vehicle to your depot's fleet so it can be used when building plans. The new vehicle is returned under vehicle, in the same shape as GET /vehicles/{id}.

  • name (up to 30 characters), availability and start_location are required. start_location and end_location accept depot or other. With other, you must send the matching *_lat and *_lng. Addresses are stored as given and are not geocoded.
  • With availability: shift, shift_start must be before shift_end (24-hour HH:mm). With break: true, break_start, break_end and break_duration are all required, and break_duration (in minutes) must be shorter than the break window.
  • capacities are matched by id against your depot's capacity types (see GET /capacities). Unknown IDs are dropped without an error. Any skills name not yet in your organisation is created. Names match exactly and are case-sensitive.
  • active defaults to true.

Each organisation has a vehicle limit across all its depots. Adding a vehicle beyond that limit returns 400 INVALID_INPUT. This endpoint supports Idempotency.

post/vehicles

Request

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

Headers

idempotency-keystring

Optional idempotency key for safe retries. See Idempotency for behaviour. 1–255 characters; UUID recommended.

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.