Docs and Resources for Calling the Tesla API Directly
When building your own Tesla app, TeslaMate can't tell you "how to send commands to the car": it only reads data and starts/stops its own logging. To trigger commands such as unlock, climate on, or honk, or to get fields TeslaMate doesn't expose, you have to call the Tesla API directly. Below are all the legitimate sources of Tesla API documentation, each labeled with "what you get / when to use it".
0. The Bottom Line (Read This Table First)
| What you want to do | Which API | Where the docs are |
|---|---|---|
| Read vehicle state (battery/location/temperature/doors and windowsβ¦) | Owner API (default) or Fleet API vehicle_data | See Β§1 |
| Real-time data (per second) | Owner Streaming (WebSocket, OAuth mode) or Fleet Telemetry (PubSub, at least 1 minute) | See Β§2 |
| Trigger commands (unlock/climate/honk/locate/charging control/Summonβ¦) | Owner API commands or Fleet API commands | See Β§3 |
| Register an app and get an OAuth client_id | Tesla Developer Portal | Β§1.1 |
| OAuth login flow (PKCE / SSO) | auth.tesla.com/oauth2/v3 | Β§1.2 |
| Can't find a field or don't understand the response structure | Reverse-engineer TeslaMate's tesla_api/ directory | See Β§5 |
| Want a shortcut and don't want to deal with OAuth yourself | Third-party proxies (MyTeslaMate, Teslemetry) | Β§4 |
1. Official APIs (Most Authoritative, but Spread Across Three Places)
1.1 Tesla Developer Portal (Registration + Main Docs Entry)
- URL: https://developer.tesla.com
- Sign up for a Tesla account, go to "Apps" and create a third-party application. You get:
client_id/client_secret- A "tagged" application that can request Fleet API / Telemetry permissions
- Docs center (full content requires login): https://developer.tesla.com/docs
- Fleet API: https://developer.tesla.com/docs/fleet-api
- Covers OAuth, commands, vehicle data, and the list of
vehicle_dataendpoints
- Covers OAuth, commands, vehicle data, and the list of
- Fleet Telemetry: https://developer.tesla.com/docs/fleet-telemetry
- PubSub model, at most once per minute (not per second!)
- Vehicle Command Protocol: https://developer.tesla.com/docs/vehicle-command/vehicle-command
- Describes the underlying mTLS + HTTP protocol for commands (Fleet API commands ultimately go through this)
- Fleet API: https://developer.tesla.com/docs/fleet-api
- Membership Levels / Rate Limits: https://developer.tesla.com/docs/fleet-api#membership-levels
- Key point: the free tier limits how often you can poll
vehicle_data(usually once every few hours); exceed it and you're throttled to once every 24h
- Key point: the free tier limits how often you can poll
1.2 OAuth 2.0 Login Endpoints (Auth)
Taken from TeslaMate's source lib/tesla_api/auth.ex. The official docs are very vague about this, so here it is in one place:
| Endpoint | Purpose |
|---|---|
https://auth.tesla.com/oauth2/v3 | Global OAuth 2.0 endpoint |
https://auth.tesla.cn/oauth2/v3 | China users (switch with the TESLA_AUTH_HOST environment variable) |
client_id = ownerapi | The "old" client_id from the Owner API era, still used by TeslaMate |
redirect_uri = https://auth.tesla.com/void/callback | TeslaMate's internal OAuth callback |
scope = openid email offline_access vehicle_device_data vehicle_cmds vehicle_charging_cmds vehicle_location | Required scopes (see the Fleet API docs for details) |
OAuth flow:
- Browser login (PKCE code flow):
https://auth.tesla.com/oauth2/v3/authorize?... - Get the code from the callback, then POST to
/oauth2/v3/tokento exchange it for anaccess_token+refresh_token access_tokenlasts about 8 hours;refresh_tokenlasts about 3 months- Before expiry, proactively POST the
refresh_tokento/oauth2/v3/tokento renew
Note: Tesla started pushing the Fleet API in 2023, and the old Owner API client (
ownerapi) is no longer available for new app registrations. But apps that already have tokens (including TeslaMate) can keep using it, which is why TeslaMate supports both modes (seelib/tesla_api/middleware/fleet_auth.ex).
1.3 Official API Domains (by Region)
From TeslaMate lib/tesla_api/auth.ex + lib/tesla_api/vehicle.ex:
| Region | Owner / Fleet API host | Streaming WebSocket |
|---|---|---|
| Global (North America, Europe, Asia) | https://owner-api.teslamotors.com | wss://streaming.vn.teslamotors.com/streaming/ |
| China | https://owner-api.vn.cloud.tesla.cn | wss://streaming.vn.cloud.tesla.cn/streaming/ |
| Fleet API (NA) | https://fleet-api.prd.na.vn.cloud.tesla.com | - |
| Fleet API (EU) | https://fleet-api.prd.eu.vn.cloud.tesla.com | - |
| Fleet API (CN) | https://fleet-api.prd.cn.vn.cloud.tesla.cn | - |
How it decides: decode the access_token JWT and look at the TLD of iss (issuer). If it's cn, it's China; otherwise global.
2. Owner Streaming (Per-Second Data over WebSocket, Most Worth Using)
Tesla's official docs don't fully cover this part, but TeslaMate has used it reliably via reverse engineering for 5+ years. It's the key to building a "real-time display" app.
2.1 WebSocket Endpoint
wss://streaming.vn.teslamotors.com/streaming/
2.2 Protocol (from TeslaMate lib/tesla_api/stream.ex, confirmed working)
Right after connecting, send a subscribe message frame (JSON):
{
"msg_type": "data:subscribe_oauth",
"token": "<access_token>",
"value": "speed,odometer,soc,elevation,est_heading,est_lat,est_lng,power,shift_state,range,est_range,heading",
"tag": "<vehicle_id>"
}
Subscribed columns (12 fields, fixed order):
| Column | Meaning | Unit |
|---|---|---|
speed | Speed | mph |
odometer | Odometer | mi |
soc | State of Charge (battery percentage) | % |
elevation | Elevation | m |
est_heading | Estimated heading (GPS-calculated) | Β° |
est_lat | Estimated latitude | Β° |
est_lng | Estimated longitude | Β° |
power | Instant power (positive = discharging, negative = charging) | kW |
shift_state | Gear | P / D / N / R / "" |
range | Rated range (based on battery percentage) | mi |
est_range | Estimated range | mi |
heading | Compass heading | Β° |
Watch the units: streaming returns imperial (mph/mi), while the Owner API's
vehicle_datais metric (km/h/km). Both line up; just multiply by0.621371/1.60934yourself.
Receiving data: each frame looks like data: <csv>, with columns in the same order as the subscription string, for example:
data: 45,12345.6,82,120,180,37.7749,-122.4194,-12,P,250,238,180
TeslaMate parsing example (lib/tesla_api/stream.ex decode_frame!/1):
Enum.zip([:time | @columns], String.split(value, ","))
|> Enum.into(%Map{})
2.3 Unsubscribe + Heartbeat
- Unsubscribe:
{"msg_type": "data:unsubscribe", "tag": "<vid>"} - Heartbeat: the server's
control:helloframe carriesconnection_timeout(seconds); the client must do something before then (or it gets disconnected) - Error frames:
data:error, witherror_typeβvehicle_disconnected/vehicle_error/client_error
2.4 Trade-offs vs. Fleet Telemetry
| Dimension | Owner Streaming | Fleet Telemetry |
|---|---|---|
| Frequency | 1 Hz (in practice 1-5 seconds) | At least 1 minute (depending on the fields you configure) |
| Protocol | WebSocket (bidirectional) | Google PubSub push (one-way) |
| Deployment complexity | Medium (need to keep the WebSocket alive) | High (need GCP PubSub + a public callback) |
| Officially recommended by Tesla | Transitional | The new approach |
| Recommended for personal apps | β Yes | Fallback |
| Field coverage | 12 core fields | 100+ configurable fields |
β For a mobile app or personal project, Owner Streaming is the first choice. Fleet Telemetry suits "company-level / multi-vehicle monitoring".
3. Owner API Command Endpoints (Unlock, Climate, etc.)
Tesla official: the "Commands" section of the Fleet API docs (https://developer.tesla.com/docs/fleet-api#commands) requires Fleet API registration + the Vehicle Command Protocol (mTLS + private-key signing).
Owner API (the unofficial interface TeslaMate uses): the command endpoints have no official documentation; the community reverse-engineered them from the Tesla app over the years.
3.1 Owner API Command Endpoints (Community Consensus)
Tesla hasn't formally documented these endpoints and could change them at any time. But they still work today (2026).
POST /api/1/vehicles/{id}/command/{command_name}
Common commands (from the community tesla-api Python library outside TeslaMate, plus consensus across many GitHub issues):
| Command | Effect | Required parameters |
|---|---|---|
wake_up | Wake the vehicle | - |
lock / unlock | Lock | - |
honk_horn | Honk | - |
flash_lights | Flash lights | - |
climate_start / climate_stop | Climate on/off | - |
set_temps | Set temperature | driver_temp, passenger_temp |
set_preconditioning_max | "MAX" mode | - |
auto_conditioning_start / stop | Auto climate | - |
charge_start / charge_stop | Start/stop charging | - |
set_charge_limit | Set charge limit | percent |
set_charging_amp | Set charging amps | charging_amps |
charge_port_door_open / close | Charge port door | - |
actuate_trunk | Open the trunk (some models) | which_trunk |
remote_start_drive | Remote start | password |
share | Share navigation/data to the car | - |
schedule_software_update | Schedule OTA | scheduled_time |
cancel_software_update | Cancel scheduled update | - |
media_toggle_playback / next_track / prev_track / volume_up / volume_down | Media controls | - |
trigger_homelink | Trigger HomeLink (garage door) | lat, lon |
set_sentry_mode | Sentry Mode | on |
set_valet_mode | Valet Mode | on, password |
reset_valet_pin | Reset valet PIN | - |
speed_limit_set_limit | Speed limit | limit_mph |
speed_limit_activate / deactivate / clear_pin | Speed limit control | - |
enable_calendar_sync | Sync calendar | - |
add_favorite / remove_favorite | Favorite locations | id (favorite id) |
β οΈ Warning: these endpoints have no SLA. Tesla may change, remove, or rate-limit them at any time. Use the Fleet API command interface in production.
3.2 Fleet API Commands (Official but Complex)
Goes through the Vehicle Command Protocol:
- Generate an ECDSA P-256 key pair and keep the private key yourself
- Bind the public key to your app in the Tesla Developer Portal
- The owner gets a "Pairing Request" in the Tesla app; approving it produces a signed "vehicle command authorization"
- After that, each command = an HTTP POST to
https://fleet-api.prd.<region>.vn.cloud.tesla.com/api/1/vehicles/{id}/command/<cmd>, with the HTTP body containing a JWT message signed with your private key
Full spec: https://developer.tesla.com/docs/vehicle-command/vehicle-command Reference implementation: https://github.com/teslamotors/vehicle-command
4. Third-Party Proxies (The Easiest Option)
If you don't want to handle OAuth + command signing + public callbacks yourself, third parties have already done it:
4.1 MyTeslaMate (Free, Closest to TeslaMate Style)
- Website: https://www.myteslamate.com
- Sign up to get a
TOKEN, then callhttps://api.myteslamate.com/...directly - It also repackages Fleet Telemetry as an Owner-style WebSocket (project: https://github.com/MyTeslaMate/websocket)
- Pros: free, simple API, compatible with TeslaMate
- Cons: depends on a third-party service staying up, and someone else can see your data
4.2 Teslemetry (Paid)
- Website: https://teslemetry.com
- Usage-based pricing (
vehicle_datais pay-per-call) - Provides its own Fleet API endpoint + its own streaming
- β οΈ Important: Teslemetry's streaming is not compatible with TeslaMate; if you use it, you must turn off TeslaMate's own streaming (see
website/docs/configuration/api.md)
5. The "Reverse-Engineering Evidence" in the TeslaMate Repo
This is the most important hidden resource. TeslaMate puts every Tesla API call in
lib/tesla_api/, so the whole directory is effectively reverse-engineered documentation.
5.1 Complete File Index
| File | Content | Purpose |
|---|---|---|
lib/tesla_api.ex | Base HTTP client (Tesla + Finch) | See the User-Agent and base URL |
lib/tesla_api/auth.ex | OAuth client + region detection | See the auth.tesla.com endpoints and region detection (JWT iss decoding) |
lib/tesla_api/auth/refresh.ex | refresh_token renewal | See the /oauth2/v3/token request body |
lib/tesla_api/stream.ex | WebSocket streaming implementation | See the subscribe protocol, column names, and heartbeat |
lib/tesla_api/vehicle.ex | /api/1/products, /api/1/vehicles/{id}, /vehicle_data | See the read endpoints |
lib/tesla_api/vehicle/state.ex | Vehicle state field definitions | The most complete field dictionary: every Owner API response field is here |
lib/tesla_api/middleware/fleet_auth.ex | Fleet API token switching | See where the qts-/eu-/cn- token prefixes come from |
lib/tesla_api/middleware/token_auth.ex | Owner API bearer token | See how Authorization: Bearer ... is injected |
lib/tesla_api/error.ex | Error code definitions | See unauthorized / vehicle_not_found / vehicle_in_service / too_many_request / timeout |
5.2 Key State Fields
lib/tesla_api/vehicle/state.ex defines five modules: Charge / Climate / Drive / VehicleConfig / VehicleState. Each module is a field table, matching the fields returned by the Owner API's /vehicle_data one-to-one.
For example, VehicleState.result/1 includes:
api_version,autopark_state_v2,autopark_style,calendar_supported,car_version,car_type,center_display_state,dark_rims,df/dr/pf/pr(door states),driven_enforced,exterior_color,fd_window/fp_window/rd_window/rp_window(windows),ft/rt(front/rear trunk),homelink_device_count,homelink_enabled,is_user_present,last_autopark_error,locked,media_state,notifications_supported,odometer,parsed_calendar_supported,perf_config,pin_to_drive_enabled,rt/ft,seat_heater_left/right,sentry_mode,service_mode,spoiler_type,sun_roof_installed,sun_roof_state,sun_roof_percent_open,third_row_seats,time_to_full_charge,tpms_pressure_fl/fr/rl/rr,tpms_soft_warning_*,valet_mode,vehicle_name,wheel_type,software_update.{status,version,download_perc,install_perc,...}β¦
β Treat this file as the source of truth for the full field list. One file is worth ten blog posts.
5.3 URL / Path Cheat Sheet
Source: TeslaMate lib/tesla_api/vehicle.ex, cross-checked with the official docs:
| Purpose | Path |
|---|---|
| List all products (vehicles + energy products) | GET /api/1/products |
| List my vehicles | GET /api/1/vehicles (filter the vehicle_id field from /products) |
| Basic vehicle info | GET /api/1/vehicles/{id} |
| Full vehicle state (charge/climate/drive/vehicle_config/vehicle_state, etc.) | GET /api/1/vehicles/{id}/vehicle_data?endpoints=charge_state;climate_state;closures_state;drive_state;gui_settings;location_data;vehicle_config;vehicle_state;vehicle_data_combo |
| Single endpoint (faster) | GET /api/1/vehicles/{id}/data/{endpoint_name} |
| Nearby data | GET /api/1/vehicles/{id}/data_request/{nearby_sites,charge_history,...} |
| Mobile Smart Summon | GET /api/1/vehicles/{id}/data_request/drive_state_v2 |
| Command | POST /api/1/vehicles/{id}/command/{cmd_name} (for the body, see Β§3.1) |
| Sharing | POST /api/1/vehicles/{id}/share |
| Mobile access state | GET /api/1/vehicles/{id}/mobile_enabled |
6. Community Ecosystem (Where to Catch the Latest Changes)
| Resource | URL | Value |
|---|---|---|
teslamate-org/teslamate | https://github.com/teslamate-org/teslamate | Reference implementation of the reverse-engineered API |
teslamotors/vehicle-command | https://github.com/teslamotors/vehicle-command | Official command protocol + Go SDK |
teslamotors/fleet-telemetry | https://github.com/teslamotors/fleet-telemetry | Go implementation of the official telemetry service (see dispatchers) |
MyTeslaMate/websocket | https://github.com/MyTeslaMate/websocket | A project that repackages Fleet Telemetry into the Owner streaming protocol |
timdorr/tesla-api | https://github.com/timdorr/tesla-api | The classic Tesla API docs (since 2020, the most complete "unofficial docs"), but Tesla has changed things many times, so parts are outdated |
Python tesla-api lib | https://github.com/tdorssers/TeslaPy | Python library, still actively updated |
TeslaMate Discord / Forum | https://discord.gg/teslamate | Any API change usually shows up first as an issue here |
developer.tesla.com forums | https://forums.tesla.com/categories/developer | Official responses (slow) |
7. Practical Advice for Building Your Own App
7.1 Minimum Viable Setup (Personal Toy Project)
# 1. Register: https://developer.tesla.com β create an app and note the client_id
# 2. Log in with the PKCE flow (the timdorr/tesla-api docs have diagrams)
# 3. Call with the access_token:
curl -H "Authorization: Bearer $TOKEN" \
"https://owner-api.teslamotors.com/api/1/vehicles"
# β list vehicles
curl -H "Authorization: Bearer $TOKEN" \
"https://owner-api.teslamotors.com/api/1/vehicles/$ID/data_request/charge_state"
# β battery state (lowest-frequency API, looser rate limits)
# 4. Connect the WebSocket:
wscat -c wss://streaming.vn.teslamotors.com/streaming/
# send: {"msg_type":"data:subscribe_oauth","token":"...","value":"speed,soc,est_lat,est_lng","tag":"$VID"}
# receive: data: 0,12345.6,82,...,...
7.2 Choosing an Approach for a Production App
| Stage | Approach | Reason |
|---|---|---|
| MVP / personal | Owner API + Owner Streaming | Direct, no detours, rate limits are enough |
| Paid product | Fleet API + Fleet Telemetry | Official, stable, has an SLA |
| Don't want to maintain infrastructure | MyTeslaMate / Teslemetry proxy | Get JSON directly, no need to deal with OAuth/mTLS/PubSub |
| Want to monitor other people's vehicles (fleets) | Fleet API + your own Telemetry server | The only legitimate option |
7.3 Legal / Risk Red Lines You Must Know
- Tesla does not officially support third-party apps calling the Owner API (it's reverse-engineered), so in theory your token could stop working at any time.
- Don't use a Tesla account for automated marketing or scraping all users' data.
- Don't bypass command signing (the Vehicle Command Protocol exists to prevent hijacking).
- The Fleet API has explicit Terms of Service; read them carefully when you register.
- High-frequency streaming will hit 429 (rate limiting). TeslaMate uses exponential backoff internally (see
exp_backoff_ms/2inlib/tesla_api/stream.ex), and your own app must do this too.
8. Cheat Sheet: URLs / Endpoints / Libraries (Paste into Your Notes)
βββββββββββββββββββββββββββββββββββββββββββββ
OAuth / Auth
https://auth.tesla.com/oauth2/v3/authorize (PKCE flow)
https://auth.tesla.com/oauth2/v3/token (token / refresh)
client_id (Owner API, old): ownerapi
client_id (Fleet API, new): <your-app-client-id>
scopes: openid email offline_access vehicle_device_data vehicle_cmds vehicle_charging_cmds vehicle_location
βββββββββββββββββββββββββββββββββββββββββββββ
Owner / Fleet REST API hosts
Global: https://owner-api.teslamotors.com
China: https://owner-api.vn.cloud.tesla.cn
Fleet NA: https://fleet-api.prd.na.vn.cloud.tesla.com
Fleet EU: https://fleet-api.prd.eu.vn.cloud.tesla.com
Fleet CN: https://fleet-api.prd.cn.vn.cloud.tesla.cn
βββββββββββββββββββββββββββββββββββββββββββββ
Read endpoints (Owner style)
GET /api/1/products
GET /api/1/vehicles
GET /api/1/vehicles/{id}
GET /api/1/vehicles/{id}/vehicle_data?endpoints=charge_state;...;vehicle_state
GET /api/1/vehicles/{id}/data_request/{charge_state,climate_state,drive_state,vehicle_state,gui_settings,location_data,vehicle_config,closures_state,nearby_sites,...}
βββββββββββββββββββββββββββββββββββββββββββββ
Command endpoints (Owner style, undocumented, may break)
POST /api/1/vehicles/{id}/command/{wake_up,lock,unlock,honk_horn,flash_lights,
climate_start,climate_stop,set_temps,set_preconditioning_max,
auto_conditioning_start,auto_conditioning_stop,
charge_start,charge_stop,set_charge_limit,set_charging_amp,
charge_port_door_open,charge_port_door_close,
actuate_trunk,remote_start_drive,
media_toggle_playback,media_next_track,media_prev_track,
media_volume_up,media_volume_down,
trigger_homelink,set_sentry_mode,set_valet_mode,reset_valet_pin,
speed_limit_set_limit,speed_limit_activate,speed_limit_deactivate,
schedule_software_update,cancel_software_update,
share,add_favorite,remove_favorite,enable_calendar_sync}
βββββββββββββββββββββββββββββββββββββββββββββ
Streaming (Owner style, seconds-level)
wss://streaming.vn.teslamotors.com/streaming/
Send: {"msg_type":"data:subscribe_oauth","token":"<access_token>",
"value":"speed,odometer,soc,elevation,est_heading,est_lat,est_lng,
power,shift_state,range,est_range,heading",
"tag":"<vehicle_id>"}
Recv: data: <csv with 12 values in same order, prefixed by timestamp>
βββββββββββββββββββββββββββββββββββββββββββββ
Telemetry (Fleet style, minutes-level)
https://developer.tesla.com/docs/fleet-telemetry
β GCP PubSub β your webhook β your app
βββββββββββββββββββββββββββββββββββββββββββββ
9. Reference Source Locations (Summary)
| Content | Path (TeslaMate repo) |
|---|---|
| HTTP client | lib/tesla_api.ex |
| OAuth flow | lib/tesla_api/auth.ex, lib/tesla_api/auth/refresh.ex |
| Fleet vs. Owner switching | lib/tesla_api/middleware/fleet_auth.ex, lib/tesla_api/middleware/token_auth.ex |
/api/1/products, /vehicles, /vehicle_data | lib/tesla_api/vehicle.ex |
| Full field dictionary (must read) | lib/tesla_api/vehicle/state.ex |
| Streaming protocol | lib/tesla_api/stream.ex |
| Official docs (summarized) | website/docs/configuration/api.md |