The carsxe package is the official CarsXE client for Python. It installs the carsxe_api module.
Installation
pip install carsxe
# uv add carsxe
# poetry add carsxeQuick start
Construct the client with your API key. Every method is a coroutine, so await it (or run it with asyncio.run).
import asyncio
from carsxe_api import CarsXE
carsxe = CarsXE("YOUR_API_KEY")
async def main():
vehicle = await carsxe.specs({"vin": "WBAFR7C57CC811956"})
print(vehicle)
asyncio.run(main())Methods
Each method is async and takes a single dict of parameters, returning the parsed JSON response.
| Method | Params | Description |
|---|---|---|
specs(params) | {"vin", "deepdata"?, "disableIntVINDecoding"?} | Decode a VIN into full vehicle specifications |
int_vin_decoder(params) | {"vin"} | Decode a non-US international VIN |
market_value(params) | {"vin", "state"?, "mileage"?, "condition"?} | Retail, trade-in, and auction value estimates |
history(params) | {"vin"} | Title events, salvage, and insurance records |
recalls(params) | {"vin"} | Open safety recalls by VIN |
lien_and_theft(params) | {"vin"} | Lien records and theft/salvage status |
plate_decoder(params) | {"plate", "state"?, "country"?, "district"?} | Resolve a license plate to vehicle data (country defaults to US) |
images(params) | {"make", "model", "year"?, "trim"?, "color"?, "angle"?, "photoType"?, "size"?, "transparent"?, "license"?} | Vehicle photos by make, model, and year |
plate_image_recognition(params) | {"upload_url"} | Extract plate info from an image URL |
vin_ocr(params) | {"upload_url"} | Extract VIN text from an image via OCR |
year_make_model(params) | {"year", "make", "model"} | Look up vehicles by year, make, and model |
obd_codes_decoder(params) | {"code"} | Decode an OBD-II diagnostic trouble code |
Error handling
Methods return the parsed JSON response. Wrap calls in try/except to catch network and request errors:
import asyncio
from carsxe_api import CarsXE
carsxe = CarsXE("YOUR_API_KEY")
async def main():
try:
vehicle = await carsxe.specs({"vin": "WBAFR7C57CC811956"})
print(vehicle)
except Exception as error:
print(f"CarsXE error: {error}")
asyncio.run(main())Best practices
Store your key in an environment variable. Never hardcode it or commit it to source control.
import os
from carsxe_api import CarsXE
carsxe = CarsXE(os.environ["CARSXE_API_KEY"])# .env
CARSXE_API_KEY=your_key_hereEvery method is asynchronous. Call them from within an async function and drive them with asyncio.run(...), or await them directly inside an existing event loop (FastAPI, async workers, notebooks).
Official CarsXE SDK for Python.