Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register

Model S REST API

This site may earn commission on affiliate links.
I absolutely loved having this available - wrote some nice fetching scripts and graphed all data points available in Cacti.

temps.png

battery_level.png

range.png


But it seems that access from Tesla has been disabled for anybody not already logged in with a token. Hope hope hope it's somehow re-enabled... All third-party apps and access will pretty much be disabled after 90 days (the expiry of all tokens...). Bummer...
 
But it seems that access from Tesla has been disabled for anybody not already logged in with a token. Hope hope hope it's somehow re-enabled... All third-party apps and access will pretty much be disabled after 90 days (the expiry of all tokens...). Bummer...

Are you sure about that? Haven't checked my script recently to see when it last logged in, but that doesn't seem right. If they ban us then they ban the mobile app as well.
 
Are you sure about that? Haven't checked my script recently to see when it last logged in, but that doesn't seem right. If they ban us then they ban the mobile app as well.
I can login and get new tokens using either the old or new API. It is only some people that are currently blocked from logging in from third party clients. For those that are blocked, the mobile client continues to work so Tesla must be able to differentiate "real" logins from the official apps from third party logins.
 
I can login and get new tokens using either the old or new API. It is only some people that are currently blocked from logging in from third party clients. For those that are blocked, the mobile client continues to work so Tesla must be able to differentiate "real" logins from the official apps from third party logins.

Absolutely, here I am totally unable to login, with old or new API. The official APP probably send some specific thing during login to tell it's the official app.
Don't know why it's working again for some users
 
Are you sure about that? Haven't checked my script recently to see when it last logged in, but that doesn't seem right. If they ban us then they ban the mobile app as well.

System was working fine for my P85 - well after for a month or so after I traded my car in waiting to my P85D. Once that car was pulled from my profile, I reran the scripts to get my new vehicle ID number - and I never get passed the HTTP 500 error (just sending the username/password). My iPhone app and portal logins work fine...


Code:
<!DOCTYPE html>
<html>
<head>
  <title>We're sorry, but something went wrong (500)</title>
  <style type="text/css">
    body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
    div.dialog {
      width: 25em;
      padding: 0 4em;
      margin: 4em auto 0 auto;
      border: 1px solid #ccc;
      border-right-color: #999;
      border-bottom-color: #999;
    }
    h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
  </style>
</head>


<body>
  <!-- This file lives in public/500.html -->
  <div class="dialog">
    <h1>We're sorry, but something went wrong.</h1>
    <p>We've been notified about this issue and we'll take a look at it shortly.</p>
  </div>
</body>
</html>

From what I've seen with VisibleTesla - it's affecting that app as well (which uses the same API I think). So much so that the VisibleTesla app developer shut it down...
 
Hans, many moons ago I installed streaming and mongodb and it all worked just fine. Then was off line for 2 months have a new car and streaming now returns:

Waiting 30 secs and then reinitializing...9 Jan 21:29:15 - [Error: login failed]
9 Jan 21:29:15 - Info: car is in (undefined) state, calling /charge_state to reveal the tokens
9 Jan 21:29:16 - Warn: waking up with charge_state request failed.
Waiting 30 secs and then reinitializing...
9 Jan 21:29:46 - 2 of 6 REST requests since 1420860554485
9 Jan 21:29:47 - [Error: login failed]
9 Jan 21:29:47 - Info: car is in (undefined) state, calling /charge_state to reveal the tokens
9 Jan 21:29:48 - Warn: waking up with charge_state request failed.

The app works fine but has now two cars registered on our account:
config.json
{ "username": "[email protected]",
"password": "xyxyxyxyx"
}

Updated code with: "C:\Program Files\nodejs>npm install -g teslams" What do you suggest I need to modify?
 
Last edited:
Hans, many moons ago I installed streaming and mongodb and it all worked just fine. Then was off line for 2 months have a new car and streaming now returns:

Waiting 30 secs and then reinitializing...9 Jan 21:29:15 - [Error: login failed]...

Sounds like you are getting blocked like many other people. Tesla is shutting down access from all third party apps. Not much we can do about it I am afraid.
 
