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.
That's ok now I can successfully get a 90 days token with curl :D
With the new api on https://owner-api.teslamotors.com/oauth/token

Now I need to see how to use this token when calling API urls


I know Tesla's internal sites can see pack temp, CAC (estimated), and other awesome things. there must be a way for us to get them too if only we had the queries.

I wish there was something we could do to see in the traffic the car is putting on my wifi without the key for the openvpn connection.
 
How can I access things like odometer, FW version, and other things that VisibleTesla displays, but is not listed here: Tesla Model S JSON API—by apiary.io

Most things are documented at either or both of apiary.io and a google doc titled "Tesla Model S Remote Access Protocol". The odometer reading is only available through the streaming API (don't ask me why). You can read about it in the google doc I just mentioned.

Another easy thing to do is look at the source code of one of the existing apps or libraries. This page gives links to code in Python, JavaScript, Java, C#, Ruby, and PHP.

Hope that helps.
 
Does anyone else experience issues at the moment (as of yesterday) with logging in? When I do curl -k -c cookies.txt -d "user_session=USERNAME&user_session[password]=PASSWORD" https://portal.vn.teslamotors.com/login[/I]I get a HTTP 500 response. Existing session do keep working, but I assume that is due to the fact that the cookie is valid for 30 days.

I read something about using OAuth to connect. Anyone care to share how this is done?

With kind regards,

Patriek
 
Question about OAuth tokens

That's ok now I can successfully get a 90 days token with curl :D
With the new api on https://owner-api.teslamotors.com/oauth/token

Now I need to see how to use this token when calling API urls

Would you like to share how you did this? I'm currently having technical issues with the plain text username/password approach (apart from the moral issues I have with it).

With kind regards,

Patriek
 
I am playing around with my NEST Thermostat and it is amazing the similarity to what has been going on with this community. People at first decoded the protocol and make unofficial APIs just as everyone here has done. Now Google has a NEST Developer Program with sample code and a proper OAuth 2.0 authentication system for allowing users to approve third party "Partner Developer Services" to be able to access the NEST resource servers.

Hey Tesla look over here!

Detailed authorization data flow | Nest Developer Program
 
Doesn't the NEST encrypt all traffic to the cloud? So it's not a local API right? I mean, the same can be said of the MS, but when I was looking to buy a new thermostat they didn't even have an API. That was a deal breaker for me so I bought a radio thermostat and haven't looked back since. Oh and it was half the price of the NEST at the time.

I think Tesla will get around to this eventually, though it's probably not high on their list of priorities.
 
Doesn't the NEST encrypt all traffic to the cloud? So it's not a local API right? I mean, the same can be said of the MS [...]

Exactly. Google are control freaks just like Tesla so all the traffic from their devices (Thermostat, Smoke detector, Dropcam) to their servers in the cloud are encrypted and they do not provide official local APIs. Hackers have figured it out and there are unofficial NEST API in a dozen languages, but NEST has no intention of enabling anyone to integrate without going through their managed APIs in the cloud, joining their developer program, complying with their terms and conditions, etc.

Tesla could do this as well for the types of apps we have been writing using the REST and streaming endpoints. They have everything they need in place. I checked a few of the standard OAUTH 2.0 URLs and parameters and they seem to work. They just need to expose a Web Page to register third party apps, assign client ids, client secret, and a redirect URI (or a PIN) for allowing the users to approve the third party apps.

The SDK for the car is something different because it would run locally on the console, likely in a sandbox, but with some (optional) access to the cars subsystems for bluetooth, navigation, the dashboard display, etc. These apps unfortuately must be tightly controlled (i.e. approved) by Tesla to comply with government regulations and ensure safety. This is a much larger effort to setup this kind of a developer program because it requires Tesla to setup a Tesla App Store, and dedicate people to an application approval process for the candidate apps. They also need to build a bulletproof sandbox on the car or they risk negative press about some rogue app taking over control.

I figure, Tesla will walk before they run so I hope to hear about a developer program with OAuth 2.0 authentication of registered third party apps and a REST and Streaming REST API that pretty much matches what we already know.
 
Last edited:
I've heard from a P85D owner that he has parking assist, but it's not showing up as an option from the vehicle data. Do all Model Ss after a certain point come with parking assist? Is it not listed as an option for those cars because it is now standard?