Fuel Tank API

Monitor fuel tank levels effortlessly

With Smartcar, checking the fuel tank level of your customer’s car is a breeze.

Fuel tank level

Retrieve the remaining range and the amount and percentage of fuel remaining in a vehicle’s tank.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
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 fuel tank level
const fuel = await vehicle.fuel();
console.log(fuel);
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
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 fuel tank level
fuel = vehicle.fuel()
print(fuel)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
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 fuel tank level
SmartcarResponse<VehicleFuel> fuel = vehicle.fuel();
System.out.println(fuel);
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
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 fuel tank level
var fuel, resErr = vehicle.GetFuel(context.TODO());
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
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 fuel tank level
fuel = vehicle.fuel()
puts fuel.to_hash.slice(*%I(amountRemaining, percentRemaining, range))
// Example response from Smartcar
{
  "amountRemaining": 53.2,
  "percentRemaining": 0.3,
  "range": 40.5
}
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

Access to live car data

Access to live car data

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

Fleet management

Allow fleet managers to monitor fuel tank levels and driver efficiency across all vehicles in their fleet.

Learn more about fleet management

On-demand services

Remind customers to schedule their next fuel delivery whenever they run low on gas.

Learn more about on-demand services

What we’re building

Latency and frequency of data availability may vary between makes and models.