Create a new vehicle

Purpose: Use this API to create a vehicle on the Motive Fleet Dashboard for your organisation. It is important to note that whenever you create 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.

📘

External IDs

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.gomotive.com/v1/vehicles')
    
    http = Net::HTTP.new(url.host, url.port)
    http.use_ssl = true
    
    request = Net::HTTP::Post.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                => "2016",
      :license_plate_state => "CA",
      :license_plate_number => "5M37250",
      :metric_units        => false,
      :notes               => "Demo Notes",
      :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: Denotes the object that contains the vehicle information that has been created.

vehicle Object

id

  • Type: String
  • Description: The unique identifier assigned to the vehicle.

company_id

  • Type: Number
  • Description: The unique identifier of the company to which the vehicle belongs.

number

  • Type: String
  • Description: The fleet number assigned to the vehicle.

status

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

ifta

  • Type: Boolean
  • Description: Indicates whether the vehicle is subject to International Fuel Tax Agreement (IFTA) reporting.

vin

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

make

  • Type: String
  • Description: The manufacturer of the vehicle. For example, Ford.

model

  • Type: String
  • Description: The model of the vehicle. For example, Expedition.

year

  • Type: String
  • Description: The year the vehicle was manufactured. For example, 2024.

license_plate_state

  • Type: String
  • Description: The state of the vehicle's license plate.

license_plate_number

  • Type: String
  • Description: The license plate number of the vehicle.

metric_units

  • Type: Boolean
  • Description: Indicates whether the vehicle's measurements are in metric units.

fuel_type

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

group_ids

  • Type: Array
  • Description: A list of group IDs assigned to the vehicle.

created_at

  • Type: DateTime
  • Description: The timestamp when the vehicle was created.

updated_at

  • Type: DateTime
  • Description: The timestamp when the vehicle was last updated.

eld_device

  • Type: String
  • Description: The ELD device associated with the vehicle, if any.

id

  • Type: Integer
  • Description: The ID of the vehicle gateway that has been assigned to the vehicle.

identifier

  • Type: Integer
  • Description: The unique identifier of the vehicle gateway.

model

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

current_driver

  • Type: String
  • Description: The current driver of the vehicle, if any.

id

  • Type: Integer
  • Description: The unique identifier of the driver.

first_name

  • Type: String
  • Description: The first name of the driver.

last_name

  • Type: String
  • Description: The last name of the driver.

username

  • Type: String
  • Description: The username assigned to the driver.

email

  • Type: String
  • Description: The email address of the driver.

driver_company_id

  • Type: Integer
  • Description: The ID of the driver assigned by the company.

status

  • Type: String
  • Description: The status of the driver in the company. For example, Active.

role

  • Type: String
  • Description: The role of the user as per the company. For example, Driver.

external_ids

  • Type: Array
  • Description: A list of external identifiers associated with the vehicle.

Language
Credentials
Header
Click Try It! to start a request and see the response here!