# DVSA MOT Vehicle History (`car_map/apify-mot-history`) Actor

Bulk lookup for UK vehicle registration to MOT history using DVSA data. Ideal for fleet, dealer, and analytics use. Supports JSON output and easy API integration for large-scale vehicle checks.

- **URL**: https://apify.com/car_map/apify-mot-history.md
- **Developed by:** [Car Map](https://apify.com/car_map) (community)
- **Categories:** E-commerce, Automation, Developer tools
- **Stats:** 16 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.01 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## UK Vehicle MOT History API

Look up complete MOT history for any UK vehicle registration. Retrieve pass/fail results, advisories, defects, odometer readings, test dates, and current MOT status in seconds — at scale.

### What You'll Get

- MOT Status — Current status and expiry date
- Full MOT History — Each test’s date, result, and station ID (where available)
- Defects & Advisories — Major/Dangerous defects and advisory notes per test
- Odometer Readings — Value and unit at each MOT test
- Vehicle Snapshot — Make, model (when available), fuel type, colour
- Data Provenance — Source timestamps and run metadata for traceability

### Perfect For

- Vehicle Traders — Assess condition trends and red flags pre‑purchase
- Fleet Managers — Track compliance and upcoming MOT expiries at scale
- Insurers — Validate risk using historical failure and advisory patterns
- Automotive Services — Prepare work orders from known advisories/defects
- Compliance & Risk Teams — Audit odometer consistency and safety defects
- Developers & Data Teams — Embed MOT histories into apps and pipelines

### How It Works

Submit UK vehicle registration numbers. The service validates inputs, queries official UK MOT history sources, normalizes the results, and returns a structured record for each registration.

Recommended batch size: 1–50 registrations per run.

Example input:

```json
{
  "registrations": ["AB12CDE", "XY99ZXY"],
  "includeAdvisories": true,
  "sinceDate": "2015-01-01"
}
```

Example output (per vehicle):

```json
{
  "registrationNumber": "AB12CDE",
  "motStatus": "Valid",
  "motExpiryDate": "2026-06-11",
  "make": "VAUXHALL",
  "fuelType": "PETROL",
  "colour": "WHITE",
  "history": [
    {
      "testNumber": "123456789012",
      "testDate": "2025-06-11",
      "result": "PASS",
      "odometerValue": 54821,
      "odometerUnit": "mi",
      "defects": [],
      "advisories": [
        "Nearside front tyre close to legal limit"
      ]
    },
    {
      "testNumber": "123456789011",
      "testDate": "2024-06-10",
      "result": "FAIL",
      "odometerValue": 51200,
      "odometerUnit": "mi",
      "defects": [
        { "category": "MAJOR", "text": "Brake pad(s) worn below 1.5mm" }
      ],
      "advisories": []
    }
  ],
  "run": {
    "fetchedAt": "2025-10-24T17:30:00Z",
    "source": "UK MOT history"
  }
}
```

Views available:

- Overview — Current status and next expiries
- Errors Only — Registrations that failed to return results
- Full History — All tests, defects, advisories, and readings

### API Access (via Apify)

Use the standard Apify run pattern to execute the actor and fetch results.

- Start a run:

  POST `https://api.apify.com/v2/acts/<username>~<actor-name>/runs?token=<APIFY_TOKEN>`

  Body:

  ```json
  {
    "registrations": ["AB12CDE"],
    "includeAdvisories": true,
    "sinceDate": "2015-01-01"
  }
  ```

- Poll run status:

  GET `https://api.apify.com/v2/actor-runs/<runId>`

- Fetch results (dataset items):

  GET `https://api.apify.com/v2/datasets/<datasetId>/items?format=json`

Common input fields:

- `registrations` (required) — Array of UK registrations
- `includeAdvisories` (optional, default true) — Include advisory notes
- `sinceDate` (optional) — ISO date to filter older tests
- `maxVehicles` (optional, default 50) — Soft cap for batch size

Error format (example):

```json
{
  "registrationNumber": "NOTAREG",
  "error": {
    "code": "NOT_FOUND",
    "message": "No MOT history found for registration"
  }
}
```

### Key Benefits

- Official UK MOT history data
- Bulk lookups (1–50 vehicles per run)
- Detailed defects and advisory notes
- Odometer consistency checks across tests
- Fast, reliable, structured results
- Simple pay‑per‑use pricing on Apify

### Export Options

- JSON
- CSV
- Excel
- HTML

### Getting Started

1. Collect registrations to check
2. Run the actor with your input JSON
3. Retrieve dataset results (JSON/CSV/Excel/HTML)
4. Filter by status or inspect full histories

### Notes & Limits

- Registrations must be valid UK formats (case‑insensitive; spaces optional)

- Historical coverage follows official MOT records availability

- Throughput and concurrency align with your Apify plan and actor settings
  The actor includes a small delay (100ms) between requests to avoid rate limiting. For large batches, consider:

- Breaking into multiple runs

- Increasing delay in [motApi.js:86](src/services/motApi.js#L86)

- Using cache to minimize API calls

# Actor input Schema

## `registrations` (type: `array`):

List of UK vehicle registration numbers to look up

## `includeAdvisories` (type: `boolean`):

Include advisory notes from MOT tests

## `sinceDate` (type: `string`):

Only include MOT tests after this date (ISO format: YYYY-MM-DD)

## `maxVehicles` (type: `integer`):

Maximum number of vehicles to process (soft cap for batch size)

## `useCache` (type: `boolean`):

Use cached results from previous runs to save API calls

## `concurrency` (type: `integer`):

Number of vehicles to process in parallel

## `rateLimitPerSecond` (type: `integer`):

Maximum number of API requests per second

## `timeoutMs` (type: `integer`):

Maximum time to wait for each API request in milliseconds

## `maxRetries` (type: `integer`):

Number of retry attempts for failed requests

## `retryBackoffMs` (type: `integer`):

Initial delay between retry attempts in milliseconds (doubles each retry)

## `failOnHttpError` (type: `boolean`):

Stop actor execution if any HTTP errors occur (404s not included)

## `useInternalDatabase` (type: `boolean`):

Use internal caching database (KeyValueStore) for persistent storage

## `maxDataAgeDays` (type: `integer`):

Maximum age of cached data in days (0 = never expire)

## `pricingPerLookup` (type: `number`):

Cost per vehicle lookup for billing calculation (informational)

## Actor input object example

```json
{
  "registrations": [
    "AB12CDE",
    "XY99ZXY"
  ],
  "includeAdvisories": true,
  "sinceDate": "2015-01-01",
  "maxVehicles": 50,
  "useCache": true,
  "concurrency": 5,
  "rateLimitPerSecond": 5,
  "timeoutMs": 10000,
  "maxRetries": 2,
  "retryBackoffMs": 500,
  "failOnHttpError": false,
  "useInternalDatabase": true,
  "maxDataAgeDays": 30,
  "pricingPerLookup": 0.1
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "registrations": [
        "AB12CDE",
        "XY99ZXY"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("car_map/apify-mot-history").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "registrations": [
        "AB12CDE",
        "XY99ZXY",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("car_map/apify-mot-history").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "registrations": [
    "AB12CDE",
    "XY99ZXY"
  ]
}' |
apify call car_map/apify-mot-history --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,car_map/apify-mot-history"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/RWmLMplPHh86FHLH3/builds/JEey8DQx5bv3c4lMp/openapi.json
