Metadata-Version: 2.4
Name: vardic-uk-vehicle-data
Version: 1.0.2
Summary: UK vehicle data API client: DVLA vehicle enquiry and DVSA MOT history in one call, with ULEZ estimate, mileage checks and expiry webhooks.
Author-email: Vardic <hello@vardic.dev>
Maintainer-email: Vardic <hello@vardic.dev>
License: MIT
Project-URL: Homepage, https://vardic.dev/vehicle
Project-URL: Documentation, https://vardic.dev/docs/vehicle
Project-URL: Source, https://github.com/vardic-dev/uk-vehicle-data-python
Project-URL: Issues, https://github.com/vardic-dev/uk-vehicle-data-python/issues
Project-URL: Changelog, https://github.com/vardic-dev/uk-vehicle-data-python/blob/main/CHANGELOG.md
Keywords: dvla,dvsa,mot,mot-history,vehicle-data,ulez,uk
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# UK vehicle data API for Python

[![PyPI](https://img.shields.io/pypi/v/vardic-uk-vehicle-data)](https://pypi.org/project/vardic-uk-vehicle-data/) [![CI](https://github.com/vardic-dev/uk-vehicle-data-python/actions/workflows/ci.yml/badge.svg)](https://github.com/vardic-dev/uk-vehicle-data-python/actions/workflows/ci.yml) [![Licence: MIT](https://img.shields.io/badge/licence-MIT-blue.svg)](LICENSE)

Look up any UK registration and get the DVLA record and full DVSA MOT history in one call, with mileage checks, an estimated ULEZ status and MOT and tax countdowns.

```python
from uk_vehicle_data import VehicleData

api = VehicleData()  # reads VARDIC_API_KEY
v = api.lookup("AB12 CDE")["data"]

print(v["make"], v["model"], v["colour"], v["fuelType"])
print("MOT expires", v["mot"]["expiryDate"], f'({v["mot"]["daysUntilExpiry"]} days)')
print("Tax", v["tax"]["status"], v["tax"]["dueDate"])
print("ULEZ (estimate)", (v["cleanAirZone"] or {}).get("result"))
for a in v["mileage"]["anomalies"]:
    print(a["type"], a["detail"])
```

## Install

```sh
pip install vardic-uk-vehicle-data
```

Python 3.9+, standard library only.

## What you get

- **Vehicle record** from the DVLA: make, colour, fuel, engine size, CO2, Euro status, first registration, tax status and due date.
- **MOT history** from the DVSA: every test with result, mileage, expiry and defects.
- **Mileage checks**: readings over time, average miles a year and anomalies such as a reading that went down.
- **Clean air zone estimate**: `likely_compliant`, `likely_non_compliant`, `uncertain` or `unknown`, with the basis for it.
- **Bulk lookups** (`bulk`): up to 25 registrations in one call.
- **Expiry webhooks** (`watch`): signed events before MOT or tax runs out, and when a new MOT test is recorded.

## Sandbox key

Every account gets a `vd_test_` key as well as a live key. It returns made-up data for any registration and is never counted. `ZZ99ZZZ` returns `vehicle_not_found` and `TL12OLD` returns an old diesel whose mileage went down.

## Webhooks

```python
api.watch("AB12CDE", "https://example.com/hooks/vardic", days_before=[30, 7, 1])

from uk_vehicle_data import verify_webhook
ok = verify_webhook(request.body, request.headers["vardic-signature"], WEBHOOK_SECRET)
```

Watches need a live key. Pass the raw request body as bytes. Event types and payloads: https://vardic.dev/docs/webhooks

## Errors

Failed calls raise `VardicApiError` with `.status` and `.code`, for example `vehicle_not_found` (404), `quota_exceeded` (429) or `upstream_unavailable` (503). Calls that fail with 503 are not counted.

## Pricing

Free plan: 100 lookups a month, no card needed. Paid plans start at £59 a month for 2,000 lookups. See https://vardic.dev/pricing

## Links

- Get a free key: https://vardic.dev/signup
- API docs: https://vardic.dev/docs/vehicle
- JavaScript client: https://github.com/vardic-dev/uk-vehicle-data-js
- Examples: [examples/](examples/)
- Changelog: [CHANGELOG.md](CHANGELOG.md)
- Contributing: [CONTRIBUTING.md](CONTRIBUTING.md)
- Security: [SECURITY.md](SECURITY.md)

## Data

Contains public sector information licensed under the Open Government Licence v3.0. Not affiliated with or endorsed by the DVLA or DVSA. Clean air zone results are estimates: check the official TfL or GOV.UK vehicle checker before relying on one.

## Licence

MIT. Made by [Vardic](https://vardic.dev).
