Skip to main content

Volvo Cars API

This python library lets you use the Volvo Cars API. Authorisation follows the OAuth 2.0 authorisation code flow with PKCE.

GitHub release Sponsor

Requirements

You'll need a Volvo Developers account and create an API application. Make sure to fill in all required fields and write down the retrieved client id and secret.

Volvo ID migration

Volvo is migrating Volvo ID to a new authorization server. API applications with a client id starting with dc- stop working after 31 January 2027.

To migrate:

  1. Create a new API application on your account page. Its client id starts with vid-dc-.
  2. Use the new client id, client secret and VCC API key.
  3. Sign in again. Existing tokens can't be reused with the new application.
  4. Delete the old application.

This library selects the authorization server based on the client id, so both kinds of applications work during the transition period. dc- clients use the legacy server and log a warning.

When signing in on the new server, check Remember me. Without it, the refresh token expires together with the login session and you'll have to sign in again sooner.

Endpoints and scopes

Use get_volvoid_server to get the correct endpoints and scopes for a client id. This is needed when you implement the OAuth 2.0 flow yourself instead of using VolvoCarsAuth, or to pick the scopes to pass to VolvoCarsAuth:

from volvocarsapi.auth import get_volvoid_server

server = get_volvoid_server(client_id)
server.authorize_url
server.token_url
server.default_scopes  # Scopes without restricted scopes
server.all_scopes  # Scopes including restricted scopes

To request a subset, combine the per-type scopes of the new server from volvocarsapi.scopes: OPENID_SCOPES, CONVE_SCOPES, ENERGY_SCOPES, ENERGY_DEVICE_SCOPES and RestrictedScope.

The AUTHORIZE_URL, TOKEN_URL, DEFAULT_SCOPES and ALL_SCOPES constants are deprecated. They keep pointing to the legacy server until the migration deadline has passed. After that, they'll point to the new server.

Usage

A script is worth a thousand words.

# Retrieved at the end of the API application registration process
client_id = "vid-dc-abc"
client_secret = "very-secret-key"

# Scopes that have been requested during the API application registration. You can also
# use less scopes than requested.
scopes = [
    "openid",
    "conve:battery_charge_level",
    "conve:brake_status",
    "conve:climatization_start_stop",
    "conve:command_accessibility",
    "conve:commands",
    "conve:diagnostics_engine_status",
    # ...
]

# Must be excactly as entered during the API application registration
redirect_uri = "htttps://my-volvo-application.io/callback"

# The VCC API key retrieved after the API application registration process
api_key = "abcdef-1234567890-abcdef"

client_session = _get_client_session()

# Authenticate
auth = VolvoCarsAuth(
    client_session,
    client_id=client_id,
    client_secret=client_secret,
    scopes=scopes,
    redirect_uri=redirect_uri)
auth_uri = auth.get_auth_uri() # optionally pass state

# Redirect user to auth_uri and wait for the callback
# ...

# Extract code from the callback url
code = _get_code_from_url()
await auth.async_request_token(code)

# The VIN must be linked to the account you sign in with
vin = "YV123456789012345"

# Create API client
api = VolvoCarsApi(client_session, auth, api_key, vin)

# Make API request
engine_warnings = await api.async_get_engine_warnings()

🚗 Powered by dreams

If you'd like to show your appreciation for this project, feel free to toss a coin to your dev. Donations help keep things running, and who knows, maybe one day they'll add up to a Volvo EX90 (hey, let me dream!). If you're feeling generous, you may donate one too. I'll even come pick it up! 😁

ko-fi sponsor github sponsor

Metadata

Release files for volvocarsapi 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for volvocarsapi 0.6.0
File Size Uploaded Provenance Actions
volvocarsapi-0.6.0.tar.gz 41.7 kB With provenance Details for volvocarsapi-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for volvocarsapi 0.6.0
File Interpreter ABI Platform Actions
volvocarsapi-0.6.0-py3-none-any.whl Python 3 none any Details for volvocarsapi-0.6.0-py3-none-any.whl

Total release size: 67.6 kB

Release files / volvocarsapi-0.6.0.tar.gz

Download URL volvocarsapi-0.6.0.tar.gz
Size 41.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ca2adb799781d4249724ce649dca7be782e3ba6e320e06260cfba4e13ffaf83e
BLAKE2b-256 checksum
How to use checksums
88e5cd6c4628163210fd49b4eb70e798c20943df8b005d7660d18242e4a0718b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / volvocarsapi-0.6.0-py3-none-any.whl

Download URL volvocarsapi-0.6.0-py3-none-any.whl
Size 25.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d447b58e42de17c6c91b38945fffb4ebd80dde4433470bbbd28052d00975841
BLAKE2b-256 checksum
How to use checksums
b62cd9b78d2efbb3088c07d0e330d855b6184b1afe661f9c978c3e8512f22556
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for volvocarsapi 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for volvocarsapi-0.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page