curl https://auth.smartcar.com/oauth/token \
-X POST \
-H 'Authorization: Basic base64({client_id}:{client_secret})' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'grant_type=authorization_code&code=35a59c0b-745c-436c-a8a2-7758e718dcb8&redirect_uri=https://example.com/home'
access = client.exchange_code('{code}')
access = client.exchangeCode('{code}');;
Auth access = authClient.exchangeCode("{code}");
access = client.exchange_code("{code}")
{
"access_token": "cf7ba7e9-8c5d-417d-a99f-c386cfc235cc",
"token_type": "Bearer",
"expires_in": 7200,
"refresh_token": "58b128ba-8e44-11ee-b9d1-0242ac120002"
}
Vehicle Authorization & Permissions
Auth Code Exchange
To interact with the Smartcar API, you will need to exchange your authorization code from the Connect redirect for an access token. Check the overview page for how to manage your tokens.
POST
/
oauth
/
token
curl https://auth.smartcar.com/oauth/token \
-X POST \
-H 'Authorization: Basic base64({client_id}:{client_secret})' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'grant_type=authorization_code&code=35a59c0b-745c-436c-a8a2-7758e718dcb8&redirect_uri=https://example.com/home'
access = client.exchange_code('{code}')
access = client.exchangeCode('{code}');;
Auth access = authClient.exchangeCode("{code}");
access = client.exchange_code("{code}")
{
"access_token": "cf7ba7e9-8c5d-417d-a99f-c386cfc235cc",
"token_type": "Bearer",
"expires_in": 7200,
"refresh_token": "58b128ba-8e44-11ee-b9d1-0242ac120002"
}
The Vehicles API v2.0 will be deprecated on December 1, 2026. The latest version, v3, was introduced on August 26, 2025. We recommend migrating as soon as possible to ensure continued support and access to new features.
response_type=code. For the v3 API, applications authenticate with application-level M2M tokens (client credentials) and have no authorization code to exchange.
Requesting Access Tokens
HeadersThe HTTP Authorization header using the Basic authentication scheme.To construct the Authorization header value:
- Join your
client_idandclient_secretwith a single colon (:). - Base64-encode the resulting string:
base64({client_id}:{client_secret}) - Prepend
Basic(with a trailing space) to the encoded string.
Basic bXktY2xpZW50LWlkOm15LWNsaWVudC1zZWNyZXQ=Must be set to
application/x-www-form-urlencoded, matching the format of the request body.A valid HTTP User Agent value. This value is typically included in the HTTP requests by the client that is making the request. You usually don’t have to set this manually.
The
redirect_uri provided in the redirect to Connect step. This value is checked to match the URI sent when the user was directed to Connect.If you launch Connect from a single-page or mobile application,
redirect_uri must match the URI passed in your Connect URL, not the redirect for your backend.curl https://auth.smartcar.com/oauth/token \
-X POST \
-H 'Authorization: Basic base64({client_id}:{client_secret})' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'grant_type=authorization_code&code=35a59c0b-745c-436c-a8a2-7758e718dcb8&redirect_uri=https://example.com/home'
access = client.exchange_code('{code}')
access = client.exchangeCode('{code}');;
Auth access = authClient.exchangeCode("{code}");
access = client.exchange_code("{code}")
Response
A string representing a refresh token, which is used to renew access when the current access token expires. The refresh token expires after 60 days.
{
"access_token": "cf7ba7e9-8c5d-417d-a99f-c386cfc235cc",
"token_type": "Bearer",
"expires_in": 7200,
"refresh_token": "58b128ba-8e44-11ee-b9d1-0242ac120002"
}
Was this page helpful?

