Using the Tesla Fleet API and Telemetry Streaming (only for business fleet users)
Official Tesla APIs
Why Tesla Fleet and Telemetry only have drawbacks
As far as we know, using the Tesla Fleet API and Telemetry API as a user has only drawbacks. The only reason to use them is if you are a Tesla Business Fleet user and therefore the Owner API is no longer available for you.
When Tesla Fleet API and Telemetry API are needed
By default, TeslaMate uses the "unofficial" Owner API and streaming.
Tesla now provides official APIs: the Fleet API and the Telemetry API, which replace the Owner API and streaming respectively. But come with limitations and drawbacks.
Migration to the new API depends on your Tesla account type:
-
Tesla Business Fleet users: the Owner API is being shut down. Fleet vehicles are upgraded gradually and an error message means that they must now use the official API.
-
Individual users: the Owner API is currently still accessible.
Resume: if you are a Tesla Business Fleet user, you should migrate to the official API ASAP! The official Tesla API will only become mandatory when the Owner API shuts down for all users. Until then you can and should continue to use the Owner API, as it is more feature-rich and has higher resolution streaming.
Impacts/Limitations of New Endpoints
Tesla Fleet API: very limited recording resolution
The Fleet API is similar to the Owner API but more comprehensive. However, retrieving vehicle information (vehicle_data
) or sending commands is limited. The limits on the Owner API were historically much higher. It is likely that these limits will also be applied soon to the API Owner.
Tesla Fleet Telemetry: non compatible by default
The Tesla Fleet Telemetry differs from the "Owner" streaming. By default, metrics are sent to message queues instead of a websocket as streaming did. Historical streaming could send events every second, whereas Fleet Telemetry will only send information every minute at the minimum.
How to Use Tesla APIs
The setup to use the official Tesla APIs (described below) is complex. You can use a third-party providers to easily access these APIs.
Guide for Third-Party Providers
Environment variables allow changing the API and streaming endpoints.
You must use the URL
and the TOKEN
given by the third party API provider.
MyTeslaMate (free)
MyTeslaMate Fleet API
- Log in the MyTeslaMate website with your Tesla account and go to the MyTeslaMate Fleet page to get your
TOKEN
. - Add the following environment variables (using your
TOKEN
instead ofxxxx-xxxx-xxxx-xxxx
):
# API Fleet
- TOKEN=?token=xxxx-xxxx-xxxx-xxxx
- TESLA_API_HOST=https://api.myteslamate.com
- TESLA_AUTH_HOST=https://api.myteslamate.com
- TESLA_AUTH_PATH=/api/oauth2/v3
MyTeslaMate Streaming
MyTeslaMate also provides streaming by reproducing the old streaming from the data sent by Fleet Telemetry.
-
You need to "Pair your vehicle(s)" on the fleet page
-
Use the following dedicated environment variables:
- TESLA_WSS_HOST=wss://streaming.myteslamate.com
- TESLA_WSS_TLS_ACCEPT_INVALID_CERTS=true
- TESLA_WSS_USE_VIN=true -
Restart your instance
Teslemetry (paid)
Teslemetry Fleet API
-
Log in the Teslemetry website and create your
TOKEN
. -
Use this
TOKEN
instead ofxxxx-xxxx-xxxx-xxxx
and add the following environment variables:- TOKEN=?token=xxxx-xxxx-xxxx-xxxx
- TESLA_API_HOST=https://api.teslemetry.com
- TESLA_AUTH_HOST=https://api.teslemetry.com
- TESLA_AUTH_PATH=/api/oauth2/v3 -
Restart your instance
Teslemetry Streaming
Important: no streaming provided by Teslemetry, you MUST disable manually the streaming in Teslamate settings.
Guide to using the official Tesla API directly (free)
Requirements
- Advanced IT skills
- A dedicated public hosting
- A free Tesla Fleet API plan
Tesla Fleet API
-
Set up a third-party account at developer.tesla.com as described on the Tesla docs
-
Add the following environment variable with your own domain :
- Use the correct region in the
TESLA_API_HOST
field:- 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
- Update the
TESLA_AUTH_CLIENT_ID
with the client ID of your Tesla application.
# API Fleet
- TESLA_API_HOST=https://fleet-api.prd.eu.vn.cloud.tesla.com
- TESLA_AUTH_HOST=https://auth.tesla.com
- TESLA_AUTH_PATH=/oauth2/v3
- TESLA_AUTH_CLIENT_ID=xxxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx - Use the correct region in the
-
(Optional) If you want to send commands or use Tesla Telemetry:
- Send drivers a "Pairing request" to be able to use your own Tesla Vehicle Command Protocol http proxy to send commands
- Send test commands or setup Telemetry to stream it to your Teslamate
Switching from Owners API to Fleet API
- Sign out from the current Owners API by visiting the teslamate settings page
- Follow step 1&2 from Tesla Fleet API
- Restart your docker instance to make the change in effect
- With proper setup, your teslamate instance will sign in automatically with your client ID after restart
Streaming via Tesla Telemetry
Important: if you don't setup your own streaming, you MUST disable manually the streaming in Teslamate settings.
To setup your own streaming server, you can follow these steps:
-
Setup a Tesla Fleet Telemetry instance on a public domain (eg: telemetry.mydomain.com)
-
Add a Google pubsub dispatcher to your own GCP PubSub.
-
Setup a MyTeslaMate Streaming Server from Fleet Telemetry Events on a public domain (eg: streaming.mydomain.com)
-
Manually create a subscription to the
telemetry_V
created in PubSub by the Tesla Telemetry with:- Delivery type: Push
- Endpoint URL: https://streaming.mydomain.com
-
Update your environment variables:
- TESLA_WSS_HOST=wss://streaming.mydomain.com
- TESLA_WSS_TLS_ACCEPT_INVALID_CERTS=true
- TESLA_WSS_USE_VIN=true -
Restart your instance