FORMAT: 1A
HOST: https://owner-api.teslamotors.com

# TeslaJS Mock Model S JSON API

This is unofficial documentation of the Tesla Model S JSON API used by the iOS and Android apps. 
Its primary purpose is to enable testing the TeslaJS node library.

# Group Authentication

## Login [/oauth/token]

### Get an Access Token [POST]

Performs the login. Takes in an plain text email and password, matching the owner's login information for [https://my.teslamotors.com/user/login](https://my.teslamotors.com/user/login).

Returns a `access_token` which is passed along as a header with all future requests to authenticate the user.

You must provide the `Authorization: Bearer {access_token}` header in all other requests.

The current client ID and secret are [available here](http://pastebin.com/fX6ejAHd)

+ Attributes

    + grant_type: `password` (string) - The type of oAuth grant. Always "password"
    + client_id: `abc` (string) - The oAuth client ID
    + client_secret: `123` (string) - The oAuth client secret
    + email: `elon@teslamotors.com` (string) - The email for my.teslamotors.com
    + password: `edisonsux` (string) - The password for my.teslamotors.com

+ Response 200 (application/json)

    + Body
    
            {
              "access_token": "abc123",
              "token_type": "bearer",
              "expires_in": 7776000,
              "created_at": 1457385291,
              "refresh_token" : "cba321"
            }
            
## Logout [/oauth/revoke]

### Revoke an Access Token [POST]

Revoke an access token

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Response 200 (application/json)

    + Body
    
            {
                "response": true
            }

# Group Vehicles

A logged in user can have multiple vehicles under their account. This resource is primarily responsible for listing the vehicles and the basic details about them.

## Vehicle Collection [/api/1/vehicles]

### List all Vehicles [GET]

Retrieve a list of your owned vehicles (includes vehicles not yet shipped!)

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Response 200 (application/json)

    + Body
    
            {
              "response": [{
                "color": null,
                "display_name": null,
                "id": 321,
                "option_codes": "MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013",
                "user_id": 123,
                "vehicle_id": 1234567890,
                "vin": "5YJSA1CN5CFP01657",
                "tokens": ["x", "x"],
                "state": "online"
              }],
              "count":1
            }

### Get specific Vehicle [GET /api/1/vehicles/{vehicle_id}]
Retrieve a specific vehicle (includes vehicles not yet shipped!)

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "color": null,
                "display_name": null,
                "id": 321,
                "option_codes": "MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013",
                "user_id": 123,
                "vehicle_id": 1234567890,
                "vin": "5YJSA1CN5CFP01657",
                "tokens": ["x", "x"],
                "state": "online"
              },
              "count":1
            }

## State and Settings [/api/1/vehicles/{vehicle_id}]

These resources are read-only and determine the state of the vehicle's various sub-systems.

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

## Mobile Access [GET /api/1/vehicles/{vehicle_id}/mobile_enabled]

Determines if mobile access to the vehicle is enabled.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
                "response": true
            }

## Data [GET /api/1/vehicles/{vehicle_id}/data]

A "legacy" version of the data endpoint.

Currently, this has the exact same response structure as the newer vehicle_data endpoint.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
                "response": {
                    "color": null,
                    "display_name": null,
                    "id": 321,
                    "option_codes": "MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013",
                    "user_id": 123,
                    "vehicle_id": 1234567890,
                    "vin": "5YJSA1CN5CFP01657",
                    "tokens": ["x", "x"],
                    "state": "online",
                    "charge_state": {
                        "charging_state": "Complete",
                        "charge_to_max_range": false,
                        "max_range_charge_counter": 0,
                        "fast_charger_present": false,
                        "battery_range": 239.02,
                        "est_battery_range": 155.79,
                        "ideal_battery_range": 275.09,
                        "battery_level": 91,
                        "battery_current": -0.6,
                        "charge_starting_range": null,
                        "charge_starting_soc": null,
                        "charger_voltage": 0,
                        "charger_pilot_current": 40,
                        "charger_actual_current": 0,
                        "charger_power": 0,
                        "time_to_full_charge": null,
                        "charge_rate": -1.0,
                        "motorized_charge_port": false,
                        "charge_energy_added": 14.74,
                        "charge_miles_added_rated": 50,
                        "charge_miles_added_ideal": 58,
                        "charge_port_door_open": true },
                    "climate_state": {
                        "inside_temp": 17.0,
                        "outside_temp": 9.5,
                        "driver_temp_setting": 22.6,
                        "passenger_temp_setting": 22.6,
                        "is_auto_conditioning_on": false,
                        "is_front_defroster_on": null,
                        "is_rear_defroster_on": false,
                        "fan_status": 0 },
                    "drive_state": {
                        "shift_state": null,
                        "speed": null,
                        "latitude": 33.794839,
                        "longitude": -84.401593,
                        "heading": 4,
                        "gps_as_of": 1359863204 },
                    "gui_settings": {
                        "gui_distance_units": "mi/hr",
                        "gui_temperature_units": "F",
                        "gui_charge_rate_units": "mi/hr",
                        "gui_24_hour_time": false,
                        "gui_range_display": "Rated" },
                    "mobile_enabled": true,
                    "vehicle_state": {
                        "df": false,
                        "dr": false,
                        "pf": false,
                        "pr": false,
                        "ft": false,
                        "rt": false,
                        "car_version": "1.19.42",
                        "locked": true,
                        "sun_roof_installed": false,
                        "sun_roof_state": "unknown",
                        "sun_roof_percent_open": 0,
                        "dark_rims": false,
                        "wheel_type": "Base19",
                        "has_spoiler": false,
                        "roof_color": "Colored",
                        "perf_config": "Base" }
                }
            }


