Tesla Fleet API and Fleet Telemetry explained for developers

· 10 min read

A red, a white and a blue Tesla Model Y parked on open tarmac with hazy mountains behind
Courtesy of Tesla, Inc.

Building on Tesla's platform means two things: the Fleet API, a regional REST API for account data, vehicle data and commands, and Fleet Telemetry, where the car itself streams fields to a server you run. Getting to your first streamed Odometer reading takes about a dozen steps; most of the pain is in partner registration, virtual keys and the mutual-TLS telemetry server.

We built KiloTrip on exactly this stack, so this is the path as we walked it, checked against Tesla's developer documentation and the fleet-telemetry README in November 2026. Tesla changes these docs often; treat the linked pages as the source of truth.

1. Developer account and application

Create a Tesla account at developer.tesla.com with a verified email and multi-factor authentication turned on, then request an application from the dashboard. You give business details, an app name and description, your purpose, the scopes you want, your allowed origin (your domain) and your OAuth redirect URI. You get back a client_id and client_secret.

Pick scopes carefully. A read-only logging app needs openid, offline_access and vehicle_device_data; add vehicle_cmds or vehicle_charging_cmds only if you will actually send commands. Users see every scope on the consent screen.

2. Generate a key pair and host the public key

Your application identifies itself to vehicles with an EC key on the prime256v1 (secp256r1) curve:

openssl ecparam -name prime256v1 -genkey -noout -out private-key.pem
openssl ec -in private-key.pem -pubout -out public-key.pem

The public key must be served, and stay served, at:

https://<your-domain>/.well-known/appspecific/com.tesla.3p.public-key.pem

The domain has to match the allowed origin you registered. The private key never goes near a web server; it signs commands and telemetry configuration later on, so treat it like any other production secret.

3. Partner registration, once per region

Before any user can connect, your application registers itself. First get a partner token with the client-credentials grant against the Fleet API auth host:

curl -X POST https://fleet-auth.prd.vn.cloud.tesla.com/oauth2/v3/token \
  -d grant_type=client_credentials \
  -d client_id=$CLIENT_ID -d client_secret=$CLIENT_SECRET \
  -d "scope=openid vehicle_device_data" \
  -d audience=https://fleet-api.prd.na.vn.cloud.tesla.com

Then call POST /api/1/partner_accounts with your domain, using that token. Tesla checks the domain against your allowed origin and fetches the public key from the .well-known path. You can confirm it worked with GET /api/1/partner_accounts/public_key?domain=<your-domain>.

The step people miss: registration is per region. The regional base URLs are:

Region Fleet API base URL
North America, Asia-Pacific (excl. 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 (separate developer site)

Australian cars live in the NA/APAC region, which surprises people. Register in every region you expect users from. If you call a region where you aren't registered you get 412 Precondition Failed, and the documented fix is to call the register endpoint first. Handling 412 by registering and retrying once is a cheap safety net. A 421 means the user isn't in the region you called; GET /api/1/users/region returns the right base URL for a user's token.

4. OAuth for your users

User authorisation is a standard authorization-code flow (Tesla's third-party token docs):

  1. Send the user to https://auth.tesla.com/oauth2/v3/authorize with response_type=code, your client_id, redirect_uri, scope and a state value.
  2. Tesla redirects back to you with a code.
  3. Exchange it with grant_type=authorization_code at https://fleet-auth.prd.vn.cloud.tesla.com/oauth2/v3/token, passing your client_secret, the redirect_uri and an audience set to a Fleet API base URL.

Two hosts trip people up. Authorisation happens on auth.tesla.com, but token calls must go to fleet-auth.prd.vn.cloud.tesla.com; older Owner API examples that post tokens to auth.tesla.com don't work for Fleet API apps.

Refresh tokens are the other trap. Request offline_access to get one. Each refresh token is single use and expires after three months; every refresh returns a new one that you must store before you use the access token. Tesla keeps the most recently used refresh token valid for up to 24 hours as a grace period, but if you lose a rotated token outside that window, the user has to sign in again. Store the new token before anything else, let only one worker refresh a given user at a time, and encrypt tokens at rest.

5. Virtual key pairing

OAuth lets you talk to Tesla's servers. A virtual key lets you talk to the car. The user installs your public key on the vehicle by opening:

https://www.tesla.com/_ak/<your-domain>

on a phone with the Tesla app installed (a QR code works well on desktop). The app shows your application's name and asks the user to approve adding the key. Tesla's virtual key overview describes this as a second layer of security on top of OAuth: even with a key installed, you only get the functions the user granted in scopes.

Without a key, telemetry configuration is skipped with a missing_key reason. Make key pairing an explicit, checked onboarding step.

6. Signed commands and the Vehicle Command Proxy

Modern Tesla vehicles authenticate commands end to end: Tesla's servers forward a request only with a valid OAuth token, and the car executes it only if it is signed by a key in its keychain. Plain REST calls without that signature are rejected by vehicles that enforce the Vehicle Command Protocol. Pre-2021 Model S and X are the exception and still take the older unsigned commands.

Rather than implement the protocol yourself, run Tesla's open-source tesla-http-proxy. Launch it with your private key; your backend calls it with the usual REST paths and the user's OAuth token, and it signs, handles sessions and retries, and forwards to the Fleet API:

tesla-http-proxy -tls-key tls-key.pem -cert tls-cert.pem \
  -key-file private-key.pem -port 4443

It only speaks TLS. Give it a certificate whose subject alternative name matches the hostname your backend calls; if the cert only carries a DNS name, calling the proxy by bare IP fails verification.

This matters for telemetry too. The fleet_telemetry_config endpoint "should be called through the Vehicle Command Proxy", which signs the configuration with your key. Fleet Telemetry itself needs firmware 2023.20.6 or later; Tesla's endpoint docs list stricter minimums for configuration sent through the proxy (2024.26) and for Intel Atom Model S/X (2025.20), and pre-2018 S/X are unsupported. Check those pages before promising support for older cars.

7. The telemetry server

Fleet Telemetry inverts the usual model: the car opens a WebSocket to your server and pushes data. Tesla publishes the reference server on GitHub (also as a Docker image). Requirements worth knowing up front:

  • It must be reachable on the public internet.
  • Vehicles authenticate with TLS client certificates, so mutual TLS must terminate on the fleet-telemetry process itself, not on a load balancer in front of it.
  • The ca you send in the vehicle config is the full certificate chain behind your server's TLS certificate, and the hostname must match it. The repo's check_server_cert.sh validates this before you touch a car.
  • Records go out through dispatchers: Kafka (preferred), Kinesis, Google Pub/Sub, ZMQ, MQTT, Redis, or a stdout logger. Messages are protobuf by default; set transmit_decoded_records to get JSON.
  • Enable connectivity records. They tell you when a car connects and disconnects, which the README says matches real vehicle online state in over 99% of cases. That is a far better "is the car awake?" signal than polling.

Monitor your certificate expiry. If the server's certificate lapses, cars quietly stop connecting and nothing upstream errors; you just get silence.

8. Configuring a vehicle

With the key paired and the server up, you send a configuration through the proxy to POST /api/1/vehicles/fleet_telemetry_config. The body names the VINs and a config holding your server's hostname, port, CA chain, an expiry, and the fields you want with an interval_seconds each. A minimal shape looks like this:

{
  "vins": ["<VIN>"],
  "config": {
    "hostname": "telemetry.example.com",
    "port": 443,
    "ca": "-----BEGIN CERTIFICATE-----\n...",
    "exp": 1798761600,
    "fields": {
      "Gear":         { "interval_seconds": 1 },
      "VehicleSpeed": { "interval_seconds": 10 },
      "Odometer":     { "interval_seconds": 60 },
      "Location":     { "interval_seconds": 10 }
    }
  }
}

Fields are sent on change, never more often than their interval, so a parked car sends almost nothing. Recent firmware also accepts a per-field minimum_delta so tiny wobbles don't count as changes.

Then read the config back and wait for synced: true; until then the car adopts it the next time it connects. The create response lists skipped_vehicles with reasons such as missing_key, unsupported_firmware, unsupported_hardware or max_configs (each car accepts only a few third-party configs). fleet_telemetry_errors tells you about failures on the car's side.

9. What a payload looks like

Each record is a Payload protobuf from vehicle_data.proto: a VIN, a created_at timestamp, an is_resend flag, and a list of key/value pairs. Decoded to JSON, a driving sample looks roughly like:

{
  "vin": "<VIN>",
  "createdAt": "2026-11-08T01:23:45Z",
  "data": [
    { "key": "Gear", "value": { "shiftStateValue": "ShiftStateD" } },
    { "key": "VehicleSpeed", "value": { "doubleValue": 37.3 } },
    { "key": "Odometer", "value": { "doubleValue": 10245.6 } },
    { "key": "Location", "value": { "locationValue": { "latitude": -33.86, "longitude": 151.21 } } }
  ]
}

Things that catch people:

  • Field names differ from vehicle_data. It's Gear, not shift_state; VehicleSpeed, not speed. The available data page maps each telemetry field to its old equivalent.
  • Gear is an enum: ShiftStateP, ShiftStateR, ShiftStateN, ShiftStateD, plus ShiftStateInvalid, ShiftStateSNA and ShiftStateUnknown. Handle the last three explicitly rather than assuming every value is a real gear.
  • Units are imperial, always. Odometer is miles and VehicleSpeed is mph, even for a car sold in Australia with its display set to kilometres. Multiply by 1.60934. We wrote up why the odometer is in miles under the hood and how to round it.
  • Values can be invalid: true when the car can't measure a signal. Don't treat that as zero.
  • Records can arrive late or resent. Use created_at, not arrival time, and be idempotent on is_resend.
  • Not every record has every field. Because fields only send on change, keep the last known value per VIN and merge.

If you are deriving trips, a state machine keyed on Gear (P to D starts, back to P ends) with Odometer deltas for distance is far more reliable than integrating speed. Keep that state machine to a single owner per VIN, or two workers will each decide a trip ended.

10. Pricing: pay per use, and streaming is the cheap path

The Fleet API is billed monthly on usage. As listed on developer.tesla.com in November 2026:

Category Price
Streaming signals 150,000 signals per $1
Commands 1,000 requests per $1
Data requests 500 requests per $1
Wakes 50 requests per $1

Every account gets a $10 monthly discount, which Tesla says covers streaming, about 100 commands and 2 wakes a day for two vehicles. Authentication calls aren't billed.

The gap between streaming and polling is the whole design argument. Our rough arithmetic: four fields during an hour of driving a day, each changing every 10 seconds, is at most 1,440 signals a day, or about 43,000 a month, which is roughly $0.29. Polling vehicle_data once a minute over the same hour is 1,800 requests a month, about $3.60, before any wakes, and a car that is kept awake by polling also burns battery. Tesla's own billing case studies report cost drops of 94% to 97% moving from polling to telemetry, and the endpoint docs say plainly that regularly polling vehicle_data "is not recommended and will be expensive".

Where to go next

Build in the order above, and get one real car streaming end to end before writing product code. To see what an app built this way looks like from the driver's side, how it works shows the logbook KiloTrip produces with nothing to open and no background polling, and the FAQ covers privacy and data handling.

Frequently asked questions

Do I need my own server to use Fleet Telemetry?

Yes. Vehicles stream directly to a server you run on the public internet, which terminates mutual TLS. Tesla publishes an open-source reference server, fleet-telemetry, that forwards records to Kafka, Kinesis, Google Pub/Sub, MQTT, Redis and others.

Why does my Fleet Telemetry config never reach the car?

The usual causes are a missing virtual key, unsupported firmware or hardware, or a server hostname and CA that don't match your TLS certificate. Check the skipped_vehicles reasons in the create response and wait for synced to be true before expecting data.

What units does Fleet Telemetry use?

Imperial, regardless of the car's region or display settings. Odometer is in miles and VehicleSpeed is in miles per hour, so multiply by 1.60934 for kilometres and km/h.

Is Fleet Telemetry cheaper than polling vehicle_data?

Usually by a wide margin. Tesla bills streamed signals far more cheaply than data requests, and signals are only sent when a value changes, while polling also risks keeping the car awake.