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.
Apologies if I missed this. Has the streaming API changed within the past couple years? It doesn't seem to return anything (content length 0) for me:

Code:
> GET /stream/xyxyxyxyxyx/?values=speed,power HTTP/1.1
> Host: streaming.vn.teslamotors.com
> Authorization: Basic xyxyxyxyxyxyxyx
> User-Agent: curl/7.42.1
> Accept: */*
>
* SSLv2, Unknown (23):
< HTTP/1.1 200 OK
< Server: nginx
< Date: Tue, 12 Jun 2018 04:22:17 GMT
< Content-Type: text/event-stream
< Content-Length: 0
< Connection: keep-alive
< Cache-Control: no-cache
<
* Connection #0 to host streaming.vn.teslamotors.com left intact
 
This works for me:
Code:
Vehicle: tokens=[u'123456789abcdef0', u'1234123412341234']
VEHICLE_TOKEN='123456789abcdef0'
curl --user "$TESLA_EMAIL:$VEHICLE_TOKEN" "https://streaming.vn.teslamotors.com/stream/$VEHICLE_ID/?values=speed,odometer,soc,elevation,est_heading,est_lat,est_lng,power,shift_state"
 
Can't get the streaming api to work either on Model 3 (2018.21.9 75bdbc11)

Looking through the APK, I found a "new" streaming endpoint:
Code:
StreamingServerEndpoints={LOCATION_STREAMING:"streaming/",AUTOPARK_SUMMON:"connect/"}

but I am unable to connect, server seems to not be able to connect to the car.

Code:
{"msg_type":"data:error","tag":"${vehicle_id}","value":"disconnected","error_type":"vehicle_disconnected"}

If anyone wants to try the new endpoint on their Model S or X I can send some sample code over
 
Ok, I posted about my Javascript API Token Generator in this thread: Tesla API Token Generator

But I've been working on enhancing it a lot tonight. Basically, it injects a Javascript script using Tampermonkey onto the https://owner-api.teslamotors.com/oauth/token domain. So in effect, all the code is running in your local browser talking directly to the Tesla API endpoints over https. No middleman or other websites or servers to worry about. No need to install Python, Ruby, PHP, Postman, CURL, etc or learn or use the OSX or linux command line.

This method only has one requirement: Install the Tampermonkey browser extension in Chrome or Firefox. You can then install my script from this page with one click: About | Telsa API Token Generator | Userscripts | OpenUserJS Once installed, just go to: https://owner-api.teslamotors.com/oauth/token to get started and the script will do its thing.

All the code is right there in Javascript/jquery for your review/inspection. Once you login, you can view all the cars on your Tesla Account, and then pull the /data endpoint for each one.

It's pretty basic at this point, but if you want to just play around and see what the API returns for your car, I think this is probably the easiest way for people to jump in and browse the API information. Or say if you're away from your own server or API code, this is browser-only code that you can safely run from anywhere.