Learn how API Authentication works for server-to-server communication with the Smartcar API.
API Authentication is an authentication method for server-to-server communication with Smartcar. Your application obtains a single application-level access token using the OAuth 2.0 Client Credentials flow.
API Authentication uses the OAuth 2.0 Client Credentials flow, designed for server-to-server scenarios where no user interaction occurs.Here’s the flow:
Authenticate: Exchange your Client ID and Secret for an access token
Make Requests: Use the access token for all subsequent API calls
The access token is valid for 1 hour. When it expires, request a new one from the token endpoint.
The userId is a unique identifier within the Smartcar platform representing a specific user’s vehicle connection. You obtain this ID from the Connections API when a user grants access to their vehicle.
The sc-user-id header is required when accessing vehicle signals and issuing commands. It tells the API which user’s vehicle connection to operate on. You obtain the userId from the Connect redirect URL when a user completes the authorization flow.
GET https://vehicle.api.smartcar.com/v3/vehicles/{id}/signalsAuthorization: Bearer YOUR_ACCESS_TOKENsc-user-id: {userId}
The header is also accepted on the /connections endpoint to filter results by user.