## Data [GET /api/1/vehicles/{vehicle_id}/vehicle_data]

Returns all vehicle data in a single call.  Highly recommended to use this
instead of individual calls as it lowers overall load on Tesla servers.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
                "response": {
                    "color": null,
                    "display_name": null,
                    "id": 321,
                    "option_codes": "MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013",
                    "user_id": 123,
                    "vehicle_id": 1234567890,
                    "vin": "5YJSA1CN5CFP01657",
                    "tokens": ["x", "x"],
                    "state": "online",
                    "charge_state": {
                        "charging_state": "Complete",
                        "charge_to_max_range": false,
                        "max_range_charge_counter": 0,
                        "fast_charger_present": false,
                        "battery_range": 239.02,
                        "est_battery_range": 155.79,
                        "ideal_battery_range": 275.09,
                        "battery_level": 91,
                        "battery_current": -0.6,
                        "charge_starting_range": null,
                        "charge_starting_soc": null,
                        "charger_voltage": 0,
                        "charger_pilot_current": 40,
                        "charger_actual_current": 0,
                        "charger_power": 0,
                        "time_to_full_charge": null,
                        "charge_rate": -1.0,
                        "motorized_charge_port": false,
                        "charge_energy_added": 14.74,
                        "charge_miles_added_rated": 50,
                        "charge_miles_added_ideal": 58,
                        "charge_port_door_open": true },
                    "climate_state": {
                        "inside_temp": 17.0,
                        "outside_temp": 9.5,
                        "driver_temp_setting": 22.6,
                        "passenger_temp_setting": 22.6,
                        "is_auto_conditioning_on": false,
                        "is_front_defroster_on": null,
                        "is_rear_defroster_on": false,
                        "fan_status": 0 },
                    "drive_state": {
                        "shift_state": null,
                        "speed": null,
                        "latitude": 33.794839,
                        "longitude": -84.401593,
                        "heading": 4,
                        "gps_as_of": 1359863204 },
                    "gui_settings": {
                        "gui_distance_units": "mi/hr",
                        "gui_temperature_units": "F",
                        "gui_charge_rate_units": "mi/hr",
                        "gui_24_hour_time": false,
                        "gui_range_display": "Rated" },
                    "mobile_enabled": true,
                    "vehicle_state": {
                        "df": false,
                        "dr": false,
                        "pf": false,
                        "pr": false,
                        "ft": false,
                        "rt": false,
                        "car_version": "1.19.42",
                        "locked": true,
                        "sun_roof_installed": false,
                        "sun_roof_state": "unknown",
                        "sun_roof_percent_open": 0,
                        "dark_rims": false,
                        "wheel_type": "Base19",
                        "has_spoiler": false,
                        "roof_color": "Colored",
                        "perf_config": "Base" }
                }
            }

## Charge State [GET /api/1/vehicles/{vehicle_id}/data_request/charge_state]

