Show your BMW's status (odometer, fuel/battery, location) from the command line, using the official Smartcar API.
Note: BMW blocked unofficial/reverse-engineered API access on 2025-09-29, so this project uses Smartcar — a sanctioned third-party API that works in North America (free tier: 500 calls/vehicle/month).
- Create a Smartcar app at https://dashboard.smartcar.com
- Copy your Client ID and Client Secret.
- Add a Redirect URI of exactly
http://localhost:8000/callback.
- Configure credentials:
cp .env.example .env # then edit .env with your Client ID/Secret npm install - Connect your car (one time):
This opens Smartcar Connect in your browser — log in with your BMW account and approve. Tokens are saved locally to
npm run auth
smartcar_tokens.json(gitignored). - See your car's status:
npm start
auth.js— one-time OAuth flow that connects your BMW and caches tokensindex.js— fetches and prints your vehicle's statustokens.js— saves/loads the cached Smartcar tokens.env— your Smartcar credentials (gitignored)
Real credentials live only in .env and smartcar_tokens.json, both gitignored and never
committed. .env.example is a safe template. Never put real secrets in committed files.