tesla_api 3.0.7 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 91569b9fd79eae85eb5d719cace95d97c7b52b553af21650fbe0dcc54bfb0587
4
- data.tar.gz: b4f045ab6be58dd83aea509685168ec9a9d6acbf23971d86602bf2febbb007d9
3
+ metadata.gz: 5b774bab2f43b76262fa9c4ab04ae250f9f325955f028d3c8bd44416f5a015f5
4
+ data.tar.gz: 157c7c913712cd7bc3e7412aead4225c5502b26399f7dcf2243a3f522c72cec9
5
5
  SHA512:
6
- metadata.gz: 273c9639d6ab5976b544e689dba5884d1449b93d1edd9c15125db5ae43f3a45df14c22333de78cc3cd34b577bff5519345a0b01ad8a4da50d77324ba7c520c10
7
- data.tar.gz: b706b047d6f1137956c16d6a58cd4c7627b21a4fa5bf9c45148b84ac45e0caa03d18f0885e538dd5b491d67d4b6d7d3e3110fb0139322f9843c265b3079bd89d
6
+ metadata.gz: 1354ad7bf60037cf9e09541d7122aed4448946262177e0c6a535f303fde5e5a479f15b2bda193102e305ec2f0743e9d4499aff27cbc2a452add543d64ee1157c
7
+ data.tar.gz: 980f1b1d752b674ab29ab82982c4ff687f3f22b62dc0c1d5aa138ef5fdd458393a7cea7177f67ae15ae64635154cd45eb7b70cf1bab12affa2c33ad9e622b32e
@@ -0,0 +1,36 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+ branches: [master]
8
+
9
+ jobs:
10
+ test:
11
+ name: Test Suite
12
+ runs-on: ubuntu-latest
13
+
14
+ env:
15
+ TESLA_EMAIL: elon.musk@teslamotors.com
16
+ TESLA_PASS: oilLOL
17
+ TESLA_CLIENT_ID: 1
18
+ TESLA_CLIENT_SECRET: 2
19
+ TESLA_ACCESS_TOKEN: 3
20
+ TESLA_REFRESH_TOKEN: 4
21
+
22
+ strategy:
23
+ matrix:
24
+ ruby-version: ['2.7', '3.0']
25
+
26
+ steps:
27
+ - uses: actions/checkout@v2
28
+
29
+ - name: Set up Ruby
30
+ uses: ruby/setup-ruby@v1
31
+ with:
32
+ ruby-version: ${{ matrix.ruby-version }}
33
+ bundler-cache: true
34
+
35
+ - name: Run test suite
36
+ run: bundle exec rake
@@ -4,9 +4,129 @@ description: The authentication process for the Tesla API
4
4
 
5
5
  # Authentication
6
6
 
7
- ## POST `/oauth/token?grant_type=password`
7
+ > ## This is a work in progress ⚠
8
+ >
9
+ > Tesla has deprecated the `/oauth/token` endpoint in favor of using `auth.tesla.com`. I'm working on updating the documentation as soon as possible. This documentation is still missing handling for MFA users. Feel free to discuss this in [issue #260](https://github.com/timdorr/tesla-api/issues/260).
8
10
 
