Overview
FleetAPI is a RESTful data and command service providing access to Tesla vehicles and energy devices.
Partners can interact with their own devices, or devices for which they have been granted access by a customer.
Setup
- Set up a third-party account at https://developer.tesla.com.
- In the "Client Details" step, it is recommended to select "Authorization Code and Machine-to-Machine" for most use cases. "Machine-to-Machine" (M2M) should only be selected for business accounts that own vehicles.
- Note that account creation requests can be automatically rejected for these common reasons:
- Domain name is invalid
- Application name already exists
- Complete registration of an account:
- Generate a public/private key pair for Tesla Vehicle Commands. Host a public key in the
/.well-known
section of the application website. This public key must remain available at the/.well-known
path for vehicles to be paired with the application. See details here. - Generate a partner authentication token.
- Make a POST call to /api/1/partner_accounts with a partner authentication token.
- Generate a public/private key pair for Tesla Vehicle Commands. Host a public key in the
- Request authorization permissions from a customer and generate a third-party token on their behalf. See the authentication section for examples.
- To interact with vehicles, send customers a pairing request, and then use the Tesla Vehicle Command Protocol http proxy to send commands.
Refer to the help section if facing any problems with registration flows or the API.
Endpoints and Regional requirements
FleetAPI is available regionally. Use the appropriate region for each user.
- North America, Asia-Pacific (excluding China): https://fleet-api.prd.na.vn.cloud.tesla.com
- Europe, Middle East, Africa: https://fleet-api.prd.eu.vn.cloud.tesla.com
- China: https://fleet-api.prd.cn.vn.cloud.tesla.cn - localized documentation at https://developer.tesla.cn/docs/fleet-api
- To make calls to vehicles in China, you must create an account on https://www.tesla.cn/ and create a separate application on https://developer.tesla.cn/. This requires a +86 phone number.
- To make calls to vehicles in China, you must create an account on https://www.tesla.cn/ and create a separate application on https://developer.tesla.cn/. This requires a +86 phone number.
API Best Practices
Avoid DNS caching
Fleet API high availability is guarenteed by dynamic IPs; addresses behind the DNS can change abruptly during regular operation. Excessive DNS TTL/caching can lead to stale DNS information. This can cause connection issues and errors.
The recommendation is to avoid altering the DNS TTL setting (use the default) to ensure that the DNS resolver is configured to follow the TTL values provided by the authoritative DNS servers.
Avoid frequently polling device data
Fleet API allows developers to get data from devices via API, these are meant to be used infrequently. The majority of these APIs have stringent rate limits in place for protection. To get data at regular interval use Fleet Telemetry which provides a direct and custom data stream in real time.
Ensure authorization tokens are not expired before making API calls
FleetAPI bearer token used for authorization are simple JWT tokens. Before calling the API, renew tokens if they are within a minute of expiration. Securely caching tokens is a viable option for distributed applications.
Respect local privacy laws and data governance
Fleet API is localized in multiple regions in accordance with local regulation (CCPA, GDPR, PIPL, etc.). The API may return some errors to guide developers, but it is the developers responsibility to comply with security, data privacy, data transfer, and data governance regulations.
Secure private keys and secrets at all time
Follow best security practices when manipulating private keys and secrets. Modern cloud providers offer key management services (such as AWS Key Management Service, Azure Key Vault, and Google Cloud Key Management Service) or hardware security module (HSM) solutions to create and manage private keys & secrets securely. It is important to not extract or transmit private keys over the network, particularly if they are not encrypted.
Validate Vehicle state after timeout errors
Timeouts can happen before or after a command is sent and executed in a vehicle, making it difficult to determine the vehicle's state when a timeout occurs. It is the developer's responsibility to ensure the vehicle is in the desired state. Most FleetAPI commands are stateful and can be safely retried, but some commands (such as honk_horn and media_next_track) may result in duplicated actions. Therefore, developers should exercise caution when retrying these commands to avoid unintended consequences.
Membership Tiers
These are the currently active membership tiers to access Tesla's Fleet API.
Discovery Tier
Subscription plan | Discovery Tier |
---|---|
Device data limits | 1 API request / car / 5 min And 1M API requests / day. |
Commands limits | 50 API requests / car / day And 500k API requests / day. |
Wake limits | 5 API requests / car / hour. |
Energy Device data limits | 100k API requests / day. |
Energy Settings limits | 5 requests / energy site / day. |
Capabilities | API access Login with Tesla Tesla for Business access Enterprise charging API Invoices Limited Fleet Telemetry streaming. |
Price | $0/week. |
Subscription duration | Weekly, auto-renewing until canceled. |
Availability | This subscription plan is a temporary plan that will be replaced with different options in 2024. |
Conventions
Request Format
Requests require the HTTP header 'Content-Type'
with the value 'application/json'
. In addition, all authenticated endpoints require the standard Bearer Authorization header and a valid token.
Content-Type: application/json
Authorization: Bearer 8s2wfclhyp5iiikowm3ocnfalt7qfl7es8xhuda3ttusslssx6c14hq7yocp62c5
POST request parameters are expected to be a JSON object in the body.
Response Format
Responses are returned as a JSON object with the following common fields:
Field | Description |
---|---|
response: <json> | JSON representing the response. May be a scalar, an array or a object depending on the specific request. |
error: short-string | Short error "enum" like "not_found", "invalid_resource", "invalid_password". |
error_description: long-string | Additional error information. |
messages: {"field1":["problem1","problem2"],...} | Data validation issues, especially on a 422 responses. |
Request Parameters
The {vehicle_tag} path parameter for device/entity/vehicle endpoints is expected to be the integer id of the record returned from the list endpoint. Example: vehicles list.
For vehicle endpoints and vehicle commands, a valid VIN can be used instead of an integer id.
Response Codes
Not all possible response codes are covered in Endpoint examples. The following are common meanings of status codes.
The response body is typically JSON-encoded with details in the "error" field.
Successes
Status Code | Description | Detail |
---|---|---|
200 | Ok | The request was handled successfully. |
201 | Created | The record was created successfully. |
Client errors
Status Code | Description | Detail |
---|---|---|
400 | Bad Request | |
• invalid_command - The data request or command is unknown. | ||
• invalid_field - A field in the input is not valid. | ||
• invalid_request - The request body is not valid, a description giving a more specific error message may be returned. | ||
• invalid_auth_code - The "code" in request body is invalid, generate a new one and try again. | ||
• invalid_redirect_url - Invalid redirect URI/URL. The authorize redirect URI and token redirect URI must match. | ||
• unauthorized_client - We don't recognize this client_id and client_secret combination. Use the client_id and client_secret that has been granted for the application. | ||
401 | Unauthorized | |
• mobile_access_disabled - The vehicle has turned off remote access. | ||
• no response body - The OAuth token has expired. | ||
• login_required - The user has reset their password and a new auth code is required, or the refresh_token has already been used. | ||
402 | Payment Required | Payment is required in order to use the API (non-free account only) |
403 | Forbidden | |
• Access to this resource is not authorized, developers should check required scopes. | ||
• Tesla Vehicle Command Protocol required in order to interact with the devices. | ||
404 | Not Found | The requested resource does not exist. |
405 | Not Allowed | The operation is not allowed. |
406 | Not Acceptable | The HTTP request does not have a Content-Type header set to application/json . |
408 | Device Not Available | If the vehicle is not "online" when a request is made. |
412 | Precondition Failed | A condition has not been met to process the request. |
• Unregistered account - first call the partner account register endpoint. | ||
418 | Client Too Old (Not supported) | Mobile application needs to be updated (Tesla App only). |
421 | Incorrect region | This user is not present in the current region. See the regional requirements section for more information. |
422 | Invalid Resource | There is a semantic problem with the data, e.g. missing or invalid data. |
• Vehicle does not yet support the Tesla Vehicle Command Protocol. | ||
423 | Locked | Account is locked, and must be unlocked by Tesla. No response body. |
429 | Rate limited | Account or server is rate limited. This happens when too many requests are made by an account. |
• Check the 'Retry-After' request header (in seconds) to determine when to make the next request. | ||
451 | Resource Unavailable For Legal Reasons | Querying for a user/vehicle without proper privacy settings (e.g. wrong region). |
499 | Client Closed Request | Client has closed the request before the server could send a response. |
Server errors
Status Code | Description | Detail |
---|---|---|
500 | Internal server error | An error occurred while processing the request. |
503 | Service Unavailable | Either an internal service or a vehicle did not respond (timeout). |
504 | Gateway Timeout | Server did not receive a response. |
Device errors
Status Code | Description | Detail |
---|---|---|
540 | Device Unexpected response | Vehicle responded with an error - might need a reboot, OTA update, or service. |
API Status
GET /status
curl 'https://fleet-api.prd.na.vn.cloud.tesla.com/status'
This endpoint returns the string "ok" if the API is operating normally. No HTTP headers are required.
Legal
All usage of Fleet API must be in compliance with the Fleet API Agreement. Accounts found in violation will be banned without notice.
Authentication
API endpoints require an authentication token. There are two types of tokens:
- Partner authentication token - The subject of this token will be an application or business account ID, and will be generated using the
client_credentials
grant type. This can be used for calls related to modifying an application like register, or for accessing business-owned devices. - Third-party token - The subject of this token will be the ID of a customer's account, and will be generated using the
authorization_code
grant type. This token is generated by a third-party application on behalf of a customer, and can be used for most endpoints.
The OAuth server's metadata file can be found at: https://auth.tesla.com/oauth2/v3/thirdparty/.well-known/openid-configuration.
A Postman collection with these requests can be found here.
Partner authentication token
POST https://auth.tesla.com/oauth2/v3/token
Generates a token to be used for managing a partner's account or devices they own.
Parameters
Name | Required | Example | Description |
---|---|---|---|
grant_type | Yes | client_credentials | Grant type must be client_credentials. |
client_id | Yes | abc-123 | Partner application client ID. |
client_secret | Yes | secret-password | Partner application client secret. |
audience | Yes | https://fleet-api.prd.na.vn.cloud.tesla.com | Audience for the generated token. |
scope | No | openid user_data vehicle_device_data vehicle_cmds vehicle_charging_cmds | Space-delimited list of scopes. |
CLIENT_ID=<command to obtain a client_id>
CLIENT_SECRET=<secure command to obtain a client_secret>
AUDIENCE="https://fleet-api.prd.na.vn.cloud.tesla.com"
# Partner authentication token request
curl --request POST \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode "client_id=$CLIENT_ID" \
--data-urlencode "client_secret=$CLIENT_SECRET" \
--data-urlencode 'scope=openid vehicle_device_data vehicle_cmds vehicle_charging_cmds' \
--data-urlencode "audience=$AUDIENCE" \
'https://auth.tesla.com/oauth2/v3/token'
Third-party token
Use the authorization_code
grant flow to generate a token on behalf of a customer. This allows API calls using the scopes granted by the customer.
1. To initiate the authorization code flow direct the customer to an /authorize
request.
https://auth.tesla.com/oauth2/v3/authorize?&client_id=$CLIENT_ID&locale=en-US&prompt=login&redirect_uri=$REDIRECT_URI&response_type=code&scope=openid%20vehicle_device_data%20offline_access&state=$STATE
https://auth.tesla.com/oauth2/v3/authorize
Parameters
Name | Required | Example | Description |
---|---|---|---|
response_type | Yes | code | A string, always use the value "code". |
client_id | Yes | abc-123 | Partner application client ID. |
redirect_uri | Yes | https://example.com/auth/callback | Partner application callback url, spec: rfc6749. |
scope | Yes | openid offline_access user_data vehicle_device_data vehicle_cmds vehicle_charging_cmds | Space delimited list of scopes, include openid and offline_access to obtain a refresh token. |
state | Yes | db4af3f87... | Random value used for validation. |
nonce | No | 7baf90cda... | Random value used for replay prevention. |
2. Extract the code
URL parameter from the callback.
3. Execute a code exchange call to generate a token. Save the refresh_token to generate tokens in the future. The access_token can be used as the Bearer token in the Authorization header when making API requests. An invalid_auth_code
response likely means the code
is expired.
POST https://auth.tesla.com/oauth2/v3/token
# Authorization code token request
CODE=<extract from callback>
curl --request POST \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode "client_id=$CLIENT_ID" \
--data-urlencode "client_secret=$CLIENT_SECRET" \
--data-urlencode "code=$CODE" \
--data-urlencode "audience=$AUDIENCE" \
--data-urlencode "redirect_uri=$CALLBACK" \
'https://auth.tesla.com/oauth2/v3/token'
# Extract access_token and refresh_token from this response
Parameters
Name | Required | Example | Description |
---|---|---|---|
grant_type | Yes | authorization_code | Grant type must be authorization_code. |
client_id | Yes | abc-123 | Partner application client ID. |
client_secret | Yes | secret-password | Partner application client secret. |
code | Yes | a90869e9d... | Code from authorize request callback. |
audience | Yes | https://fleet-api.prd.na.vn.cloud.tesla.com | Audience for generated token. |
redirect_uri | Yes | https://example.com/auth/callback | Partner application callback url, spec: rfc6749. |
scope | No | openid offline_access user_data vehicle_device_data vehicle_cmds vehicle_charging_cmds | Space-delimited list of scopes. |
4. Use the refresh_token to generate new tokens and obtain refresh tokens. There are two common failure modes for using a refresh_token that will return a 401 - login_required response: 1. The refresh token has already been used; only the newest refresh token is valid. 2. The user has reset their password.
# Refresh token request
REFRESH_TOKEN=<extract from authorization code token request>
curl --request POST \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=refresh_token' \
--data-urlencode "client_id=$CLIENT_ID" \
--data-urlencode "refresh_token=$REFRESH_TOKEN" \
'https://auth.tesla.com/oauth2/v3/token'
POST https://auth.tesla.com/oauth2/v3/token
Parameters
Name | Required | Example | Description |
---|---|---|---|
grant_type | Yes | refresh_token | Grant type must be refresh_token. |
client_id | Yes | abc-123 | Partner application client ID. |
refresh_token | Yes | NA_a90869e9d... | Refresh token from the code exchange response. |
5. Once a user has granted scopes to an application, they can modify scopes or revoke access using the consent management page:
https://auth.tesla.com/user/revoke/consent?revoke_client_id=$CLIENT_ID&back_url=$RETURN_URL
https://auth.tesla.com/user/revoke/consent?revoke_client_id=cb30fbdf81e9-4405-ba59-ddbc042277e8&back_url=https://accounts.tesla.com/account-settings/security?tab=tpty-apps
Scope modifications are compatible with existing refresh tokens and will be applied to new access tokens.
Authorization Scopes
Name | Scope | Description |
---|---|---|
Sign in with Tesla | openid | Allow Tesla customers to sign in to the application with their Tesla credentials. |
Refresh Tokens | offline_access | Allow getting a refresh token without needing user to log in again. |
Profile Information | user_data | Contact information, home address, profile picture, and referral information. |
Vehicle Information | vehicle_device_data | Vehicle live data, location, eligible upgrades, nearby superchargers, ownership, and service scheduling data. |
Vehicle Commands | vehicle_cmds | Commands like add/remove driver, access Live Camera, unlock, wake up, remote start, and schedule software updates. |
Vehicle Charging Management | vehicle_charging_cmds | Vehicle charging history, billed amount, charging location, commands to schedule, and start/stop charging. |
Energy Product Information | energy_device_data | Energy live status, site info, backup history, energy history, and charge history. |
Energy Product Settings | energy_cmds | Update settings like backup reserve percent, operation mode, and storm mode. |
To view a list of endpoints available by scope, see scopes.json.
Charging Endpoints
charging_history
GET /api/1/dx/charging/history
scopes: vehicle_charging_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/charging/history'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/charging/history", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/charging/history")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/dx/charging/history", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns the paginated charging history.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vin | query | string | No | Vehicle Identification Number (VIN) of the selected vehicle. |
startTime | query | string | No | Start time of the windows to download charging history for (i,e "2023-07-27T11:43:45-07:00"). |
endTime | query | string | No | End time of the windows to download charging history for (i,e "2023-07-28T11:43:45-07:00"). |
pageNo | query | integer | No | Current page number. |
pageSize | query | integer | No | Number of records per page. |
sortBy | query | string | No | Field to sort by. |
sortOrder | query | string | No | Sort order (ASC or DESC). |
Click to view successful response
{
"response": {
"data": [
{
"sessionId": 1234567,
"vin": "TEST00000000VIN01",
"siteLocationName": "Truckee, CA - Soaring Way",
"chargeStartDateTime": "2023-07-27T11:43:45-07:00",
"chargeStopDateTime": "2023-07-27T12:08:35-07:00",
"unlatchDateTime": "2023-07-27T12:25:31-07:00",
"countryCode": "US",
"fees": [
{
"sessionFeeId": 7654321,
"feeType": "CHARGING",
"currencyCode": "USD",
"pricingType": "PAYMENT",
"rateBase": 0.46,
"rateTier1": 0,
"rateTier2": 0,
"rateTier3": null,
"rateTier4": null,
"usageBase": 40,
"usageTier1": 0,
"usageTier2": 24,
"usageTier3": null,
"usageTier4": null,
"totalBase": 18.4,
"totalTier1": 0,
"totalTier2": 0,
"totalTier3": 0,
"totalTier4": 0,
"totalDue": 18.4,
"netDue": 18.4,
"uom": "kwh",
"isPaid": true,
"status": "PAID"
},
{
"sessionFeeId": 87654321,
"feeType": "PARKING",
"currencyCode": "USD",
"pricingType": "NO_CHARGE",
"rateBase": 0,
"rateTier1": 0,
"rateTier2": 0,
"rateTier3": null,
"rateTier4": null,
"usageBase": 0,
"usageTier1": 0,
"usageTier2": 0,
"usageTier3": null,
"usageTier4": null,
"totalBase": 0,
"totalTier1": 0,
"totalTier2": 0,
"totalTier3": 0,
"totalTier4": 0,
"totalDue": 0,
"netDue": 0,
"uom": "min",
"isPaid": true,
"status": "PAID"
}
],
"billingType": "IMMEDIATE",
"invoices": [
{
"fileName": "ABC-123NN-US.pdf",
"contentId": "abc-123-efg",
"invoiceType": "IMMEDIATE"
}
],
"vehicleMakeType": "TSLA"
}
]
}
}
charging_invoice
GET /api/1/dx/charging/invoice/{id}
scopes: vehicle_charging_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/charging/invoice/{id}'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/charging/invoice/{id}", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/charging/invoice/{id}")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/dx/charging/invoice/{id}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns a charging invoice pdf for an event from charging history.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | string | Yes | Content ID. This can be obtained from the invoices.contentId of a charging history event. |
Click to view successful response
{
"response": "raw .pdf document"
}
charging_sessions (only for business fleet owners)
GET /api/1/dx/charging/sessions
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/charging/sessions'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/charging/sessions", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/charging/sessions")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/dx/charging/sessions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns the charging session information including pricing and energy data. This endpoint is only available for business accounts that own a fleet of vehicles.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vin | query | string | No | Vehicle Identification Number (VIN) of the selected vehicle. |
date_from | query | string | No | Start date of the windows to download charging sessions. |
date_to | query | string | No | End date of the windows to download charging sessions. |
limit | query | integer | No | Number of entities to be returned. |
offset | query | integer | No | offset. |
Click to view successful response
{
"response": {
"data": [
{
"charging_periods": [
{
"dimensions": [
{
"type": "ENERGY",
"volume": 0
}
],
"start_date_time": "string"
}
],
"id": "string",
"location": {
"country": "string",
"name": "string"
},
"model": "string",
"start_date_time": "string",
"stop_date_time": "string",
"tariffs": {
"currency": "string",
"elements": [
{
"price_components": [
{
"price": 0,
"step_size": 0,
"type": "ENERGY"
}
],
"restrictions": {
"additionalProp1": {}
}
}
]
},
"total_cost": {
"excl_vat": 0,
"incl_vat": 0,
"vat": 0
},
"total_energy": 0,
"total_time": 0,
"vin": "string"
}
],
"status_code": 0,
"status_message": "string",
"timestamp": {
"time.Time": "string"
}
}
}
Energy Endpoints
backup
POST /api/1/energy_sites/{energy_site_id}/backup
scopes: energy_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"backup_reserve_percent": "integer"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/backup'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"backup_reserve_percent": "integer"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/backup", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/backup")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"backup_reserve_percent": "integer"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"backup_reserve_percent": "integer"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/energy_sites/{energy_site_id}/backup", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Adjust the site's backup reserve.
- Visit https://www.tesla.com/support/energy/powerwall/mobile-app/powerwall-modes#backup-reserve-anchor for more info.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
energy_site_id | path | integer | Yes | ID field of an energy site from /api/1/products endpoint. |
backup_reserve_percent | body | integer | Yes | The desired backup reserve percent. |
Click to view successful response
{
"response": {
"code": 201,
"message": "Updated"
}
}
backup_history
GET /api/1/energy_sites/{energy_site_id}/calendar_history?kind=backup&
scopes: energy_device_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/calendar_history?kind={kind}&start_date={start_date}&end_date={end_date}&period={period}&time_zone={time_zone}'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/calendar_history?kind={kind}&start_date={start_date}&end_date={end_date}&period={period}&time_zone={time_zone}", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/calendar_history?kind={kind}&start_date={start_date}&end_date={end_date}&period={period}&time_zone={time_zone}")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/energy_sites/{energy_site_id}/calendar_history?kind=%7Bkind%7D&start_date=%7Bstart_date%7D&end_date=%7Bend_date%7D&period=%7Bperiod%7D&time_zone=%7Btime_zone%7D", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns the backup (off-grid) event history of the site in duration of seconds.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
energy_site_id | path | integer | Yes | ID field of an energy site from /api/1/products endpoint. |
kind | query | string | Yes | The kind of history to be requested. 'backup', 'charge', 'energy' are all supported. |
start_date | query | string | Yes | Start date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00 |
end_date | query | string | Yes | End date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00 |
period | query | string | Yes | Period of the window to retrieve backup events. This can be day, week, month, year, lifetime and should align with the window requested. |
time_zone | query | string | Yes | Timezone of the requested window in IANA name format. i.e. 'America/Los_Angeles' |
Click to view successful response
{
"response": {
"events": [
{
"timestamp": "2023-01-01T01:00:00-08:00",
"duration": 3600
},
{
"timestamp": "2023-01-02T08:00:00-08:00",
"duration": 7200
}
],
"total_events": 2
}
}
charge_history
GET /api/1/energy_sites/{energy_site_id}/telemetry_history?kind=charge&
scopes: energy_device_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/telemetry_history?kind={kind}&start_date={start_date}&end_date={end_date}&time_zone={time_zone}'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/telemetry_history?kind={kind}&start_date={start_date}&end_date={end_date}&time_zone={time_zone}", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/telemetry_history?kind={kind}&start_date={start_date}&end_date={end_date}&time_zone={time_zone}")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/energy_sites/{energy_site_id}/telemetry_history?kind=%7Bkind%7D&start_date=%7Bstart_date%7D&end_date=%7Bend_date%7D&time_zone=%7Btime_zone%7D", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns the charging history of a wall connector.
- Energy values are in watt hours.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
energy_site_id | path | integer | Yes | ID field of an energy site from /api/1/products endpoint. |
kind | query | string | Yes | The kind of history to be requested. 'backup', 'charge', 'energy' are all supported. |
start_date | query | string | Yes | Start date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00 |
end_date | query | string | Yes | End date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00 |
time_zone | query | string | Yes | Timezone of the requested window in IANA name format. i.e. 'America/Los_Angeles' |
Click to view successful response
{
"response": {
"charge_history": [
{
"charge_start_time": {
"seconds": 1672560000
},
"charge_duration": {
"seconds": 12000
},
"energy_added_wh": 25000
}
]
}
}
energy_history
GET /api/1/energy_sites/{energy_site_id}/calendar_history?kind=energy&
scopes: energy_device_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/calendar_history?kind={kind}&start_date={start_date}&end_date={end_date}&period={period}&time_zone={time_zone}'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/calendar_history?kind={kind}&start_date={start_date}&end_date={end_date}&period={period}&time_zone={time_zone}", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/calendar_history?kind={kind}&start_date={start_date}&end_date={end_date}&period={period}&time_zone={time_zone}")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/energy_sites/{energy_site_id}/calendar_history?kind=%7Bkind%7D&start_date=%7Bstart_date%7D&end_date=%7Bend_date%7D&period=%7Bperiod%7D&time_zone=%7Btime_zone%7D", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns the energy measurements of the site, aggregated to the requested period.
- Energy values are in watt hours.
- Visit https://www.tesla.com/support/energy/powerwall/mobile-app/energy-data for more info.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
energy_site_id | path | integer | Yes | ID field of an energy site from /api/1/products endpoint. |
kind | query | string | Yes | The kind of history to be requested. 'backup', 'charge', 'energy' are all supported. |
start_date | query | string | Yes | Start date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00 |
end_date | query | string | Yes | End date of the window to retrieve backup events in RFC3339 format. i.e. 2023-01-01T00:00:00-08:00 |
period | query | string | Yes | Period of the window to retrieve backup events. This can be day, week, month, year, lifetime and should align with the window requested. |
time_zone | query | string | Yes | Timezone of the requested window in IANA name format. i.e. 'America/Los_Angeles' |
Click to view successful response
{
"response": {
"period": "day",
"time_series": [
{
"timestamp": "2023-06-01T01:00:00-07:00",
"solar_energy_exported": 70940,
"generator_energy_exported": 0,
"grid_energy_imported": 521,
"grid_services_energy_imported": 17.53125,
"grid_services_energy_exported": 3.80859375,
"grid_energy_exported_from_solar": 43660,
"grid_energy_exported_from_generator": 0,
"grid_energy_exported_from_battery": 19,
"battery_energy_exported": 10030,
"battery_energy_imported_from_grid": 80,
"battery_energy_imported_from_solar": 16800,
"battery_energy_imported_from_generator": 0,
"consumer_energy_imported_from_grid": 441,
"consumer_energy_imported_from_solar": 10480,
"consumer_energy_imported_from_battery": 10011,
"consumer_energy_imported_from_generator": 0
}
]
}
}
grid_import_export
POST /api/1/energy_sites/{energy_site_id}/grid_import_export
scopes: energy_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"disallow_charge_from_grid_with_solar_installed": "boolean",
"customer_preferred_export_rule": "string"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/grid_import_export'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"disallow_charge_from_grid_with_solar_installed": "boolean",
"customer_preferred_export_rule": "string"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/grid_import_export", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/grid_import_export")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"disallow_charge_from_grid_with_solar_installed": "boolean",
"customer_preferred_export_rule": "string"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"disallow_charge_from_grid_with_solar_installed": "boolean",
"customer_preferred_export_rule": "string"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/energy_sites/{energy_site_id}/grid_import_export", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Allow/disallow charging from the grid and exporting energy to the grid.
- Visit https://www.tesla.com/support/energy/powerwall/mobile-app/powerwall-modes#energy-exports-anchor for more info.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
energy_site_id | path | integer | Yes | ID field of an energy site from /api/1/products endpoint. |
disallow_charge_from_grid_with_solar_installed | body | boolean | No | The desired behavior towards importing from the grid. Charging from the grid is disabled when set to true and enabled when set to false. |
customer_preferred_export_rule | body | string | No | The desired behavior for grid exporting. The available options are battery_ok, pv_only, and never. |
Click to view successful response
{
"response": {
"code": 204,
"message": "Updated"
}
}
live_status
GET /api/1/energy_sites/{energy_site_id}/live_status
scopes: energy_device_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/live_status'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/live_status", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/live_status")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/energy_sites/{energy_site_id}/live_status", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns the live status of the site (power, state of energy, grid status, storm mode).
- Power values are in watts.
- Energy values are in watt hours.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
energy_site_id | path | integer | Yes | ID field of an energy site from /api/1/products endpoint. |
Click to view successful response
{
"response": {
"solar_power": 3102,
"energy_left": 18020.894736842107,
"total_pack_energy": 39343,
"percentage_charged": 45.80457701965307,
"backup_capable": true,
"battery_power": -3090,
"load_power": 2581,
"grid_status": "Active",
"grid_power": 2569,
"island_status": "on_grid",
"storm_mode_active": false,
"timestamp": "2023-01-01T00:00:00-08:00"
}
}
off_grid_vehicle_charging_reserve
POST /api/1/energy_sites/{energy_site_id}/off_grid_vehicle_charging_reserve
scopes: energy_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"off_grid_vehicle_charging_reserve_percent": "integer"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/off_grid_vehicle_charging_reserve'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"off_grid_vehicle_charging_reserve_percent": "integer"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/off_grid_vehicle_charging_reserve", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/off_grid_vehicle_charging_reserve")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"off_grid_vehicle_charging_reserve_percent": "integer"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"off_grid_vehicle_charging_reserve_percent": "integer"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/energy_sites/{energy_site_id}/off_grid_vehicle_charging_reserve", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Adjust the site's off-grid vehicle charging backup reserve.
- Visit https://www.tesla.com/support/energy/powerwall/mobile-app/vehicle-charging-during-power-outage for more info.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
energy_site_id | path | integer | Yes | ID field of an energy site from /api/1/products endpoint. |
off_grid_vehicle_charging_reserve_percent | body | integer | Yes | The desired off grid vehicle charging reserve percent. |
Click to view successful response
{
"response": {
"code": 201,
"message": "Updated"
}
}
operation
POST /api/1/energy_sites/{energy_site_id}/operation
scopes: energy_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"default_real_mode": "string"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/operation'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"default_real_mode": "string"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/operation", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/operation")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"default_real_mode": "string"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"default_real_mode": "string"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/energy_sites/{energy_site_id}/operation", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Set the site's mode.
- Use autonomous for time-based control and self_consumption for self-powered mode.
- Visit https://www.tesla.com/support/energy/powerwall/mobile-app/powerwall-modes for more info.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
energy_site_id | path | integer | Yes | ID field of an energy site from /api/1/products endpoint. |
default_real_mode | body | string | Yes | The desired operation mode. Use autonomous for time-based control and self_consumption for self-powered mode. |
Click to view successful response
{
"response": {
"code": 201,
"message": "Updated"
}
}
products
GET /api/1/products
scopes: One of - vehicle_device_data, energy_device_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/products'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/products", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/products")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/products", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns products mapped to user.
Click to view successful response
{
"response": [
{
"id": 100021,
"user_id": 429511308124,
"vehicle_id": 99999,
"vin": "5YJ3000000NEXUS01",
"color": null,
"access_type": "OWNER",
"display_name": "Owned",
"option_codes": "TEST0,COUS",
"cached_data": null,
"granular_access": {
"hide_private": false
},
"tokens": [
"4f993c5b9e2b937b",
"7a3153b1bbb48a96"
],
"state": null,
"in_service": false,
"id_s": "100021",
"calendar_enabled": false,
"api_version": null,
"backseat_token": null,
"backseat_token_updated_at": null,
"command_signing": "off"
},
{
"energy_site_id": 429124,
"resource_type": "battery",
"site_name": "My Home",
"id": "STE12345678-12345",
"gateway_id": "1112345-00-E--TG0123456789",
"energy_left": 35425,
"total_pack_energy": 39362,
"percentage_charged": 90,
"battery_power": 1000
}
],
"count": 2
}
site_info
GET /api/1/energy_sites/{energy_site_id}/site_info
scopes: energy_device_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/site_info'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/site_info", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/site_info")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/energy_sites/{energy_site_id}/site_info", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns information about the site. Things like assets (has solar, etc), settings (backup reserve, etc), and features (storm_mode_capable, etc).
- Power values are in watts.
- Energy values are in watt hours.
- default_real_mode can be autonomous for time-based control and self_consumption for self-powered mode.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
energy_site_id | path | integer | Yes | ID field of an energy site from /api/1/products endpoint. |
Click to view successful response
{
"response": {
"id": "0000000-00-A--TEST0000000DIN",
"site_name": "My Home",
"backup_reserve_percent": 20,
"default_real_mode": "autonomous",
"installation_date": "2023-01-01T00:00:00-08:00",
"user_settings": {
"storm_mode_enabled": true
},
"components": {
"solar": true,
"solar_type": "pv_panel",
"battery": true,
"grid": true,
"backup": true,
"load_meter": true,
"storm_mode_capable": true,
"off_grid_vehicle_charging_reserve_supported": true,
"solar_value_enabled": true,
"set_islanding_mode_enabled": true,
"battery_type": "ac_powerwall",
"configurable": true
},
"version": "23.12.11 452c76cb",
"battery_count": 3,
"nameplate_power": 15000,
"nameplate_energy": 40500,
"installation_time_zone": "America/Los_Angeles",
"max_site_meter_power_ac": 1000000000,
"min_site_meter_power_ac": -11.726
}
}
storm_mode
POST /api/1/energy_sites/{energy_site_id}/storm_mode
scopes: energy_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"enabled": "boolean"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/storm_mode'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"enabled": "boolean"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/storm_mode", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/energy_sites/{energy_site_id}/storm_mode")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"enabled": "boolean"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"enabled": "boolean"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/energy_sites/{energy_site_id}/storm_mode", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Update storm watch participation.
- Visit https://www.tesla.com/support/energy/powerwall/mobile-app/storm-watch for more info.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
energy_site_id | path | integer | Yes | ID field of an energy site from /api/1/products endpoint. |
enabled | body | boolean | Yes | The storm mode participation value to set. |
Click to view successful response
{
"response": {
"code": 201,
"message": "Updated"
}
}
Partner Endpoints
fleet_telemetry_errors
GET /api/1/partner_accounts/fleet_telemetry_errors
scopes: vehicle_device_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/partner_accounts/fleet_telemetry_errors'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/partner_accounts/fleet_telemetry_errors", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/partner_accounts/fleet_telemetry_errors")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/partner_accounts/fleet_telemetry_errors", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns recent fleet telemetry errors reported by vehicles after receiving the config.
This endpoint requires a partner authentication token.
Click to view successful response
{
"response": {
"fleet_telemetry_errors": [
{
"name": "client-id",
"error": "msg",
"vin": "vin"
},
{
"name": "client-id",
"error": "msg2",
"vin": "vin"
}
]
}
}
public_key
GET /api/1/partner_accounts/public_key
scopes: One of - vehicle_device_data, vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/partner_accounts/public_key?domain={domain}'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/partner_accounts/public_key?domain={domain}", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/partner_accounts/public_key?domain={domain}")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/partner_accounts/public_key?domain=%7Bdomain%7D", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns the public key associated with a domain. It can be used to ensure the registration was successful.
This endpoint requires a partner authentication token.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
domain | query | string | Yes | Partner domain used to validate registration flow. |
Click to view successful response
{
"response": {
"public_key": "0437d832a7a695151f5a671780a276aa4cf2d6be3b2786465397612a342fcf418e98022d3cedf4e9a6f4b3b160472dee4ca022383d9b4cc4001a0f3023caec58fa"
}
}
register
POST /api/1/partner_accounts
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"domain": "string",
"csr": "string"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/partner_accounts'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"domain": "string",
"csr": "string"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/partner_accounts", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/partner_accounts")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"domain": "string",
"csr": "string"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"domain": "string",
"csr": "string"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/partner_accounts", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Registers an existing account before it can be used for general API access. Each application from developer.tesla.com must complete this step.
- The domain for this endpoint must match the root domain from the allowed_origins on developer.tesla.com. Ex.: 123.abc.com can be used for an allowed_origin of www.abc.com.
- The Bearer token for this request must be a partner authentication token.
- A PEM-encoded EC public key using the secp256r1 curve (prime256v1) must be and remain hosted at https://<app domain>/.well-known/appspecific/com.tesla.3p.public-key.pem. This public key will be registered on devices and used to validate commands that are generated by the vehicle-command proxy.
- The domain will be displayed to users as part of the mobile-app-based vehicle key-pairing process.
This endpoint requires a partner authentication token.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
domain | body | string | Yes | The application domain. A PEM-encoded EC public key must be hosted at https://<app domain>/.well-known/appspecific/com.tesla.3p.public-key.pem. Domains must be lowercase and have the same root as a domain from the application's allowed_origins on developer.tesla.com. |
csr | body | string | No | A certificate signing request to be configured for your account. Once uploaded, it may take up to one week to be fully processed. |
Click to view successful response
{
"response": {
"client_id": "client-id",
"name": "The Best Tesla Partner",
"description": "The very best Tesla partner",
"domain": "the-best-partner.com",
"ca": null,
"created_at": "2023-06-28T00:42:00.000Z",
"updated_at": "2023-06-28T00:42:00.000Z",
"enterprise_tier": "free",
"account_id": "account-id",
"issuer": null,
"csr": "-----BEGIN CERTIFICATE REQUEST-----\nMIHZMIGBAgEAMB8xHTAbBgNVBAMMFHRoZS1iZXN0LXBhcnRuZXIuY29tMFkwEwYH\nKoZIzj0CAQYIKoZIzj0DAQcDQgAEN9gyp6aVFR9aZxeAonaqTPLWvjsnhkZTl2Eq\nNC/PQY6YAi087fTppvSzsWBHLe5MoCI4PZtMxAAaDzAjyuxY+qAAMAoGCCqGSM49\nBAMCA0cAMEQCIE7LtTJO/Vrbr97cMz+FyjmzJ5FA+Xck55/QOnPq9AsOAiB77g0W\noEFqpvbpUQ1Y7biEoPa1gT0/nvoB31suLABmMg==\n-----END CERTIFICATE REQUEST-----\n",
"csr_updated_at": "2023-06-28T00:42:00.000Z",
"public_key": "0437d832a7a695151f5a671780a276aa4cf2d6be3b2786465397612a342fcf418e98022d3cedf4e9a6f4b3b160472dee4ca022383d9b4cc4001a0f3023caec58fa"
}
}
User Endpoints
backup_key
GET /api/1/users/backup_key
scopes: user_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/backup_key'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/backup_key", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/backup_key")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/users/backup_key", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns the public key associated with the user.
Click to view successful response
{
"response": {
"backup_key": null
}
}
feature_config
GET /api/1/users/feature_config
scopes: user_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/feature_config'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/feature_config", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/feature_config")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/users/feature_config", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns any custom feature flag applied to a user.
Click to view successful response
{
"response": {
"signaling": {
"enabled": true,
"subscribe_connectivity": false,
"use_auth_token": false
}
}
}
me
GET /api/1/users/me
scopes: user_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/me'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/me", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/me")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/users/me", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns a summary of a user's account.
Click to view successful response
{
"response": {
"email": "test-user@tesla.com",
"full_name": "Testy McTesterson",
"profile_image_url": "https://vehicle-files.prd.usw2.vn.cloud.tesla.com/profile_images/f98c87cd7bebc06069b89b33f9ec634c195520f75b6e63ea89f0b7c61449c689.jpg",
"vault_uuid": "b5c443af-a286-49eb-a4ad-35a97963155d"
}
}
orders
GET /api/1/users/orders
scopes: vehicle_device_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/orders'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/orders", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/orders")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/users/orders", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns the active orders for a user.
Click to view successful response
{
"response": [
{
"vehicleMapId": 1234466,
"referenceNumber": "RN00000001",
"vin": "5YJ30000000000001",
"orderStatus": "BOOKED",
"orderSubstatus": "_Z",
"modelCode": "m3",
"countryCode": "US",
"locale": "en_US",
"mktOptions": "APBS,DV2W,IBB1,PMNG,PRM30,SC04,MDL3,W41B,MT322,CPF0,RSF1,CW03",
"isB2b": false
}
],
"count": 1
}
region
GET /api/1/users/region
scopes: One of - vehicle_device_data, vehicle_cmds, energy_cmds, energy_device_data, user_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/region'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/region", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/users/region")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/users/region", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns a user's region and appropriate fleet-api base URL. Accepts no parameters, response is based on the authentication token subject.
Click to view successful response
{
"response": {
"region": "eu",
"fleet_api_base_url": "https://fleet-api.prd.eu.vn.cloud.tesla.com"
}
}
Vehicle Commands
actuate_trunk
POST /api/1/vehicles/{vehicle_tag}/command/actuate_trunk
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"which_trunk": "string"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/actuate_trunk'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"which_trunk": "string"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/actuate_trunk", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/actuate_trunk")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"which_trunk": "string"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"which_trunk": "string"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/actuate_trunk", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Controls the front (which_trunk: "front") or rear (which_trunk: "rear") trunk.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
which_trunk | body | string | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
adjust_volume
POST /api/1/vehicles/{vehicle_tag}/command/adjust_volume
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"volume": "number"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/adjust_volume'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"volume": "number"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/adjust_volume", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/adjust_volume")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"volume": "number"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"volume": "number"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/adjust_volume", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Adjusts vehicle media playback volume.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
volume | body | number | Yes | A floating point number from 0.0 to 11.0. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
auto_conditioning_start
POST /api/1/vehicles/{vehicle_tag}/command/auto_conditioning_start
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/auto_conditioning_start'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/auto_conditioning_start", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/auto_conditioning_start")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/auto_conditioning_start", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Starts climate preconditioning.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
auto_conditioning_stop
POST /api/1/vehicles/{vehicle_tag}/command/auto_conditioning_stop
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/auto_conditioning_stop'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/auto_conditioning_stop", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/auto_conditioning_stop")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/auto_conditioning_stop", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Stops climate preconditioning.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
cancel_software_update
POST /api/1/vehicles/{vehicle_tag}/command/cancel_software_update
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/cancel_software_update'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/cancel_software_update", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/cancel_software_update")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/cancel_software_update", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Cancels the countdown to install the vehicle software update. This operation will no longer work after the vehicle begins the software installation.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
charge_max_range
POST /api/1/vehicles/{vehicle_tag}/command/charge_max_range
scopes: One of - vehicle_cmds, vehicle_charging_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/charge_max_range'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/charge_max_range", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/charge_max_range")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/charge_max_range", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Charges in max range mode -- we recommend limiting the use of this mode to long trips.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
charge_port_door_close
POST /api/1/vehicles/{vehicle_tag}/command/charge_port_door_close
scopes: One of - vehicle_cmds, vehicle_charging_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/charge_port_door_close'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/charge_port_door_close", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/charge_port_door_close")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/charge_port_door_close", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Closes the charge port door.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
charge_port_door_open
POST /api/1/vehicles/{vehicle_tag}/command/charge_port_door_open
scopes: One of - vehicle_cmds, vehicle_charging_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/charge_port_door_open'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/charge_port_door_open", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/charge_port_door_open")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/charge_port_door_open", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Opens the charge port door.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
charge_standard
POST /api/1/vehicles/{vehicle_tag}/command/charge_standard
scopes: One of - vehicle_cmds, vehicle_charging_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/charge_standard'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/charge_standard", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/charge_standard")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/charge_standard", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Charges in Standard mode.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
charge_start
POST /api/1/vehicles/{vehicle_tag}/command/charge_start
scopes: One of - vehicle_cmds, vehicle_charging_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/charge_start'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/charge_start", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/charge_start")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/charge_start", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Starts charging the vehicle.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
charge_stop
POST /api/1/vehicles/{vehicle_tag}/command/charge_stop
scopes: One of - vehicle_cmds, vehicle_charging_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/charge_stop'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/charge_stop", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/charge_stop")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/charge_stop", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Stops charging the vehicle.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
clear_pin_to_drive_admin
POST /api/1/vehicles/{vehicle_tag}/command/clear_pin_to_drive_admin
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/clear_pin_to_drive_admin'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/clear_pin_to_drive_admin", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/clear_pin_to_drive_admin")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/clear_pin_to_drive_admin", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Deactivates PIN to Drive and resets the associated PIN for vehicles running firmware versions 2023.44+. This command is only accessible to fleet managers or owners.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
door_lock
POST /api/1/vehicles/{vehicle_tag}/command/door_lock
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/door_lock'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/door_lock", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/door_lock")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/door_lock", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Locks the vehicle.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
door_unlock
POST /api/1/vehicles/{vehicle_tag}/command/door_unlock
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/door_unlock'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/door_unlock", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/door_unlock")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/door_unlock", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Unlocks the vehicle.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
erase_user_data
POST /api/1/vehicles/{vehicle_tag}/command/erase_user_data
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/erase_user_data'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/erase_user_data", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/erase_user_data")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/erase_user_data", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Erases user's data from the user interface. Requires the vehicle to be in park.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
flash_lights
POST /api/1/vehicles/{vehicle_tag}/command/flash_lights
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/flash_lights'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/flash_lights", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/flash_lights")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/flash_lights", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Briefly flashes the vehicle headlights. Requires the vehicle to be in park.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
guest_mode
POST /api/1/vehicles/{vehicle_tag}/command/guest_mode
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"enable": "boolean"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/guest_mode'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"enable": "boolean"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/guest_mode", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/guest_mode")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"enable": "boolean"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"enable": "boolean"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/guest_mode", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
- Restricts certain vehicle UI functionality from guest users:
- PIN to Drive
- Speed Limit Mode
- Glovebox PIN
- Add/Remove keys
- Change vehicle name
- Enables erase_user_data API on the vehicle to clear user data.
- Allows a user to set up Tesla mobile app access with the vehicle key card:
- If a user unlocks a vehicle or authenticates it for driving while in Guest Mode, they will receive a prompt to set up a phone key by scanning a QR code on the vehicle touchscreen.
- Requires vehicle to be online.
- Does not show a QR code if a phone key is already connected.
- Revokes any existing guest access if a QR code is shown.
- Any account that scans the QR code will gain Tesla app access to the vehicle. This allows that account to view live vehicle location and issue remote commands, and download that account's Tesla profile to the vehicle.
- The QR code is single-use and expires after 10 minutes.
- Use the revoke API to remove access.
- The vehicle needs to be online to use this API (wake if vehicle unavailable).
- The app access is GUEST access, it does not have access to all the features an owner or driver does.
- Only one guest is allowed access at a time.
- If a user does not have the app installed, they will see this webpage (https://www.tesla.com/_gs/test) to guide them through the process.
- A user can set up their phone as key with the Tesla app when in proximity of the vehicle.
- If a user unlocks a vehicle or authenticates it for driving while in Guest Mode, they will receive a prompt to set up a phone key by scanning a QR code on the vehicle touchscreen.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
enable | body | boolean | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
honk_horn
POST /api/1/vehicles/{vehicle_tag}/command/honk_horn
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/honk_horn'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/honk_horn", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/honk_horn")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/honk_horn", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Honks the vehicle horn. Requires the vehicle to be in park.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
media_next_fav
POST /api/1/vehicles/{vehicle_tag}/command/media_next_fav
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/media_next_fav'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/media_next_fav", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/media_next_fav")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/media_next_fav", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Advances media player to next favorite track.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
media_next_track
POST /api/1/vehicles/{vehicle_tag}/command/media_next_track
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/media_next_track'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/media_next_track", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/media_next_track")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/media_next_track", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Advances media player to next track.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
media_prev_fav
POST /api/1/vehicles/{vehicle_tag}/command/media_prev_fav
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/media_prev_fav'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/media_prev_fav", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/media_prev_fav")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/media_prev_fav", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Advances media player to previous favorite track.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
media_prev_track
POST /api/1/vehicles/{vehicle_tag}/command/media_prev_track
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/media_prev_track'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/media_prev_track", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/media_prev_track")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/media_prev_track", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Advances media player to previous track.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
media_toggle_playback
POST /api/1/vehicles/{vehicle_tag}/command/media_toggle_playback
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/media_toggle_playback'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/media_toggle_playback", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/media_toggle_playback")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/media_toggle_playback", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Toggles current play/pause state.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
media_volume_down
POST /api/1/vehicles/{vehicle_tag}/command/media_volume_down
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/media_volume_down'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/media_volume_down", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/media_volume_down")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/media_volume_down", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Turns the volume down by one.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
navigation_gps_request
POST /api/1/vehicles/{vehicle_tag}/command/navigation_gps_request
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"lat": "number",
"lon": "number",
"order": "integer"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/navigation_gps_request'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"lat": "number",
"lon": "number",
"order": "integer"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/navigation_gps_request", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/navigation_gps_request")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"lat": "number",
"lon": "number",
"order": "integer"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"lat": "number",
"lon": "number",
"order": "integer"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/navigation_gps_request", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Start navigation to given coordinates. Order can be used to specify order of multiple stops.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
lat | body | number | Yes | |
lon | body | number | Yes | |
order | body | integer | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
navigation_request
POST /api/1/vehicles/{vehicle_tag}/command/navigation_request
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"type": "string",
"locale": "string",
"timestamp_ms": "string"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/navigation_request'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"type": "string",
"locale": "string",
"timestamp_ms": "string"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/navigation_request", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/navigation_request")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"type": "string",
"locale": "string",
"timestamp_ms": "string"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"type": "string",
"locale": "string",
"timestamp_ms": "string"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/navigation_request", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Sends a location to the in-vehicle navigation system.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
type | body | string | Yes | |
value | body | Unknown | Yes | |
locale | body | string | Yes | |
timestamp_ms | body | string | Yes |
Click to view successful response
{
"response": {
"result": true,
"queued": true
}
}
navigation_sc_request
POST /api/1/vehicles/{vehicle_tag}/command/navigation_sc_request
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"id": "integer",
"order": "integer"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/navigation_sc_request'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"id": "integer",
"order": "integer"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/navigation_sc_request", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/navigation_sc_request")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"id": "integer",
"order": "integer"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"id": "integer",
"order": "integer"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/navigation_sc_request", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Start navigation to a supercharger.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
id | body | integer | Yes | |
order | body | integer | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
remote_auto_seat_climate_request
POST /api/1/vehicles/{vehicle_tag}/command/remote_auto_seat_climate_request
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"auto_seat_position": "integer",
"auto_climate_on": "boolean"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/remote_auto_seat_climate_request'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"auto_seat_position": "integer",
"auto_climate_on": "boolean"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/remote_auto_seat_climate_request", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/remote_auto_seat_climate_request")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"auto_seat_position": "integer",
"auto_climate_on": "boolean"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"auto_seat_position": "integer",
"auto_climate_on": "boolean"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/remote_auto_seat_climate_request", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Sets automatic seat heating and cooling.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
auto_seat_position | body | integer | Yes | |
auto_climate_on | body | boolean | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
remote_auto_steering_wheel_heat_climate_request
POST /api/1/vehicles/{vehicle_tag}/command/remote_auto_steering_wheel_heat_climate_request
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"on": "boolean"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/remote_auto_steering_wheel_heat_climate_request'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"on": "boolean"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/remote_auto_steering_wheel_heat_climate_request", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/remote_auto_steering_wheel_heat_climate_request")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"on": "boolean"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"on": "boolean"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/remote_auto_steering_wheel_heat_climate_request", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Sets automatic steering wheel heating on/off.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
on | body | boolean | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
remote_boombox
POST /api/1/vehicles/{vehicle_tag}/command/remote_boombox
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"sound": "integer"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/remote_boombox'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"sound": "integer"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/remote_boombox", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/remote_boombox")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"sound": "integer"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"sound": "integer"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/remote_boombox", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Plays a sound through the vehicle external speaker.
Sound IDs:
0
: random fart2000
: locate ping
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
sound | body | integer | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
remote_seat_cooler_request
POST /api/1/vehicles/{vehicle_tag}/command/remote_seat_cooler_request
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"seat_position": "integer",
"seat_cooler_level": "integer"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/remote_seat_cooler_request'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"seat_position": "integer",
"seat_cooler_level": "integer"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/remote_seat_cooler_request", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/remote_seat_cooler_request")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"seat_position": "integer",
"seat_cooler_level": "integer"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"seat_position": "integer",
"seat_cooler_level": "integer"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/remote_seat_cooler_request", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Sets seat cooling.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
seat_position | body | integer | Yes | |
seat_cooler_level | body | integer | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
remote_seat_heater_request
POST /api/1/vehicles/{vehicle_tag}/command/remote_seat_heater_request
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/remote_seat_heater_request'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/remote_seat_heater_request", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/remote_seat_heater_request")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/remote_seat_heater_request", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Sets seat heating.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
remote_start_drive
POST /api/1/vehicles/{vehicle_tag}/command/remote_start_drive
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/remote_start_drive'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/remote_start_drive", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/remote_start_drive")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/remote_start_drive", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Starts the vehicle remotely. Requires keyless driving to be enabled.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
remote_steering_wheel_heat_level_request
POST /api/1/vehicles/{vehicle_tag}/command/remote_steering_wheel_heat_level_request
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"level": "integer"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/remote_steering_wheel_heat_level_request'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"level": "integer"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/remote_steering_wheel_heat_level_request", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/remote_steering_wheel_heat_level_request")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"level": "integer"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"level": "integer"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/remote_steering_wheel_heat_level_request", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Sets steering wheel heat level.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
level | body | integer | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
remote_steering_wheel_heater_request
POST /api/1/vehicles/{vehicle_tag}/command/remote_steering_wheel_heater_request
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"on": "boolean"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/remote_steering_wheel_heater_request'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"on": "boolean"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/remote_steering_wheel_heater_request", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/remote_steering_wheel_heater_request")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"on": "boolean"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"on": "boolean"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/remote_steering_wheel_heater_request", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Sets steering wheel heating on/off. For vehicles that do not support auto steering wheel heat.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
on | body | boolean | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
reset_pin_to_drive_pin
POST /api/1/vehicles/{vehicle_tag}/command/reset_pin_to_drive_pin
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/reset_pin_to_drive_pin'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/reset_pin_to_drive_pin", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/reset_pin_to_drive_pin")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/reset_pin_to_drive_pin", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Removes PIN to Drive. Requires the car to be in Pin to Drive mode and not in Valet mode. Note that this only works if PIN to Drive is not active. This command also requires the Tesla Vehicle Command Protocol - for more information, please see refer to the documentation here.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
reset_valet_pin
POST /api/1/vehicles/{vehicle_tag}/command/reset_valet_pin
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/reset_valet_pin'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/reset_valet_pin", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/reset_valet_pin")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/reset_valet_pin", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Removes PIN for Valet Mode. To use this command, valet mode must be disabled. See set_valet_mode.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
schedule_software_update
POST /api/1/vehicles/{vehicle_tag}/command/schedule_software_update
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"offset_sec": "integer"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/schedule_software_update'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"offset_sec": "integer"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/schedule_software_update", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/schedule_software_update")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"offset_sec": "integer"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"offset_sec": "integer"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/schedule_software_update", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Schedules a vehicle software update (over the air "OTA") to be installed in the future.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
offset_sec | body | integer | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
set_bioweapon_mode
POST /api/1/vehicles/{vehicle_tag}/command/set_bioweapon_mode
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"on": "boolean",
"manual_override": "boolean"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_bioweapon_mode'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"on": "boolean",
"manual_override": "boolean"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_bioweapon_mode", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_bioweapon_mode")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"on": "boolean",
"manual_override": "boolean"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"on": "boolean",
"manual_override": "boolean"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/set_bioweapon_mode", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Turns Bioweapon Defense Mode on and off.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
on | body | boolean | Yes | |
manual_override | body | boolean | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
set_cabin_overheat_protection
POST /api/1/vehicles/{vehicle_tag}/command/set_cabin_overheat_protection
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"on": "boolean",
"fan_only": "boolean"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_cabin_overheat_protection'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"on": "boolean",
"fan_only": "boolean"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_cabin_overheat_protection", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_cabin_overheat_protection")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"on": "boolean",
"fan_only": "boolean"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"on": "boolean",
"fan_only": "boolean"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/set_cabin_overheat_protection", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Sets the vehicle overheat protection.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
on | body | boolean | Yes | |
fan_only | body | boolean | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
set_charge_limit
POST /api/1/vehicles/{vehicle_tag}/command/set_charge_limit
scopes: One of - vehicle_cmds, vehicle_charging_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"percent": "integer"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_charge_limit'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"percent": "integer"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_charge_limit", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_charge_limit")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"percent": "integer"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"percent": "integer"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/set_charge_limit", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Sets the vehicle charge limit.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
percent | body | integer | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
set_charging_amps
POST /api/1/vehicles/{vehicle_tag}/command/set_charging_amps
scopes: One of - vehicle_cmds, vehicle_charging_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"charging_amps": "integer"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_charging_amps'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"charging_amps": "integer"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_charging_amps", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_charging_amps")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"charging_amps": "integer"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"charging_amps": "integer"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/set_charging_amps", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Sets the vehicle charging amps.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
charging_amps | body | integer | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
set_climate_keeper_mode
POST /api/1/vehicles/{vehicle_tag}/command/set_climate_keeper_mode
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"climate_keeper_mode": "integer"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_climate_keeper_mode'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"climate_keeper_mode": "integer"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_climate_keeper_mode", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_climate_keeper_mode")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"climate_keeper_mode": "integer"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"climate_keeper_mode": "integer"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/set_climate_keeper_mode", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Enables climate keeper mode. Accepted values are: 0
,1
,2
,3
. Mapping to respectively Off, Keep Mode, Dog Mode, Camp Mode.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
climate_keeper_mode | body | integer | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
set_cop_temp
POST /api/1/vehicles/{vehicle_tag}/command/set_cop_temp
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"cop_temp": "integer"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_cop_temp'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"cop_temp": "integer"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_cop_temp", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_cop_temp")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"cop_temp": "integer"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"cop_temp": "integer"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/set_cop_temp", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Adjusts the Cabin Overheat Protection temperature (COP). This command will not activate COP. The precise target temperature depends on if the user has selected C or F. Accepted values are: 0
,1
,2
. Mapping to respectively Low (90F/30C), Medium (95F/35C), High (100F/40C).
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
cop_temp | body | integer | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
set_pin_to_drive
POST /api/1/vehicles/{vehicle_tag}/command/set_pin_to_drive
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"on": "boolean",
"password": "string"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_pin_to_drive'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"on": "boolean",
"password": "string"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_pin_to_drive", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_pin_to_drive")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"on": "boolean",
"password": "string"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"on": "boolean",
"password": "string"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/set_pin_to_drive", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Sets a four-digit passcode for PIN to Drive. This PIN must then be entered before the vehicle can be driven. Once a PIN is set, the vehicle remembers its value even when PIN to Drive is disabled and it will discard any new PIN provided using this method. To change an existing PIN, first call reset_pin_to_drive_pin. This command also requires the Tesla Vehicle Command Protocol - for more information, please see refer to the documentation here.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
on | body | boolean | Yes | |
password | body | string | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
set_preconditioning_max
POST /api/1/vehicles/{vehicle_tag}/command/set_preconditioning_max
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"on": "boolean",
"manual_override": "boolean"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_preconditioning_max'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"on": "boolean",
"manual_override": "boolean"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_preconditioning_max", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_preconditioning_max")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"on": "boolean",
"manual_override": "boolean"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"on": "boolean",
"manual_override": "boolean"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/set_preconditioning_max", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Sets an override for preconditioning — it should default to empty if no override is used.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
on | body | boolean | Yes | |
manual_override | body | boolean | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
set_scheduled_charging
POST /api/1/vehicles/{vehicle_tag}/command/set_scheduled_charging
scopes: One of - vehicle_cmds, vehicle_charging_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"enable": "boolean",
"time": "integer"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_scheduled_charging'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"enable": "boolean",
"time": "integer"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_scheduled_charging", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_scheduled_charging")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"enable": "boolean",
"time": "integer"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"enable": "boolean",
"time": "integer"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/set_scheduled_charging", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Sets a time at which charging should be completed. The time
parameter is minutes after midnight (e.g: time=120 schedules charging for 2:00am vehicle local time).
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
enable | body | boolean | Yes | |
time | body | integer | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
set_scheduled_departure
POST /api/1/vehicles/{vehicle_tag}/command/set_scheduled_departure
scopes: One of - vehicle_cmds, vehicle_charging_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"enable": "boolean",
"time": "integer"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_scheduled_departure'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"enable": "boolean",
"time": "integer"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_scheduled_departure", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_scheduled_departure")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"enable": "boolean",
"time": "integer"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"enable": "boolean",
"time": "integer"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/set_scheduled_departure", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Sets a time at which departure should be completed. The time
parameter is minutes after midnight (e.g: time=120 schedules departure for 2:00am vehicle local time).
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
enable | body | boolean | Yes | |
time | body | integer | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
set_sentry_mode
POST /api/1/vehicles/{vehicle_tag}/command/set_sentry_mode
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"on": "boolean"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_sentry_mode'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"on": "boolean"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_sentry_mode", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_sentry_mode")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"on": "boolean"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"on": "boolean"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/set_sentry_mode", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Enables and disables Sentry Mode. Sentry Mode allows customers to watch the vehicle cameras live from the mobile app, as well as record sentry events.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
on | body | boolean | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
set_temps
POST /api/1/vehicles/{vehicle_tag}/command/set_temps
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"driver_temp": "integer",
"passenger_temp": "integer"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_temps'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"driver_temp": "integer",
"passenger_temp": "integer"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_temps", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_temps")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"driver_temp": "integer",
"passenger_temp": "integer"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"driver_temp": "integer",
"passenger_temp": "integer"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/set_temps", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Sets the driver and/or passenger-side cabin temperature (and other zones if sync is enabled).
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
driver_temp | body | integer | Yes | |
passenger_temp | body | integer | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
set_valet_mode
POST /api/1/vehicles/{vehicle_tag}/command/set_valet_mode
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"on": "boolean",
"password": "string"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_valet_mode'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"on": "boolean",
"password": "string"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_valet_mode", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_valet_mode")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"on": "boolean",
"password": "string"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"on": "boolean",
"password": "string"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/set_valet_mode", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Turns on Valet Mode and sets a four-digit passcode that must then be entered to disable Valet Mode.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
on | body | boolean | Yes | |
password | body | string | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
set_vehicle_name
POST /api/1/vehicles/{vehicle_tag}/command/set_vehicle_name
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"vehicle_name": "string"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_vehicle_name'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"vehicle_name": "string"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_vehicle_name", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/set_vehicle_name")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"vehicle_name": "string"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"vehicle_name": "string"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/set_vehicle_name", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Changes the name of a vehicle. This command also requires the Tesla Vehicle Command Protocol - for more information, please see refer to the documentation here.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
vehicle_name | body | string | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
speed_limit_activate
POST /api/1/vehicles/{vehicle_tag}/command/speed_limit_activate
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"pin": "string"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/speed_limit_activate'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"pin": "string"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/speed_limit_activate", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/speed_limit_activate")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"pin": "string"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"pin": "string"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/speed_limit_activate", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Activates Speed Limit Mode with a four-digit PIN.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
pin | body | string | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
speed_limit_clear_pin
POST /api/1/vehicles/{vehicle_tag}/command/speed_limit_clear_pin
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"pin": "string"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/speed_limit_clear_pin'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"pin": "string"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/speed_limit_clear_pin", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/speed_limit_clear_pin")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"pin": "string"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"pin": "string"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/speed_limit_clear_pin", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Deactivates Speed Limit Mode and resets the associated PIN.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
pin | body | string | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
speed_limit_clear_pin_admin
POST /api/1/vehicles/{vehicle_tag}/command/speed_limit_clear_pin_admin
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/speed_limit_clear_pin_admin'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/speed_limit_clear_pin_admin", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/speed_limit_clear_pin_admin")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/speed_limit_clear_pin_admin", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Deactivates Speed Limit Mode and resets the associated PIN for vehicles running firmware versions 2023.38+. This command is only accessible to fleet managers or owners.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
speed_limit_deactivate
POST /api/1/vehicles/{vehicle_tag}/command/speed_limit_deactivate
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"pin": "string"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/speed_limit_deactivate'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"pin": "string"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/speed_limit_deactivate", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/speed_limit_deactivate")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"pin": "string"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"pin": "string"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/speed_limit_deactivate", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Deactivates Speed Limit Mode.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
pin | body | string | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
speed_limit_set_limit
POST /api/1/vehicles/{vehicle_tag}/command/speed_limit_set_limit
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"limit_mph": "integer"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/speed_limit_set_limit'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"limit_mph": "integer"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/speed_limit_set_limit", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/speed_limit_set_limit")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"limit_mph": "integer"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"limit_mph": "integer"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/speed_limit_set_limit", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Sets the maximum speed (in miles per hours) for Speed Limit Mode.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
limit_mph | body | integer | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
sun_roof_control
POST /api/1/vehicles/{vehicle_tag}/command/sun_roof_control
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"state": "string"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/sun_roof_control'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"state": "string"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/sun_roof_control", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/sun_roof_control")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"state": "string"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"state": "string"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/sun_roof_control", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Control the sunroof on sunroof-enabled vehicles.
Supported states: stop, close, and vent.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
state | body | string | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
take_drivenote
POST /api/1/vehicles/{vehicle_tag}/command/take_drivenote
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"note": "string"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/take_drivenote'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"note": "string"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/take_drivenote", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/take_drivenote")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"note": "string"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"note": "string"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/take_drivenote", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Records a drive note. The note parameter is truncated to 80 characters in length.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
note | body | string | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
trigger_homelink
POST /api/1/vehicles/{vehicle_tag}/command/trigger_homelink
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"lat": "number",
"lon": "number",
"token": "string"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/trigger_homelink'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"lat": "number",
"lon": "number",
"token": "string"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/trigger_homelink", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/trigger_homelink")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"lat": "number",
"lon": "number",
"token": "string"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"lat": "number",
"lon": "number",
"token": "string"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/trigger_homelink", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
⚠️ Newest vehicles require Tesla Vehicle Command protocol (see details). ⚠️
Turns on HomeLink (used to open and close garage doors).
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
lat | body | number | Yes | |
lon | body | number | Yes | |
token | body | string | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
upcoming_calendar_entries
POST /api/1/vehicles/{vehicle_tag}/command/upcoming_calendar_entries
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"calendar_data": "string"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/upcoming_calendar_entries'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"calendar_data": "string"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/upcoming_calendar_entries", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/upcoming_calendar_entries")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"calendar_data": "string"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"calendar_data": "string"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/upcoming_calendar_entries", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Upcoming calendar entries stored on the vehicle.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
calendar_data | body | string | Yes |
Click to view successful response
{
"response": {
"reason": "",
"result": true
}
}
window_control
POST /api/1/vehicles/{vehicle_tag}/command/window_control
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"lat": "number",
"lon": "number",
"command": "string"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/window_control'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"lat": "number",
"lon": "number",
"command": "string"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/window_control", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/command/window_control")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"lat": "number",
"lon": "number",
"command": "string"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"lat": "number",
"lon": "number",
"command": "string"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/command/window_control", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Control the windows of a parked vehicle. Supported commands: vent and close. When closing, specify lat and lon of user to ensure they are within range of vehicle (unless this is an M3 platform vehicle).
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
lat | body | number | Yes | |
lon | body | number | Yes | |
command | body | string | Yes |
Click to view successful response
{
"response": {
"result": true,
"reason": ""
}
}
Vehicle Endpoints
drivers
GET /api/1/vehicles/{vehicle_tag}/drivers
scopes: vehicle_device_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/drivers'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/drivers", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/drivers")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/vehicles/{vehicle_tag}/drivers", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns all allowed drivers for a vehicle. This endpoint is only available for the vehicle owner.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": [
{
"my_tesla_unique_id": 8888888,
"user_id": 800001,
"user_id_s": "800001",
"vault_uuid": "b5c443af-a286-49eb-a4ad-35a97963155d",
"driver_first_name": "Testy",
"driver_last_name": "McTesterson",
"granular_access": {
"hide_private": false
},
"active_pubkeys": [],
"public_key": ""
}
],
"count": 1
}
drivers remove
DELETE /api/1/vehicles/{vehicle_tag}/drivers
scopes: vehicle_cmds
curl --request DELETE \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/drivers'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/drivers", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/drivers")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("DELETE", "/api/1/vehicles/{vehicle_tag}/drivers", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Removes driver access from a vehicle. Share users can only remove their own access. Owners can remove share access or their own.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
share_user_id | query | integer | No | user id from a share |
Click to view successful response
{
"response": "ok"
}
eligible_subscriptions
GET /api/1/dx/vehicles/subscriptions/eligibility
scopes: vehicle_device_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/vehicles/subscriptions/eligibility?vin={vin}'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/vehicles/subscriptions/eligibility?vin={vin}", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/vehicles/subscriptions/eligibility?vin={vin}")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/dx/vehicles/subscriptions/eligibility?vin=%7Bvin%7D", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns eligible vehicle subscriptions.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vin | query | string | Yes | Vin |
Click to view successful response
{
"response": {
"country": "string",
"eligible": [
{
"addons": [
{
"billingPeriod": "string",
"currencyCode": "string",
"optionCode": "string",
"price": 0,
"tax": 0,
"total": 0
}
],
"billingOptions": [
{
"billingPeriod": "string",
"currencyCode": "string",
"optionCode": "string",
"price": 0,
"tax": 0,
"total": 0
}
],
"optionCode": "string",
"product": "string",
"startDate": "string"
}
],
"vin": "string"
}
}
eligible_upgrades
GET /api/1/dx/vehicles/upgrades/eligibility
scopes: vehicle_device_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/vehicles/upgrades/eligibility?vin={vin}'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/vehicles/upgrades/eligibility?vin={vin}", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/vehicles/upgrades/eligibility?vin={vin}")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/dx/vehicles/upgrades/eligibility?vin=%7Bvin%7D", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns eligibile vehicle upgrades.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vin | query | string | Yes | Vin |
Click to view successful response
{
"response": {
"vin": "TEST00000000VIN01",
"country": "US",
"type": "VEHICLE",
"eligible": [
{
"optionCode": "$FM3U",
"optionGroup": "PERF_FIRMWARE",
"currentOptionCode": "$FM3B",
"pricing": [
{
"price": 2000,
"total": 2000,
"currencyCode": "USD",
"isPrimary": true
}
]
}
]
}
}
fleet_status
POST /api/1/vehicles/fleet_status
scopes: vehicle_device_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"vins": [
"vin1"
]
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/fleet_status'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"vins": [
"vin1"
]
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/fleet_status", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/fleet_status")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"vins": [
"vin1"
]
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"vins": [
"vin1"
]
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/fleet_status", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Checks whether vehicles can accept Tesla commands protocol for the partner's public key
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vins | body | array | Yes | list of Vehicle Identification Number (VIN). |
Click to view successful response
{
"response": {
"key_paired_vins": [],
"unpaired_vins": [
"5YJ3000000NEXUS01"
],
"vehicle_info": {
"5YJ3000000NEXUS01": {
"firmware_version": "2024.14.30"
}
}
}
}
fleet_telemetry_config create
POST /api/1/vehicles/fleet_telemetry_config
scopes: vehicle_device_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"vins": [
"vin1",
"vin2"
],
"config": {
"hostname": "test-telemetry.com",
"ca": "-----BEGIN CERTIFICATE-----\ncert\n-----END CERTIFICATE-----\n",
"fields": {
"DriveRail": {
"interval_seconds": 1800
},
"BmsFullchargecomplete": {
"interval_seconds": 1800
}
},
"alert_types": [
"service"
],
"exp": 1704067200,
"port": 4443
}
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/fleet_telemetry_config'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"vins": [
"vin1",
"vin2"
],
"config": {
"hostname": "test-telemetry.com",
"ca": "-----BEGIN CERTIFICATE-----\ncert\n-----END CERTIFICATE-----\n",
"fields": {
"DriveRail": {
"interval_seconds": 1800
},
"BmsFullchargecomplete": {
"interval_seconds": 1800
}
},
"alert_types": [
"service"
],
"exp": 1704067200,
"port": 4443
}
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/fleet_telemetry_config", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/fleet_telemetry_config")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"vins": [
"vin1",
"vin2"
],
"config": {
"hostname": "test-telemetry.com",
"ca": "-----BEGIN CERTIFICATE-----\ncert\n-----END CERTIFICATE-----\n",
"fields": {
"DriveRail": {
"interval_seconds": 1800
},
"BmsFullchargecomplete": {
"interval_seconds": 1800
}
},
"alert_types": [
"service"
],
"exp": 1704067200,
"port": 4443
}
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"vins": [
"vin1",
"vin2"
],
"config": {
"hostname": "test-telemetry.com",
"ca": "-----BEGIN CERTIFICATE-----\ncert\n-----END CERTIFICATE-----\n",
"fields": {
"DriveRail": {
"interval_seconds": 1800
},
"BmsFullchargecomplete": {
"interval_seconds": 1800
}
},
"alert_types": [
"service"
],
"exp": 1704067200,
"port": 4443
}
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/fleet_telemetry_config", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Configures vehicles to connect to self-hosted fleet-telemetry server. This endpoint has concurrency 1 (status 429 will be returned if many calls are made at the same time). Multiple vehicles can be configured with a single call.
If any specified VINs are not configured, the response will include skipped_vehicles
. The reasons VINs may be rejected:
missing_key
: Your virtual key has not been added to the vehicle. Distributing your public key.unsupported_hardware
: Pre-2021 Model S and X are not supported.unsupported_firmware
: Vehicles running firmware version earlier than 2023.20.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vins | body | array | Yes | list of Vehicle Identification Number (VIN) |
config.hostname | body | string | Yes | url of the fleet-telemetry server, must match the root domain (second-level + first-level domain) of the registered application |
config.ca | body | string | Yes | public certificate authority cert for fleet-telemetry server |
config.fields.<field_to_stream> .interval_seconds |
body | integer | Yes | field publishing interval, exhaustive list of <field_to_stream> here. |
config.alert_types | body | array | No | list of alert types that the vehicle will publish |
config.exp | body | integer | No | expiration (epoch time in seconds) of the current config. If not specified, config will be valid indefinitely. |
config.port | body | integer | Yes | fleet-telemetry server port |
Click to view successful response
{
"response": {
"updated_vehicles": 1,
"skipped_vehicles": {
"missing_key": [],
"unsupported_hardware": [
"5YJ3000000NEXUS02"
],
"unsupported_firmware": [
"5YJ3000000NEXUS02"
]
}
}
}
fleet_telemetry_config delete
DELETE /api/1/vehicles/{vehicle_tag}/fleet_telemetry_config
scopes: vehicle_device_data
curl --request DELETE \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/fleet_telemetry_config'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/fleet_telemetry_config", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/fleet_telemetry_config")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("DELETE", "/api/1/vehicles/{vehicle_tag}/fleet_telemetry_config", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Disconnects vehicles to stream telemetry data to self hosted fleet-telemetry server.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"updated_vehicles": 1
}
}
fleet_telemetry_config get
GET /api/1/vehicles/{vehicle_tag}/fleet_telemetry_config
scopes: vehicle_device_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/fleet_telemetry_config'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/fleet_telemetry_config", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/fleet_telemetry_config")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/vehicles/{vehicle_tag}/fleet_telemetry_config", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Fetches a vehicle's fleet telemetry config. synced
set to true
means the vehicle has adopted the target config. synced
set to false
means the vehicle will attempt to adopt the target config when it next establishes a backend connection.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"synced": true,
"config": {
"hostname": "test-telemetry.com",
"ca": "-----BEGIN CERTIFICATE-----\ncert\n-----END CERTIFICATE-----\n",
"exp": 1704067200,
"port": 4443,
"fields": {
"DriveRail": {
"interval_seconds": 1800
},
"BmsFullchargecomplete": {
"interval_seconds": 1800
}
},
"alert_types": [
"service"
]
}
}
}
list
GET /api/1/vehicles
scopes: vehicle_device_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/vehicles", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns vehicles belonging to the account.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
page | query | integer | No | Current page number. |
per_page | query | integer | No | Number of records per page. |
Click to view successful response
{
"response": [
{
"id": 100021,
"vehicle_id": 99999,
"vin": "TEST00000000VIN01",
"color": null,
"access_type": "OWNER",
"display_name": "Owned",
"option_codes": "TEST0,COUS",
"granular_access": {
"hide_private": false
},
"tokens": [
"4f993c5b9e2b937b",
"7a3153b1bbb48a96"
],
"state": null,
"in_service": false,
"id_s": "100021",
"calendar_enabled": true,
"api_version": null,
"backseat_token": null,
"backseat_token_updated_at": null
}
],
"pagination": {
"previous": null,
"next": null,
"current": 1,
"per_page": 2,
"count": 2,
"pages": 1
},
"count": 1
}
mobile_enabled
GET /api/1/vehicles/{vehicle_tag}/mobile_enabled
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/mobile_enabled'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/mobile_enabled", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/mobile_enabled")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/vehicles/{vehicle_tag}/mobile_enabled", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns whether or not mobile access is enabled for the vehicle.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"reason": "",
"result": true
}
}
nearby_charging_sites
GET /api/1/vehicles/{vehicle_tag}/nearby_charging_sites
scopes: vehicle_device_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/nearby_charging_sites'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/nearby_charging_sites", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/nearby_charging_sites")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/vehicles/{vehicle_tag}/nearby_charging_sites", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns the charging sites near the current location of the vehicle.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
count | query | integer | No | Number of entities to be returned. |
radius | query | integer | No | radius in miles |
detail | query | boolean | No | include site detail |
Click to view successful response
{
"response": {
"congestion_sync_time_utc_secs": 1693588513,
"destination_charging": [
{
"location": {
"lat": 37.409314,
"long": -122.123068
},
"name": "Hilton Garden Inn Palo Alto",
"type": "destination",
"distance_miles": 1.35024,
"amenities": "restrooms,wifi,lodging"
},
{
"location": {
"lat": 37.407771,
"long": -122.120076
},
"name": "Dinah's Garden Hotel & Poolside Restaurant",
"type": "destination",
"distance_miles": 1.534213,
"amenities": "restrooms,restaurant,wifi,cafe,lodging"
}
],
"superchargers": [
{
"location": {
"lat": 37.399071,
"long": -122.111216
},
"name": "Los Altos, CA",
"type": "supercharger",
"distance_miles": 2.202902,
"available_stalls": 12,
"total_stalls": 16,
"site_closed": false,
"amenities": "restrooms,restaurant,wifi,cafe,shopping",
"billing_info": ""
},
{
"location": {
"lat": 37.441734,
"long": -122.170202
},
"name": "Palo Alto, CA - Stanford Shopping Center",
"type": "supercharger",
"distance_miles": 2.339135,
"available_stalls": 11,
"total_stalls": 20,
"site_closed": false,
"amenities": "restrooms,restaurant,wifi,cafe,shopping",
"billing_info": ""
}
],
"timestamp": 1693588576552
}
}
options
GET /api/1/dx/vehicles/options
scopes: vehicle_device_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/vehicles/options?vin={vin}'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/vehicles/options?vin={vin}", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/vehicles/options?vin={vin}")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/dx/vehicles/options?vin=%7Bvin%7D", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns vehicle option details.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vin | query | string | Yes | Vin |
Click to view successful response
{
"response": {
"codes": [
{
"code": "$MT315",
"displayName": "Long Range All-Wheel Drive",
"isActive": true
},
{
"code": "$PPSW",
"colorCode": "PPSW",
"displayName": "Pearl White Multi-Coat",
"isActive": true
},
{
"code": "$W40B",
"displayName": "18’’ Aero Wheels",
"isActive": true
},
{
"code": "$IPB0",
"displayName": "All Black Premium Interior",
"isActive": true
},
{
"code": "$APBS",
"displayName": "Basic Autopilot",
"isActive": true
},
{
"code": "$APF2",
"displayName": "Full Self-Driving Capability",
"isActive": true
},
{
"code": "$SC04",
"displayName": "Supercharger Network Access + Pay-as-you-go",
"isActive": true
}
]
}
}
recent_alerts
GET /api/1/vehicles/{vehicle_tag}/recent_alerts
scopes: vehicle_device_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/recent_alerts'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/recent_alerts", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/recent_alerts")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/vehicles/{vehicle_tag}/recent_alerts", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
List of recent alerts
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"recent_alerts": [
{
"name": "Name_Of_The_Alert",
"time": "2021-03-19T22:01:15.101+00:00",
"audience": [
"service-fix",
"customer"
],
"user_text": "additional description text"
}
]
}
}
release notes
GET /api/1/vehicles/{vehicle_tag}/release_notes
scopes: vehicle_device_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/release_notes'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/release_notes", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/release_notes")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/vehicles/{vehicle_tag}/release_notes", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns firmware release notes.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
staged | query | boolean | No | returns upcoming software update release notes when set to true |
language | query | integer | No | language locale |
Click to view successful response
{
"response": {
"response": {
"release_notes": [
{
"title": "Minor Fixes",
"subtitle": "Some more info",
"description": "This release contains minor fixes and improvements",
"customer_version": "2022.42.0",
"icon": "release_notes_icon",
"image_url": "https://vehicle-files.teslamotors.com/release_notes/d0fa3e08a458696e6464a46c938ffc0a",
"light_image_url": "https://vehicle-files.teslamotors.com/release_notes/9a122cff8916fffcb61cfd65a15c276f"
}
]
}
}
}
service_data
GET /api/1/vehicles/{vehicle_tag}/service_data
scopes: vehicle_device_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/service_data'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/service_data", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/service_data")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/vehicles/{vehicle_tag}/service_data", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Fetches information about the service status of the vehicle.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"service_status": "in_service",
"service_etc": "2023-05-02T17:10:53-10:00",
"service_visit_number": "SV12345678",
"status_id": 8
}
}
share_invites
GET /api/1/vehicles/{vehicle_tag}/invitations
scopes: vehicle_device_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/invitations'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/invitations", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/invitations")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/vehicles/{vehicle_tag}/invitations", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns the active share invites for a vehicle.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | string | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": [
{
"id": 429509621657,
"owner_id": 429511308124,
"share_user_id": null,
"product_id": "TEST00000000VIN01",
"state": "pending",
"code": "aqwl4JHU2q4aTeNROz8W9SpngoFvj-ReuDFIJs6-YOhA",
"expires_at": "2023-06-29T00:42:00.000Z",
"revoked_at": null,
"borrowing_device_id": null,
"key_id": null,
"product_type": "vehicle",
"share_type": "customer",
"share_user_sso_id": null,
"active_pubkeys": [
null
],
"id_s": "429509621657",
"owner_id_s": "429511308124",
"share_user_id_s": "",
"borrowing_key_hash": null,
"vin": "TEST00000000VIN01",
"share_link": "https://www.tesla.com/_rs/1/aqwl4JHU2q4aTeNROz8W9SpngoFvj-ReuDFIJs6-YOhA"
}
],
"pagination": {
"previous": null,
"next": null,
"current": 1,
"per_page": 25,
"count": 1,
"pages": 1
},
"count": 1
}
share_invites create
POST /api/1/vehicles/{vehicle_tag}/invitations
scopes: vehicle_cmds
curl --request POST \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/invitations'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'POST',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/invitations", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/invitations")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/invitations", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
- Each invite link is for single-use and expires after 24 hours.
- An account that uses the invite will gain Tesla app access to the vehicle, which allows it to do the following:
- View the live location of the vehicle.
- Send remote commands.
- Download the user\'s Tesla profile to the vehicle.
- To remove access, use the revoke API.
- If a user does not have the Tesla app installed, they will be directed to this webpage for guidance.
- A user can set up their phone as key with the Tesla app when in proximity of the vehicle.
- The app access provides DRIVER privileges, which do not encompass all OWNER features.
- Up to five drivers can be added at a time .
- This API does not require the car to be online.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | string | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"id": 429509621657,
"owner_id": 429511308124,
"share_user_id": null,
"product_id": "TEST00000000VIN01",
"state": "pending",
"code": "aqwl4JHU2q4aTeNROz8W9SpngoFvj-ReuDFIJs6-YOhA",
"expires_at": "2023-06-29T00:42:00.000Z",
"revoked_at": null,
"borrowing_device_id": null,
"key_id": null,
"product_type": "vehicle",
"share_type": "customer",
"share_user_sso_id": null,
"active_pubkeys": [
null
],
"id_s": "429509621657",
"owner_id_s": "429511308124",
"share_user_id_s": "",
"borrowing_key_hash": null,
"vin": "TEST00000000VIN01",
"share_link": "https://www.tesla.com/_rs/1/aqwl4JHU2q4aTeNROz8W9SpngoFvj-ReuDFIJs6-YOhA"
}
}
share_invites redeem
POST /api/1/invitations/redeem
scopes: vehicle_cmds
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"code": "string"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/invitations/redeem'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"code": "string"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/invitations/redeem", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/invitations/redeem")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"code": "string"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"code": "string"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/invitations/redeem", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Redeems a share invite. Once redeemed, the account will gain access to the vehicle within the Tesla app.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
code | body | string | Yes | invitation code |
Click to view successful response
{
"response": {
"vehicle_id_s": "88850",
"vin": "5YJY000000NEXUS01"
}
}
share_invites revoke
POST /api/1/vehicles/{vehicle_tag}/invitations/{id}/revoke
scopes: vehicle_cmds
curl --request POST \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/invitations/{id}/revoke'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'POST',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/invitations/{id}/revoke", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/invitations/{id}/revoke")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/invitations/{id}/revoke", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Revokes a share invite. This invalidates the share and makes the link invalid.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | string | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
id | path | string | Yes | id of share_invite to revoke |
Click to view successful response
{
"response": true
}
signed_command
POST /api/1/vehicles/{vehicle_tag}/signed_command
scopes: One of - vehicle_cmds, vehicle_charging_cmds, vehicle_device_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
--data '{
"routable_message": "string"
}' \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/signed_command'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const body = JSON.stringify({
"routable_message": "string"
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/signed_command", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/signed_command")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
request.body = JSON.dump({
"routable_message": "string"
})
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"routable_message": "string"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/signed_command", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Signed Commands is a generic endpoint replacing legacy commands. It accepts any of the scopes listed above, depending on the type of command. It uses the Tesla Vehicle Command Protocol to execute commands on a vehicle. Please see the vehicle command SDK - tesla-http-proxy for more information.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
routable_message | body | string | Yes | Base64 encoded Tesla Vehicle Command Protocol message. |
Click to view successful response
{
"response": "base64_response"
}
subscriptions
GET /api/1/subscriptions
scopes: user_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/subscriptions'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/subscriptions", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/subscriptions")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/subscriptions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns the list of vehicles for which this mobile device currently subscribes to push notifications.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
device_token | query | string | No | Either an APNS device token or a GCM registration id |
device_type | query | string | No | One of 'android', 'ios-development', 'ios-enterprise', 'ios-beta', 'ios-production'. |
Click to view successful response
{
"vehicle": {
"ids": [
100021
],
"count": 1
},
"energy_site": {
"ids": [
429500927973
],
"count": 1
}
}
subscriptions set
POST /api/1/subscriptions
scopes: user_data
curl --request POST \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/subscriptions'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'POST',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/subscriptions", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/subscriptions")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/subscriptions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Allows a mobile device to specify which vehicles to receive push notifications from. When calling from a mobile device, it is sufficient to only provide the vehicle IDs to which the mobile device wishes to subscribe to.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
device_token | query | string | No | Either an APNS device token or a GCM registration id |
device_type | query | string | No | One of 'android', 'ios-development', 'ios-enterprise', 'ios-beta', 'ios-production'. |
Click to view successful response
{
"vehicle": {
"ids": [
100021
],
"count": 1
},
"energy_site": {
"ids": [
429500927973
],
"count": 1
}
}
vehicle
GET /api/1/vehicles/{vehicle_tag}
scopes: vehicle_device_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/vehicles/{vehicle_tag}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns information about a vehicle.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"id": 100021,
"vehicle_id": 99999,
"vin": "TEST00000000VIN01",
"color": null,
"access_type": "OWNER",
"display_name": "Owned",
"option_codes": "TEST0,COUS",
"granular_access": {
"hide_private": false
},
"tokens": [
"4f993c5b9e2b937b",
"7a3153b1bbb48a96"
],
"state": null,
"in_service": false,
"id_s": "100021",
"calendar_enabled": true,
"api_version": null,
"backseat_token": null,
"backseat_token_updated_at": null
}
}
vehicle_data
GET /api/1/vehicles/{vehicle_tag}/vehicle_data
scopes: vehicle_device_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/vehicle_data'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/vehicle_data", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/vehicle_data")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/vehicles/{vehicle_tag}/vehicle_data", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Makes a live call to the vehicle. This may return cached data if the vehicle is offline. For vehicles running firmware versions 2023.38+, location_data is required to fetch vehicle location. This will result in a location sharing icon to show on the vehicle UI.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
endpoints | query | string | No | String of URL-encoded, semicolon-separated values. Can be many of 'charge_state', 'climate_state', 'closures_state', 'drive_state', 'gui_settings', 'location_data', 'vehicle_config', 'vehicle_state', 'vehicle_data_combo' |
Click to view successful response
{
"response": {
"id": 100021,
"user_id": 800001,
"vehicle_id": 99999,
"vin": "TEST00000000VIN01",
"color": null,
"access_type": "OWNER",
"granular_access": {
"hide_private": false
},
"tokens": [
"4f993c5b9e2b937b",
"7a3153b1bbb48a96"
],
"state": null,
"in_service": false,
"id_s": "100021",
"calendar_enabled": true,
"api_version": 54,
"backseat_token": null,
"backseat_token_updated_at": null,
"charge_state": {
"battery_heater_on": false,
"battery_level": 42,
"battery_range": 133.99,
"charge_amps": 48,
"charge_current_request": 48,
"charge_current_request_max": 48,
"charge_enable_request": true,
"charge_energy_added": 48.45,
"charge_limit_soc": 90,
"charge_limit_soc_max": 100,
"charge_limit_soc_min": 50,
"charge_limit_soc_std": 90,
"charge_miles_added_ideal": 202,
"charge_miles_added_rated": 202,
"charge_port_cold_weather_mode": false,
"charge_port_color": "<invalid>",
"charge_port_door_open": false,
"charge_port_latch": "Engaged",
"charge_rate": 0,
"charger_actual_current": 0,
"charger_phases": null,
"charger_pilot_current": 48,
"charger_power": 0,
"charger_voltage": 2,
"charging_state": "Disconnected",
"conn_charge_cable": "<invalid>",
"est_battery_range": 143.88,
"fast_charger_brand": "<invalid>",
"fast_charger_present": false,
"fast_charger_type": "<invalid>",
"ideal_battery_range": 133.99,
"managed_charging_active": false,
"managed_charging_start_time": null,
"managed_charging_user_canceled": false,
"max_range_charge_counter": 0,
"minutes_to_full_charge": 0,
"not_enough_power_to_heat": null,
"off_peak_charging_enabled": false,
"off_peak_charging_times": "all_week",
"off_peak_hours_end_time": 360,
"preconditioning_enabled": false,
"preconditioning_times": "all_week",
"scheduled_charging_mode": "Off",
"scheduled_charging_pending": false,
"scheduled_charging_start_time": null,
"scheduled_departure_time": 1634914800,
"scheduled_departure_time_minutes": 480,
"supercharger_session_trip_planner": false,
"time_to_full_charge": 0,
"timestamp": 1692141038420,
"trip_charging": false,
"usable_battery_level": 42,
"user_charge_enable_request": null
},
"climate_state": {
"allow_cabin_overheat_protection": true,
"auto_seat_climate_left": false,
"auto_seat_climate_right": false,
"auto_steering_wheel_heat": false,
"battery_heater": false,
"battery_heater_no_power": null,
"bioweapon_mode": false,
"cabin_overheat_protection": "On",
"cabin_overheat_protection_actively_cooling": true,
"climate_keeper_mode": "off",
"cop_activation_temperature": "High",
"defrost_mode": 0,
"driver_temp_setting": 21,
"fan_status": 0,
"hvac_auto_request": "On",
"inside_temp": 38.4,
"is_auto_conditioning_on": true,
"is_climate_on": false,
"is_front_defroster_on": false,
"is_preconditioning": false,
"is_rear_defroster_on": false,
"left_temp_direction": -293,
"max_avail_temp": 28,
"min_avail_temp": 15,
"outside_temp": 36.5,
"passenger_temp_setting": 21,
"remote_heater_control_enabled": false,
"right_temp_direction": -276,
"seat_heater_left": 0,
"seat_heater_rear_center": 0,
"seat_heater_rear_left": 0,
"seat_heater_rear_right": 0,
"seat_heater_right": 0,
"side_mirror_heaters": false,
"steering_wheel_heat_level": 0,
"steering_wheel_heater": false,
"supports_fan_only_cabin_overheat_protection": true,
"timestamp": 1692141038419,
"wiper_blade_heater": false
},
"drive_state": {
"active_route_latitude": 37.7765494,
"active_route_longitude": -122.4195418,
"active_route_traffic_minutes_delay": 0,
"gps_as_of": 1692137422,
"heading": 289,
"latitude": 37.7765494,
"longitude": -122.4195418,
"native_latitude": 37.7765494,
"native_location_supported": 1,
"native_longitude": -122.4195418,
"native_type": "wgs",
"power": 1,
"shift_state": null,
"speed": null,
"timestamp": 1692141038420
},
"gui_settings": {
"gui_24_hour_time": false,
"gui_charge_rate_units": "mi/hr",
"gui_distance_units": "mi/hr",
"gui_range_display": "Rated",
"gui_temperature_units": "F",
"gui_tirepressure_units": "Psi",
"show_range_units": false,
"timestamp": 1692141038420
},
"vehicle_config": {
"aux_park_lamps": "NaPremium",
"badge_version": 0,
"can_accept_navigation_requests": true,
"can_actuate_trunks": true,
"car_special_type": "base",
"car_type": "modely",
"charge_port_type": "US",
"cop_user_set_temp_supported": true,
"dashcam_clip_save_supported": true,
"default_charge_to_max": false,
"driver_assist": "TeslaAP3",
"ece_restrictions": false,
"efficiency_package": "MY2021",
"eu_vehicle": false,
"exterior_color": "MidnightSilver",
"exterior_trim": "Black",
"exterior_trim_override": "",
"has_air_suspension": false,
"has_ludicrous_mode": false,
"has_seat_cooling": false,
"headlamp_type": "Premium",
"interior_trim_type": "Black2",
"key_version": 2,
"motorized_charge_port": true,
"paint_color_override": "19,20,22,0.8,0.04",
"performance_package": "Base",
"plg": true,
"pws": true,
"rear_drive_unit": "PM216MOSFET",
"rear_seat_heaters": 1,
"rear_seat_type": 0,
"rhd": false,
"roof_color": "RoofColorGlass",
"seat_type": null,
"spoiler_type": "None",
"sun_roof_installed": null,
"supports_qr_pairing": false,
"third_row_seats": "None",
"timestamp": 1692141038420,
"trim_badging": "74d",
"use_range_badging": true,
"utc_offset": -25200,
"webcam_selfie_supported": true,
"webcam_supported": true,
"wheel_type": "Apollo19"
},
"vehicle_state": {
"api_version": 54,
"autopark_state_v3": "ready",
"autopark_style": "dead_man",
"calendar_supported": true,
"car_version": "2023.7.20 7910d26d5c64",
"center_display_state": 0,
"dashcam_clip_save_available": false,
"dashcam_state": "Unavailable",
"df": 0,
"dr": 0,
"fd_window": 0,
"feature_bitmask": "15dffbff,0",
"fp_window": 0,
"ft": 0,
"homelink_device_count": 3,
"homelink_nearby": false,
"is_user_present": false,
"last_autopark_error": "no_error",
"locked": true,
"media_info": {
"a2dp_source_name": "Pixel 6",
"audio_volume": 2.6667,
"audio_volume_increment": 0.333333,
"audio_volume_max": 10.333333,
"media_playback_status": "Playing",
"now_playing_album": "KQED",
"now_playing_artist": "PBS Newshour on KQED FM",
"now_playing_duration": 0,
"now_playing_elapsed": 0,
"now_playing_source": "13",
"now_playing_station": "88.5 FM KQED",
"now_playing_title": "PBS Newshour"
},
"media_state": {
"remote_control_enabled": true
},
"notifications_supported": true,
"odometer": 15720.074889,
"parsed_calendar_supported": true,
"pf": 0,
"pr": 0,
"rd_window": 0,
"remote_start": false,
"remote_start_enabled": true,
"remote_start_supported": true,
"rp_window": 0,
"rt": 0,
"santa_mode": 0,
"sentry_mode": false,
"sentry_mode_available": true,
"service_mode": false,
"service_mode_plus": false,
"smart_summon_available": true,
"software_update": {
"download_perc": 0,
"expected_duration_sec": 2700,
"install_perc": 1,
"status": "",
"version": " "
},
"speed_limit_mode": {
"active": false,
"current_limit_mph": 85,
"max_limit_mph": 120,
"min_limit_mph": 50,
"pin_code_set": false
},
"summon_standby_mode_enabled": false,
"timestamp": 1692141038419,
"tpms_hard_warning_fl": false,
"tpms_hard_warning_fr": false,
"tpms_hard_warning_rl": false,
"tpms_hard_warning_rr": false,
"tpms_last_seen_pressure_time_fl": 1692136878,
"tpms_last_seen_pressure_time_fr": 1692136878,
"tpms_last_seen_pressure_time_rl": 1692136878,
"tpms_last_seen_pressure_time_rr": 1692136878,
"tpms_pressure_fl": 3.1,
"tpms_pressure_fr": 3.1,
"tpms_pressure_rl": 3.15,
"tpms_pressure_rr": 3,
"tpms_rcp_front_value": 2.9,
"tpms_rcp_rear_value": 2.9,
"tpms_soft_warning_fl": false,
"tpms_soft_warning_fr": false,
"tpms_soft_warning_rl": false,
"tpms_soft_warning_rr": false,
"valet_mode": false,
"valet_pin_needed": true,
"vehicle_name": "grADOFIN",
"vehicle_self_test_progress": 0,
"vehicle_self_test_requested": false,
"webcam_available": true
}
}
}
vehicle_subscriptions
GET /api/1/vehicle_subscriptions
scopes: user_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicle_subscriptions'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicle_subscriptions", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicle_subscriptions")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/vehicle_subscriptions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns the list of vehicles for which this mobile device currently subscribes to push notifications.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
device_token | query | string | No | Either an APNS device token or a GCM registration id |
device_type | query | string | No | One of 'android', 'ios-development', 'ios-enterprise', 'ios-beta', 'ios-production'. |
Click to view successful response
{
"response": [
100021
],
"count": 1
}
vehicle_subscriptions set
POST /api/1/vehicle_subscriptions
scopes: user_data
curl --request POST \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicle_subscriptions'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'POST',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicle_subscriptions", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicle_subscriptions")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicle_subscriptions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Allows a mobile device to specify which vehicles to receive push notifications from. It is sufficient to only provide the vehicle IDs to which a mobile device wishes to subscribe to.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
device_token | query | string | No | Either an APNS device token or a GCM registration id |
device_type | query | string | No | One of 'android', 'ios-development', 'ios-enterprise', 'ios-beta', 'ios-production'. |
Click to view successful response
{
"response": [],
"count": 0
}
wake_up
POST /api/1/vehicles/{vehicle_tag}/wake_up
scopes: vehicle_device_data
curl --request POST \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/wake_up'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'POST',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/wake_up", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/vehicles/{vehicle_tag}/wake_up")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("POST", "/api/1/vehicles/{vehicle_tag}/wake_up", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Wakes the vehicle from sleep, which is a state to minimize idle energy consumption.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vehicle_tag | path | integer | Yes | VIN or id field of a vehicle from /api/1/vehicles endpoint. |
Click to view successful response
{
"response": {
"id": 100021,
"user_id": 800001,
"vehicle_id": 99999,
"vin": "TEST00000000VIN01",
"color": null,
"access_type": "OWNER",
"granular_access": {
"hide_private": false
},
"tokens": [
"4f993c5b9e2b937b",
"7a3153b1bbb48a96"
],
"state": null,
"in_service": false,
"id_s": "100021",
"calendar_enabled": true,
"api_version": null,
"backseat_token": null,
"backseat_token_updated_at": null
}
}
warranty_details
GET /api/1/dx/warranty/details
scopes: vehicle_device_data
curl --header 'Content-Type: application/json' \
--header "Authorization: Bearer $TESLA_API_TOKEN" \
'https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/warranty/details'
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${process.env.TESLA_API_TOKEN}`);
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/warranty/details", requestOptions)
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.log('error', error));
require "uri"
require "json"
require "net/http"
url = URI("https://fleet-api.prd.na.vn.cloud.tesla.com/api/1/dx/warranty/details")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer ENV_TESLA_API_TOKEN"
response = https.request(request)
puts response.read_body
import os
import http.client
import json
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ENV_TESLA_API_TOKEN'
}
conn.request("GET", "/api/1/dx/warranty/details", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Returns the warranty information for a vehicle.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
vin | query | string | No | Vehicle Identification Number (VIN) of the selected vehicle. |
Click to view successful response
{
"response": {
"activeWarranty": [
{
"warrantyType": "NEW_MFG_WARRANTY",
"warrantyDisplayName": "Basic Vehicle Limited Warranty",
"expirationDate": "2025-10-21T00:00:00Z",
"expirationOdometer": 50000,
"odometerUnit": "MI",
"warrantyExpiredOn": null,
"coverageAgeInYears": 4
},
{
"warrantyType": "BATTERY_WARRANTY",
"warrantyDisplayName": "Battery Limited Warranty",
"expirationDate": "2029-10-21T00:00:00Z",
"expirationOdometer": 120000,
"odometerUnit": "MI",
"warrantyExpiredOn": null,
"coverageAgeInYears": 8
},
{
"warrantyType": "DRIVEUNIT_WARRANTY",
"warrantyDisplayName": "Drive Unit Limited Warranty",
"expirationDate": "2029-10-21T00:00:00Z",
"expirationOdometer": 120000,
"odometerUnit": "MI",
"warrantyExpiredOn": null,
"coverageAgeInYears": 8
}
],
"upcomingWarranty": [],
"expiredWarranty": []
}
}
FAQ
Why do some calls return a 429?
This means the account has reached the request rate limit for the endpoint. Check the 'Retry-After' request header (in seconds) to determine when to make the next request. See more information on response codes.
Why do some calls to vehicles return a 408?
This tends to mean the device is offline. Does the device have internet connectivity? If so, is it asleep (saving energy) in which case might need to wake it up ?
What does it mean when I get an Unauthorized missing scopes
403 error?
The token that is being provided does not have the required scopes for the current resource. Look at the scopes requirements for the endpoint and ensure the token has those scopes. If the token is not created with the required scopes, it means the owner needs to explicity grant the required scope(s) as part of the authorization flow.
Why are my API requests for new users returning unknown user
?
Before requests can be made on behalf of an account, the owner of the account must have logged into the mobile app at least once.
Why are authorization requests are failing?
Please re-read the authentication section and follow the examples exactly as they are written.
My auth requests are returning "We don't recognize this client_id and client_secret combination".
Ensure you are following the examples given in the authentication section.
Why does my request not have a refresh_token
in it?
Per the Authorization Scopes section, the offline_access
scope must be requested to get a refresh token.
Why are my refresh tokens suddenly invalid?
Refresh tokens are one-time-use and are valid for 3 months. When you perform a token exchange using a refresh token, ensure you save the new refresh token for use on the next exchange.
Fleet Telemetry
For high data fidelity use cases, as well as general efficiency (no additional battery usage or wake-ups required), vehicles can stream telemetry directly to a configured server. See account tier information at https://developer.tesla.com. Setup steps are available in the fleet-telemetry Github repository.
Announcements & API Changelog
2024-03-26: Shutting down Legacy vehicle API endpoints
Fleet API is Tesla's official 3rd party API and the only supported API for vehicle interactions. The list of available endpoints can be found at Endpoints and Regional Requirements. Starting April 2024, any vehicle APIs not part of this list will be phased out. Per the Fleet API policies, continued usage of unsupported APIs will result in the revocation of Fleet API access privileges.
2024-02-02: Public key must remain available for pairing continuity
With the release of Tesla mobile app 4.30.0, vehicle pairing will require the application public key to remain hosted at the /.well-known/
path on the domain used for application registration. This is a security improvement that includes partner domains in the chain of trust for vehicle interactions. See the check_csr script for an example testing the presence of the registerd public key on the application domain.
2024-02-01: Auth Access token policy change
As part of a security improvement, the acquisition of a new Refresh token will now render the user’s previous Refresh token and its associated Access tokens invalid.
2024-01-02: Adding support for registering vehicles for fleet telemetry
Registering vehicles for fleet-telemetry is now live. See here for more information.
2023-11-17: Vehicle commands endpoint deprecation timeline [Action Required]
Calls directly to the /command endpoint without the use of the Tesla Vehicle Commands protocol SDK will be deprecated. For command continuity, please migrate to the Tesla Vehicle Commands protocol as soon as possible:
Dates | Change |
---|---|
November 2023 | Newly delivered vehicles* will only support the Tesla Vehicle Command protocol after this date |
Nov - Dec 2023 | REST API support will be deprecated on existing customer vehicles that have not used the REST API in the preceding 30 days |
January 2024 | All vehicles* will require Tesla Vehicle Command protocol. The REST API will be fully deprecated |
*Fleet accounts are excluded from these changes until further notice. Pre-2021 Model S/X are excluded from these changes.
When calling the /command endpoint for a vehicle that requires the Tesla Vehicle Command protocol, Fleet API will return the following error: "Tesla Vehicle Command Protocol required, please refer to the documentation here: https://developer.tesla.com/docs/fleet-api#2023-10-09-rest-api-vehicle-commands-endpoint-deprecation-warning (403)"
2023-10-24: Vehicle data update on firmware versions 2023.38+
Vehicles running firmware versions 2023.38+ will not return location information by default in vehicle data. Developers who need that information will need to add "location_data" parameter to the query, see here. This will result in a location sharing icon to show on the vehicle UI.
Important: Fetching vehicle data periodically is not recommended, check out Fleet Telemetry for streaming needs.
2023-10-09: Rest API vehicle commands endpoint - deprecation warning
Following the release of Tesla Vehicle Command SDK support for REST API vehicle command endpoints is now reaching end of life. Starting 2024 most vehicles will require sending commands via Tesla Vehicle Command SDK.
The use of Tesla http proxy is recommended for ease of development and to accelerate the transition to Tesla Vehicle Command (via SDK). When applicable, the proxy will transform Rest API HTTP commands into the Tesla Vehicle Command Protocol. Once configured, developers can simply point their application to the proxy without making any code changes to their application.
2023-10-09: Tesla Vehicle Command SDK
Tesla Vehicle Command SDK provides end-to-end authentication for sending commands to vehicles. This is the recommended way of sending commands to vehicles.
Security experts are encouraged to dive more into the protocol and give feedback on Github. To report a security issue, follow the directions on https://www.tesla.com/legal/security.
Help and Support
Email fleetapisupport@tesla.com for developer support. Please include the application client_id, a description of the use case, any example logs or curl statements, and the server response including the x-txid header.
Please make sure NOT to share any API token, OAuthToken, or any credentials via email. Tesla does not need passwords or tokens to help diagnose problems.
The most common issues have been listed in the FAQ section. Please read through these before reaching out.