Upgraded Tesla API Integration
This page has information regarding Smartcar’s upgraded Tesla integration.
What’s changing for my integration?
For new developers
If you’re on an Enterprise or Scale plan, please reach out to your Account Manager or Solutions Architect for information on setting up your own Virtual Key.
Free and Build customers can get started with the default Virtual Key and no additional configuration.
For existing developers
Please see the section that applies to your situation here.
What is a Virutal Key?
A virtual key is a digital access method required by Tesla for third-party applications to receive vehicle data and issue commands to Tesla vehicles. Please see this section for more information.
Where can I find my Virtual Key?
The Virtual Key URL for your application will be sent back along with the authorization code after a user completes the Connect flow.
Handling the new redirect parameter
After going through the new Connect flow, we’ll send back a URL pointing to a Virtual Key along with the code
:
This new param will not break existing HTTP client integrations or older SDK versions. Update to the latest version to receive the URL in the Connect onComplete
for our Frontend SDKs.
Adding a Virtual Key
This process should take place after the Connect flow when a user has returned to your application.
The Virtual Key is a URL in the form:
After prompting your your users to open the link, depending on their device, they will need to do the following:
Adding a Virtual Key will need to be done after a user has granted your application access to their Tesla account in the Connect flow.
Please see our FAQs for details on adding a virtual key for accounts with multiple vehicles and different account types.
On mobile devices, they will be redirected to the Tesla app and prompted to add the Virtual Key
Opening the link on a mobile device with the Tesla app installed
Do all vehicles need a Virtual Key?
2020 and earlier Model S and X will not require a Virtual Key to keep working at this time. However, you may not always receive the latest data from the vehicle when you make an API request to Smartcar.
Updating access with Tesla
You can use either of the following URLs to prompt users for more Tesla permissions in the event you need additional access from the vehicle owner due to:
-
A PERMISSION error from API
-
A CONNECTED_SERVICES_ACCOUNT:PERMISSION error from API
-
Needing access to an endpoint out of scope for your existing permissions
If one or more of the Smartcar scopes you pass map to a new Tesla permission(s) for the account, the user will be prompted to update access after they log in with Tesla.
This flow sends a new authorization code to your callback URI in order to fetch a new access and refresh token.
name | type | required | description |
---|---|---|---|
response_type | string | true | This should be set to code . |
make | string | true | Specifies the brand to update access to. Currently, the only make available for this flow is TESLA . |
client_id | string | true | The application’s unique identifier. This is available on the credentials tab of the Smartcar Dashboard. |
scope | [permissions] | true | A space-separated list of permissions that your application is requesting access to. The valid permission names can be found in the permissions section. When reauthenticating, the user will be required to grant the corresponding OEM permissions before being able to exit the flow. |
redirect_uri | string | true | Required if using the /authorize route for Smartcar to return an authorization code. |
Requiring Tesla Permissions
To ensure users select the necessary permissions with Tesla before
being able to connect their vehicle via Smartcar, please append the required:
prefix to Smartcar scopes in your Connet URL e.g. required:read_location
.
As a result if they do not select the necessary permissions with Tesla, they will see the following screen and be prompted to return to Tesla to update their permissions.
Permission Mappings
Smartcar Permission | Tesla Permission |
---|---|
control_charge | Vehicle Charge Management |
control_climate | Vehicle Commands |
control_navigation | Vehicle Commands |
control_pin | Vehicle Commands |
control_security | Vehicle Commands |
control_trunk | Vehicle Commands |
read_battery | Vehicle Information |
read_charge_records | Vehicle Charge Management |
read_charge | Vehicle Information |
read_climate | Vehicle Information |
read_compass | Vehicle Information |
read_engine_oil | Vehicle Information |
read_extended_vehicle_info | Vehicle Information |
read_fuel | Vehicle Information |
read_location | Vehicle Location |
read_odometer | Vehicle Information |
read_security | Vehicle Information |
read_speedometer | Vehicle Information |
read_thermometer | Vehicle Information |
read_tires | Vehicle Information |
read_user_profile | Profile Information |
read_vehicle_info | Vehicle Information |
read_vin | Vehicle Information |
Was this page helpful?