Returns the state of charge in the battery.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "charging_state": "Complete",
                "charge_to_max_range": false,
                "max_range_charge_counter": 0,
                "fast_charger_present": false,
                "battery_range": 239.02,
                "est_battery_range": 155.79,
                "ideal_battery_range": 275.09,
                "battery_level": 91,
                "battery_current": -0.6,
                "charge_starting_range": null,
                "charge_starting_soc": null,
                "charger_voltage": 0,
                "charger_pilot_current": 40,
                "charger_actual_current": 0,
                "charger_power": 0,
                "time_to_full_charge": null,
                "charge_rate": -1.0,
                "motorized_charge_port": false,
                "charge_energy_added": 14.74,
                "charge_miles_added_rated": 50,
                "charge_miles_added_ideal": 58,
                "charge_port_door_open": true
              }
            }

## Climate Settings [GET /api/1/vehicles/{vehicle_id}/data_request/climate_state]

Returns the current temperature and climate control state.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "inside_temp": 17.0,
                "outside_temp": 9.5,
                "driver_temp_setting": 22.6,
                "passenger_temp_setting": 22.6,
                "is_auto_conditioning_on": false,
                "is_front_defroster_on": null,
                "is_rear_defroster_on": false,
                "fan_status": 0
              }
            }

## Driving and Position [GET /api/1/vehicles/{vehicle_id}/data_request/drive_state]

Returns the driving and position state of the vehicle.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "shift_state": null,
                "speed": null,
                "latitude": 33.794839,
                "longitude": -84.401593,
                "heading": 4,
                "gps_as_of": 1359863204
              }
            }

## GUI Settings [GET /api/1/vehicles/{vehicle_id}/data_request/gui_settings]

Returns various information about the GUI settings of the car, such as unit format and range display.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "gui_distance_units": "mi/hr",
                "gui_temperature_units": "F",
                "gui_charge_rate_units": "mi/hr",
                "gui_24_hour_time": false,
                "gui_range_display": "Rated"
              }
            }

## Vehicle State [GET /api/1/vehicles/{vehicle_id}/data_request/vehicle_state]

Returns the vehicle's physical state, such as which doors are open.

+ Request

    + Headers

            authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "df": false,
                "dr": false,
                "pf": false,
                "pr": false,
                "ft": false,
                "rt": false,
                "car_version": "1.19.42",
                "locked": true,
                "sun_roof_installed": false,
                "sun_roof_state": "unknown",
                "sun_roof_percent_open": 0,
                "dark_rims": false,
                "wheel_type": "Base19",
                "has_spoiler": false,
                "roof_color": "Colored",
                "perf_config": "Base"
              }
            }

## Vehicle Config [GET /api/1/vehicles/{vehicle_id}/data_request/vehicle_config]

Returns the vehicle's configuration details.

+ Request

    + Headers

            authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "car_special_type":"base",
                "car_type":"s",
                "eu_vehicle":false,
                "exterior_color":"Black",
                "has_ludicrous_mode":false,
                "motorized_charge_port":false,
                "perf_config":"P2",
                "plg":true,
                "rear_seat_heaters":0,
                "rear_seat_type":0,
                "rhd":false,
                "roof_color":"None",
                "seat_type":0,
                "spoiler_type":"None",
                "sun_roof_installed":1,
                "third_row_seats":"None",
                "timestamp":1506198725145,
                "trim_badging":"p85",
                "wheel_type":"Base19"
              }
            }
            
# Group Vehicle Commands

These commands alter the vehicles state, and return result (true/false) to indicate success, and if failure reason contains the cause of failure.

## Wake Up Car [POST /api/1/vehicles/{vehicle_id}/wake_up]

Wakes up the car from the sleep state. Necessary to get some data from the car.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "result": true,
                "reason": ""
              }
            }

## Schedule Software Update [POST /api/1/vehicles/{vehicle_id}/command/schedule_software_update?offset_sec={offset_sec}]

Schedules the car to install a pending firmware Update

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.
    + offset_sec: `0` (number) - The number of ms before installation.

+ Response 200 (application/json)

    + Body
    
            {
                "response": {
                "result": true,
                "reason": ""
              }
            }

## Cancel Software Update [POST /api/1/vehicles/{vehicle_id}/command/cancel_software_update]

Cancels a pending firmware Update

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
                "response": {
                "result": true,
                "reason": ""
              }
            }

## Media toggle playback [POST /api/1/vehicles/{vehicle_id}/command/media_toggle_playback]

Toggles media playback

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
                "response": {
                "result": true,
                "reason": ""
              }
            }

## Media play next track [POST /api/1/vehicles/{vehicle_id}/command/media_next_track]

