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

Tesla Owner API Tutorial (All you need is your browser)

This site may earn commission on affiliate links.
I searched through the threads here but all I was able to find was a little bit too technical IMO for the average user and the step by step how to was not really there. I love the fact that Tim did the Apiary.io documentation and wanted with just the browser to walk through an example of how to get your Tesla's vehicle state etc.

I ended up actually doing this step by step for myself and that is how I found out that my "uncorking" was not done although my car was 2 months ago with Tesla of West Palm Beach for that exact purpose. So I have a real life example how this helped me.

Obviously, you can go like 10 different ways to get to the API and work with it but what I really liked with the Apiary.io was that all you need is just the browser so anyone can quickly do it without any other tools like Postman etc.

In any case, hope this is useful to the community and my apologies if it was done already. I did not find much on YT on the subject.



PS. There are few issues in the video like the Content-Type header param etc but overall it should suffice for the average user to follow and get data for their vehicle out IMO.
 
I searched through the threads here but all I was able to find was a little bit too technical IMO for the average user and the step by step how to was not really there. I love the fact that Tim did the Apiary.io documentation and wanted with just the browser to walk through an example of how to get your Tesla's vehicle state etc.

I ended up actually doing this step by step for myself and that is how I found out that my "uncorking" was not done although my car was 2 months ago with Tesla of West Palm Beach for that exact purpose. So I have a real life example how this helped me.

Obviously, you can go like 10 different ways to get to the API and work with it but what I really liked with the Apiary.io was that all you need is just the browser so anyone can quickly do it without any other tools like Postman etc.

In any case, hope this is useful to the community and my apologies if it was done already. I did not find much on YT on the subject.



PS. There are few issues in the video like the Content-Type header param etc but overall it should suffice for the average user to follow and get data for their vehicle out IMO.
Great stuff. I've just honked my car's horn using my mouse. That's a first :)
 
That was helpful, thank you.

Just did my uncork today and no performance gain was noted. I followed your tutorial and mine also says p3. Going to have a nice chat w/ SC tomorrow.

Ask them (nicely) to show you the diagnostics screen so you can verify the uncork took. Based on the data we have so far, the API will only tell you part of the story. But even so, any car with "P3", as far as we can tell, is not uncorked:

So, there appear to be two fields that are relevant here.... One is "Performance" (My car was P3, and is now P1), the other is "Perf Add On" (My car was "Standard", and is now "Uncorked")

Both of these fields can be seen in the car's diagnostics interface (accessible to SC techs/rangers):
View attachment 256359

The Performance setting can also be read via the Tesla owner API.

Unfortunately, it appears the Performance tag is only useful for checking the "Uncorked" state of your car if you have a dual motor vehicle (like my 75D). And even then, it is only an indicator; PerfAddOn also needs to be set to Uncorked. (and, I suspect, in addition to these config changes, the motor controllers also need to get a firmware redeploy with their new configs/curves, which is likely why this update needs to be done in person and not OTA).

If you do have a 75D though and want to check its uncorked status, you should be able to do so via the vehicle_state call from the owner API.

You'll need an API key, as well as your car's id (from the vehicles call): Tesla Model S JSON API · Apiary

Code:
curl --header "Authorization:Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" https://owner-api.teslamotors.com/api/1/vehicles/xxxxxxxxxxxxxxxxx/data_request/vehicle_state

The response should include this:
Code:
      "perf_config" : "P1"

if you're uncorked.

or this:
Code:
      "perf_config" : "P3",

if you're corked.

If you use Teslafi, you can see the Performance tag in the raw API data section:
View attachment 256360

JDeck has collected some more data from his Teslafi platform here that does seem to validate that P3 = corked for 75Ds: http://firmware.teslafi.com/uncorked.php

UncorkedDiagUI75D.jpg
 
This is great stuff!
I was following right along and making good progress. Until I tried a GET for the Vehicle State :(
I get a 404:
{
"response": null,
"error": "not_found",
"error_description": ""
}
The vehicle ID in the URL also shows in red font.
I get the impression that I don't have the correct syntax to put in the URI parameter??
The URI name/value pair I'm using is vehicle_id 0123456789
Where the numeric string is a cut and paste of the return of my successful Vehicle call (List all vehicles)

Thoughts??
 
This is great stuff!
I was following right along and making good progress. Until I tried a GET for the Vehicle State :(
I get a 404:
{
"response": null,
"error": "not_found",
"error_description": ""
}
The vehicle ID in the URL also shows in red font.
I get the impression that I don't have the correct syntax to put in the URI parameter??
The URI name/value pair I'm using is vehicle_id 0123456789
Where the numeric string is a cut and paste of the return of my successful Vehicle call (List all vehicles)

Thoughts??

Yes you copied either the wrong vechile_id or typed it wrong. It should be in red font. Did you copy the id_s? In the video I mentioned that you should copy id_s and not vechicle_id ... not sure why they did this.
 
  • Informative
  • Funny
Reactions: Mygr8 and GaryW
I searched through the threads here but all I was able to find was a little bit too technical IMO for the average user and the step by step how to was not really there. I love the fact that Tim did the Apiary.io documentation and wanted with just the browser to walk through an example of how to get your Tesla's vehicle state etc.

I ended up actually doing this step by step for myself and that is how I found out that my "uncorking" was not done although my car was 2 months ago with Tesla of West Palm Beach for that exact purpose. So I have a real life example how this helped me.

Obviously, you can go like 10 different ways to get to the API and work with it but what I really liked with the Apiary.io was that all you need is just the browser so anyone can quickly do it without any other tools like Postman etc.

In any case, hope this is useful to the community and my apologies if it was done already. I did not find much on YT on the subject.



PS. There are few issues in the video like the Content-Type header param etc but overall it should suffice for the average user to follow and get data for their vehicle out IMO.

Do I have to put in every quotation mark, full colon, and comma in the Body field? I fill everything in as instructed in your video but I keep getting messages like this:


  1. "error": "invalid_request",
  2. "error_description": "The request is missing a required parameter, includes an unsupported parameter value, or is otherwise malformed.”

I probably need to go back to my apiary and tend to my bees. Much easier than dealing with any programming language. Novice user here.
 
The "Set Charge Limit" doesn't seem to be working fine. It doesn't matter what percentage I specify, it gets set to 50%. Anyone else had luck with it? I am thinking about creating a simple webpage for my personal use to get/set some basis things the way I like it.
 
Do I have to put in every quotation mark, full colon, and comma in the Body field? I fill everything in as instructed in your video but I keep getting messages like this:


  1. "error": "invalid_request",
  2. "error_description": "The request is missing a required parameter, includes an unsupported parameter value, or is otherwise malformed.”

I probably need to go back to my apiary and tend to my bees. Much easier than dealing with any programming language. Novice user here.

Copy and paste the bellow. Replace the email and password. Should work.

{
"grant_type": "password",
"client_id": "81527cff06843c8634fdc09e8ac0abefb46ac849f38fe1e431c2ef2106796384",
"client_secret": "c7257eb71a564034f9419ee651c7d0e5f7aa6bfbd18bafb5c5c033b093bb2fa3",
"email": "<YOUREMAIL>",
"password": "<YOURPASSWORD>"
}