{
    "openapi": "3.0.3",
    "info": {
        "title": "Battery & EV Data API",
        "version": "1.0.0",
        "description": "Electric and hybrid specifics by registration \u2014 battery capacity, chemistry/type, charge times and connector type."
    },
    "servers": [
        {
            "url": "https://vehiclematic.com/products/battery-and-ev-data/api/live",
            "description": "Live"
        }
    ],
    "security": [
        {
            "ApiKeyAuth": []
        }
    ],
    "tags": [
        {
            "name": "Lookups",
            "description": "Look up Battery & EV Data data by UK registration."
        }
    ],
    "paths": {
        "/{vrm}": {
            "get": {
                "tags": [
                    "Lookups"
                ],
                "operationId": "lookup",
                "summary": "Look up by registration",
                "description": "Returns Battery & EV Data for a single UK registration (VRM). Costs \u00a30.08 per lookup on Tier 1, down to \u00a30.02 on the largest top-up tier.",
                "parameters": [
                    {
                        "name": "vrm",
                        "in": "path",
                        "required": true,
                        "description": "UK vehicle registration mark.",
                        "schema": {
                            "type": "string",
                            "pattern": "^[A-Z0-9]{1,8}$",
                            "example": "AB12CDE"
                        }
                    },
                    {
                        "name": "format",
                        "in": "query",
                        "required": false,
                        "description": "Response format. Defaults to JSON.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "json",
                                "csv"
                            ],
                            "default": "json"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful lookup.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "vrm": {
                                                    "type": "string"
                                                },
                                                "battery": {
                                                    "type": "object",
                                                    "properties": {
                                                        "capacity": {
                                                            "type": "string"
                                                        },
                                                        "charge_port": {
                                                            "type": "string"
                                                        },
                                                        "charge_time": {
                                                            "type": "string"
                                                        },
                                                        "type": {
                                                            "type": "string"
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "credit_balance": {
                                            "type": "integer"
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "vrm": "AB12CDE",
                                        "battery": {
                                            "capacity": "58 kWh",
                                            "charge_port": "CCS Type 2",
                                            "charge_time": "8h (7kW AC) / 35min 10\u201380% (100kW DC)",
                                            "type": "Lithium-ion"
                                        }
                                    },
                                    "credit_balance": 499
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "Insufficient credits.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "boolean"
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    }
                                },
                                "example": {
                                    "error": true,
                                    "message": "Insufficient credits.",
                                    "credit_balance": 0
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "This API key is not authorised for this product.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "boolean"
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    }
                                },
                                "example": {
                                    "error": true,
                                    "message": "This API key is not authorised for this product."
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Missing or invalid registration.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "boolean"
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    }
                                },
                                "example": {
                                    "error": true,
                                    "message": "A vrm parameter is required."
                                }
                            }
                        }
                    }
                }
            }
        },
        "/lookup": {
            "post": {
                "tags": [
                    "Lookups"
                ],
                "operationId": "bulkLookup",
                "summary": "Bulk lookup",
                "description": "Look up many registrations in one request (up to 50). Each result is charged at your per-lookup tier price. Processing stops when the balance is exhausted.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "vrms"
                                ],
                                "properties": {
                                    "vrms": {
                                        "type": "array",
                                        "items": {
                                            "type": "string",
                                            "example": "AB12CDE"
                                        },
                                        "maxItems": 50,
                                        "description": "Registrations to look up."
                                    }
                                }
                            },
                            "example": {
                                "vrms": [
                                    "AB12CDE",
                                    "XY19ABC"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Results, one per registration, in request order.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "vrm": {
                                                        "type": "string"
                                                    },
                                                    "battery": {
                                                        "type": "object",
                                                        "properties": {
                                                            "capacity": {
                                                                "type": "string"
                                                            },
                                                            "charge_port": {
                                                                "type": "string"
                                                            },
                                                            "charge_time": {
                                                                "type": "string"
                                                            },
                                                            "type": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "requested": {
                                            "type": "integer"
                                        },
                                        "returned": {
                                            "type": "integer"
                                        },
                                        "credit_balance": {
                                            "type": "integer"
                                        }
                                    }
                                },
                                "example": {
                                    "data": [
                                        {
                                            "vrm": "AB12CDE",
                                            "battery": {
                                                "capacity": "58 kWh",
                                                "charge_port": "CCS Type 2",
                                                "charge_time": "8h (7kW AC) / 35min 10\u201380% (100kW DC)",
                                                "type": "Lithium-ion"
                                            }
                                        }
                                    ],
                                    "requested": 1,
                                    "returned": 1,
                                    "credit_balance": 499
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Too many registrations (max 50).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "error": {
                                            "type": "boolean"
                                        },
                                        "message": {
                                            "type": "string"
                                        }
                                    }
                                },
                                "example": {
                                    "error": true,
                                    "message": "A maximum of 50 registrations may be looked up per request."
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "ApiKeyAuth": {
                "type": "apiKey",
                "in": "header",
                "name": "X-VEHICLEMATIC-KEY",
                "description": "Your API key. Create one on the API access page in your portal."
            }
        }
    }
}