# Teslemetry API > Teslemetry's improved Tesla Fleet API, and real-time Fleet Telemetry stream. Auto-generated from the API route schemas. Each link below documents the endpoints for one area, including their parameters. For the full machine-readable specification see [/openapi.json](/openapi.json) and [/openapi.yaml](/openapi.yaml); interactive docs are at [/docs](/docs). ## Getting started - **Base URL:** `https://api.teslemetry.com` — a global load balancer that routes each request to your account's region. You do not need to choose a region. - **Auth:** send your token as a Bearer token in the `Authorization` header, or as a `token` query parameter. - **Success responses** are wrapped: `{ "response": }`. - **Response shapes:** each endpoint below lists a truncated, generated example under `Returns`; full per-field response schemas are intentionally omitted here to keep these documents small — see [/openapi.json](/openapi.json) for exact response shapes. - **Credits:** vehicle commands and fresh data reads consume credits. `GET .../telemetry` is always free (cache/stream-only, never calls Tesla). `GET .../vehicle_data` with `use_cache=true` (the default) is free only when a classic cache entry exists and is under 20 minutes old, or the vehicle is not online; once that entry is missing or stale and the vehicle is online, the same call performs an on-demand refresh and charges (normally 2 credits, 0.1 for a Tesla-marked discounted device). - **First call:** `GET /api/metadata` — it returns your VIN(s), granted scopes, and each vehicle's Fleet Telemetry sync state and firmware in one request, so it's the fastest way to see what you have access to before calling anything else. ## How Teslemetry works - **Auth:** every request needs a token (Bearer header or `token` query param, see Getting started above). Vehicle/energy endpoints additionally need the account to have granted the relevant Tesla OAuth scope (data-access scopes for reads, command scopes for actuation) — a missing scope returns `403` (see Troubleshooting). - **Streamed fields are opt-in per vehicle — the #1 source of "missing data".** A field only appears once it's been added to the vehicle's fleet telemetry field configuration **and** the vehicle has connected and reported it since; an unconfigured field is silently absent, no error. Configure with `POST /api/config/:vin` (`fields`; see [/fields.json](/fields.json)) or the Teslemetry console (https://teslemetry.com/console), then confirm with `GET /:vin/fleet_telemetry_config` — `synced: true` means applied, `synced: false` means it applies on the vehicle's next connection. This is a data-configuration call, not a vehicle command: it needs the `vehicle_device_data` OAuth scope, not a command scope (see Troubleshooting). - **`GET /sse/:id?` is the one consumption path for vehicle data, for every vehicle.** It's a long-lived, free `text/event-stream` connection pushing `state`/`data`/`alerts`/`errors`/`connectivity`/`credits`/`vehicle_data`/`config` events in real time; omit `:id` to stream every vehicle at once. It opens with a cache snapshot (unless `?cache=false`) then tails live updates, so a dropped connection just reconnects — no cursor to track. This holds regardless of whether a vehicle streams via Fleet Telemetry or is too old to support it: for a non-streaming vehicle, Teslemetry itself polls `vehicle_data` from Tesla on a managed interval and broadcasts every result to all `/sse` subscribers for that vehicle — a client never calls Tesla's `vehicle_data` on its own behalf. In no circumstance should a client poll `GET /api/1/vehicles/:vin/vehicle_data` as its way of getting vehicle data; it's a credit-costing Fleet API call once its classic cache entry is missing or at least 20 minutes old and the vehicle is online, unlike the free SSE stream — it never sends a wake command, so it only refreshes an already-online vehicle. Use the one-shot `GET /:vin/telemetry` (and long-poll sibling `GET /:vin/telemetry/wait`) for a spot check, not as a primary consumption path. - **The `vehicle_data` SSE event carries the full classic `vehicle_data` shape** (`charge_state`, `climate_state`, etc. — see the streaming/vehicle_data bridge section below), not the raw per-field telemetry vocabulary the `data` event uses. On connect it always fires once as part of the opening cache-snapshot replay (`isCache: true`), for every vehicle. Whether it recurs live afterwards depends on `GET /api/metadata`'s `vehicles..polling`: for a streaming vehicle (`polling: false`) it does not recur — live updates arrive as `data` events instead; for a polled vehicle (`polling: true`) a fresh `vehicle_data` event is broadcast every time Teslemetry's own poll cycle completes. - **`GET /api/metadata`'s `vehicles..polling` tells you what kind of data to expect, not how to consume it.** `true` means the vehicle has no Fleet Telemetry connection and is served by Teslemetry's own periodic `vehicle_data` polling instead of a live stream — so its `/sse` updates land less frequently and carry whatever `vehicle_data` reports, not the richer per-field telemetry set. The same response's `issue` field (`"no_data"`, `"streaming_toggle"`, `"key"`, `"scope"`, or `null`) explains a broken, as opposed to absent, telemetry connection. - **One-off spot check, not a client-application pattern:** `GET /api/1/vehicles/:vin/vehicle_data?use_cache=true` is free only while the classic cache entry is under 20 minutes old or the vehicle isn't online; a stale-or-missing entry on an online vehicle triggers a charged on-demand refresh. Reach for it only to eyeball a value once — never poll it and never use it in place of the SSE stream above. - **Typical first-time flow:** call `GET /api/metadata` to see your vehicles, scopes, and telemetry sync state -> configure the fields you need and confirm `synced: true` via `GET /:vin/fleet_telemetry_config` -> wait for (or wake) the vehicle to connect -> subscribe to `GET /sse/:id?` for continuous updates, whether the vehicle streams or is polled server-side. - **Client libraries**, for agents driving or generating integration code rather than calling the HTTP API directly — the streaming libraries below consume exactly this SSE surface (`GET /sse/:id?`), not the one-shot telemetry reads: - Python, Tesla Fleet API (cloud + BLE vehicle/energy commands): https://github.com/Teslemetry/python-tesla-fleet-api - Python, typed telemetry stream listeners: https://github.com/Teslemetry/python-teslemetry-stream - TypeScript, `@teslemetry/api` (incl. SSE): https://github.com/Teslemetry/typescript-teslemetry ## Streaming fields vs. vehicle_data shape The live `data` SSE event (and the per-field `GET /sse/:vin/:field` stream) use Fleet Telemetry's raw field vocabulary: flat field names like `DetailedChargeState`, `Gear`, `Locked`. `GET /:vin/vehicle_data` and the one-shot `GET /:vin/telemetry` use the classic, nested vocabulary: `charge_state.charging_state`, `drive_state.shift_state`, `vehicle_state.locked`. Each field's `vehicle_data_equivalent` in [/fields.json](/fields.json) names its classic `vehicle_data` key(s) (`null` when there is none); treat it as a starting point, since semantics and units can differ — this section covers the common dashboard fields' differences. - **Enum-prefix convention:** an enum-typed streaming field's string values are prefixed with an internal state name (usually, but not always, the field name itself) — e.g. `Gear` values are `ShiftStateP`/`ShiftStateD`/`ShiftStateR`/`ShiftStateN`, and `ChargingCableType` values are `CableTypeIEC`/`CableTypeSAE`/etc. Strip the declared prefix (see each field's `enum` name in [/fields.json](/fields.json)) to get the bare state — `ShiftStateP` -> `P`, matching `vehicle_data`'s `drive_state.shift_state`. - **Charging state:** stream `DetailedChargeState` (prefixed `DetailedChargeState*`, e.g. `DetailedChargeStateCharging`, `DetailedChargeStateDisconnected`, `DetailedChargeStateComplete`) is the streaming equivalent of `vehicle_data`'s `charge_state.charging_state` (`"Charging"`, `"Disconnected"`, `"Complete"`, ...) — strip the `DetailedChargeState` prefix to get the matching classic string. `ChargeState` is a separate, coarser connector-hardware field with its own unrelated enum; prefer `DetailedChargeState` for a dashboard's charging status. - **Battery percent — `BatteryLevel` vs `Soc`:** both are numeric `%` fields and read bit-for-bit identical in normal operation, but they're not documented as redundant — they're two different Tesla figures that usually coincide. `BatteryLevel` is the displayed state of charge (`vehicle_data`'s `charge_state.battery_level`); `Soc` is the *usable* state of charge, i.e. accounting for any unusable buffer at the top/bottom of the pack (`vehicle_data`'s `charge_state.usable_battery_level`). They can diverge when a vehicle has a usable-capacity buffer in effect. Recommendation: use `BatteryLevel` for a dashboard's headline battery percentage (it matches what the vehicle's own UI shows); use `Soc` only if you specifically need the usable-capacity figure. - **Other common fields:** `Locked` -> `vehicle_state.locked`; `InsideTemp`/`OutsideTemp` -> `climate_state.inside_temp`/`outside_temp`; `VehicleSpeed` -> `drive_state.speed`; `Odometer` -> `vehicle_state.odometer`. Boolean and plain numeric fields like these have no enum prefix to strip — the streaming and classic values are the same type and unit. ## Endpoints - [Streaming](/llms/streaming.md): Teslemetry streaming endpoint - [General](/llms/general.md): Products endpoint - [Vehicle](/llms/vehicle.md): Vehicle data endpoints - [Vehicle Command](/llms/vehicle-command.md): Vehicle command endpoints - [Vehicle Custom Commands](/llms/vehicle-custom-commands.md): Vehicle commands specific to Teslemetry - [Energy](/llms/energy.md): Energy product endpoints - [Energy Command](/llms/energy-command.md): Energy command endpoints - [User](/llms/user.md): Tesla user account informations - [Meta](/llms/meta.md): Teslemetry specific endpoints - [Automations](/llms/automations.md): Rules that run API calls when vehicle telemetry changes, or on a schedule - [Charging](/llms/charging.md) ## Errors Failed responses use: `{ "response": null, "error": "", "error_description": "" }`. Common status codes: - `401` — missing or invalid token. - `402` — out of credits. - `403` — token is missing a required OAuth scope (see Troubleshooting). - `404` — unknown vehicle/resource. - `408` — vehicle is asleep or unreachable; retry, or wake it first. - `429` - rate limited; honor `Retry-After` when present, then retry. - `5xx` — upstream Tesla or Teslemetry error; retry with backoff. ## Troubleshooting - **Scopes:** endpoints require specific OAuth scopes; a missing scope returns `403`. Reading vehicle or energy data needs the data-access scopes (`vehicle_device_data`, `energy_device_data`), while sending commands needs the command scopes (`vehicle_cmds`/`vehicle_charging_cmds` for vehicles, `energy_cmds` for energy). - **Command prerequisites:** vehicle commands use Tesla's signed-command protocol and require the Teslemetry virtual key to be paired to the vehicle. Use `POST /api/1/vehicles/fleet_status` to check whether a vehicle can accept commands. Commands sent to a sleeping or offline vehicle may return `408`. - **Regions:** `api.teslemetry.com` automatically routes to your account's region — you do not need to call the regional (`na.`/`eu.`) hosts directly.