Register a third-party application on developer.tesla.com and configure OAuth 2.0 redirect URIs; Tesla Fleet API uses OAuth with scopes such as 'energy_device_data' and 'energy_cmds'.
Complete the OAuth authorization code flow with a Tesla account owner to obtain an access token; include the required scopes for reading energy data.
Retrieve the list of energy products (Powerwall gateways) associated with the account via GET /api/1/products, filtering for entries where energy_site_id is present.
Fetch current battery state via GET /api/1/energy_sites/<ENERGY_SITE_ID>/live_status to get battery percentage, grid status, power flows, and island mode.
Query historical energy data via GET /api/1/energy_sites/<ENERGY_SITE_ID>/calendar_history with kind=energy and a specified period (e.g., day or month) to retrieve time-series export, import, solar, and battery charge/discharge values.
Known gotchas
Tesla's Fleet API endpoint base URL differs by region and account type; using the wrong regional base URL results in authentication errors even with a valid token — check the 'api_base_url' returned in the OAuth token response.
Powerwall data can have reporting gaps if the gateway loses connectivity; the calendar_history endpoint returns zero-filled buckets for offline periods rather than omitting them, which can understate actual production or consumption.
Access tokens have a short lifespan; the refresh token must be used to obtain new access tokens, and refresh tokens themselves expire after a period of inactivity — implement proactive refresh and handle re-authorization gracefully.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp