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.
/wake_up is the only such endpoint.
The trick is to just keep trying.

I have not even once gotten the wake_up command to work. How often are people posting to it, and for how long, in order to get this working? Has anyone sniffed the app traffic to verify it's using the exact same thing and what it's frequency is? I've been using postman and just manually mashing the send button for a few minutes with no results. But, if I open my phone app, it wakes up in a few seconds, so I know it's not in "deep" sleep.
 
Thanks @goRt!

I appreciate your response and support.

I thought Telsa managed the connection from the car but wasn't sure if the change from wifi to cellular impacted the stream. When I'm in my garage, I'm connected to wifi. By the time I'm at the end of my driveway, the car has switched to cellular. I can imagine some delay in reconnecting with Tesla.

It appears that my app never gets connected again when there is a switch from wifi to cellular; that is what I'm attempting to understand/solve.
I usually see the subscribe sent, one data set is streamed (perhaps more depending on what the car is doing), and a disconnect. In my app, I see that pattern while the car sits in the garage. The pattern stops when there is a switch from wifi to cellular. Perhaps I need to wait longer (I'm happy to be patient) but I wondered if other had seen this and had solutions.

Joe

I don't know if this helps, but if I use my phone's streaming connection to summon my car at home, where there is both terrible cell service, and weak wifi in the garage, I often have problems and was told by Tesla service it was likely a symptom of switching connections on the car side, so you may be on to something.
 
I have not even once gotten the wake_up command to work. How often are people posting to it, and for how long, in order to get this working? Has anyone sniffed the app traffic to verify it's using the exact same thing and what it's frequency is? I've been using postman and just manually mashing the send button for a few minutes with no results. But, if I open my phone app, it wakes up in a few seconds, so I know it's not in "deep" sleep.

When I get a 408 back, I just wait for 15s and then loop back round - take 2-3 attempts
 
When I get a 408 back, I just wait for 15s and then loop back round - take 2-3 attempts

Can I ask for the exact contents (minus token of course) of your headers? what are you using to send the command? Do you have a basic case using curl or similar that is not implemented inside a larger app?

Here is my command, for reference (copied from Postman Console):

Code:
POST https://owner-api.teslamotors.com/api/1/vehicles/61123815190767109/command/wake_up
408
117 ms
Network
Request Headers
User-Agent: Autocharger
Authorization: Bearer !!!!!
Accept: */*
Postman-Token: 2b342346-8ed0-42a4-a5ca-043eebad8875
Host: owner-api.teslamotors.com
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Request Body
Response Headers
Date: Thu, 07 Jan 2021 05:43:58 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 106
Connection: keep-alive
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Cache-Control: no-cache
X-Request-Id: c37e51be1550b18b9a226a132b7ec050c37e51be1550b18b9a226a132b7ec050
X-Runtime: 0.035559
Strict-Transport-Security: max-age=15724800; includeSubDomains
Response Body
{"response":null,"error":"vehicle unavailable: {:error=>\"vehicle unavailable:\"}","error_description":""}
 
Can I ask for the exact contents (minus token of course) of your headers? what are you using to send the command? Do you have a basic case using curl or similar that is not implemented inside a larger app?

Here is my command, for reference (copied from Postman Console):

Code:
POST https://owner-api.teslamotors.com/api/1/vehicles/61123815190767109/command/wake_up
408
117 ms
Network
Request Headers
User-Agent: Autocharger
Authorization: Bearer !!!!!
Accept: */*
Postman-Token: 2b342346-8ed0-42a4-a5ca-043eebad8875
Host: owner-api.teslamotors.com
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Request Body
Response Headers
Date: Thu, 07 Jan 2021 05:43:58 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 106
Connection: keep-alive
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Cache-Control: no-cache
X-Request-Id: c37e51be1550b18b9a226a132b7ec050c37e51be1550b18b9a226a132b7ec050
X-Runtime: 0.035559
Strict-Transport-Security: max-age=15724800; includeSubDomains
Response Body
{"response":null,"error":"vehicle unavailable: {:error=>\"vehicle unavailable:\"}","error_description":""}

I'm not using postman, I'm using teslaJS as the base hacked about by myself and called from node-red
mseminatore/TeslaJS
 
Don't all the other endpoints wake up the car? (The exceptions are the vehicle list and the streaming API.)
None of the ones I've tried (both GET and POST) will do so, although they will keep my car awake as seems to be the norm. I just can't wake up my car. Do the other endpoints in fact wake up anyone else's?
 
I'm not using postman, I'm using teslaJS as the base hacked about by myself and called from node-red
mseminatore/TeslaJS
The dev of teslaJS also made a windows app; it asks for "Username" and "Password (or token)". I tried a freshly generated access_token returned from https://owner-api.teslamotors.com/oauth/token, but it just sat there with a loading circle of dots forever. Is there a way to get teslaJS or the Tesla Control Windows app running without supplying the password?
 
The dev of teslaJS also made a windows app; it asks for "Username" and "Password (or token)". I tried a freshly generated access_token returned from https://owner-api.teslamotors.com/oauth/token, but it just sat there with a loading circle of dots forever. Is there a way to get teslaJS or the Tesla Control Windows app running without supplying the password?

Answer to my own question:
install TeslaJS

picked apart login.js, did this:
Code:
node
> var token = JSON.stringify({copy and paste entire oauth/token response body here, including curly braces});
undefined [output]
> var fs = require('fs');
undefined [output]
> fs.writeFileSync('.token',token, 'utf8');
undefined [output]

then I was in business with teslaJS.

First attempt returned
Model 3 ( 'Autocorrect' ) is: ONLINE
WakeUp command: Succeeded
Vehicle state: online

However, when checking vehicle list, it was NOT online.

wakeup attempts from Postman didn't do anything.

As @goRt said, a second attempt from TeslaJS actually brought it online.
 
  • Like
Reactions: goRt
Bad news bears: The auth endpoint on the Owner API has been deprecated and deactivated:
INFO -- request: POST https://owner-api.teslamotors.com/oauth/token
INFO -- response: {"response":"endpoint_deprecated:_please_update_your_app."}

Looks like I'll have to update the docs for the new auth.tesla.com server. Fun weekend ahead...
 
Using @timdorr's documentation (Authentication) I was able to get my scripts working with the new authentication scheme. Since the only user of my scripts is me, I skipped the whole HTML parsing part, and instead I just put the URL from step 1 into a web browser, login to the website, then using the web browser's network debug tool, I copy the authentication code out of the Location header. I plug that code back into my script, which does the rest. I figure I only have to do the initial login once, and then use the refresh tokens after that, so there's not much point in putting more effort into the first part.