Skip to navigation

Get Vehicle by ID

View as Markdown

Retrieves detailed specifications for a specific vehicle by its unique ID.


Endpoint Overview

  • Method: GET

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

  • Authentication: None (Public)

  • Content-Type: N/A


Path Parameters

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

Example Request URL

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

Request Body Schema

None (GET request)


Response Body Schema (200 OK)

Top-Level KeyData TypeDescription
vehicleobjectVehicle details

vehicle Object Fields

FieldData TypeNullableAllowed Values / ConstraintsDescription
idstringNoPrefixed with veh_Unique vehicle ID
driverIdstringYesPrefixed with drv_Associated driver ID (null if unassigned)
namestringNoStringVehicle make / brand (e.g. "Maruti Suzuki")
modelstringNoStringVehicle model (e.g. "Swift Dzire")
colorstringYesStringVehicle paint color
number_platestringYesStringGovernment license plate number
created_atstringNoISO 8601 TimestampRegistration timestamp
updated_atstringNoISO 8601 TimestampLast update timestamp

Response Examples

1. 200 OK — Vehicle Found

{
"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 fetch vehicle"
}

Status Codes Reference

HTTP Status CodeCondition
200 OKVehicle record located and returned.
404 Not FoundNo vehicle found matching the specified ID in the path.
500 Internal Server ErrorServer or database query error.

Authentication

AuthorizationBearer

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