Update an existing vehicle

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

Purpose: Use this API to update a vehicle on the Motive Fleet Dashboard for your organisation. It is important to note that whenever you update a vehicle, a vehicle gateway must be installed, and you must assign the vehicle gateway to it, so that you can track the vehicle and also get the respective metrics.

📘

NOTE

External IDs are the unique identifiers assigned by an external system or an integration. When you enter the external ID, you must also mention the integration it is associated with. The combination of the external ID and the integration name will always be unique. Below are the steps that you must take in order to add an external ID to the endpoint.

Apart from adding the following to the request body, you must also add the external_id and the integration_name in the Body Parameters. Refer to the Body Parameters section for more info.

External IDs

To add an external ID to the vehicle, take the following steps:

  1. Add the following request to the body:

  2. {
      "number":"toyota_32",
      # other attributes for a vehicle
      ...
      ...
      ...
      # add external id for vehicle
      "external_ids_attributes":[
        {
          "external_id":"987",
          "integration_name":"generic_tms"
        }
      ]
    }
    
  3. require 'uri'
    require 'net/http'
    require 'json'
    
    url = URI('https://api.keeptruckin.com/v1/vehicles/4')
    
    http = Net::HTTP.new(url.host, url.port)
    http.use_ssl = true
    
    request = Net::HTTP::Put.new(url)
    request['Authorization'] = "Bearer <OAUTH_TOKEN>"
    request['Content-Type'] = 'application/json'
    
    params = {
        :company_id          => 1,
        :number              => "Demo Vehicle",
        :status              => "active",
        :ifta                => true,
        :vin                 => "WP0AB2966NS458669",
        :make                => "Demo",
        :model               => "Vehicle",
        :year                => "2017",
        :license_plate_state => "CA",
        :license_plate_number=> "5M37250",
        :metric_units        => false,
        :fuel_type           => "diesel",
        :eld_device          => {
          :id                => 2,
          :identifier        => "000074802542164638439715893965",
          :model             => "lbb-1"
        },
        :current_driver      => {
          :id                => 11,
          :first_name        => "Demo",
          :last_name         => "Driver",
          :username          => "demo_driver",
          :email             => nil,
          :driver_company_id => nil,
          :status            => "active",
          :role              => "driver"
        }
      }
    request.body = params.to_json
    
    response = http.request(request)
    puts response.read_body
    

Response Parameters

vehicle

  • Type: Object
  • Description: Contains details of the vehicle.

id

  • Type: Integer
  • Description: Unique identifier for the vehicle.

company_id

  • Type: Integer
  • Description: ID of the company that owns the vehicle.

number

  • Type: String
  • Description: The vehicle's assigned number or name.

status

  • Type: String
  • Description: Current status of the vehicle (e.g., active).

ifta

  • Type: Boolean
  • Description: Indicates whether the vehicle is IFTA-registered.

vin

  • Type: String
  • Description: The Vehicle Identification Number (VIN).

make

  • Type: String
  • Description: The make of the vehicle.

model

  • Type: String
  • Description: The model of the vehicle.

year

  • Type: String
  • Description: The manufacturing year of the vehicle.

license_plate_state

  • Type: String
  • Description: The state where the vehicle's license plate is registered.

license_plate_number

  • Type: String
  • Description: The vehicle's license plate number.

metric_units

  • Type: Boolean
  • Description: Indicates if the vehicle uses metric units.

fuel_type

  • Type: String
  • Description: The type of fuel used by the vehicle (e.g., diesel).

group_ids

  • Type: Array of Integers
  • Description: List of group IDs associated with the vehicle.

prevent_auto_odometer_entry

  • Type: Boolean
  • Description: Indicates if auto-odometer entry is disabled.

created_at

  • Type: String (Date-Time)
  • Description: The timestamp when the vehicle was created.

updated_at

  • Type: String (Date-Time)
  • Description: The timestamp when the vehicle was last updated.

eld_device

  • Type: Object
  • Description: Information about the vehicle' gateway.

id

  • Type: Integer
  • Description: The ID of the vehicle gateway.

identifier

  • Type: String
  • Description: Unique identifier for the vehicle gateway.

model

  • Type: String
  • Description: The model of the vehicle gateway.

current_driver

  • Type: Object
  • Description: Information about the vehicle's current driver.

id

  • Type: Integer
  • Description: Driver's unique identifier.

first_name

  • Type: String
  • Description: Driver's first name.

last_name

  • Type: String
  • Description: Driver's last name.

username

  • Type: String
  • Description: Driver's username.

email

  • Type: String
  • Description: Driver's email address.

driver_company_id

  • Type: Integer
  • Description: Driver's company ID.

status

  • Type: String
  • Description: Current status of the driver (e.g., active).

role

  • Type: String
  • Description: The driver's role (e.g., driver).

external_ids

  • Type: Array of Objects
  • Description: List of external system IDs associated with the vehicle.

Path Params
string
required

Specify the ID of the vehicle for which you want to make an update.

Body Params
int32

Specify the ID number of the vehicle gateway that is assigned to the vehicle.

boolean

Specify if the vehicle is part of the IFTA calculations. TRUE: Denotes that the vehicle is part of the calculations. FALSE: The vehicle is not part of the calculations.

boolean

Specify if the is using Metric Units or the Imperial Units. TRUE: Uses the metric units. FALSE: Uses the imperial units.

string

Specify the type of the fuel the vehicle is using. Allowed values are: diesel, gasoline, propane, lng, cng, ethanol, methanol, e85, m85, a55, biodiesel, and other.

string

Specify the Vehicle Identification Number (VIN).

string

Specify the state where the license number was issued.

string

Specify the license number plate of the vehicle.

string

Specify the make of the vehicle.

string

Specify the model of the vehicle.

string

Specify the year when the vehicle was manufactured.

boolean

Specify if the vehicle prevents an auto odometer entry. TRUE: The vehicle prevents the odometer entry. FALSE: The vehicle does not prevent the odometer entry.

external_ids_attributes
array of objects

Specify the external ID, as well as the associated integration name for the vehicle.

external_ids_attributes
int32

Specify the permanent driver ID that is assigned to the driver of the vehicle.

string

Mention any notes for the vehicle that you are creating.

group_ids
array of int32s

Specify the IDs of the group with which the vehicle is associated.

group_ids
int32
Defaults to -1

Denotes if the recording of the driver facing camera is enabled or not. Allowed values are: -1: no_override (meaning cannot be overridden), 0: No recording, 1: Recording enabled, 2: No recording while idling, & 3: Recording enabled if engine in ON.

int32
Defaults to -1

Denotes if the audio from the driver's cab is being recorded or not. Allowed values are: -1: No manual override, 0: No recording of audio, 1: Audio recording enabled.

Headers
string

Specify the timezone for formatting the timestamps.

boolean

Specify if you want to use the Metric units or the Imperial units. TRUE: Metric units. FALSE: Imperial Units

int32

Specify the ID of the Fleet Admin or the Fleet Manager who is accessing this endpoint.

Responses

Language
Credentials
Header
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json