Hmmm, changed the source IP. Same result. Not Happy! This is a new P85D feature, in the sense that anybody with two cars on the account now has a problem?
The login problems people are experiencing are unrelated to having two cars. It's that's the problem you have I would be happy to debug it for you and enhance the code to make it work. PM me and I will give you you some debugging tips.
 
Sorry to cut to the chase but I am a new Model S owner interested in trying this out and it isn't that practical to read a 114 page thread. What is the current status of accessing the Tesla server(s) using the API? Does it work at all? It looks like some people are having trouble accessing Tesla's servers. Any quick start guides for doing basic stuff like just reading charge status, etc? I would be most comfortable doing this in Python if that is an option.
 
I apologize if this has been posted... tried various searches and could not find... Does visibletesla have any way of indicating whether the car it is talking to is connected by 3G or WiFi? If not, any suggestions on how to do that? I often leave my car connected to WiFi with good signal in my garage, only to return minutes or hours later to see it is connected to 3G. Would be useful to check without going to garage to see if I can figure out root cause.
 
I apologize if this has been posted... tried various searches and could not find... Does visibletesla have any way of indicating whether the car it is talking to is connected by 3G or WiFi? If not, any suggestions on how to do that? I often leave my car connected to WiFi with good signal in my garage, only to return minutes or hours later to see it is connected to 3G. Would be useful to check without going to garage to see if I can figure out root cause.
Could you check your wifi router to see if the tesla is connected? The mac address is available from the network setup scenes in the car.
 
From some experimentation, I wonder if Tesla isn't blocking third-party apps, but is just more aggressively rate-limiting the requests. I reset my logger to only update every 10 minutes and it's been running fine for over 24 hours (3 503 responses, but that's pretty normal). This is with the old portal.vn API, FWIW.

It could be a red herring, but figured I'd mention it.

- - - Updated - - -

Sorry to cut to the chase but I am a new Model S owner interested in trying this out and it isn't that practical to read a 114 page thread. What is the current status of accessing the Tesla server(s) using the API? Does it work at all? It looks like some people are having trouble accessing Tesla's servers. Any quick start guides for doing basic stuff like just reading charge status, etc? I would be most comfortable doing this in Python if that is an option.

Wayner, check out the wiki here with a few links to libraries: http://www.teslamotorsclub.com/showwiki.php?title=REST+API+Tools+and+Apps
 
From some experimentation, I wonder if Tesla isn't blocking third-party apps, but is just more aggressively rate-limiting the requests. I reset my logger to only update every 10 minutes and it's been running fine for over 24 hours (3 503 responses, but that's pretty normal). This is with the old portal.vn API, FWIW.

It could be a red herring, but figured I'd mention it.

- - - Updated - - -



Wayner, check out the wiki here with a few links to libraries: REST API Tools and Apps - Tesla Motors Club - Enthusiasts & Owners Forum
They have definitely increased their throttling but the login problem is a separate issue.
 
Could you check your wifi router to see if the tesla is connected? The mac address is available from the network setup scenes in the car.
This is a bit OT but I use a program called WakeMeOnLan to send wake up packets. But this program also does a great job scanning your subnet and showing you what is or has been connected. My Tesla shows up with a MAC starting 90-03-B7 and the company this maps to is PARROT. Fing is a similar iOS app that also scans your subnet.
 
I just started logging the http-responses from the API, and after the last downtime a few days ago, it seems to have stabilized quite a lot.

The last 1000 requests to the API has given the following response-codes:

Last 1000 responses:
200 => 981
503 => 14
502 => 5

IE about 2% errors.

And it seems like most of these errors happened during a short time, because earlier today I had an even better result:

Last 1000 responses:
200 => 998
503 => 2

So that's a mere 0,2% error-rate.

Hopefully they have upgraded their servers and this will keep working.

Now, all I really want is my own API-client-id and secret...
 
I apologize if this has been posted... tried various searches and could not find... Does visibletesla have any way of indicating whether the car it is talking to is connected by 3G or WiFi? If not, any suggestions on how to do that? I often leave my car connected to WiFi with good signal in my garage, only to return minutes or hours later to see it is connected to 3G. Would be useful to check without going to garage to see if I can figure out root cause.

From my experience as soon as the car goes to sleep (even if the keep connected setting is set) WiFi is dropped and 3G gets connected.