Tesla Fleet API

Tesla's official API for cars and Powerwalls: the 1-time app setup, OAuth per scope, pay-per-use pricing, and how NicAI fetches my Supercharger invoices with it.

The Tesla Fleet API is Tesla's official API for third-party apps that read or control Tesla vehicles and energy products (Powerwall, solar). It replaced the old, unofficial "Owner API" that apps used to call with a user's password. Today every app registers with Tesla, proves it owns a domain, and gets per-scope OAuth consent from the owner.

What it covers

Area Examples Scope
Vehicle data State, charge level, climate, location vehicle_device_data, vehicle_location
Vehicle commands Lock, climate, charge limit, start or stop charging vehicle_cmds, vehicle_charging_cmds
Charging history Supercharger sessions, billed amounts, invoice PDFs vehicle_charging_cmds
Energy products Powerwall and solar status, history, backup reserve energy_device_data, energy_cmds
Fleet Telemetry Streaming signals pushed from the car to your own server vehicle_device_data

Regional base URLs: Europe uses https://fleet-api.prd.eu.vn.cloud.tesla.com, North America https://fleet-api.prd.na.vn.cloud.tesla.com. An account answers only on its own region.

Setup, once per app

  1. Create an application on the developer dashboard. You get a client ID and a client secret.
  2. Generate an EC key pair (P-256, secp256r1).
  3. Host the public key on a domain you own, at exactly https://<domain>/.well-known/appspecific/com.tesla.3p.public-key.pem.
  4. Get a partner token (client credentials grant) and call POST /api/1/partner_accounts with your domain, once per region. Until you do, every call fails.
  5. Log the owner in with the OAuth authorisation-code flow at https://auth.tesla.com/oauth2/v3/authorize, asking only for the scopes you need. Add offline_access to get a refresh token.

Commands to a car need 1 more step: the car must hold your app's virtual key. The owner pairs it once through the Tesla app, and commands are then signed with your private key, usually through Tesla's Vehicle Command HTTP Proxy. Reading data and charging history don't need the virtual key.

Pricing and limits

Pay per use, billed monthly, with a 10 USD monthly discount for individual developers and small apps. For a personal script, the discount covers everything.

Category Price
Streaming signals 150,000 signals for 1 USD
Commands 1,000 requests for 1 USD
Data requests 500 requests for 1 USD
Wakes 50 requests for 1 USD

Authentication calls and HTTP 500 errors are free. Rate limits are per device and account: 60 realtime data requests a minute, 3 wakes a minute, 30 commands a minute.

The pricing shapes the design: a wake is 10 times dearer than a data request, and streaming is far cheaper than polling. Don't wake a sleeping car to read 1 value.

How NicAI uses it

NicAI has 1 shared client, tesla.py, in my shared tools folder. Python standard library only, no SDK.

tesla.py keygen                  # EC key pair, kept outside the repo
tesla.py publish-key             # the public key to the .well-known path of my domain
tesla.py register                # partner account, EU region

tesla.py login --profile <name> --scopes vehicle_charging_cmds
tesla.py history  --profile <name> --since 2026-01-01
tesla.py invoices --profile <name> --out <dir>
tesla.py get      --profile <name> /api/1/products

The design choice I like: 1 Fleet API app, 1 login profile per project. Each project logs in with its own profile and only the scopes it needs, so a token for invoices can't touch the Powerwall, and the reverse. The OAuth callback is caught by a local server on localhost, so the login is 1 browser click.

Supercharger invoices for my bookkeeping

The live use today. My company pays for the car's Supercharging, and every session needs its invoice in the books.

  1. GET /api/1/dx/charging/history lists every Supercharger session (back to 2020 on my account).
  2. GET /api/1/dx/charging/invoice/{contentId} downloads the PDF of each one.
  3. Receiptee (!NicAI/receiptee), my receipts app, imports the new PDFs, skips duplicates by content, and matches each invoice to its card payment.

What I learnt:

  • The Fleet API has no subscription invoices. Premium Connectivity (9.99 EUR a month) still has to be downloaded from the Tesla account page by hand.
  • Free or cancelled sessions have no invoice. A few sessions in the history return nothing, and that is normal.
  • A 401 or 403 on every call means the token expired. Run login again for that profile.
  • The script downloads to a working folder first and only then copies into the synced finance folder, so a half-written PDF never reaches the books.

Next: the Powerwall

A second profile with energy_device_data is ready in the script for my Powerwall 3 and solar (!interests/tesla-powerwall). The idea is solar-aware car charging through Home Assistant (!apps/home-assistant). The Powerwall 3 changed its local API compared with the older Backup Gateway, so the Fleet API is the likely data source. That profile has no login yet.

NicAI
Written by NicAI, Nic's AI assistant, for his personal knowledge base. Researched and drafted by the model, not hand-written by Nic. Verify anything you plan to act on.