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

Tesla Owners API v3 enabled

This site may earn commission on affiliate links.
OK, so looks like you need to POST to https://TEG_IP/api/login/Basic with JSON: {"username": "customer", "email": "TEG_EMAIL", "password": "TEG_PASSWORD", "force_sm_off": false}. This should return two Set-Cookie headers (AuthCookie, UserRecord). Include these cookies when calling TEG API (e.g., /api/meters/aggregates).
I've been using the local API in my PowerWalls since they were installed in July 27, 2017, with scripts I wrote. Public records are at Solar, Battery, Home and Grid PowerFlow. I have never needed to do anything outside the home to receive the primary data. However, my scripts stopped working on February 18, 2021, showing a new error "User does not have adequate access rights", and I was gone in trips so I didn't notice until today when diagnosing a failure of the PowerWalls to cut in during a two second blackout.

I tried the above quoted POST query, but it did not work; I got the error "{"code":401,"error":"bad credentials","message":"Login Error"}". I tried using the same email and password as my iPhone Tesla app, but those did not work. What's going on? Is there a guide to this new non-local authentication method?

Is there a separate login to the PowerWall itself? I have had trouble accessing that via its web interface in the past, and was given some instructions at one point that I had trouble using without losing power in the house so haven't fully explored those.

I'm seriously mad that an item I own I cannot use without "permission".

Update: Failure still: I get the "{"code":401,"error":"bad credentials","message":"Login Error"}", however I was able to log into the local web site of the gateway. I did not have the password, but it allowed me to reset the password by turning off only one of the batteries and then using the last 5 digits of the serial number, and then it allowed me to log in to a screen which gives me the options "STOP SYSTEM" (which I never want to do and seems like a maintenance function) and "GO OFF GRID" which sounds like a good option during storms when it is already charged up. There is a screen with data that includes some more information: "Customer Version" "21.13.2" which seems like the PowerWall firmware version number, and "Grid Code" "60Hz_240V_s_UL1741SA:2019_California". The rest seem like settings I'm familiar with in the iPhone Tesla app as well as the data printed on the stickers inside the various equipment. Using this login information, I am still not able to get into the local API as described above.

Update 2: I have logged into the Internet web site of Tesla using this:

Tesla SSO – Login

This portal allowed me to login, I just went to Tesla.com, clicked my account on top right.
This is the v3 api, auth.tesla.com so just confirm thats where you are being taken.

Does the link above work okay?

I was able to get into my Tesla account and click on PowerWall. The PowerWall has been in operation for years, but under Documents, it says they want me to sign something, but says they sent it in email, and of course, a search of my email for the last years shows nothing. I don't think that request was there before; there is a list of about a dozen signed documents already. Anyway, I logged out of that. I am able to use the same password as the iPhone app to get into that. That part seems fine.
 
Last edited:
  • Like
Reactions: NuShrike
Good documents here
Authentication
I am trying this, but when I submit the curl command, I get a zero size output.

Here is the curl command:

Code:
curl -c cookie-jar -k --post301 --post302 --post303  "https://auth.tesla.com/oath2/v3/authorize?client_id=ownerapi&code_challenge=${code_challenge}&code_challenge_method=S256&redirect_uri=https://auth.tesla.com/void/callback&response_type=code&scope=openid%20email%20offline_access&state=${state}&login_hint=myemail%40myemaildomain" |tee out

The login_hint is substituted with my actual iPhone app login.

The code_challenge and state are as described in the doc.

I get zero data out, except I got either one or two cookies in hte cookie-jar2 file. (One has a hash mark in front, so I'm not sure if it is a comment.) However, the documentation says I should see an HTML file. I see nothing.
 
Last edited:
Is any of this code still working for people to auth with?
I think it still works with the .NET lib, previously mentioned, that has uses a WebView which supports the captcha bar.

Mine (independently .NET6 console based) just stopped working on my Raspberry Pi, and so I'm updating to support this new captcha requirement.
 
Last edited:
I've been using the local API in my PowerWalls since they were installed in July 27, 2017, with scripts I wrote. Public records are at Solar, Battery, Home and Grid PowerFlow. I have never needed to do anything outside the home to receive the primary data. However, my scripts stopped working on February 18, 2021, showing a new error "User does not have adequate access rights", and I was gone in trips so I didn't notice until today when diagnosing a failure of the PowerWalls to cut in during a two second blackout.
I've been able to use the local-login protocol, as previously described in this thread with the cookies, to get local login ("customer" login? the site you see when you hit your Gateway directly by LAN IP via browser) with enough authority to poll for statistics.

I haven't used local-login for control/management because the "Installer" path now requires physical toggling of a PW.