Vehicle attributes API
Know the make, model, and year of your customer’s car.
Retrieve a vehicle’s make, model, and model year.
const smartcar = require('smartcar');
// Get all vehicles associated with this access token
const {vehicles} = await smartcar.getVehicleIds("<access-token>");
// Construct a new vehicle instance using the first vehicle's id
const vehicle = new smartcar.Vehicle(vehicles[0], "<access-token>");
// Fetch the vehicle's attributes
const vehicleInfo = await vehicle.info();
console.log(vehicleInfo);
import smartcar
# Get all vehicles associated with this access token
response = smartcar.get_vehicle_ids("<access-token>")
# Construct a new vehicle instance using the first vehicle's id
vehicle = smartcar.Vehicle(response["vehicles"][0], "<access-token>")
# Fetch the vehicle's attributes
vehicle_info = vehicle.info()
print(vehicle_info)
import com.smartcar.sdk.*;
// Get all vehicles associated with this access token
SmartcarResponse<VehicleIds> response = AuthClient.getVehicleIds("<access-token>");
String[] vehicleIds = response.getData().getVehicleIds();
// Construct a new vehicle instance using the first vehicle's id
Vehicle vehicle = new Vehicle(vehicleIds[0], "<access-token>");
// Fetch the vehicle's attributes
SmartcarResponse<VehicleInfo> vehicleInfo = vehicle.info();
System.out.println(vehicleInfo);
import (
"context"
smartcar "github.com/smartcar/go-sdk"
)
// Create a smartcar client
var smartcarClient = smartcar.NewClient()
// Get all vehicles associated with this access token
var vehicleIDs, resErr = smartcarClient.GetVehicleIDs(
context.TODO(),
&smartcar.VehicleIDsParams{Access: "<access-token>"},
);
// Construct a new vehicle instance using the first vehicle's id
var vehicle = smartcarClient.NewVehicle(&smartcar.VehicleParams{
ID: vehicleIDs.VehicleIDs[0],
AccessToken: "<access-token>"},
);
// Fetch the vehicle's attributes
var info, resErr = vehicle.GetInfo(context.TODO());
require 'smartcar'
# Get all vehicles associated with this access token
vehicle_ids = Smartcar::Vehicle.all_vehicle_ids(token: token)
# Construct a new vehicle instance using the first vehicle's id
vehicle = Smartcar::Vehicle.new(
token: "<access-token>",
id: vehicle_ids.first
)
# Fetch the vehicle's attributes
vehicle_attributes = vehicle.vehicle_attributes()
puts vehicle_attributes.to_hash.slice(*%I(id make model year))
// Example response from Smartcar
{
"id": "36ab27d0-fd9d-4455-823a-ce30af709ffc",
"make": "TESLA",
"model": "Model S",
"year": 2014
}
Confirm the make, model, and year of your customer’s vehicle to detect misstated policy information.
Learn more about auto insuranceLearn more about the vehicle your customer drives and offer them personalized EV charging services.
Learn more about EV charging