How to Build a Tesla Data Dashboard with the Tesla API

Jamie Bailey
Initial State
Published in
10 min readApr 15, 2020


Tesla data dashboard

*Update 11/13/2020: Unfortunately, Tesla has started restricting access to their API through most major services including AWS. This decision has broken this tutorial.


If you own a Tesla, there is a good chance you fell in love with all of the advanced technology your vehicle puts at your fingertips. Geeking out about all of the things your car can do has become a favorite pastime of Tesla owners. While autopilot, sentry mode, auto-presenting door handles, frequent firmware updates, ludicrous mode, easter eggs, etc. are all go-tos when showing off unique capabilities, there is one really amazing feature that you probably haven’t taken advantage of yet — the Tesla API.

Tesla’s instrumentation panels give you unmatched real-time information about what is happening in and around your car while you drive. However, it cannot let you see a historical log of information like where you have been, your battery charge history, or how hot/cold it got in your car last night. Your Tesla cannot do things like automatically text your child when you are arriving to pick them up from swim practice. Or can it?

This tutorial will show you how you can connect your Tesla to a web service to do these things and more. This tutorial will leverage Initial State as the connecting web service since Initial State provides a simple, codeless Tesla API integration.

Background Info: Initial State

Initial State is an Internet of Things platform for data visualizations. You can stream real-time data into your Initial State account and build dashboards and custom trigger alerts from your data. There are several nifty integrations with other services that let you build your dashboards/triggers with data from those services with only a couple of clicks (i.e. no coding required). The Tesla API integration is particularly useful for this tutorial. Initial State has a 14-day free trial and costs $8.33/mo for a paid account unless you are a student, then it is free.

Background Info: Tesla API

Like all good, web-connected software, Tesla has an API. This API is used by the Tesla app and their internal diagnostics tools. However, Tesla does not publicly support this API and provide official documentation. That has not stopped the Tesla community from reverse engineering their API endpoints and providing excellent documentation (e.g. ). The information available through this API is extremely useful and interesting. Your vehicle’s information is secured by your Tesla credentials, specifically OAuth, a standard protocol for authorization. This means you (and Tesla) are in control of your vehicle’s information.

Getting Started

Initial State account registration

The first step to getting started is to create an Initial State account. Go to and click on the GET STARTED button to register for an account. This will start a 14-day free trial. You do not need to enter anything other than your email address and a password to create an account and go through this tutorial.

Initial State app landing page after account creation

After creating an account, you will be automatically logged in to the Initial State web app, which will look similar to the screenshot above. To get to the data integrations section, click on the View all integrations link or go to . This is where you will find the Tesla API integration. Click on the Tesla integration, then the Begin Setup button.

Tesla API authorization

To use this data integration, you will need to authorize it by clicking on the Authorize button and entering your Tesla login information. This will generate an OAuth access token and allow access to your Tesla vehicle’s information.

Tesla integration setup — authorizing your Tesla

Once authorization is successful, you will return to the setup page where you should see that you successfully authorized your Tesla. Let’s complete the setup.

Tesla integration setup — starting the integration

Click the Begin Setup button to set up the integration parameters. Fill out the required information on the right

  • Give your integration a name (e.g. Tesla Vehicle Data).
  • Select your vehicle from the drop-down (required).
  • Leave Create a new bucket selected under “Choose a Bucket”.
  • Leave All available data selected under “What data would you like?”. This will pull in all available information from the Tesla API.
  • Select Every minute under “How often do you want new data?”. This is how often data will be fetched from your Tesla.

Click Start Integration at the bottom right to start receiving data from your Tesla. You are ready to start viewing your Tesla data. Return to the app starting page by clicking on the icon in the top left.

Tesla integration setup complete

A data bucket containing your Tesla data will be automatically created and shown in the bucket shelf on the left. Click on this data bucket to open up a dashboard of your Tesla data.

Tesla data dashboard
Tesla data dashboard

Your dashboard will look something like the one above. This dashboard only shows data since you started your integration. Hop in your car and drive around to start collecting some interesting data.

Create a Mobile Optimized Dashboard

The default dashboard created is great for viewing on your desktop but terrible for viewing on your phone. Let’s create a second view of your data optimized for your phone.

Data bucket settings

Click the bucket shelf icon on the top left to show a list of your data buckets. Click the settings icon under your Tesla Vehicle Data bucket.

Creating a duplicate dashboard view

Click the Duplicate button. Change the name to something like “Tesla Vehicle Data (Mobile)” in the top left and click the Create button at the bottom to create a duplicate view of your Tesla data.

Duplicated dashboard view

A second data bucket will be shown in your bucket shelf, an identical copy of your other Tesla data view. Let’s change this duplicate copy’s view to a mobile optimized view.

Click on the settings link under the new data bucket. Next, click on the Import View button.

Importing a mobile template

