Prerequisites: Creating your application

Before implementing the Smartcar API for charging station discoverability, ensure you have:

  • Created a Smartcar Account and registered your application to obtain your client_id and client_secret.
  • Set up Smartcar Connect Flow to authenticate and authorize users.
For more details, refer to the Getting Started Guide.

Smartcar API Endpoints for charging station discoverability

Use the following Smartcar API endpoints to help drivers locate nearby charging stations based on their vehicle’s current range and location.

1. Determine EV Range

Once a vehicle is authorized via Smartcar’s Connect flow, you can use the vehicle’s access token to retrieve the current battery level and range through the GET /battery endpoint.

Range Remaining and SoC
    GET /vehicles/{vehicle_id}/battery
Example Response
{
    "percentRemaining": 0.3,
    "range": 40.5
}

2. Retrieve Vehicle Location

To locate nearby charging stations based on the vehicle’s current location, use the GET /location endpoint.

Location
    GET /vehicles/{vehicle_id}/location
Example Response
{
    "latitude": 37.4292,
    "longitude": -122.1381
}

3. Calculate Distance to Charging Stations

Once you have the vehicle’s location, compare it with nearby charging stations’ coordinates. Charging station locations can be sourced from a Charge Point Operator (CPO) or through third-party services such as Google’s Places API. Calculate the distance and estimated time to reach these stations using Google’s Distance Matrix API or a similar service.

  • Sourcing Charging Station Data: While Smartcar provides vehicle location data, you’ll need to source station coordinates from a CPO database or third-party API like Google’s Places API.
  • Distance Calculation: Use Google’s Distance Matrix API to compute the travel distance and time, factoring in real-time traffic conditions and travel modes. This process helps drivers locate the nearest available charging stations in real time, offering a smooth and integrated experience.

This process helps drivers locate the nearest available charging stations in real time, offering a smooth and integrated experience.

4. Send Destination to Vehicle Navigation (Optional)

Once you’ve identified the nearest charging station, guide the driver to the location. Depending on the vehicle’s capabilities, there are two options for navigation:

  1. Mobile Navigation Apps: For vehicles that don’t support in-dash navigation, dispatch the destination coordinates to a mobile app (e.g., Google Maps, Apple Maps). This ensures drivers can still navigate using their smartphone..
  2. Send to in-dash navigation: For vehicles that support in-dash navigation, Smartcar allows you to send destination coordinates directly to the onboard system. This allows for seamless, in-vehicle routing. You can check which brands support this feature by visiting the Supported Brands section.

Use Send Destination for supported vehicles to send coordinates to the vehicle’s navigation.

Send Destination
    POST /vehicles/navigation/destination
    {
        "latitude": 37.4292,
        "longitude": -122.1381
    }

FAQs