9
- The initial authentication process is via [an OAuth 2.0 Password Grant](https://oauth.net/2/grant-types/password/) with the same credentials used for tesla.com and the mobile apps.
11
+ Tesla uses a separate SSO service (auth.tesla.com) for authentication across their app and website. This service is designed around a browser-based flow using OAuth 2.0, but also appears to have support for Open ID Connect. This supports both obtaining an access token and refreshing it as it expires.
12
+
13
+ ## Logging in
14
+
15
+ ### Step 1: Obtain the login page
16
+
17
+ Subsequent requests to the SSO service will require a "code challenge" and "code verifier". These are just a random 86-character string and its SHA-256 hash. Both must be encoded in base64 with url-safe encoding (base64url). Here is an example of generating them in Ruby, but you can apply this same process to other languages.
18
+
19
+ ```ruby
20
+ code_verifier = random_string(86)
21
+ code_challenge = Base64.urlsafe_encode64(Digest::SHA256.hexdigest(code_verifier))
22
+ code_verifier = Base64.urlsafe_encode64(code_verifier)
23
+ ```
24
+
25
+ You will also need a stable `state` value for requests, which is a random string of any length.
26
+
27
+ #### GET `https://auth.tesla.com/oauth2/v3/authorize`
28
+
29
+ The first request returns HTML intended for display in the browser. You will need to parse this HTML for hidden input fields.
30
+
31
+ The request is made with a `redirect_url` of "https://auth.tesla.com/void/callback", which is a non-existent page. The Tesla app intercepts the request to this page to capture the authorization code.
32
+
33
+ ##### Request parameters
34
+
35
+ | Field | Type | Example | Description |
36
+ | :---------------------- | :--------------- | :------------------------------------- | :-------------------------------------------------------------- |
37
+ | `client_id` | String, required | `ownerapi` | The OAuth client ID. Always "ownerapi" |
38
+ | `code_challenge` | String, required | `123` | The "code challenge" |
39
+ | `code_challenge_method` | String, required | `S256` | The code challenge hash method. Always "S256" (SHA-256) |
40
+ | `redirect_uri` | String, required | `https://auth.tesla.com/void/callback` | The redirect URL. Always "https://auth.tesla.com/void/callback" |
41
+ | `response_type` | String, required | `code` | The type of expected response. Always "code" |
42
+ | `scope` | String, required | `openid email offline_access` | The authentication scope. Always "openid email offline_access" |
43
+ | `state` | String, required | `123` | The OAuth state value. Any random string. |
44
+
45
+ ##### Response
46
+
47
+ This returns an HTML response body. There will be a `<form>` with hidden `<input>` elements that contain session-based information to prevent CSRF attacks. At the moment, they appear to be `_csrf`, `_phase`, `_process`, `transaction_id`, and `cancel`, but they may change due to server-side changes by Tesla. These must be provided in the POST body to validate the following request.
48
+
49
+ The response will also include a `set-cookie` header that includes a session ID cookie. This should be provided to the following request as a `Cookie` header so that the SSO service can match up your request with private data it has in that session.
50
+
51
+ ### Step 2: Obtain an authorization code
52
+
53
+ This will simulate a user submitting the form from the previous request in their browser. Ensure that the hidden `<input>`s are provided as POST body parameters and the `Cookie` header is set.
54
+
55
+ #### POST `https://auth.tesla.com/oauth2/v3/authorize`
56
+
57
+ ```http
58
+ Cookie: {cookie value from set-cookie header}
59
+ ```
60
+
61
+ ##### Request parameters
62
+
63
+ > Note: These are query parameters, not part of the POST body
64
+
65
+ | Field | Type | Example | Description |
66
+ | :---------------------- | :--------------- | :------------------------------------- | :-------------------------------------------------------------- |
67
+ | `client_id` | String, required | `ownerapi` | The OAuth client ID. Always "ownerapi" |
68
+ | `code_challenge` | String, required | `123` | The "code challenge" |
69
+ | `code_challenge_method` | String, required | `S256` | The code challenge hash method. Always "S256" (SHA-256) |
70
+ | `redirect_uri` | String, required | `https://auth.tesla.com/void/callback` | The redirect URL. Always "https://auth.tesla.com/void/callback" |
71
+ | `response_type` | String, required | `code` | The type of expected response. Always "code" |
72
+ | `scope` | String, required | `openid email offline_access` | The authentication scope. Always "openid email offline_access" |
73
+ | `state` | String, required | `123` | The OAuth state value. Any random string. |
74
+
75
+ > Note: This is the contents of the POST body. These should be form encoded (`application/x-www-form-urlencoded`).
76
+
77
+ | Field | Type | Example | Description |
78
+ | :----------------- | :----------------- | :------------------ | :------------------------------------------------ |
79
+ | hidden input names | String[], required | hidden input values | The fields from the HTML's hidden `<input>`s |
80
+ | `identity` | String, required | `elon@tesla.com` | The email for the authenticating Tesla account |
81
+ | `credential` | String, required | `brbgoingtomars` | The password for the authenticating Tesla account |
82
+
83
+ ##### Response
84
+
85
+ This will respond with a 302 HTTP response code, which will attempt to redirect to the redirect_uri with additional query parameters added. This new URL is located in the `location` header. You should not follow it, as it is non-existent. Instead, you should parse this URL and extract the `code` query parameter, which is your authorization code.
86
+
87
+ ### Step 3: Exchange authorization code for bearer token
88
+
89
+ #### POST `https://auth.tesla.com/oauth2/v3/token`
90
+
91
+ This is a standard [OAuth 2.0 Authorization Code exchange](https://oauth.net/2/grant-types/authorization-code/). This endpoint uses JSON for the request and response bodies.
92
+
93
+ ##### Request parameters
94
+
95
+ | Field | Type | Example | Description |
96
+ | :-------------- | :--------------- | :------------------------------------- | :-------------------------------------------------------------- |
97
+ | `grant_type` | String, required | `authorization_code` | TThe type of OAuth grant. Always "authorization_code" |
98
+ | `client_id` | String, required | `ownerapi` | The OAuth client ID. Always "ownerapi" |
99
+ | `code` | String, required | `123` | The authorization code from the last request. |
100
+ | `code_verifier` | String, required | `123` | The code verifier string generated previously. |
101
+ | `redirect_uri` | String, required | `https://auth.tesla.com/void/callback` | The redirect URL. Always "https://auth.tesla.com/void/callback" |
102
+
103
+ ```json
104
+ {
105
+ "grant_type": "authorization_code",
106
+ "client_id": "ownerapi",
107
+ "code": "123",
108
+ "code_verifier": "123",
109
+ "redirect_uri": "https://auth.tesla.com/void/callback"
110
+ }
111
+ ```
112
+
113
+ ##### Response
114
+
115
+ ```json
116
+ {
117
+ "access_token": "eyJaccess",
118
+ "refresh_token": "eyJrefresh",
119
+ "expires_in": 300,
120
+ "state": "of the union",
121
+ "token_type": "Bearer"
122
+ }
123
+ ```
124
+
125
+ ### Step 4: Exchange bearer token for access token
126
+
127
+ #### POST `https://owner-api.teslamotors.com/oauth/token`
128
+
129
+ This endpoint follows [RFC 7523](https://tools.ietf.org/html/rfc7523) to exchange a JWT access token from the SSO service for an access token usable by the Owner API.
10
130
 
11
131
  The current client ID and secret are [available here](https://pastebin.com/pS7Z6yyP).
12
132
 
@@ -18,29 +138,30 @@ Authorization: Bearer {access_token}
18
138
 
19
139
  The access token has a 45 day expiration.
20
140
 
21
- ### Request parameters
141
+ ##### Request parameters
22
142
 
23
- | Field | Type | Example | Description |
24
- | :-------------- | :--------------- | :--------------------- | :------------------------------------------------ |
25
- | `grant_type` | String, required | `password` | The type of OAuth grant. Always "password" |
26
- | `client_id` | String, required | `abc` | The OAuth client ID |
27
- | `client_secret` | String, required | `123` | The OAuth client secret |
28
- | `email` | String, required | `elon@teslamotors.com` | The email for the authenticating Tesla account |
29
- | `password` | String, required | `edisonsux` | The password for the authenticating Tesla account |
143
+ > Important: Ensure you are using the `access_token` from the SSO service here. The returned access_token is for all other requests to the Owner API.
30
144
 
31
- ### Request
145
+ ```http
146
+ Authorization: Bearer {access_token}
147
+ ```
148
+
149
+ | Field | Type | Example | Description |
150
+ | :-------------- | :--------------- | :-------------------------------------------- | :---------------------------------------------------------------------------- |
151
+ | `grant_type` | String, required | `urn:ietf:params:oauth:grant-type:jwt-bearer` | The type of OAuth grant. Always "urn:ietf:params:oauth:grant-type:jwt-bearer" |
152
+ | `client_id` | String, required | `abc` | The OAuth client ID |
153
+ | `client_secret` | String, required | `123` | The OAuth client secret |
154
+
155
+ ##### Request
32
156
 
33
157
  ```json
34
158
  {
35
- "grant_type": "password",
159
+ "grant_type": "urn:ietf:params:oauth:grant-type:jwt-bearer",
36
160
  "client_id": "abc",
37
- "client_secret": "123",
38
- "email": "elon@teslamotors.com",
39
- "password": "edisonsux"
40
- }
161
+ "client_secret": "123"
41
162
  ```
42
163
 
43
- ### Response
164
+ ##### Response
44
165
 
45
166
  ```json
46
167
  {
@@ -52,38 +173,44 @@ The access token has a 45 day expiration.
52
173
  }
53
174
  ```
54
175
 
55
- ## POST `/oauth/token?grant_type=refresh_token`
176
+ ## Refreshing an access token
177
+
178
+ #### POST `https://auth.tesla.com/oauth2/v3/token`
56
179
 
57
- You can use the `refresh_token` from the Password Grant to do [an OAuth 2.0 Refresh Token Grant](https://oauth.net/2/grant-types/refresh-token/) and obtain a new access token. Note: This will invalidate the previous access token.
180
+ This uses the SSO `refresh_token` from Step 3 above to do an [OAuth 2.0 Refresh Token Grant](https://oauth.net/2/grant-types/refresh-token/). _This does not work with the `refresh_token` provided by the Owner API._ Those have no use currently and should be discarded.
58
181
 
59
- ### Request parameters
182
+ This refreshed access token can be used with the Owner API to obtain a new access token for that service using the exact same request as Step 4 above.
60
183
 
61
- | Field | Type | Example | Description |
62
- | :-------------- | :--------------- | :-------------- | :-------------------------------------------------------- |
63
- | `grant_type` | String, required | `refresh_token` | The type of OAuth grant. Always "refresh_token" |
64
- | `client_id` | String, required | `abc` | The OAuth client ID |
65
- | `client_secret` | String, required | `123` | The OAuth client secret |
66
- | `refresh_token` | String, required | `cba321` | The refresh token returned from a previous token request. |
184
+ This endpoint uses JSON for the request and response bodies.
67
185
 
68
- ### Request
186
+ ##### Request parameters
187
+
188
+ | Field | Type | Example | Description |
189
+ | :-------------- | :--------------- | :---------------------------- | :------------------------------------------------------------- |
190
+ | `grant_type` | String, required | `refresh_token` | TThe type of OAuth grant. Always "refresh_token" |
191
+ | `client_id` | String, required | `ownerapi` | The OAuth client ID. Always "ownerapi" |
192
+ | `client_secret` | String, required | `123` | The OAuth client ID. |
193
+ | `refresh_token` | String, required | `123` | The refresh token from a prior authentication. |
194
+ | `scope` | String, required | `openid email offline_access` | The authentication scope. Always "openid email offline_access" |
69
195
 
70
196
  ```json
71
197
  {
72
- "grant_type": "refresh_token",
73
- "client_id": "abc",
198
+ "grant_type": "authorization_code",
199
+ "client_id": "ownerapi",
74
200
  "client_secret": "123",
75
- "refresh_token": "cba321"
201
+ "refresh_token": "eyJrefresh",
202
+ "scope": "openid email offline_access"
76
203
  }
77
204
  ```
78
205
 
79
- ### Response
206
+ ##### Response
80
207
 
81
208
  ```json
82
209
  {
83
- "access_token": "abc123",
84
- "token_type": "bearer",
85
- "expires_in": 3888000,
86
- "refresh_token": "cba321",
87
- "created_at": 1538359034
210
+ "access_token": "eyJaccess",
211
+ "refresh_token": "eyJrefresh",
212
+ "id_token": "id",
213
+ "expires_in": 300,
214
+ "token_type": "Bearer"
88
215
  }
89
216
  ```
@@ -24,6 +24,7 @@ return a generic set of codes related to a Model 3.
24
24
  | RENA | Region: North America | |
25
25
  | RENC | Region: Canada | |
26
26
  | REEU | Region: Europe | |
27
+ | ACL1 | Ludicrous Mode | Model X |
27
28
  | AD02 | NEMA 14-50 | |
28
29
  | AD04 | European 3-Phase | |
29
30
  | AD05 | European 3-Phase, IT | |
@@ -68,7 +69,7 @@ return a generic set of codes related to a Model 3.
68
69
  | BG32 | Performance AWD Badge | Model 3 |
69
70
  | BP00 | No Ludicrous | |
70
71
  | BP01 | Ludicrous Speed Upgrade | |
71
- | BP02 | Non-Performance Uncorked Acceleration | |
72
+ | BP02 | Uncorked Acceleration | Non-Performance |
72
73
  | BR00 | No Battery Firmware Limit | |
73
74
  | BR03 | Battery Firmware Limit (60kWh) | |
74
75
  | BR05 | Battery Firmware Limit (75kWh) | |
@@ -86,6 +87,7 @@ return a generic set of codes related to a Model 3.
86
87
  | BTX8 | 85 kWh | |
87
88
  | CC01 | Five Seat Interior | |
88
89
  | CC02 | Six Seat Interior | |
90
+ | CC03 | Seven Seat Interior | |
89
91
  | CC04 | Seven Seat Interior | |
90
92
  | CC12 | Six Seat Interior with Center Console | |
91
93
  | CDM0 | No CHAdeMO Charging Adaptor | |
@@ -109,7 +111,7 @@ return a generic set of codes related to a Model 3.
109
111
  | CPF0 | Standard Connectivity | |
110
112
  | CPF1 | Premium Connectivity | |
111
113
  | CPW1 | 20" Performance Wheels | |
112
- | CW00 | Weather Package | No Cold Weather Package |
114
+ | CW00 | No Weather Package | No Cold Weather Package |
113
115
  | CW02 | Weather Package | Subzero Weather Package |
114
116
  | DA00 | No Autopilot | |
115
117
  | DA01 | Active Safety (ACC,LDW,SA) | Drivers Assistance Package |
@@ -129,9 +131,10 @@ return a generic set of codes related to a Model 3.
129
131
  | FG00 | No Exterior Lighting Package | |
130
132
  | FG01 | Fog Lamps | Exterior Lighting Package |
131
133
  | FG02 | Fog Lamps | Fog Lamps |
132
- | FG31 | Fog Lamps | Premium Fog Lights (Model 3) |
133
- | FM3B | Performance Package (Model 3) | |
134
- | FMP6 | FMP6 | |
134
+ | FG31 | Fog Lamps | Premium Fog Lights | Model 3
135
+ | FM3B | Performance Package | Model 3 |
136
+ | FM3U | Acceleration Boost | Model 3 Long Range All-Wheel Drive |
137
+ | FMP6 | Performance Firmware | |
135
138
  | FR01 | Base Front Row | |
136
139
  | FR02 | Ventilated Front Seats | |
137
140
  | FR03 | FR03 | |
@@ -140,10 +143,10 @@ return a generic set of codes related to a Model 3.
140
143
  | HC00 | No Home Charging installation | |
141
144
  | HC01 | Home Charging Installation | |
142
145
  | HM31 | Teck Package - Homelink | Homelink |
143
- | HL31 | Head Lamp (Model 3) | Uplevel Headlamps |
146
+ | HL31 | Head Lamp | Model 3 Uplevel Headlamps |
144
147
  | HP00 | No HPWC Ordered | |
145
148
  | HP01 | HPWC Ordered | |
146
- | ID3W | (Model 3) Wood Decor | |
149
+ | ID3W | Wood Decor | Model 3 |
147
150
  | IDBA | Dark Ash Wood Decor | |
148
151
  | IDBO | Figured Ash Wood Decor | |
149
152
  | IDCF | Carbon Fiber Decor | |
@@ -154,24 +157,27 @@ return a generic set of codes related to a Model 3.
154
157
  | IDLW | Lacewood Decor | |
155
158
  | IDPB | Piano Black Decor | |
156
159
  | IN3BB | All Black Partial Premium Interior | |
160
+ | IN3BW | Black and White Interior | Model 3 Interior |
157
161
  | IN3PB | All Black Premium Interior | Model 3 Interior |
158
162
  | IN3PW | All White Premium Interior | Model 3 Interior |
159
- | INBBW | White | |
160
- | INBFP | Classic Black | |
161
- | INBPP | Black | |
162
- | INBPW | White Seats | |
163
- | INBTB | Multi-Pattern Black | |
164
- | INFBP | Black Premium | |
165
- | INLPC | Cream | |
166
- | INLPP | Black / Light Headliner | |
163
+ | INBBW | White Interior | |
164
+ | INB3C | Premium beige interior with oak wood finishes | Model X |
165
+ | INBC3W | Premium black and white interior with Carbon Fiber decor | Model X |
166
+ | INBFP | Classic Black Interior | |
167
+ | INBPP | Black Interior | |
168
+ | INBPW | White Seats Interior | |
169
+ | INBTB | Multi-Pattern Black Interior | |
170
+ | INFBP | Black Premium Interior | |
171
+ | INLPC | Cream Interior | |
172
+ | INLPP | Black / Light Headliner Interior | |
167
173
  | INWPT | Tan Interior | |
168
174
  | INYPB | All Black Premium Interior | |
169
175
  | INYPW | Black and White Premium Interior | |
170
- | IL31 | Interior Ambient Lighting | |
176
+ | IL31 | Interior Ambient Lighting Interior | |
171
177
  | IVBPP | All Black Interior | |
172
178
  | IVBSW | Ultra White Interior | |
173
179
  | IVBTB | All Black Interior | |
174
- | IVLPC | Vegan Cream | |
180
+ | IVLPC | Vegan Cream Interior | |
175
181
  | IX00 | No Extended Nappa Leather Trim | |
176
182
  | IX01 | Extended Nappa Leather Trim | |
177
183
  | LLP1 | LLP1 | |
@@ -193,23 +199,52 @@ return a generic set of codes related to a Model 3.
193
199
  | LTPW | Lower Trim PUR White | |
194
200
  | ME01 | Memory Seats | |
195
201
  | ME02 | Seat Memory | Seat Memory LHD Driver |
196
- | MI00 | 2015 Production Refresh | |
197
- | MI01 | 2016 Production Refresh | |
198
- | MI02 | 2017 Production Refresh | |
199
- | MI03 | 201? Production Refresh | Found on Model X ordered 11/2018 delivered 3/2019 |
202
+ | MI00 | 1st Generation Production| Model 3 (2019), Model S (Nosecone), Model X (2016) |
203
+ | MI01 | 2nd Generation Production | Model 3 (2020), Model S (2016 Facelit), Model X (2017) |
204
+ | MI02 | 3rd Generation Production | Model 3 (2021), Model X (2017) |
205
+ | MI03 | 4th Generation Production | Model S (2018), Model X (2018) |
206
+ | MI04 | 5th Generation Production | Model S (2019/2020), Model X (2020/2021) |
200
207
  | MR31 | Tech Package - Mirror -YES | Uplevel Mirrors |
201
- | MT300 | Standard Range Rear-Wheel Drive | |
202
- | MT301 | Standard Range Plus Rear-Wheel Drive | |
203
- | MT320 | Standard Range Plus Rear-Wheel Drive | Late 2020 Refresh |
204
- | MT302 | Long Range Rear-Wheel Drive | |
205
- | MT303 | Long Range All-Wheel Drive | |
206
- | MT315 | Long Range All-Wheel Drive | Late 2020 Refresh |
207
- | MT304 | Long Range All-Wheel Drive Performance | |
208
- | MT317 | Long Range All-Wheel Drive Performance | Late 2020 Refresh |
209
- | MT305 | Mid Range Rear-Wheel Drive | |
210
- | MTY02 | Long Range Rear-Wheel Drive | |
211
- | MTY03 | Long Range All-Wheel Drive | |
212
- | MTY04 | Long Range All-Wheel Drive Performance | |
208
+ | MT300 | Standard Range Rear-Wheel Drive | Model 3 |
209
+ | MT301 | Standard Range Plus Rear-Wheel Drive | Model 3 |
210
+ | MT302 | Long Range Rear-Wheel Drive | Model 3 |
211
+ | MT303 | Long Range All-Wheel Drive | Model 3 |
212
+ | MT304 | Long Range All-Wheel Drive Performance | Model 3 |
213
+ | MT305 | Mid Range Rear-Wheel Drive | Model 3 |
214
+ | MT307 | Mid Range Rear-Wheel Drive | Model 3 |
215
+ | MT308 | Standard Range Plus Rear-Wheel Drive | Model 3 2019 Refresh |
216
+ | MT309 | Standard Range Plus Rear-Wheel Drive | Model 3 2019 Refresh |
217
+ | MT314 | Standard Range Plus Rear-Wheel Drive | Model 3 2021 Refresh |
218
+ | MT320 | Standard Range Plus Rear-Wheel Drive | Model 3 2021 Refresh |
219
+ | MT336 | Standard Range Plus Rear-Wheel Drive | Model 3 2020 Refresh |
220
+ | MT337 | Standard Range Plus Rear-Wheel Drive | Model 3 2021 Refresh |
221
+ | MT310 | Long Range All-Wheel Drive | Model 3 |
222
+ | MT311 | Long Range All-Wheel Drive Performance | Model 3 |
223
+ | MT315 | Long Range All-Wheel Drive | Model 3 2021 Refresh |
224
+ | MT316 | Long Range All-Wheel Drive | Model 3 2021 Refresh |
225
+ | MT317 | Long Range All-Wheel Drive Performance | Model 3 2021 Refresh |
226
+ | MTS01 | Standard Range | Model S |
227
+ | MTS03 | Long Range | Model S |
228
+ | MTS04 | Performance | Model S |
229
+ | MTS05 | Long Range | Model S |
230
+ | MTS06 | Performance | Model S |
231
+ | MTS07 | Long Range Plus | Model S |
232
+ | MTS08 | Performance | Model S |
233
+ | MTS09 | Plaid+ | Model S Refresh 2021 |
234
+ | MTS10 | Long Range | Model S Refresh 2021 |
235
+ | MTS11 | Plaid | Model S Refresh 2021 |
236
+ | MTX01 | Standard Range | Model X |
237
+ | MTX03 | Long Range | Model X |
238
+ | MTX04 | Performance | Model X |
239
+ | MTX05 | Long Range Plus | Model X |
240
+ | MTX06 | Performance | Model X |
241
+ | MTX07 | Long Range Plus | Model X |
242
+ | MTX08 | Performance | Model X |
243
+ | MTX10 | Long Range | Model X Refresh 2021 |
244
+ | MTX11 | Plaid | Model X Refresh 2021 |
245
+ | MTY02 | Long Range Rear-Wheel Drive | Model Y |
246
+ | MTY03 | Long Range All-Wheel Drive | Model Y |
247
+ | MTY04 | Long Range All-Wheel Drive Performance | Model Y |
213
248
  | OSSB | Safety CA Black | |
214
249
  | OSSW | Safety CA White | |
215
250
  | PA00 | No Paint Armor | |
@@ -276,13 +311,13 @@ return a generic set of codes related to a Model 3.
276
311
  | QXMB | Black Leather Seat | |
277
312
  | RCX0 | No Rear Console | |
278
313
  | RCX1 | Rear Console | |
279
- | RF3G | Model 3 Glass Roof | |
280
- | RFBK | Black Roof | |
281
- | RFBC | Body Color Roof | Roof |
282
- | RFFG | Glass Roof | 2017 Production Refresh |
283
- | RFPO | All Glass Panoramic Roof | 2015 Production Refresh |
284
- | RFP2 | Sunroof | 2016 Production Refresh |
285
- | RFPX | Model X Roof | |
314
+ | RF3G | Glass Roof | Model 3 |
315
+ | RFBK | Black Roof | Model S |
316
+ | RFBC | Body Color Roof | Model S |
317
+ | RFFG | Glass Roof | Model S 2017 Production Refresh |
318
+ | RFPO | All Glass Panoramic Roof | Model S 2015 Production Refresh |
319
+ | RFP2 | Sunroof | Model S 2016 Production Refresh |
320
+ | RFPX | Glass Roof | Model X |
286
321
  | RSF1 | Rear Heated Seats | |
287
322
  | RU00 | No Range Upgrade | |
288
323
  | S01B | Black Textile Seats | |
@@ -316,7 +351,7 @@ return a generic set of codes related to a Model 3.
316
351
  | SU00 | Standard Suspension | |
317
352
  | SU01 | Smart Air Suspension | |
318
353
  | SU03 | Suspension Update | Model X 2020 |
319
- | SU3C | Suspension | Coil spring suspension |
354
+ | SU3C | Coil Spring Suspension | |
320
355
  | T3MA | Tires M3 | 18 Michelin All Season, Square |
321
356
  | TIC4 | Tires | All-Season Tires |
322
357
  | TIG2 | Summer Tires | |
@@ -355,7 +390,9 @@ return a generic set of codes related to a Model 3.
355
390
  | W38B | 18" Aero Wheels | For the Model 3 and Model Y |
356
391
  | W39B | 19" Sport Wheels | |
357
392
  | WR00 | No Wrap | |
393
+ | WS90 | 19" Tempest Wheels | Model S Refresh 2021 |
358
394
  | WT19 | 19" Wheels | |
395
+ | WS10 | 21" Arachnid Wheels | Model S Refresh 2021 |
359
396
  | WT20 | 20" Silver Slipstream Wheels | |
360
397
  | WT22 | 22" Silver Turbine Wheels | |
361
398
  | WTAB | 21" Black Arachnid Wheels | |
@@ -365,6 +402,7 @@ return a generic set of codes related to a Model 3.
365
402
  | WTNS | 20" Nokian Winter Tires (studded) | |
366
403
  | WTP2 | 20" Pirelli Winter Tires | |
367
404
  | WTSC | 20" Sonic Carbon Wheels | |
405
+ | WTSD | 20" Two-Tone Slipstream Wheels | |
368
406
  | WTSG | 21" Turbine Wheels | |
369
407
  | WTSP | 21" Turbine Wheels | |
370
408
  | WTSS | 21" Turbine Wheels | |
@@ -381,6 +419,8 @@ return a generic set of codes related to a Model 3.
381
419
  | WTW7 | 19" Nokian Winter Tires (non-studded) | |
382
420
  | WTW8 | 19" Pirelli Winter Tires | |
383
421
  | WTX1 | 19" Michelin Primacy Tire Upgrade | |
422
+ | WX00 | 20" Cyberstream Wheels | Model X Refresh 2021 |
423
+ | WX20 | 22" Turbine Wheels | Model X Refresh 2021 |
384
424
  | WXNN | No 20" Nokian Winter Tires (non-studded) | |
385
425
  | WXNS | No 20" Nokian Winter Tires (studded) | |
386
426
  | WXP2 | No 20" Pirelli Winter Tires | |
@@ -408,7 +448,7 @@ return a generic set of codes related to a Model 3.
408
448
  | X020 | No Performance Exterior | |
409
449
  | X021 | No Rear Carbon Fiber Spoiler | |
410
450
  | X024 | Performance Package | |
411
- | X025 | Performance Powertrain | |
451
+ | X025 | No Performance Powertrain | |
412
452
  | X026 | Door handle | No light handle |
413
453
  | X027 | Lighted Door Handles | Light handle |
414
454
  | X028 | Battery Badge | Normal Badging |