Smartcar Node SDK documentation.
- AuthClient
- SmartcarError
Class to handle all errors from Smartcar API Please see our error guides to see a list of all the possible error types and codes of both v2.0 and v1.0 requests.
- SmartcarService
- Vehicle
- METHODS_MAP :
object.<String, Object>
Every key here is the function name on vehicle This map is used to generate the methods dynamically. Every value is an object of the following fields :
- requestType: http request type, defaults to 'get' if not mentioned.
- path: url path to hit, defaults to the method name
- body: body for post requests.
- Access :
Object
- Permissions :
Object
- DiagnosticSystemStatus :
Object
- DiagnosticSystemStatusResponse :
Object
- DiagnosticTroubleCode :
Object
- DiagnosticTroubleCodesResponse :
Object
- ServiceHistory :
Object
- ChargeLimit
- WebhookSubscription :
Object
- Batch :
Object
- Response :
Object
- Meta :
Object
- Vin :
Object
- Charge :
Object
- Battery :
Object
- BatteryCapacity :
Object
- NominalCapacity :
Object
- Fuel :
Object
- TirePressure :
Object
- EngineOil :
Object
- Odometer :
Object
- SecurityResponse :
Object
- Location :
Object
- Attributes :
Object
- ActionResponse :
Object
- smartcar
- static
- .SmartcarError
- .Vehicle
- .AuthClient
- .setApiVersion(version)
- .getApiVersion() ⇒
String
- .getUser(accessToken) ⇒
User
- .getVehicles(accessToken, [paging]) ⇒
VehicleIds
- .getCompatibility(vin, scope, [country], [options]) ⇒
Compatibility
- .hashChallenge(amt, challenge) ⇒
String
- .verifyPayload(amt, signature, body) ⇒
Boolean
- inner
- ~User :
Object
- ~VehicleIds :
Object
- ~Compatibility :
Object
- ~GetConnections ⇒
GetConnections
- ~DeleteConnections ⇒
DeleteConnections
- ~User :
- static
Kind: static property of smartcar
See: module:errors
Kind: static property of smartcar
See: Vehicle
Kind: static property of smartcar
See: AuthClient
Sets the version of Smartcar API you are using
Kind: static method of smartcar
Param | Type |
---|---|
version | String |
Gets the version of Smartcar API that is set
Kind: static method of smartcar
Returns: String
- version
smartcar.getUser(accessToken) ⇒ User
Return the user's id.
Kind: static method of smartcar
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
Param | Type | Description |
---|---|---|
accessToken | String |
access token |
smartcar.getVehicles(accessToken, [paging]) ⇒ VehicleIds
Return list of the user's vehicles ids.
Kind: static method of smartcar
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
Param | Type | Description |
---|---|---|
accessToken | String |
access token |
[paging] | Object |
|
[paging.limit] | Number |
number of vehicles to return |
[paging.offset] | Number |
index to start vehicle list |
smartcar.getCompatibility(vin, scope, [country], [options]) ⇒ Compatibility
Determine whether a vehicle is compatible with Smartcar.
A compatible vehicle is a vehicle that:
- has the hardware required for internet connectivity,
- belongs to the makes and models Smartcar supports, and
- supports the permissions.
To use this function, please contact us!
Kind: static method of smartcar
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
Param | Type | Default | Description |
---|---|---|---|
vin | String |
the VIN of the vehicle | |
scope | Array.<String> |
list of permissions to check compatibility for | |
[country] | String |
'US' |
an optional country code according to ISO 3166-1 alpha-2. |
[options] | Object |
||
[options.testMode] | Boolean |
Deprecated, please use mode instead. Launch Smartcar Connect in test mode. |
|
[options.mode] | String |
Determine what mode Smartcar Connect should be launched in. Should be one of test, live or simulated. | |
[options.testModeCompatibilityLevel] | String |
This string determines which permissions the simulated vehicle is capable of. Possible Values can be found at this link: (https://smartcar.com/docs/integration-guide/test-your-integration/test-requests/#test-successful-api-requests-with-specific-vins) |
Generate hash challenege for webhooks. It does HMAC_SHA256(amt, challenge)
Kind: static method of smartcar
Returns: String
- String representing the hex digest
Param | Type | Description |
---|---|---|
amt | String |
Application Management Token |
challenge | String |
Challenge string |
Verify webhook payload with AMT and signature.
Kind: static method of smartcar
Returns: Boolean
- true if signature matches the hex digest of amt and body
Param | Type | Description |
---|---|---|
amt | String |
Application Management Token |
signature | String |
sc-signature header value |
body | object |
webhook response body |
Kind: inner typedef of smartcar
Properties
Name | Type | Description |
---|---|---|
id | String |
User Id |
meta | module:smartcar.Vehicle.Meta |
Example
{
id: "e0514ef4-5226-11e8-8c13-8f6e8f02e27e",
meta: {
requestId: 'b9593682-8515-4f36-8190-bb56cde4c38a',
}
}
Kind: inner typedef of smartcar
Properties
Name | Type | Description |
---|---|---|
vehicles | Array.<String> |
A list of the user's authorized vehicle ids. |
paging | Object |
|
paging.count- | Number |
The total number of vehicles. |
paging.offset | Number |
The current start index of returned vehicle ids. |
meta | module:smartcar.Vehicle.Meta |
Example
{
vehicles: [
'36ab27d0-fd9d-4455-823a-ce30af709ffc',
'770bdda4-2429-4b20-87fd-6af475c4365e',
],
paging: {
count: 2,
offset: 0,
},
meta: {
requestId: 'b9593682-8515-4f36-8190-bb56cde4c38a',
}
}
Kind: inner typedef of smartcar
Properties
Name | Type |
---|---|
compatible | Boolean |
reason | VEHICLE_NOT_COMPATIBLE | MAKE_NOT_COMPATIBLE | null |
capabilities | Array.<String> |
capabilities[].permission | String |
capabilities[].endpoint | String |
capabilities[].capable | Boolean |
capabilities[].reason | VEHICLE_NOT_COMPATIBLE | MAKE_NOT_COMPATIBLE | null |
meta | module:smartcar.Vehicle.Meta |
Example
{
compatible: true,
reason: null,
capabilities: [
{
capable: false,
endpoint: '/engine/oil',
permission: 'read_engine_oil',
reason: 'SMARTCAR_NOT_CAPABLE',
},
{
capable: true,
endpoint: '/vin',
permission: 'read_vin',
reason: null,
},
],
meta: {
'requestId':'6d4226e7-a7dd-44e0-b29c-9eed26be249d'
}
}
Returns a paged list of all the vehicles that are connected to the application associated with the management API token used sorted in descending order by connection date.
Kind: inner typedef of smartcar
Param | Type | Description |
---|---|---|
amt | String |
Application Management Token |
filter | object |
|
filter.userId | String |
|
filter.vehicleId | String |
|
paging | object |
|
paging.limit | number |
|
paging.cursor | String |
Properties
Name | Type |
---|---|
vehicleId | String |
userId | String |
connectedAt | String |
connections | Array.<Connection> |
[paging] | Object |
[paging.cursor] | string |
Deletes all the connections by vehicle or user ID and returns a list of all connections that were deleted.
Kind: inner typedef of smartcar
Param | Type | Description |
---|---|---|
amt | String |
Application Management Token |
filter | object |
|
filter.userId | String |
|
filter.vehicleId | String |
Properties
Name | Type |
---|---|
vehicleId | String |
userId | String |
connections | Array.<Connection> |
Kind: global class
Create a Smartcar OAuth client for your application.
Param | Type | Default | Description |
---|---|---|---|
options | Object |
||
options.clientId | String |
Application client id obtained from Smartcar Developer Portal. If you do not have access to the dashboard, please request access. | |
options.clientSecret | String |
The application's client secret. | |
options.redirectUri | String |
Redirect URI registered in the application settings. The given URL must exactly match one of the registered URLs. | |
[options.testMode] | Boolean |
false |
Deprecated, please use mode instead. Launch Smartcar Connect in test mode. |
[options.mode] | String |
'live' |
Determine what mode Smartcar Connect should be launched in. Should be one of test, live or simulated. |
Generate the Smartcar Connect URL.
By default users are not shown the permission dialog if they have already
approved the set of scopes for this application. The application can elect
to always display the permissions dialog to the user by setting
approval_prompt to force
.
Kind: instance method of AuthClient
Returns: String
- Smartcar Connect URL to direct user to.
Param | Type | Description |
---|---|---|
[scope] | Array.<String> |
List of permissions your application requires. The valid permission names are found in the API Reference |
[options] | Object |
|
[options.forcePrompt] | Boolean |
Setting forcePrompt to true will show the permissions approval screen on every authentication attempt, even if the user has previously consented to the exact scope of permissions. |
[options.singleSelect] | Boolean | Object |
An optional value that sets the behavior of the grant dialog displayed to the user. Object can contain two keys : - enabled - Boolean value, if set to true , single_select limits the user to selecting only one vehicle. - vin - String vin, if set, Smartcar will only authorize the vehicle with the specified VIN. See the Single Select guide for more information. |
[options.state] | String |
OAuth state parameter passed to the redirect uri. This parameter may be used for identifying the user who initiated the request. |
[options.makeBypass] | Object |
An optional parameter that allows users to bypass the car brand selection screen. For a complete list of supported makes, please see our API Reference documentation. |
[options.flags] | Object |
Object of flags where key is the name of the flag value is string or boolean value. |
[options.user] | String |
An optional unique identifier for a vehicle owner. This identifier is used to aggregate analytics across Connect sessions for each vehicle owner. |
Example
https://connect.smartcar.com/oauth/authorize?
response_type=code
&client_id=8229df9f-91a0-4ff0-a1ae-a1f38ee24d07
&scope=read_odometer read_vehicle_info
&redirect_uri=https://example.com/home
&state=0facda3319
&make=TESLA
&single_select=true
&single_select_vin=5YJSA1E14FF101307
&flags=country:DE color:00819D
&user=61a3e3d2-5198-47ba-aabd-4623ce4a4042
authClient.exchangeCode(code) ⇒ Access
Exchange an authorization code for an access object.
Kind: instance method of AuthClient
Returns: Access
- New set of Access and Refresh tokens.
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
Param | Type | Description |
---|---|---|
code | String |
Authorization code to exchange for a Smartcar access token and refresh token. |
[options.flags] | Object |
Object of flags where key is the name of the flag value is string or boolean value. |
authClient.exchangeRefreshToken(token) ⇒ Access
Exchange a refresh token for a new access object.
Kind: instance method of AuthClient
Returns: Access
- New set of Access and Refresh tokens.
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
Param | Type | Description |
---|---|---|
token | String |
Refresh token to exchange for a new set of Access and Refresh tokens. |
[options.flags] | Object |
Object of flags where key is the name of the flag value is string or boolean value. |
Class to handle all errors from Smartcar API Please see our error guides to see a list of all the possible error types and codes of both v2.0 and v1.0 requests.
Kind: global class
- SmartcarError
- new SmartcarError(status, body, headers)
- .error :
string
- .message :
string
- .description :
string
- .type :
string
- .code :
string
- .statusCode :
number
- .requestId :
string
- .resolution :
Resolution
- .docURL :
string
- .details :
Array.<object>
- .Resolution :
Object
Param | Type | Description |
---|---|---|
status | number |
response status |
body | object |
response body |
headers | object |
response headers |
Legacy field from V1 error depicting a category/type/description of the error.
Kind: static property of SmartcarError
Error message field inherited from StandardError
Kind: static property of SmartcarError
Description of meaning of the error.
Kind: static property of SmartcarError
Type of error
Kind: static property of SmartcarError
Error code
Kind: static property of SmartcarError
HTTP status code
Kind: static property of SmartcarError
Unique identifier for request
Kind: static property of SmartcarError
SmartcarError.resolution : Resolution
Possible resolution for fixing the error
Kind: static property of SmartcarError
Reference to Smartcar documentation
Kind: static property of SmartcarError
Further detail about the error in form of array of objects
Kind: static property of SmartcarError
Kind: static typedef of SmartcarError
Properties
Name | Type | Description |
---|---|---|
type | String |
Possible hint to fixing the issue |
url | String |
A URL to help resolve the issue or resume the operation |
Initializes a new Service object to make requests to the Smartcar API.
Param | Type | Description |
---|---|---|
[options] | Object |
|
[options.baseUrl] | String |
Host/Base URL for the requests |
[options.auth] | Object |
authorization options |
[options.headers] | Object |
headers to add |
Kind: global class
- Vehicle
- new Vehicle(id, token, [options])
- .permissions([paging]) ⇒
Permissions
- .diagnosticSystemStatus() ⇒
DiagnosticSystemStatusResponse
- .diagnosticTroubleCodes() ⇒
DiagnosticTroubleCodesResponse
- .serviceHistory([startDate], [endDate]) ⇒
Array.<ServiceHistory>
- .getChargeLimit() ⇒
ChargeLimit
- .setChargeLimit(limit) ⇒
ChargeLimit
- .sendDestination(latitude, longitude) ⇒
ActionResponse
- .subscribe(webhookId) ⇒
Object
- .unsubscribe(amt, webhookId) ⇒
Meta
- .batch(paths) ⇒
Batch
- .request(method, path, body, headers) ⇒
Response
- .vin() ⇒
Vin
- .charge() ⇒
Charge
- .battery() ⇒
Battery
- .batteryCapacity() ⇒
BatteryCapacity
- .nominalCapacity() ⇒
NominalCapacity
- .fuel() ⇒
Fuel
- .tirePressure() ⇒
TirePressure
- .engineOil() ⇒
EngineOil
- .odometer() ⇒
Odometer
- .location() ⇒
Location
- .attributes() ⇒
Attributes
- .lock() ⇒
ActionResponse
- .unlock() ⇒
ActionResponse
- .startCharge() ⇒
ActionResponse
- .stopCharge() ⇒
ActionResponse
- .disconnect() ⇒
ActionResponse
- .lockStatus() ⇒
LockStatus
Initializes a new Vehicle to use for making requests to the Smartcar API.
Param | Type | Default | Description |
---|---|---|---|
id | String |
The vehicle's unique identifier. Retrieve a user's vehicle id using getVehicles. | |
token | String |
A valid access token | |
[options] | Object |
||
[options.unitSystem] | String |
metric |
The unit system to use for vehicle data must be either metric or imperial . |
[options.version] | Object |
API version to use | |
[options.flags] | Object |
Object of flags where key is the name of the flag and value is string or boolean value. |
vehicle.permissions([paging]) ⇒ Permissions
Fetch the list of permissions that this application has been granted
Kind: instance method of Vehicle
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
Param | Type | Description |
---|---|---|
[paging] | Object |
|
[paging.limit] | String |
number of permissions to return |
[options.offset] | Object |
The current start index of the returned list of elements. |
vehicle.diagnosticSystemStatus() ⇒ DiagnosticSystemStatusResponse
Fetches diagnostic system status information for the vehicle.
Kind: instance method of Vehicle
Returns: DiagnosticSystemStatusResponse
- - The response containing diagnostic system statuses.
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
Example
{
"systems": [
{
"systemId": "SYSTEM_TPMS",
"status": "ALERT",
"description": "Left rear tire sensor battery low"
},
{
"systemId": "SYSTEM_AIRBAG",
"status": "OK",
"description": null
},
{
"systemId": "SYSTEM_ABS",
"status": "ALERT",
"description": null
},
// Additional diagnostic systems
]
}
vehicle.diagnosticTroubleCodes() ⇒ DiagnosticTroubleCodesResponse
Fetches active diagnostic trouble codes (DTCs) for the vehicle.
Kind: instance method of Vehicle
Returns: DiagnosticTroubleCodesResponse
- - The response containing active
diagnostic trouble codes.
Throws:
SmartcarError
- If there is an error with the API request.
Example
{
"activeCodes": [
{
"code": "P302D",
"timestamp": "2024-09-05T14:48:00.000Z"
},
{
"code": "P303D",
"timestamp": null
},
// Additional codes as needed
]
}
vehicle.serviceHistory([startDate], [endDate]) ⇒ Array.<ServiceHistory>
Returns a list of all the service records performed on the vehicle, filtered by the optional date range. If no dates are specified, records from the last year are returned.
Kind: instance method of Vehicle
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
See: Smartcar API Doc - Vehicle Service History
Param | Type | Description |
---|---|---|
[startDate] | String |
The start date for the record filter, either in 'YYYY-MM-DD' or 'YYYY-MM-DDTHH:MM:SS.SSSZ' format. |
[endDate] | String |
The end date for the record filter, similar format to startDate. |
vehicle.getChargeLimit() ⇒ ChargeLimit
Fetch the charge limit for an electric vehicle
Kind: instance method of Vehicle
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
Example
{
limit: .7,
meta: {
requestId: '26c14915-0c26-43c5-8e42-9edfc2a66a0f',
}
}
vehicle.setChargeLimit(limit) ⇒ ChargeLimit
Set the charge limit for an electric vehicle.
Kind: instance method of Vehicle
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
Param | Type | Description |
---|---|---|
limit | number |
a number between 0 and 1 |
Example
{
status: string,
meta: {
requestId: '26c14915-0c26-43c5-8e42-9edfc2a66a0f',
}
}
vehicle.sendDestination(latitude, longitude) ⇒ ActionResponse
Send a destination to the vehicle's navigation system.
Kind: instance method of Vehicle
Returns: ActionResponse
- - A Response object containing the status and metadata.
Throws:
SmartcarError
- An instance of SmartcarError. See the errors section for all possible errors.
Param | Type | Description |
---|---|---|
latitude | number |
Latitude of the destination. Must be a valid latitude value between -90 and 90 (inclusive). |
longitude | number |
Longitude of the destination. Must be a valid longitude value between -180 and 180 (inclusive). |
Example
{
status: string,
meta: {
requestId: '26c14915-0c26-43c5-8e42-9edfc2a66a0f',
}
}
Subscribe the vehicle to given webhook Id
Kind: instance method of Vehicle
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
Param | Type | Description |
---|---|---|
webhookId | String |
Webhook Id to subscribe to. |
vehicle.unsubscribe(amt, webhookId) ⇒ Meta
Unsubscribe the vehicle from given webhook Id
Kind: instance method of Vehicle
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
Param | Type | Description |
---|---|---|
amt | String |
Application management token to be used as authorization |
webhookId | String |
Webhook Id to unsubscribe from. |
vehicle.batch(paths) ⇒ Batch
Make batch requests for supported items
Kind: instance method of Vehicle
Throws:
SmartcarError
- on unsuccessful request. An instance of SmartcarError. See the errors section for all possible errors.
See: Smartcar API Doc - Batch Request
Param | Type | Description |
---|---|---|
paths | Array.<String> |
A list of paths of endpoints to send requests to. |
vehicle.request(method, path, body, headers) ⇒ Response
General purpose method to make a request to a Smartcar endpoint.
Kind: instance method of Vehicle
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
Param | Type | Description |
---|---|---|
method | String |
The HTTP request method to use. |
path | String |
The path to make the request to. |
body | Object |
The request body. |
headers | Object |
The headers to include in the request. |
vehicle.vin() ⇒ Vin
Returns the vehicle's manufacturer identifier (VIN).
Kind: instance method of Vehicle
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
vehicle.charge() ⇒ Charge
Returns the current charge status of the vehicle.
Kind: instance method of Vehicle
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
See: Smartcar API Doc - EV charging status
vehicle.battery() ⇒ Battery
Returns the state of charge (SOC) and remaining range of an electric or plug-in hybrid vehicle's battery.
Kind: instance method of Vehicle
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
See: Smartcar API Doc - EV battery level
vehicle.batteryCapacity() ⇒ BatteryCapacity
Returns the capacity of an electric or plug-in hybrid vehicle's battery.
Kind: instance method of Vehicle
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
See: Smartcar API Doc - EV battery capacity
vehicle.nominalCapacity() ⇒ NominalCapacity
Returns a list of nominal rated battery capacities for a vehicle.
Kind: instance method of Vehicle
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
See: Smartcar API Doc - nominal capacity
vehicle.fuel() ⇒ Fuel
Returns the status of the fuel remaining in the vehicle's gas tank.
Kind: instance method of Vehicle
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
See: Smartcar API Doc - Fuel tank
vehicle.tirePressure() ⇒ TirePressure
Returns the air pressure of each of the vehicle's tires.
Kind: instance method of Vehicle
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
See: Smartcar API Doc - Tire pressure
vehicle.engineOil() ⇒ EngineOil
Returns the remaining life span of a vehicle's engine oil
Kind: instance method of Vehicle
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
See: Smartcar API Doc - Engine oil life
vehicle.odometer() ⇒ Odometer
Returns the vehicle's last known odometer reading.
Kind: instance method of Vehicle
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
See: Smartcar API Doc - Odometer
vehicle.location() ⇒ Location
Returns the last known location of the vehicle in geographic coordinates.
Kind: instance method of Vehicle
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
See: Smartcar API Doc - Location
vehicle.attributes() ⇒ Attributes
Returns make model year and id of the vehicle
Kind: instance method of Vehicle
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
See: Smartcar API Doc - Vehicle attributes
vehicle.lock() ⇒ ActionResponse
Attempts to lock the vehicle.
Kind: instance method of Vehicle
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
vehicle.unlock() ⇒ ActionResponse
Attempts to lock the vehicle.
Kind: instance method of Vehicle
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
See: Smartcar API Doc - Unlock
vehicle.startCharge() ⇒ ActionResponse
Attempts to start charging the vehicle.
Kind: instance method of Vehicle
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
See: Smartcar API Doc - EV start charge
vehicle.stopCharge() ⇒ ActionResponse
Attempts to stop charging the vehicle.
Kind: instance method of Vehicle
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
See: Smartcar API Doc - EV stop charge
vehicle.disconnect() ⇒ ActionResponse
Disconnect this vehicle from the connected application. Note: Calling this method will invalidate your token's access to the vehicle. You will have to reauthorize the user to your application again if you wish to make requests to it again.
Kind: instance method of Vehicle
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
See: Smartcar API Doc - Disconnect
Returns the lock status of the vehicle.
Kind: instance method of Vehicle
Throws:
SmartcarError
- an instance of SmartcarError. See the errors section for all possible errors.
See: Smartcar API Doc - Lock Status
Every key here is the function name on vehicle This map is used to generate the methods dynamically. Every value is an object of the following fields :
- requestType: http request type, defaults to 'get' if not mentioned.
- path: url path to hit, defaults to the method name
- body: body for post requests.
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
expiration | Date |
Date object which represents when the access token expires. |
accessToken | String |
A token to be used for requests to the Smartcar API |
refreshToken | String |
A token which is used to renew access when the current access token expires, expires in 60 days |
refreshExpiration | Date |
Date object which represents when the refresh token expires. |
Example
{
expiration: new Date('2017-05-26T01:21:27.070Z'),
accessToken: '88704225-9f6c-4919-93e7-e0cec71317ce',
refreshToken: '60a9e801-6d26-4d88-926e-5c7f9fc13486',
refreshExpiration: new Date('2017-05-26T01:21:27.070Z'),
}
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
permissions | Array.<String> |
An array of permissions names. |
[paging] | Object |
|
[paging.count] | Number |
The total number of elements for the entire query (not just the given page). |
[options.offset] | Number |
The current start index of the returned list of elements. |
meta | Meta |
Example
{
permissions: ['read_vehicle_info'],
paging: {
count: 25,
offset: 10
},
meta: {
requestId: '26c14915-0c26-43c5-8e42-9edfc2a66a0f',
}
}
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
systemId | string |
The identifier for the vehicle's system. |
status | string |
The status of the system, either 'OK' or 'ALERT'. |
description | string | null |
Additional details about the system's status, if any. |
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
systems | Array.<DiagnosticSystemStatus> |
An array of diagnostic system statuses. |
meta | Meta |
Metadata about the request. |
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
code | string |
The diagnostic trouble code identifier. |
timestamp | string | null |
ISO 8601 formatted timestamp indicating when the code was triggered, may be null if not available. |
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
activeCodes | Array.<DiagnosticTroubleCode> |
An array of active diagnostic trouble codes. |
meta | Meta |
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
serviceID | Number | null |
The unique identifier for the service record, or null if not available. |
serviceDate | String |
The date and time the service was performed. |
odometerDistance | Number |
The odometer reading at the time of service, in miles or kilometers based on the unit system. |
serviceTasks | Array.<ServiceTask> |
A list of tasks performed during the service. |
serviceDetails | ServiceDetails |
Details about the service provider and the type of service. |
serviceCost | ServiceCost |
The cost of the service with currency. |
meta | Meta |
Metadata related to the service record. |
Example
[
{
serviceId: 12345,
serviceDate: "2022-07-10T16:20:00.000Z",
odometerDistance: 50000,
serviceTasks: [
{
taskId: 01,
taskDescription: "oil change"
}
],
serviceDetails: {
type: "dealership" // "manual_entry" could be another possible value
},
serviceCost: {
totalCost: 100,
currency: 'USD'
},
meta: {
dataAge: new Date('2023-04-30T07:20:50.844Z'),
unitSystem: 'imperial',
requestId: 'b3c14915-0c26-43c5-8e42-9edfc2a66b2f',
fetchedAt: new Date('2023-04-30T07:20:51.844Z'),
}
}
// ... additional service records
]
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
limit | number |
the charge limit expressed as a decimal value between 0 and 1. |
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
webhookId | String |
Webhook Id that the vehicle was subscribed to |
vehicleId | String |
Current vehicle id that was subscribed to the webhook |
meta | Meta |
Example
{
webhookId: 'dd214915-0c26-13c5-8e42-7edfc2ab320a',
vehicleId: '19c0cc8c-80e0-4182-9372-6ef903c7599c',
meta: {
requestId: '26c14915-0c26-43c5-8e42-9edfc2a66a0f',
}
}
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
ENDPOINT | function |
The response object for a given ENDPOINT where ENDPOINT is a Smartcar endpoint (i.e. /odometer, /fuel) or throws SmartcarError if the endpoint resulted in an error. |
Example
{
"odometer" : function() => returns odometer object or throws SmartcarError,
"location" : function() => returns odometer location or throws SmartcarError,
}
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
body | String |
The response body |
meta | Meta |
Example
{
body: { distance: 59801.6373441601 },
meta: {
dataAge: 2022-01-20T02:55:25.041Z,
unitSystem: 'imperial',
requestId: 'f787849d-d228-482d-345f-459a5154sg73',
fetchedAt: 2022-01-20T02:55:25.041Z
}
}
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
dataAge | Date |
The timestamp of when the data was recorded; returned if applicable. |
fetchedAt | Date |
The timestamp when the data was fetched from the vehicle |
requestId | String |
The smartcar request ID for debugging |
unitSystem | String |
Unit system used, metric or imperial; returned if applicable. |
Example
{
requestId: 'b9593682-8515-4f36-8190-bb56cde4c38a',
dataAge: new Date('2018-05-04T07:20:50.844Z'),
unitSystem: 'imperial',
fetchedAt: new Date('2018-05-04T07:20:51.844Z'),
}
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
vin | String |
VIN of the vehicle |
meta | Meta |
Example
{
vin: '12345678901234567',
meta: {
requestId: 'b9593682-8515-4f36-8190-bb56cde4c38a',
}
}
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
isPluggedIn | Boolean |
Indicates whether charging cable is plugged in. |
state | String |
Indicates the current state of the charge system. Can be FULLY_CHARGED , CHARGING , or NOT_CHARGING . |
meta | Meta |
Example
{
isPluggedIn: false,
state: "FULLY_CHARGED",
meta: {
dataAge: new Date('2018-05-04T07:20:50.844Z'),
fetchedAt: new Date('2018-05-04T07:20:51.844Z'),
}
}
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
range | Number |
The estimated remaining distance the car can travel (in kms or miles). Unit is passed as a parameter in vehicle constructor. |
percentRemaining | Number |
The remaining level of charge in the battery (in percent). |
meta | Meta |
Example
{
range: 40.5,
percentRemaining: 0.3,
meta: {
dataAge: new Date('2018-05-04T07:20:50.844Z'),
unitSystem: 'imperial',
requestId: '26c14915-0c26-43c5-8e42-9edfc2a66a0f',
fetchedAt: new Date('2018-05-04T07:20:51.844Z'),
}
}
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
capacity | Number |
The total capacity of the vehicle's battery (in kilowatt-hours) |
meta | Meta |
Example
{
capacity: 24,
meta: {
dataAge: new Date('2018-05-04T07:20:50.844Z'),
unitSystem: 'imperial',
requestId: '26c14915-0c26-43c5-8e42-9edfc2a66a0f',
fetchedAt: new Date('2018-05-04T07:20:51.844Z'),
}
}
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
availableCapacities | Array |
A list of the rated nominal capacities available for a vehicle |
capacity | Object |
The rated nominal capacity for the vehicle's battery in kWh |
url | String |
A URL that will launch the flow for a vehicle owner to specify the correct battery capacity for a vehicle |
meta | Meta |
Example
{
"availableCapacities": [
{
"capacity" : 70.9,
"description" : null
},
{
"capacity" : 80.9,
"description" : null
},
{
"capacity" : 90.9,
"description" : "BEV:Extended Range"
}
],
"capacity": null,
"url" : "https://connect.smartcar.com/battery-capacity?vehicle_id=36ab27d0-fd9d-4455-823a-ce30af709ffc&client_id=8229df9f-91a0-4ff0-a1ae-a1f38ee24d07&token=90abecb6-e7ab-4b85-864a-e1c8bf67f2ad&response_type=vehicle_id&redirect_uri="
}
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
range | Number |
The estimated remaining distance the car can travel (in kms or miles). Unit is passed as a parameter in vehicle constructor. |
percentRemaining | Number |
The remaining level of fuel in the tank (in percent). |
amountRemaining | Number |
The amount of fuel in the tank (in liters or gallons (US)). Unit is passed as a parameter in vehicle constructor. |
meta | Meta |
Example
{
range: 40.5,
percentRemaining: 0.3,
amountRemaining: 40.5,
meta: {
dataAge: new Date('2018-05-04T07:20:50.844Z'),
unitSystem: 'imperial',
requestId: '26c14915-0c26-43c5-8e42-9edfc2a66a0f',
fetchedAt: new Date('2018-05-04T07:20:51.844Z'),
}
}
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
frontLeft | Number |
The current air pressure of the front left tire |
frontRight | Number |
The current air pressure of the back right tire |
backLeft | Number |
The current air pressure of the back left tire |
backRight | Number |
The current air pressure of the back right tire |
meta | Meta |
Example
{
frontLeft: 33,
frontRight: 34,
backLeft: 34,
backRight: 33
meta: {
dataAge: new Date('2018-05-04T07:20:50.844Z'),
unitSystem: 'imperial',
requestId: '26c14915-0c26-43c5-8e42-9edfc2a66a0f',
fetchedAt: new Date('2018-05-04T07:20:51.844Z'),
}
}
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
lifeRemaining | Number |
The engine oil's remaining life span (as a percentage). Oil life is based on the current quality of the oil. |
meta | Meta |
Example
{
lifeRemaining: 0.86,
meta: {
dataAge: new Date('2018-05-04T07:20:50.844Z'),
unitSystem: 'imperial',
requestId: '26c14915-0c26-43c5-8e42-9edfc2a66a0f',
fetchedAt: new Date('2018-05-04T07:20:51.844Z'),
}
}
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
distance | Number |
The reading of the vehicle's odometer (in kms or miles). Unit is passed as a parameter in vehicle constructor. |
meta | Meta |
Example
{
distance: 1234.12,
meta: {
dataAge: new Date('2018-05-04T07:20:50.844Z'),
unitSystem: 'imperial',
requestId: '26c14915-0c26-43c5-8e42-9edfc2a66a0f',
fetchedAt: new Date('2018-05-04T07:20:51.844Z'),
}
}
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
isLocked | Boolean |
Whether the vehicle is locked or not. |
doors | Array |
The status of each of the vehicle's doors. |
windows | Array |
The status of each of the vehicle's windows. |
sunroof | Array |
The status of each of the vehicle's sunroof. |
storage | Array |
The status of each of the vehicle's storage. |
chargingPort | Array |
The status of each of the vehicle's chargingPort. |
meta | Meta |
Example
{
isLocked: true,
doors: [
{
type: 'frontLeft',
status: 'LOCKED',
},
{
type: 'frontRight',
status: 'LOCKED',
},
{
type: 'backLeft',
status: 'LOCKED',
},
{
type: 'backRight',
status: 'LOCKED',
},
],
windows: [
{
type: 'frontLeft',
status: 'CLOSED',
},
{
type: 'frontRight',
status: 'CLOSED',
},
{
type: 'backLeft',
status: 'CLOSED',
},
{
type: 'backRight',
status: 'CLOSED',
},
],
sunroof: [
{
type: 'sunroof',
status: 'CLOSED',
},
],
storage: [
{
type: 'rear',
status: 'CLOSED',
},
{
type: 'front',
status: 'CLOSED',
},
],
chargingPort: [
{
type: 'chargingPort',
status: 'CLOSED',
},
],
meta: {
dataAge: new Date('2018-05-04T07:20:50.844Z'),
requestId: '26c14915-0c26-43c5-8e42-9edfc2a66a0f',
fetchedAt: new Date('2018-05-04T07:20:51.844Z'),
},
}
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
latitude | Number |
The vehicle latitude (in degrees). |
longitude | Number |
The vehicle longitude (in degrees). |
meta | Meta |
Example
{
latitude: 37.400880,
longitude: -122.057804,
meta: {
dataAge: new Date('2018-05-04T07:20:50.844Z'),
unitSystem: 'imperial',
requestId: '26c14915-0c26-43c5-8e42-9edfc2a66a0f',
fetchedAt: new Date('2022-01-20T02:55:25.041Z'),
}
}
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
id | String |
The vehicle's unique Smartcar identifier. |
make | String |
The brand of the vehicle. |
model | String |
The specific model of the vehicle. |
year | Number |
The model year of the vehicle. |
meta | Meta |
Example
{
id: '19c0cc8c-80e0-4182-9372-6ef903c7599c',
make: 'TESLA',
model: 'S',
year: 2017,
meta: {
requestId: '26c14915-0c26-43c5-8e42-9edfc2a66a0f',
}
}
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
status | String |
set to success on successful request |
meta | Meta |
Example
{
status: 'success',
meta: {
requestId: '26c14915-0c26-43c5-8e42-9edfc2a66a0f',
}
}