This changelog contains all major updates and feature additions to version 2.0 of Smartcar’s APIs.

v2.0 SDK methods

If you are using one of our SDKs, please add the following code block to specify that all requests should be made to v2.0 of the Smartcar API.

Note: It’s best to invoke the method from a “central” part of your codebase, as the helper method only needs to be invoked once rather than before every API request.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
const smartcar = require('smartcar');

smartcar.setApiVersion('2.0');

If you are not using any of our SDKs, simply replace /v1.0/ with /v2.0/ in the URLs that you construct.

Compatibility

The Compatibility API has been updated to return a more detailed response that provides an endpoint-by-endpoint breakdown of what the vehicle is capable of.

The previous version of the Compatibility API returned a single field named compatible, which encapsulated both the vehicle’s compatibility with Smartcar and the vehicle’s capability to carry out all of the permissions that were passed into the scope parameter. This new version of the Compatibility API breaks this single field down into the following fields:

    • compatible: Does the vehicle have the required hardware for internet connectivity and does it belong to the set of makes and models that Smartcar is compatible with?

      Note: The meaning of this field has changed compared to v1.0.

    • capabilities: A list of the endpoints that the permissions passed into the scope parameter provide access to. Each entry has a field named capable that indicates whether the vehicle capable of supporting that specific endpoint.

Please see the API reference for more detail on the new response format.

Example

GET https://api.smartcar.com/v2.0/compatibility?vin=PLACEHOLDER&scope=read_battery&country=us
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
{
  "compatible": true,
  "reason": null,
  "capabilities": [
    {
      "permission": "read_battery",
      "endpoint": "/battery",
      "capable": true,
      "reason": null
    },
    {
      "permission": "read_battery",
      "endpoint": "/battery/capacity",
      "capable": false,
      "reason": "VEHICLE_NOT_CAPABLE"
    }
  ]
}

Migration Steps

The simplest migration path would entail replacing mentions of compatible with a logical AND between compatible and capabilities[].capable. However, we recommend modifying your application logic to make use of the more detailed information that the new version of the Compatibility API offers.

We recommend using logic similar to the following:

  1. If compatible is false, use the reason field to let the user know that their vehicle is not compatible because it does not have the required hardware (reason = VEHICLE_NOT_CAPABLE) or because their vehicle is not yet supported (reason = UNSUPPORTED_MAKE).
  2. Iterate through the list of capabilities to check whether the vehicle is capable of the endpoints that your application requires. While iterating through the list, collect the subset of permissions that the vehicle is capable of.
  3. Launch Connect with scope set to the list of permissions that the vehicle is capable of.

Errors

We updated the errors returned by Smartcar’s API and webhooks to include a lot more detail. We also introduced new error types and codes to let developers more easily investigate Smartcar errors.

Smartcar errors now contain the following properties:

PropertyDescription
typeA unique identifier that groups codes into broad categories of errors. This property roughly maps to the “error” property in version 1.0, but we have renamed the types and introduced new ones.
codeA short, descriptive identifier for the error that occurred. This property roughly maps to the “code” property in version 1.0, but we have renamed the codes and introduced new ones.
descriptionA short description of the code that provides additional information about the error. This property maps to the “message” property in version 1.0.
docURLA link to Smartcar’s doc center guide for the given type and code
statusCodeThe HTTP status code
requestIdSmartcar’s request ID
resolutionAn enumerated type that specifies which action can be taken to resolve this error

Migration steps

  1. Reference body.type instead of body.error.
  2. Reference body.description instead of body.message.
  3. Make use of the new values of type and code rather than the old values by referencing the mapping in the table below. Note that some version 1.0 errors map to multiple version 2.0 errors, as version 2.0 contains more detailed errors.
The above steps correspond to the minimal amount of work that you’ll need to do in order to start using version 2.0 of the Smartcar API. In addition to those steps, we recommend that you read the new error guides and make use of all new codes and properties.
error (1.0)code (1.0)type (2.0)code (2.0)
validation_errorN/AVALIDATIONnull
vehicle_owner_action_requiredVOA_000CONNECTED_SERVICES_ACCOUNTAUTHENTICATION_FAILED
vehicle_owner_errorVOA_001CONNECTED_SERVICES_ACCOUNTSUBSCRIPTION
vehicle_owner_errorVOA_002CONNECTED_SERVICES_ACCOUNTNO_VEHICLES
vehicle_owner_errorVOA_002CONNECTED_SERVICES_ACCOUNTVEHICLE_MISSING
vehicle_owner_errorVOA_003CONNECTED_SERVICES_ACCOUNTACCOUNT_ISSUE
authentication_errorN/AAUTHENTICATIONnull
permission_errorN/APERMISSIONnull
resource_not_found_errorN/ARESOURCE_NOT_FOUNDPATH
version_not_found_errorN/ARESOURCE_NOT_FOUNDVERSION
vehicle_state_errorVS_000VEHICLE_STATEUNKNOWN
vehicle_state_errorVS_001VEHICLE_STATEDOOR_OPEN
vehicle_state_errorVS_002VEHICLE_STATETRUNK_OPEN
vehicle_state_errorVS_003VEHICLE_STATEHOOD_OPEN
vehicle_state_errorVS_004VEHICLE_STATECHARGING_PLUG_NOT_CONNECTED
vehicle_state_errorVS_005VEHICLE_STATEFULLY_CHARGED
vehicle_state_errorVS_006VEHICLE_STATEASLEEP
vehicle_state_errorVS_007VEHICLE_STATEUNREACHABLE
vehicle_state_errorVS_008VEHICLE_STATEIGNITION_ON
vehicle_state_errorVS_009VEHICLE_STATEIN_MOTION
vehicle_state_errorVS_010VEHICLE_STATEREMOTE_ACCESS_DISABLED
vehicle_state_errorVS_011VEHICLE_STATECHARGING_IN_PROGRESS
rate_limiting_errorN/ARATE_LIMITSMARTCAR_API
monthly_limit_exceededN/ABILLINGVEHICLE_LIMIT
monthly_limit_exceededN/ABILLINGVEHICLE_REQUEST_LIMIT
server_errorN/ASERVERINTERNAL
server_errorN/AUPSTREAMNO_RESPONSE
server_errorN/AUPSTREAMINVALID_DATA
server_errorN/AUPSTREAMKNOWN_ISSUE
server_errorN/AUPSTREAMUNKNOWN_ISSUE
vehicle_not_capable_errorN/ACOMPATIBILITYSMARTCAR_NOT_CAPABLE
vehicle_not_capable_errorN/ACOMPATIBILITYVEHICLE_NOT_CAPABLE

Webhook verification

The verification payload now includes the ID of the requested webhook. It also includes an eventName property that lets you distinguish verify events from other webhook events. For verify events, the eventName property will be set to “verify”. The challenge property is now nested under a payload property.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
{
  "version": "2.0",
  "webhookId": "uuid",
  "eventName": "verify",
  "payload": {
    "challenge": "string"
  }
}

Migration steps

  1. Reference body.payload.challenge instead of body.challenge.
  2. (Optional:) Use body.eventName to detect a webhook verification request rather than checking for the presence of the challege property.

Webhook event payloads

The vehicles property is now nested under a payload property.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
{
  "version": "2.0",
  "webhookId": "uuid",
  "eventName": "schedule",
  "mode": "test|live",
  "payload": {
    "vehicles": []
  }
}

Migration steps

  1. Reference body.payload.vehicles instead of body.vehicles.