Play the next track

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
                "response": {
                "result": true,
                "reason": ""
              }
            }

## Media play previous track [POST /api/1/vehicles/{vehicle_id}/command/media_prev_track]

Play the previous track

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
                "response": {
                "result": true,
                "reason": ""
              }
            }

## Media play next favorite [POST /api/1/vehicles/{vehicle_id}/command/media_next_fav]

Play the next favorite

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
                "response": {
                "result": true,
                "reason": ""
              }
            }

## Media play previous favorite [POST /api/1/vehicles/{vehicle_id}/command/media_prev_fav]

Play the previous favorite

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
                "response": {
                "result": true,
                "reason": ""
              }
            }

## Media volume up [POST /api/1/vehicles/{vehicle_id}/command/media_volume_up]

Increase media volume

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
                "response": {
                "result": true,
                "reason": ""
              }
            }

## Media volume down [POST /api/1/vehicles/{vehicle_id}/command/media_volume_down]

Decrease media volume

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
                "response": {
                "result": true,
                "reason": ""
              }
            }

## Speed limit activate [POST /api/1/vehicles/{vehicle_id}/command/speed_limit_activate?pin={pin}]

Activate speed limitation

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.
    + pin: '1234' (string) - The pin code.

+ Response 200 (application/json)

    + Body
    
            {
                "response": {
                "result": true,
                "reason": ""
              }
            }

## Speed limit deactivate [POST /api/1/vehicles/{vehicle_id}/command/speed_limit_deactivate?pin={pin}]

Deactivate speed limitation

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.
    + pin: '1234' (string) - The pin code.

+ Response 200 (application/json)

    + Body
    
            {
                "response": {
                "result": true,
                "reason": ""
              }
            }

## Speed limit clear pin [POST /api/1/vehicles/{vehicle_id}/command/speed_limit_clear_pin?pin={pin}]

Clear speed limitation pin

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.
    + pin: '1234' (string) - The pin code.

+ Response 200 (application/json)

    + Body
    
            {
                "response": {
                "result": true,
                "reason": ""
              }
            }

## Speed limit set limit [POST /api/1/vehicles/{vehicle_id}/command/speed_limit_set_limit?limit_mph={limit_mph}]

Set speed limit

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.
    + limit_mph: '80.0' (number) - The speed limit.

+ Response 200 (application/json)

    + Body
    
            {
                "response": {
                "result": true,
                "reason": ""
              }
            }

## Sentry mode [POST /api/1/vehicles/{vehicle_id}/command/set_sentry_mode?on={onoff}]

Enable or disable sentry mode.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.
    + onoff: true (boolean) - Sentry mode state.

+ Response 200 (application/json)

    + Body
    
            {
                "response": {
                "result": true,
                "reason": ""
              }
            }

## Nearby chargers request [GET /api/1/vehicles/{vehicle_id}/nearby_charging_sites]

Return a list of nearby Destination and Superchargers

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
                "response": {
                    "congestion_sync_time_utc_secs": 1547415712,
                    "destination_charging": [
                        {"location": {"lat":47.671225,"long":-122.122192},"name":"Seattle Marriott","type":"destination","distance_miles":21.744819}
                    ],
                    "superchargers":[
                        {"location":{"lat":47.671225,"long":-122.122192},"name":"Seattle, WA","type":"supercharger","distance_miles":21.345058,"available_stalls":2,"total_stalls":8,"site_closed":false}
                    ]
              }
            }

## Seat heater request [POST /api/1/vehicles/{vehicle_id}/command/remote_seat_heater_request?heater={heater}&level={level}]

Adjust seat heater levels

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.
    + heater: '0' (number) - The heater to adjust.
    + level: '1' (number) - The heater level.

+ Response 200 (application/json)

    + Body
    
            {
                "response": {
                "result": true,
                "reason": ""
              }
            }

## Window control request [POST /api/1/vehicles/{vehicle_id}/command/window_control?command={command}]

Control the windows

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.
    + command: 'open' (string) - Action to take. Allowable values are 'vent' and 'close'

+ Response 200 (application/json)

    + Body
    
            {
                "response": {
                "result": true,
                "reason": ""
              }
            }
      
## Max Defrost request [POST /api/1/vehicles/{vehicle_id}/command/set_preconditioning_max?command={command}]

Toggles the climate controls between Max Defrost and the previous setting

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.
    + command: true (boolean) - Action to take. True to turn on, false to turn off.

