API
Teslemetry will proxy documented Tesla Fleet API requests with a valid access token and subscription to the correct Fleet API regional server for your account. Documentation on all the available API endpoints can be found at api.teslemetry.com/docs.
Sending API Requests
API requests use the same URI path as the Tesla Fleet API, with the Teslemetry API domain. Requests are load balanced to your nearest Teslemetry API server.
curl --header "Authorization: Bearer {token}" 'https://api.teslemetry.com/api/1/vehicles/{vin}'
https://api.teslemetry.com/api/1/vehicles/{vin}?token={token}
import asyncio, aiohttp, tesla_fleet_api
async def main():
async with aiohttp.ClientSession() as session:
api = tesla_fleet_api.Teslemetry(access_token="access_token_here",session=session)
try:
print(await api.vehicle.vehicle_data("your_vin_here"))
except tesla_fleet_api.exceptions.TeslaFleetError as e:
print(e)
asyncio.run(main())
import { Teslemetry } from 'tesla-fleet-api';
const teslemetry = new Teslemetry("access_token_here");
teslemetry.products().then((products) => { console.log(products); });
teslemetry.vehicle.options("your_vin_here").then(x => console.log(x))
Handling Sleep
A Tesla vehicle can be online, offline, or asleep. Since your vehicle must be online to execute a command, Teslemetry automatically wakes your vehicle and ensures its online before executing a command.
Wake-Up Process
- Your vehicle's state is checked via the Tesla Fleet API.
- If already online, the command proceeds immediately (1 credit).
- If asleep, Teslemetry sends a wake-up request (20 credits) and polls every 3 seconds up to 10 times (~30 seconds).
- After the vehicle comes online, a 3 second buffer ensures the vehicle is fully ready before executing the command (1 credit).
- If the vehicle does not come online after all attempts, the command returns HTTP 408.
If you send multiple commands, the wake-up is performed once and subsequent commands are queued.
Command Retries
Teslemetry automatically retries failed commands at multiple layers for up to 90 seconds. You do not need to implement retry logic in your application.
Proxied Commands
Commands proxied to Tesla's Fleet API are retried up to 6 times:
| Upstream Response | Retry Delay | Reason |
|---|---|---|
| 424 (Failed Dependency) | Exponential backoff | Vehicle subsystem not ready |
| 429 (Rate Limited) | retry-after header | Tesla API rate limiting |
| 5xx (Server Error) | Exponential backoff | Tesla server-side error |
| All others | No retry | Treated as final response |
Signed Commands
Commands using end-to-end signing are retried up to 5 total attempts:
- Session recovery (immediate retry): Stale cryptographic session errors are resolved automatically by refreshing the session.
- Vehicle busy/not ready (linear backoff: 1s, 2s, 3s, 4s): The vehicle acknowledged the command but needs more time.
- Vehicle went offline (linear backoff: 1s, 2s, 3s, 4s): The vehicle fell back asleep during command execution.
- Unrecoverable errors (no retry): Key not recognized, user not authorized, mobile access disabled, and other permanent failures return immediately.
Virtual Key & Command Signing
All vehicles that support the virtual key are required to have it installed to enable Teslemetry to use your vehicle.
You can install the Teslemetry virtual key by clicking the following link using a mobile phone with the Tesla app installed:
https://tesla.com/_ak/teslemetry.com
You can read more about the Virtual Key and Command Signing topics.
If you want another Tesla account to install the virtual key, you can use teslemetry.com/key
Custom endpoints
Teslemetry also has its own API endpoints which can help you interact with the service itself, and provides additional functionality on top of the Fleet API.
The API is constantly improving, so please refer to the API documentation for the most up-to-date information.
Rate limiting
Teslemetry has a master rate limit of 60 requests per minute per IP address to try and prevent abuse. On top of this, requests to energy sites are limited to 30 requests per minute per energy site, regardless of the endpoint, user, or IP address.