Service Account API Tutorial (deprecated)

The Service Account API authentication has been replaced by OAuth2. Head to the OAuth2 Client Credentials page for full details.

The Service Account API provides functionality related to your platform account. The usage is intended from your own cloud infrastructure and the API should not be used from front-end applications.

The Service Account API can today be used for:

  • Doing Vehicle Identification Number (VIN) lookups to see if a vehicle is capable of providing telematics data.
  • Adding and removing fleet vehicles and getting access tokens for cleared vehicles.
  • Managing Device Certificates. Retrieving the certificates is necessary when the HMKit iOS or Android SDK is being used in native smartphone applications.

Once the administrator of your team creates an API key on the team settings page, a cryptographic key-pair is generated according to the JSON Web Token (JWT) standard. The JWT has to always be exchanged for an auth token in order to make requests to any of the functional endpoints.

Here's an overview of the steps:

Include the key-pair information in your back-end system. You can use your preferred JWT library.
Create an auth token per the example below.
Use auth token for all endpoints, e.g. Device Certificate creation or VIN lookup.

Endpoint URL

Note that the base URL is when working with the car emulators and for cars in production mode.

How to create and sign a JWT

The JWT must contain the following claims:



The UUID of the API key


Fixed string: This is used to ensure that the JWT was meant to be used for our REST API


The current datetime, formatted in the Unix timestamp format. This is used to minimize the possibilities of a replay attack, so that a JWT created in the past cannot be reused. Currently a tolerance of 30 seconds is used to account for any clock skew between our servers and the back end servers, but it can be changed, probably shortened in the future. Example value: 1502121268


An unique identifier in the UUID format of the JWT itself to ensure a JWT can be used only once.


The version of the JWT. Currently fixed value 1.


After the JWT is created it must be signed with the private key returned in the Console, using the ES 256 algorithm. A list of libraries in various languages able to perform this can be found on the JSON Web Token official page.


  "iss": "API Key uuid",
  "aud": "",
  "iat": "Current datetime in UNIX timestamp",
  "jti": "A random and unique UUIDv4",
  "ver": 2

Implementation example

This is a full example for getting an auth token. For more languages, check out the examples repo on GitHub.

const jwt = require("jsonwebtoken")
const uuid4 = require('uuid4')
const request = require('request')

var config = {"inserted_at":"2020-06-22T09:38:09","private_key":"-----BEGIN PRIVATE KEY-----\n....\n-----END PRIVATE KEY-----","id":"f6c331c4-9271-4e3b-a8c4-6a2cacac6451"}

var payload = {
    ver: 2,
    aud: "",
    jti: uuid4(),
    iat: Math.round( / 1000),

const privateKey = Buffer.from(config.private_key, 'utf8')
const jwtToken = jwt.sign(payload, privateKey, { algorithm: 'ES256' }){
    url: '',
    formData: {assertion: jwtToken}
(error, response, body) => {
console.log('error:', error)
console.log('statusCode:', response && response.statusCode)
console.log('body:', body)

Use the access token which was obtained via /v1/auth_tokens endpoint as Bearer in other API calls


curl -X POST '' \
--header 'Content-Type: application/json' \
--data-raw '{"assertion":"eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJodHRwczovL3NhbmRib3guYXBpLmhpZ2gtbW9iaWxpdHkuY29tL3YxIiwiaWF0IjoxNjY5ODg1OTQzLCJpc3MiOiI1MzI2OWUyZS00ZjI3LTRjMGEtOTYyOS1jNjQ2ZmE0OGFhYjIiLCJqdGkiOiJmOGVmZjMzYS05YjdiLTQ4NWItYTdmOC01MDEyZjBhZmUyYTIiLCJ2ZXIiOjF9.O4wdgxUpzTMhyioLPMOCrLQUXNE0QwqLDYMaOk8wtElMvtMSPcbC_KqQB3hF0nnq20pvumyC5xxuhDd2MVm7Jw"}'

curl '' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI8YXBwbGljYXRpb25fdXVpZD4iLCJpc3MiOiJodHRwczovL3NhbmRib3gtYmV0YS5hcGkuaGlnaC1tb2JpbGl0eS5jb20vdjEvYXV0aF90b2tlbnMiLCJleHAiOjE1MTYyMzkwMjJ9.heA5dvzL0Qe6C89lRRAB2_7QqQsYoaPcjlJuOqL320M'