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.
Using an AI Agent? Give it llms.txt and it will know how to use the API.
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 '@teslemetry/api';
const teslemetry = new Teslemetry("access_token_here");
teslemetry.products().then((products) => { console.log(products); });
const vehicle = teslemetry.getVehicle("your_vin_here");
vehicle.api.state().then(x => console.log(x));
The SDK also includes a vehicle.sse client for streaming Fleet Telemetry data - see the README for details.
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 performs up to 11 status checks, 3 seconds apart, waiting for the vehicle to come online - about 36 seconds in total including a final 3 second buffer once it does.
- If the vehicle does not come online after all checks, 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 for up to 6 total attempts (5 retries), subject to a mutation retry budget that can stop retrying earlier for a locked vehicle:
| 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
In addition to any limits Tesla's Fleet API imposes upstream, Teslemetry applies its own application-side rate limits to try and prevent abuse. These are keyed per account (not per IP), except for time-of-use updates which are keyed per energy site:
| Group | Limit | Key |
|---|---|---|
| Energy site requests | 55 per minute | Account |
| Vehicle commands | 28 per 30 seconds | Account |
| Vehicle wake-ups | 3 per 30 seconds | Account |
| Time-of-use setting updates | 10 per 45 minutes | Energy site |
Exceeding a limit returns HTTP 429 with a retry-after value.