APIs

Getting started

Overview

This page will guide you on how to get started with Volvo Cars’ APIs.

As an introductory exercise, we will use the Connected Vehicle API to make requests against a Demo Test Vehicle using curl. The goal of this short exercise is to check the current engine status of a vehicle – and in doing so, learn how to use our APIs along the way.

Prerequisites

1. Create an account

Sign up using Google or GitHub to create an account for the Developer Portal. As a Volvo Cars employee, you should sign up using CDSID to get access to even more APIs and tools.

2. Create an application

To use the APIs, you must connect your Developer Portal account to an application. When your application is created, you’ll receive a VCC API key. This key must be included in the header of each request sent to the API.

3. Generate access tokens

To access Volvo Cars user data and features you must first ask for end-user permission. End-users permit access to their data to your application through their Volvo ID account. Once permission has been granted, you’ll receive a temporary access token. This must be added to the header of each request sent to the API.

For this guide, we will use our Access token generation tool. Generate an access token allowing access to Connected Vehicle API.

Your first API request

We now have everything we need to make requests towards our APIs, but before we can interact with a specific vehicle we need to know its Vehicle Identification Number (VIN).

1. Get a VIN number

A Volvo ID account can contain several registered vehicles. To get a list of them we call the Get vehicle list endpoint.

Replace <your-vcc-api-key> with your applications key and <your-access-token> with the generated access token. Then execute the curl command.

curl -X GET 'https://api.volvocars.com/connected-vehicle/v2/vehicles'
  -H 'accept: application/json'
  -H 'authorization: Bearer <your-access-token>'
  -H 'vcc-api-key: <your-vcc-api-key>'

The response will be a list of one or more vehicles, each vehicle has a unique VIN. Copy one of the VINs and continue to the next step.

2. Get current engine status

We are now ready to get data from the vehicle. We will use the Get engine status endpoint to see if the engine is either on or off.

Again, replace <your-vcc-api-key> and <your-access-token> but now also replace {vin} in the URL with a VIN you copied during step 1. Then execute the curl command.

curl -X GET 'https://api.volvocars.com/connected-vehicle/v2/vehicles/{vin}/engine-status'
  -H 'accept: application/json'
  -H 'authorization: Bearer <your-access-token>'
  -H 'vcc-api-key: <your-vcc-api-key>'

Tip: Most value responses in our APIs also include a timestamp, indicating when the value was last collected from the vehicle in question.

3. Explore and learn more

This concludes our short introductory exercise on how to use Volvo Cars’ APIs.

Continue learning:

Deploy to Volvo Cars’ users

Once you’re all set you’ll need to publish your application first, before it can be made available to end-users.

Read more about the publishing process on our Authorisation page.

/