{
  "openapi": "3.1.0",
  "info": {
    "title": "Pronto-Via Vehicle Check API",
    "version": "1.0.0",
    "description": "UK vehicle checks for people who move cars: MOT on the day, tax or trade plates, and a plain yes/no on whether a vehicle can be driven. Trade-plate workspaces skip tax checks entirely, so untaxed transport stock never raises false alarms. MOT data: DVSA MOT History. Tax: DVLA, where available.",
    "contact": {
      "email": "support@pronto-guide.com"
    }
  },
  "servers": [
    {
      "url": "https://via.pronto-guide.com/api/v1"
    },
    {
      "url": "https://pronto-fleet.vercel.app/api/v1",
      "description": "Previous address, still served"
    }
  ],
  "security": [
    {
      "ApiKey": []
    }
  ],
  "paths": {
    "/vehicle/{reg}": {
      "get": {
        "operationId": "getVehicle",
        "summary": "Vehicle check",
        "description": "Make, model, fuel, colour and year; MOT and tax status on the day; whether it can be driven and if trade plates are needed. Counts as one lookup.",
        "parameters": [
          {
            "name": "reg",
            "in": "path",
            "required": true,
            "description": "UK registration, spaces optional",
            "schema": {
              "type": "string",
              "example": "AB12CDE"
            }
          },
          {
            "name": "on",
            "in": "query",
            "required": false,
            "description": "The day the vehicle will be moved (YYYY-MM-DD). Default: today (UK).",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Vehicle check",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Vehicle"
                }
              }
            }
          },
          "400": {
            "description": "Invalid reg or date",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Module not on your plan (FEATURE_NOT_SUBSCRIBED) or workspace suspended",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Per-minute limit (RATE_LIMITED) or month's allowance used (MONTHLY_LIMIT_REACHED)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "DVSA or DVLA didn't answer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Lookups unavailable or today's cap reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/vehicle/{reg}/movable": {
      "get": {
        "operationId": "getMovable",
        "summary": "Can it be driven on the day?",
        "description": "Just the answer: can_drive, trade_plates and the reasons. Counts as one lookup.",
        "parameters": [
          {
            "name": "reg",
            "in": "path",
            "required": true,
            "description": "UK registration, spaces optional",
            "schema": {
              "type": "string",
              "example": "AB12CDE"
            }
          },
          {
            "name": "on",
            "in": "query",
            "required": false,
            "description": "The day the vehicle will be moved (YYYY-MM-DD). Default: today (UK).",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Movable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MovableAnswer"
                }
              }
            }
          },
          "400": {
            "description": "Invalid reg or date",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Module not on your plan (FEATURE_NOT_SUBSCRIBED) or workspace suspended",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Per-minute limit (RATE_LIMITED) or month's allowance used (MONTHLY_LIMIT_REACHED)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "DVSA or DVLA didn't answer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Lookups unavailable or today's cap reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/vehicle/{reg}/mot-history": {
      "get": {
        "operationId": "getMotHistory",
        "summary": "Full MOT history",
        "description": "Every MOT test with mileage, defects and advisories. Ultra and Mega plans.",
        "parameters": [
          {
            "name": "reg",
            "in": "path",
            "required": true,
            "description": "UK registration, spaces optional",
            "schema": {
              "type": "string",
              "example": "AB12CDE"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "MOT history",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MotHistory"
                }
              }
            }
          },
          "400": {
            "description": "Invalid reg",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Module not on your plan (FEATURE_NOT_SUBSCRIBED) or workspace suspended",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Per-minute limit (RATE_LIMITED) or month's allowance used (MONTHLY_LIMIT_REACHED)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "DVSA or DVLA didn't answer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Lookups unavailable or today's cap reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/vehicle/batch": {
      "post": {
        "operationId": "batchVehicles",
        "summary": "Check up to 50 vehicles",
        "description": "Each reg counts as one lookup.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "regs"
                ],
                "properties": {
                  "regs": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "string"
                    },
                    "example": [
                      "AB12CDE",
                      "XY34ZZZ"
                    ]
                  },
                  "on": {
                    "type": "string",
                    "format": "date"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Results in order; a failed reg has error and message instead",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "on": {
                      "type": "string",
                      "format": "date"
                    },
                    "count": {
                      "type": "integer"
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Vehicle"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid body",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Module not on your plan (FEATURE_NOT_SUBSCRIBED) or workspace suspended",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Per-minute limit (RATE_LIMITED) or month's allowance used (MONTHLY_LIMIT_REACHED)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "DVSA or DVLA didn't answer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Lookups unavailable or today's cap reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/usage": {
      "get": {
        "operationId": "getUsage",
        "summary": "This month's usage",
        "description": "Lookups used this month, your allowance and your modules. Not counted.",
        "responses": {
          "200": {
            "description": "Usage",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "operationId": "health",
        "summary": "Service status",
        "security": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "Direct customers. RapidAPI subscribers use X-RapidAPI-Key instead; RapidAPI handles it."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error",
          "message"
        ],
        "properties": {
          "error": {
            "type": "string",
            "example": "FEATURE_NOT_SUBSCRIBED"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "Mot": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "VALID",
              "EXPIRED",
              "NOT_YET_DUE",
              "NO_RECORD",
              "NOT_REQUESTED"
            ]
          },
          "expiry": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "valid_on_date": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "last_test": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "date": {
                "type": "string"
              },
              "result": {
                "type": "string"
              }
            }
          }
        }
      },
      "Tax": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "TAXED",
              "UNTAXED",
              "SORN",
              "NOT_TAXED_FOR_ON_ROAD_USE",
              "UNKNOWN",
              "BYPASSED_TRADE_PLATE"
            ]
          },
          "due": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "valid_on_date": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "check_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "GOV.UK's free tax check, when tax couldn't be checked (status UNKNOWN)"
          }
        }
      },
      "Movable": {
        "type": "object",
        "properties": {
          "can_drive": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "false when there is no valid MOT on the day — not even trade plates cover that"
          },
          "trade_plates": {
            "type": "string",
            "enum": [
              "REQUIRED",
              "NOT_REQUIRED",
              "UNKNOWN",
              "ASSUMED"
            ]
          },
          "electric": {
            "type": "boolean"
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "MovableAnswer": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Movable"
          },
          {
            "type": "object",
            "properties": {
              "reg": {
                "type": "string"
              },
              "on": {
                "type": "string",
                "format": "date"
              },
              "found": {
                "type": "boolean"
              },
              "checked_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        ]
      },
      "Vehicle": {
        "type": "object",
        "properties": {
          "reg": {
            "type": "string",
            "example": "AB12CDE"
          },
          "on": {
            "type": "string",
            "format": "date"
          },
          "found": {
            "type": "boolean"
          },
          "vehicle": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "make": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "model": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "colour": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "fuel_type": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "year": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "engine_cc": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "first_registered": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              }
            }
          },
          "mot": {
            "$ref": "#/components/schemas/Mot"
          },
          "tax": {
            "$ref": "#/components/schemas/Tax"
          },
          "movable": {
            "$ref": "#/components/schemas/Movable"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "MotHistory": {
        "type": "object",
        "properties": {
          "reg": {
            "type": "string"
          },
          "found": {
            "type": "boolean"
          },
          "tests": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "date": {
                  "type": "string"
                },
                "result": {
                  "type": "string"
                },
                "expiry": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "mileage": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "mileage_read": {
                  "type": "boolean"
                },
                "defects": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "text": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "dangerous": {
                        "type": "boolean"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