Paste the following URL in the input field at the top: . This is a dashboard template built for a Tesla mobile view. Click on the “Tesla Data (mobile)” link below the input field and then click the Import button at the bottom to import this template.

Tesla mobile dashboard
Tesla Mobile Dashboard

Log in to your Initial State account on your phone and open the mobile dashboard view. It should look like the above screenshot. The same Tesla data will drive both the desktop and mobile dashboard. If you are using an iOS device, you can add an icon to your home screen and get rid of the top and bottom toolbars for a fullscreen view by following the instructions here.

Cool Things You Can Do

In addition to having a nice looking web dashboard, this integration adds a couple of features to your Tesla that can be used for several applications. The biggest new capabilities are historical data storage and real-time triggers (e.g. text message / email alerts). Let’s go over some cool things you can do with these new features.

Create a detailed trip log

Tesla trip log

You can tuck away data from a specified period of time by following the steps outlined in the tutorial here. This can be used to create an easy-to-access trip log that will show up as a data bucket in your bucket shelf. All of the data from your Tesla that was collected during your trip can be viewed and analyzed such as how many miles you drove, where you went, your battery performance, and more.

A simple example of this is shown in the screenshot above, showing me parked outside a restaurant for 30 minutes waiting for my take-out. Seriously! 30 minutes! I am not bitter. Nope. Not one bit.

Analyze battery usage (e.g. measure vampire drain)

Tesla battery vampire drain
Tesla battery vampire drain

Logging the state of your battery every minute (or however long you set the frequency of your Tesla integration) gives you access to plenty of data to analyze what is going on with your battery. You can capture the effects that certain features like smart preconditioning have on your battery, measure battery range with different driving habits, or quantify your Tesla’s battery vampire drain.

The screenshot above is 9 days worth of battery data, specifically a line graph of battery range. You can see the cyclical pattern repeated every day. This is my battery charging to 226 miles then slowly declining to 217 miles over the course of 17 hours and repeating. This is my Tesla’s vampire drain — 9 miles per 17 hours. What is interesting is that my Tesla is plugged into the charger the entire time. After it drains down to 217 miles, charging restarts and the battery charges back to 226 miles. Very interesting behavior that I would not have known without capturing the data.

Track the number of miles driven every month

Tesla odometer log
Miles driven this month

I have a tendency to drive way too many miles on my cars, which really hurts my pocketbook when I go to trade it in or at the end of a lease. My goal is to drive less than 1,000 miles per month. Having a log of your odometer can help you automatically keep track of how many miles you have driven this month.

To add the number of miles driven so far this month to your dashboard, first add a tile (more info), then edit that tile with the following real-time expression (more info):

=’+’ & math.round([odometer] — 23647,1) & “ mi (Apr)”

You will need to change the constant used in the expression above, 23647, to whatever your odometer was at the beginning of the month as well as the month (Apr) label. If you need to go back to the beginning of the month to get your odometer (assuming the integration started before then), refer to tutorial here.

Send an alert when your battery gets low

Tesla low battery alert text message
Tesla battery low text message alert

Range anxiety haunts a lot of Tesla owners. Waking up in the morning and realizing that you forgot to plug in your Tesla charger is a bad way to start your day. Sometimes you just need an extra reminder to ensure you keep your battery charged up enough to get through your day.

I set up a trigger to text me to remind me to plug in whenever my battery range gets below 90 miles (see screenshot above). This helps me remember to plug when I get home. If my battery gets below 50 miles, I get another text message warning me that I need to plug in ASAP.

You can easily set up your own trigger alerts to receive text messages when your battery range gets below certain thresholds (more info). A step-by-step guide to setting up real-time triggers can be found here. You can also customize your alert message to whatever you want (more info).

Set a geofence trigger alert

Tesla geofence trigger alert
Tesla geofence trigger alert

A geofence trigger sends an alert whenever your location enters or leaves a radius around a GPS coordinate. For example, send a text message when I am entering 0.5 km from 36.0020015,-86.7911145.

This particular application can be really useful. For example, I have to pick my daughter up from swim practice every day. I would prefer to text her a couple of minutes before I arrive so she can get her stuff and meet me at the pickup line to keep me from having to sit in the car waiting. However, that requires I pick up my phone and text her while driving … not safe. A geofence trigger gives me the ability to have my Tesla automatically text my daughter when I am getting close. How cool is that?!?

You can learn more about how to set up a geofence trigger here.


This tutorial shows you a few things you can do when you connect your Tesla data to another web service that adds additional capabilities. The possibilities are endless as you have the option to bring in data from other services and combine that with your Tesla data. For example, you can bring in weather data to log the current conditions outside along with your trip data. Hopefully, this tutorial gives you yet another Tesla feature to show off to your friends.

Get started implementing this tutorial >>



Jamie Bailey
Initial State

EVP Strategy, Alto | ex-CEO Initial State | SaaS | startup guy | nerd