General
What is API Authentication?
What is API Authentication?
sc-user-id header in each request to specify which user’s vehicles you are accessing.How is API Authentication different from per-vehicle access tokens?
How is API Authentication different from per-vehicle access tokens?
sc-user-id header, lets you access any user’s vehicles connected to your application.Who can use API Authentication?
Who can use API Authentication?
Do I have to migrate to API Authentication?
Do I have to migrate to API Authentication?
Setup & Configuration
How do I create API credentials?
How do I create API credentials?
Where do I find my client ID and secret?
Where do I find my client ID and secret?
Can I have multiple API secrets?
Can I have multiple API secrets?
Authentication & Usage
How do I obtain an access token?
How do I obtain an access token?
access_token that you use in subsequent API requests.How long are access tokens valid?
How long are access tokens valid?
Do access tokens have refresh tokens?
Do access tokens have refresh tokens?
What is the sc-user-id header?
What is the sc-user-id header?
sc-user-id header identifies which user’s vehicles you want to access. Since API credentials grant access to all vehicles connected to your application, this header scopes the request to a particular user. Include it in your API requests to ensure you only access the intended user’s vehicle data.Example:How do I get a user's userId?
How do I get a user's userId?
userId is returned in the Smartcar Connect flow after a user authorizes your application. You also receive it in webhook payloads under the user.id field. Store this identifier to use in the sc-user-id header for subsequent API requests on behalf of that user.Migration
Can I use both API Authentication and opaque tokens at the same time?
Can I use both API Authentication and opaque tokens at the same time?
What happens to my existing opaque tokens if I enable API Authentication?
What happens to my existing opaque tokens if I enable API Authentication?
Do I need to change my Connect flow?
Do I need to change my Connect flow?
How do webhooks work with API Authentication?
How do webhooks work with API Authentication?
user.id field nested inside the data object. Both Vehicle Connection Status and Vehicle State events contain the userId alongside the vehicleId. You can use this to identify which user’s vehicle triggered the event and use that userId in subsequent API requests with the sc-user-id header.Security
How should I store API credentials?
How should I store API credentials?
- Store credentials in environment variables or a secrets vault
- Use infrastructure-level security (IAM roles, key management services)
- Never commit credentials to version control
- Rotate secrets regularly according to your security policy
What happens if my client secret is compromised?
What happens if my client secret is compromised?
- Generate a new API credential immediately through the Smartcar Dashboard
- Update your application to use the new secret
- Delete the compromised secret
- Review your audit trail for any unauthorized access
Can an access token access any user's vehicles?
Can an access token access any user's vehicles?
sc-user-id header in each request. Only vehicles connected to that specific user are accessible. Always verify you’re using the correct userId to prevent unauthorized access to other users’ data.
