EV Charging API

Remotely manage EV charging

Check the charging status and charge electric vehicles with simple API requests.

Charging status

Check whether an EV’s charging cable is plugged in and charging.

Start or stop charge (early access)

Remotely start or stop charging a battery electric (BEV) or plug-in hybrid vehicle (PHEV).

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
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 charging status
const charge = await vehicle.charge();
console.log(charge);

// Start the vehicle's charging session
await vehicle.startCharge();
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
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 charging status
charge = vehicle.charge()
print(charge)

# Start the vehicle's charging session
vehicle.start_charge()
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
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 charging status
SmartcarResponse<VehicleCharge> charge = vehicle.charge();
System.out.println(charge);

// Start the vehicle's charging session
vehicle.startCharge();
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
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 charging status
var charge, resErr = vehicle.GetCharge(context.TODO());

// Start the vehicle's charging session
var startCharge, resErr = vehicle.StartCharge(context.TODO());
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
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 charging status
charge = vehicle.charge()
puts charge.to_hash.slice(*%I(isPluggedIn state))

# Start the vehicle's charging session
vehicle.startCharge!
// Example response from Smartcar (charging status)
{
  "isPluggedIn": true,
  "state":"FULLY_CHARGED"
}

// Example response from Smartcar (start charge)
{
  "status": "success"
}
See the API docs

Product features

Compatible with 20 car brands

Compatible with 20 car brands

Friendly user consent flow

Friendly user consent flow

Works on 2015 and newer vehicles

Works on 2015 and newer vehicles

Trusted & secure

Trusted & secure

Retrieve live data and trigger live actions

Retrieve live data and trigger live actions

SDKs for Go, Java, Node.js, Python, and Ruby

SDKs for Go, Java, Node.js, Python, and Ruby

Learn more about Smartcar’s APIs

Related industries

EV charging networks

Provide estimated charging times, automatic charging schedules, and EV trip planning in your app.

Learn more about EV charging

Energy & utility providers

Manage your customers’ residential EV charging to best balance electric grid load.

Learn more about energy and utilities