> ## Documentation Index
> Fetch the complete documentation index at: https://smartcar.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Charging station utilization

> This guide explains how to use the Smartcar API to enhance charging station discoverability by leveraging vehicle data such as state of charge, battery level, range, and location. These capabilities allow developers to help EV drivers find nearby charging stations based on real-time vehicle data.

## 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.

<Note> For more details, refer to the [Getting Started
Guide](/getting-started/introduction). </Note>

## 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](/api-reference/evs/get-battery-level) endpoint.

```bash Range Remaining and SoC theme={null}
    GET /vehicles/{vehicle_id}/battery
```

```json Example Response theme={null}
{
    "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](/api-reference/get-location) endpoint.

```bash Location theme={null}
    GET /vehicles/{vehicle_id}/location
```

```json Example Response theme={null}
{
    "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](/api-reference/send-destination-to-vehicle) for supported
vehicles to send coordinates to the vehicle's navigation.

```bash Send Destination theme={null}
    POST /vehicles/navigation/destination
    {
        "latitude": 37.4292,
        "longitude": -122.1381
    }
```

## FAQs

<AccordionGroup>
  <Accordion title="Does this use case require regular polling or scheduled polling?">
    Scheduled polling is recommended for passive monitoring of vehicle data. For
    real-time use cases, such as finding the nearest charging station based on
    current range and location, sending requests on-demand is more efficient.
  </Accordion>

  <Accordion
    title="What additional data sources are needed besides the
SmartcarAPI?"
  >
    To locate nearby charging stations, you will need external data sources to
    locate nearby charging stations. This data can be sourced from Charge Point
    Operators (CPOs) or third-party services like Google’s Places API. You may
    also use public databases such as the National Renewable Energy Laboratory
    (NREL) API for detailed information on charging station availability and
    locations.

    You may also wish to use Google’s Distance Matrix API to help
    calculate drive distance and time based on real-time traffic conditions.
  </Accordion>

  <Accordion title="Is the Smartcar API charger-agnostic?">
    Yes, Smartcar’s API enables integration with any charging station network by
    providing vehicle data through our platform.
  </Accordion>
</AccordionGroup>