+ Response 200 (application/json)

    + Body
    
            {
                "response": {
                "result": true,
                "reason": ""
              }
            }

## Steering heater request [POST /api/1/vehicles/{vehicle_id}/command/remote_steering_wheel_heater_request?on={on}]

Adjust steering heater levels

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.
    + on: '1' (number) - The heater level.

+ Response 200 (application/json)

    + Body
    
            {
                "response": {
                "result": true,
                "reason": ""
              }
            }

## Navigation Request [POST /api/1/vehicles/{vehicle_id}/command/navigation_request?subject={subject}&text={text}&locale={locale}]

Sends a navigation request to the car

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.
    + subject: `Tesla` (string) - Short name of location.
    + text: `Tesla Motors Corporation Freemont, CA` (string) - The name, address and map location of destination.
    + locale: `en-US` (string) - The locale.

+ Response 200 (application/json)

    + Body
    
            {
                "response": {
                "result": true,
                "reason": ""
              }
            }

## Set Valet Mode [POST /api/1/vehicles/{vehicle_id}/command/set_valet_mode?on={on}&password={password}]

Sets valet mode on or off with a PIN to disable it from within the car. Reuses last PIN from previous valet session.

Valet Mode limits the car's top speed to 70MPH and 80kW of acceleration power. It also disables Homelink, Bluetooth and

Wifi settings, and the ability to disable mobile access to the car. It also hides your favorites, home, and work

locations in navigation.



+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.
    + on: true (boolean) - Whether to enable or disable valet mode.
    + password: 1234 (number) - (optional) A 4 digit PIN code to unlock the car.

+ Response 200 (application/json)

    + Body
    
            {
                "response": {
                "result": true,
                "reason": ""
              }
            }

## Reset Valet PIN [POST /api/1/vehicles/{vehicle_id}/command/reset_valet_pin]

Resets the PIN set for valet mode, if set.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "result": true,
                "reason": ""
              }
            }

## Open Charge Port [POST /api/1/vehicles/{vehicle_id}/command/charge_port_door_open]

Opens the charge port.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "result": true,
                "reason": ""
              }
            }

## Close Charge Port [POST /api/1/vehicles/{vehicle_id}/command/charge_port_door_close]

Closes the charge port.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "result": true,
                "reason": ""
              }
            }
## Set Charge Limit to Standard [POST /api/1/vehicles/{vehicle_id}/command/charge_standard]

Set the charge mode to standard (90% under the new percentage system introduced in 4.5).

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "result": true,
                "reason": ""
              }
            }

## Set Charge Limit to Max Range [POST /api/1/vehicles/{vehicle_id}/command/charge_max_range]

Set the charge mode to max range (100% under the new percentage system introduced in 4.5). Use sparingly!

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "result": true,
                "reason": ""
              }
            }

## Set Charge Limit [POST /api/1/vehicles/{vehicle_id}/command/set_charge_limit?percent={limit_value}]

Set the charge limit to a custom percentage.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.
    + limit_value: `75` (number) - The percentage value

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "result": true,
                "reason": ""
              }
            }

## Start Charging [POST /api/1/vehicles/{vehicle_id}/command/charge_start]

Start charging. Must be plugged in, have power available, and not have reached your charge limit.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "result": true,
                "reason": ""
              }
            }

## Stop Charging [POST /api/1/vehicles/{vehicle_id}/command/charge_stop]

Stop charging. Must already be charging.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "result": true,
                "reason": ""
              }
            }

## Flash Lights [POST /api/1/vehicles/{vehicle_id}/command/flash_lights]

Flash the lights once.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "result": true,
                "reason": ""
              }
            }

## Honk Horn [POST /api/1/vehicles/{vehicle_id}/command/honk_horn]

Honk the horn once.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "result": true,
                "reason": ""
              }
            }

## Unlock Doors [POST /api/1/vehicles/{vehicle_id}/command/door_unlock]

Unlock the car's doors.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "result": true,
                "reason": ""
              }
            }

## Lock Doors [POST /api/1/vehicles/{vehicle_id}/command/door_lock]

Lock the car's doors.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "result": true,
                "reason": ""
              }
            }

## Set Temperature [POST /api/1/vehicles/{vehicle_id}/command/set_temps?driver_temp={driver_degC}&passenger_temp={pass_degC}]

