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.
Thank you for replying :)

I use this: https://owner-api.teslamotors.com/api/1/vehicles/<vehicleid>/command/actuate_trunk?which_trunk=rear

All other commands work.


Your request likely looks like:

POST /api/1/vehicles/zzzzzzz/command/actuate_trunk?which_trunk=rear HTTP/1.1
User-Agent: yyyyy
Authorization: Bearer xxxxx
Host: owner-api.teslamotors.com
Connection: close
Content-Length: 0


with your values for x,y,z....

I duplicated your current result of:

{"response":{"reason":"invalid_value","result":false}}


Instead of passing the commend as parameter on the url just pass them as value in the body. Note the additional Content-Type header and its value to indicate the type of data you are passing in the body for the POST request

POST /api/1/vehicles/zzzzzz/command/actuate_trunk HTTP/1.1
User-Agent: yyyyy
Authorization: Bearer xxxxxx
Content-Type: application/json
Host: owner-api.teslamotors.com
Connection: close
Content-Length: 22

{"which_trunk":"rear"}


Which yields a valid response:

{"response":{"reason":"","result":true}}
 
  • Helpful
Reactions: scottf200
Does the API support changing the charging start time? I can't find it, but it seems like a pretty fundamental need. If the answer is "no", then are all the apps that support changing the start time just manually starting the charge at the new time from the app/server end? Sounds crazy to me!
Tesla Control lets you schedule start and stop times. It’s done with background tasks.
 
I can find the start/stop charging commands (no details about what the httpbody payload should be though?)... however, is there such a command that could set the charging current remotely? I haven't seen one in the official app but I'm wondering if an API for it exists (or if someone managed to sniff one out)?
 
I can find the start/stop charging commands (no details about what the httpbody payload should be though?)... however, is there such a command that could set the charging current remotely? I haven't seen one in the official app but I'm wondering if an API for it exists (or if someone managed to sniff one out)?

Unfortunately not. This is a holy grail I have been waiting for (And tweeting Elon).
If the API allowed us to set the charge rate, I could utilise much more of my solar export by keeping the charge rate the same as solar excess.
 
  • Love
Reactions: lonertic
Unfortunately not. This is a holy grail I have been waiting for (And tweeting Elon).
If the API allowed us to set the charge rate, I could utilise much more of my solar export by keeping the charge rate the same as solar excess.
EXACTLY the reason why I asked for it too :) Tweet him again, I'd imagine we're not the only ones thinking about this... Since my solar inverter can't work in island mode, and I can't send any predetermined amount of power towards the car first before exporting excess, having the car "pull" a corresponding amperage out of the inverter in line with solar output seems to make a lot of sense!

I'm guessing you already tried obvious stuff like command/set_charge_current (as opposed to set_charge_limit) just to see if the API actually exists right? (i just tested it now, got a 400 bad request).. that makes me think, i wonder what other hidden APIs there are.. possible able to just guess a bunch i think
 
EXACTLY the reason why I asked for it too :) Tweet him again, I'd imagine we're not the only ones thinking about this... Since my solar inverter can't work in island mode, and I can't send any predetermined amount of power towards the car first before exporting excess, having the car "pull" a corresponding amperage out of the inverter in line with solar output seems to make a lot of sense!

I'm guessing you already tried obvious stuff like command/set_charge_current (as opposed to set_charge_limit) just to see if the API actually exists right? (i just tested it now, got a 400 bad request).. that makes me think, i wonder what other hidden APIs there are.. possible able to just guess a bunch i think
Mate it doesn't exist
 
Unfortunately not. This is a holy grail I have been waiting for (And tweeting Elon).
If the API allowed us to set the charge rate, I could utilise much more of my solar export by keeping the charge rate the same as solar excess.

There's a different way to achieve this, by using the load sharing protocol of the Tesla Wall Connector. (This requires wiring something to the wall connector.) There's a thread here:

New Wall Connector load sharing protocol

And source code here:

cdragon/TWCManager
 
There's a different way to achieve this, by using the load sharing protocol of the Tesla Wall Connector. (This requires wiring something to the wall connector.) There's a thread here:
Nice! But unfortunately my car is 2015, so is my HPWC... so I can only assume it's the "older" model with older firmware/hardware that can't run that... and it wouldn't be as precise as the car controlling draw either, because HPWC selector is still in stepped amps, whereas car is single digit amp changes... really wish an API was available! :( What about canbus message within the car? anyone?
 
Nice! But unfortunately my car is 2015, so is my HPWC... so I can only assume it's the "older" model with older firmware/hardware that can't run that... and it wouldn't be as precise as the car controlling draw either, because HPWC selector is still in stepped amps, whereas car is single digit amp changes... really wish an API was available! :( What about canbus message within the car? anyone?

It requires a second generation wall connector, but I believe it will work with any Model S/X/3.
 
Nice! But unfortunately my car is 2015, so is my HPWC... so I can only assume it's the "older" model with older firmware/hardware that can't run that... and it wouldn't be as precise as the car controlling draw either, because HPWC selector is still in stepped amps, whereas car is single digit amp changes... really wish an API was available! :( What about canbus message within the car? anyone?
That's doable, as the car is the one that talks to EVSE and requests the current
 
So I'm digging into the latest app version and like the new nearby charging station APIs.

Endpoint: api/1/vehicles/{vehicle_id}/nearby_charging_sites
Method: GET
* Bearer Token auth header required

Response Sample:

Code:
{
   "response":{
      "congestion_sync_time_utc_secs":1545270496,
      "destination_charging":[
         {
            "location":{
               "lat":60.480312,
               "long":22.327951
            },
            "name":"Unique Home",
            "type":"destination",
            "distance_miles":1.645089
         },
         {
            "location":{
               "lat":60.460714,
               "long":22.290152
            },
            "name":"Holiday Club Caribia",
            "type":"destination",
            "distance_miles":2.673828
         },
         {
            "location":{
               "lat":60.4554,
               "long":21.9516
            },
            "name":"Kultaranta Resort",
            "type":"destination",
            "distance_miles":14.195284
         },
         {
            "location":{
               "lat":60.163116,
               "long":22.732845
            },
            "name":"K-Supermarket Kompass",
            "type":"destination",
            "distance_miles":24.419037
         }
      ],
      "superchargers":[
         {
            "location":{
               "lat":60.442961,
               "long":22.605621
            },
            "name":"Paimio, Finland - Tammisilta",
            "type":"supercharger",
            "distance_miles":8.271776,
            "available_stalls":8,
            "total_stalls":8,
            "site_closed":false
         },
         {
            "location":{
               "lat":61.181106,
               "long":23.885075
            },
            "name":"Akaa, Finland - Toijala",
            "type":"supercharger",
            "distance_miles":71.047409,
            "available_stalls":8,
            "total_stalls":8,
            "site_closed":false
         }
      ],
      "timestamp":1545271308686
   }
}

-

And on that note, I'm excited my Model S got the latest software update earlier today so I'm gonna try to guess the new seat heater / steering wheel heater control endpoint seeing as the mobile app update with support for it hasn't been released yet. :eek:
 
@ACDriveMotor , haven't found it yet. I've tried 50+ different combinations of "set", "heater", "seat", "level", "limit", "heating", "element", etc. If you get a 400 status code it's wrong, if you get anything else then we're in business.

There's a chance Tesla doesn't enable the endpoint until the 3.8.0 app release as well.
 
Last edited: