Skip to navigation

Delete Vehicle by ID

View as Markdown

Permanently removes a registered vehicle record from the database by its unique ID.


Endpoint Overview

  • Method: DELETE

  • Route: /api/v1/vehicles/:id

  • Authentication: None (Public)

  • Content-Type: N/A


Path Parameters

ParameterData TypeRequiredDescription
idstringYesUnique vehicle ID to delete (prefixed with veh_, e.g. veh_1a2b3c4d5e)

Example Request URL

DELETE {{baseUrl}}/api/v1/vehicles/veh_1a2b3c4d5e

Request Body Schema

None (DELETE request)


Response Body Schema (200 OK)

Top-Level KeyData TypeDescription
messagestringConfirmation message ("Vehicle deleted successfully")
vehicleobjectThe deleted vehicle record

vehicle Object Fields

FieldData TypeNullableAllowed Values / ConstraintsDescription
idstringNoPrefixed with veh_Unique vehicle ID
driverIdstringYesPrefixed with drv_ID of previously linked driver
namestringNoStringVehicle make / brand
modelstringNoStringVehicle model
colorstringYesStringVehicle color
number_platestringYesStringLicense registration plate number
created_atstringNoISO 8601 TimestampCreation timestamp
updated_atstringNoISO 8601 TimestampLast update timestamp

Response Examples

1. 200 OK — Vehicle Deleted Successfully

{
"message": "Vehicle deleted successfully",
"vehicle": {
"id": "veh_1a2b3c4d5e",
"driverId": "drv_8a7b6c5d4e",
"name": "Maruti Suzuki",
"model": "Swift Dzire",
"color": "White",
"number_plate": "KA-01-AB-1234",
"created_at": "2026-09-21T05:40:00.000Z",
"updated_at": "2026-09-21T05:40:00.000Z"
}
}

2. 404 Not Found — Vehicle Does Not Exist

{
"error": "Vehicle not found"
}

3. 500 Internal Server Error

{
"error": "Failed to delete vehicle"
}

Status Codes Reference

HTTP Status CodeCondition
200 OKVehicle record located, deleted, and returned.
404 Not FoundNo vehicle found with the given ID.
500 Internal Server ErrorServer or database deletion error.

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.