Set the temperature target for the HVAC system.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.
    + driver_degC: `23.7` (number) - The desired temperature on the driver's side in celcius.
    + pass_degC: `18.1` (number) - The desired temperature on the passenger's side in celcius.

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "result": true,
                "reason": ""
              }
            }

## Start HVAC System [POST /api/1/vehicles/{vehicle_id}/command/auto_conditioning_start]

Start the climate control system. Will cool or heat automatically, depending on set temperature.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "result": true,
                "reason": ""
              }
            }

## Stop HVAC System  [POST /api/1/vehicles/{vehicle_id}/command/auto_conditioning_stop]

Stop the climate control system.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "result": true,
                "reason": ""
              }
            }

## Move Pano Roof [POST /api/1/vehicles/{vehicle_id}/command/sun_roof_control?state={state}&percent={percent}]

Controls the car's panoramic roof, if installed.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.
    + state: `open` (enum[string])
        The desired state of the panoramic roof. The approximate percent open values for each state are `open` = 100%, `close` = 0%, `comfort` = 80%, and `vent` = ~15%
        + Members
            + `open` - Open the roof fully
            + `close` - Close the roof completely
            + `comfort` - Open to the comfort (80%) setting
            + `vent` - Open the roof to the vent (~15%) setting
            + `move` - Indicates you will provide a percentage to move the roof.
    + percent: `50` (number, optional) - The percentage to move the roof to.

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "result": true,
                "reason": ""
              }
            }

## Remote Start [POST /api/1/vehicles/{vehicle_id}/command/remote_start_drive?password={password}]

Start the car for keyless driving. Must start driving within 2 minutes of issuing this request.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.
    + password: `edisonsux` (string) - The password to the authenticated my.teslamotors.com account.

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "result": true,
                "reason": ""
              }
            }

## Open Trunk/Frunk [POST /api/1/vehicles/{vehicle_id}/command/actuate_trunk?which_trunk={which_trunk}]

Open the trunk or frunk. Currently inoperable.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.
    + which_trunk: `rear` (string) - The trunk to open. `rear` is the only one known currently.

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "result": true,
                "reason": ""
              }
            }

## Trigger Homelink [POST /api/1/vehicles/{vehicle_id}/command/trigger_homelink?lat={lat}&long={long}&token={token}]

Trigger homelink.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.
    + lat: `75` (number) - The home latitude.
    + long: `34` (number) - The home longitude.
    + token: `75` (string) - The streaming token.

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "result": true,
                "reason": ""
              }
            }

## Update Calendar [POST /api/1/vehicles/{vehicle_id}/command/upcoming_calendar_entries]

Update calendar.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Response 200 (application/json)

    + Body
    
            {
              "response": {
                "result": true,
                "reason": ""
              }
            }

            
## Bad Get [GET /api/1/vehicles/{vehicle_id}/data_request/err_get]

This is a GET that is guaranteed to fail.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Response 400 (text/xml)

    + Body
    
            <HTML><HEAD></HEAD><BODY>Unknown Request</BODY></HEAD></HTML>
            
## Bad Post [POST /api/1/vehicles/{vehicle_id}/command/err_post]

This is a POST that is guaranteed to fail.

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Response 400 (text/xml)

    + Body
    
            <HTML><HEAD></HEAD><BODY>Unknown Request</BODY></HEAD></HTML>

## Streaming [GET /{vehicle_id}/?values=elevation,est_heading,est_lat,est_lng,est_range,heading,odometer,power,range,shift_state,speed,soc]

This models the streaming API interface.

+ Parameters

    + vehicle_id: `1` (number) - The id of the Vehicle.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Response 200 (application/json)

    + Body
    
            {
                "result": "['elevation', 'est_heading', 'est_lat', 'est_lng', 'est_range', 'heading', 'odometer', 'power', 'range', 'shift_state', 'speed', 'soc']"            
            }

## Get Owned Tesla Product List [GET /api/1/products]

Get a list of the users owned Tesla products.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Response 200 (application/json)

    + Body

            {
                "response": [{
                    "id": 1
                }]
            }

## Get Current Solar Usage [GET /api/1/energy_sites/{site_id}/live_status]

Get solar live status.

+ Request

    + Headers

            Authorization: Bearer {access_token}

+ Parameters

    + site_id: `1` (number) - The id of the Vehicle.

+ Response 200 (application/json)

    + Body

            {
              "response": {
                "solar_power": 1000,
                "load_power": 750,
                "grid_power": 250
              }
            }