To query vehicle telemetry with Python, install the DIMO Python SDK, get a Developer JWT, exchange it for a Vehicle JWT, and send a GraphQL query to the Telemetry API. DIMO gives developers API access to vehicle-state data: diagnostics, fault codes, battery and fuel health, odometer, and maintenance signals. Vehicle owners consent to and control sharing, so builders get data with clear provenance.
Steps
- Sign up at the DIMO Developer Console and create a Developer License. You need the
Client ID, at least oneRedirect URI, and anAPI Key. - Install the SDK with
pip install dimo-python-sdk. - Initialize the client with
DIMO("Production"). - Call
dimo.auth.get_dev_jwtwith yourclient_id,domain(your redirect URI), andprivate_key(your API key). Read the Developer JWT fromauth_header["access_token"]. - Get a vehicle shared with your app through DIMO Connect. When a user shares a vehicle, you receive a
tokenIdfor it. - Call
dimo.token_exchange.exchangewith the Developer JWT and the vehicletoken_id. Read the Vehicle JWT fromget_vehicle_jwt['token']. - Call
dimo.telemetry.querywith the Vehicle JWT and a GraphQL query. The Telemetry API has a single endpoint,/query, and is written in GraphQL.
Code
This example is adapted from the DIMO quickstart. Replace the placeholders with your own values.
from dimo import DIMO
dimo = DIMO("Production")
# 1. Get Developer JWT
auth_header = dimo.auth.get_dev_jwt(
client_id = '<client_id>',
domain = '<redirect_uri>',
private_key = '<api_key>'
)
dev_jwt = auth_header["access_token"]
# 2. Get Vehicle JWT
get_vehicle_jwt = dimo.token_exchange.exchange(
developer_jwt = dev_jwt,
token_id = "<token_id>" # Obtained from DIMO Connect
)
vehicle_jwt = get_vehicle_jwt['token']
# 3. Query Telemetry API
telemetry_data = dimo.telemetry.query(
vehicle_jwt = vehicle_jwt,
query = """
query {
signalsLatest(tokenId: <token_id>) {
speed {
value
timestamp
}
}
}
"""
)
FAQ
What is the difference between a Developer JWT and a Vehicle JWT?
A Developer JWT gives general access to DIMO APIs for a longer period and has no access to vehicle data. A Vehicle JWT grants access to one specific vehicle's data for a short time.
Do I need a vehicle shared with me before I can query telemetry?
Yes. You need a vehicle shared with you to fetch a Vehicle JWT, and sharing is done through DIMO Connect. The permissions the user approves determine what data the Vehicle JWT can access.
Can I query historical data, not just the latest values?
The Telemetry API provides realtime and historical vehicle data. The documentation's sample signals query takes tokenId, interval, from, and to arguments and applies aggregations such as AVG, MAX, and LAST to float signals.
How do I see which signals are available for a vehicle?
Send an availableSignals(tokenId: <vehicleTokenId>) query to the Telemetry API with your Vehicle JWT in the Authorization header.
Methodology: based on the DIMO documentation for the Developer Quickstart, Authentication, the Server SDK, and the Telemetry API Introduction.