Get Vehicle by ID
# Get Vehicle by ID
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
| Parameter | Data Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | **Yes** | Unique vehicle ID (prefixed with `veh_`, e.g. `veh_1a2b3c4d5e`) |
#### Example Request URL
``` http
GET {{baseUrl}}/api/v1/vehicles/veh_1a2b3c4d5e
```
---
### Request Body Schema
_None (GET request)_
---
### Response Body Schema (`200 OK`)
| Top-Level Key | Data Type | Description |
| --- | --- | --- |
| `vehicle` | `object` | Vehicle details |
#### `vehicle` Object Fields
| Field | Data Type | Nullable | Allowed Values / Constraints | Description |
| --- | --- | --- | --- | --- |
| `id` | `string` | No | Prefixed with `veh_` | Unique vehicle ID |
| `driverId` | `string` | Yes | Prefixed with `drv_` | Associated driver ID (`null` if unassigned) |
| `name` | `string` | No | String | Vehicle make / brand (e.g. `"Maruti Suzuki"`) |
| `model` | `string` | No | String | Vehicle model (e.g. `"Swift Dzire"`) |
| `color` | `string` | Yes | String | Vehicle paint color |
| `number_plate` | `string` | Yes | String | Government license plate number |
| `created_at` | `string` | No | ISO 8601 Timestamp | Registration timestamp |
| `updated_at` | `string` | No | ISO 8601 Timestamp | Last update timestamp |
---
### Response Examples
#### 1\. `200 OK` — Vehicle Found
``` json
{
"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
``` json
{
"error": "Vehicle not found"
}
```
#### 3\. `500 Internal Server Error`
``` json
{
"error": "Failed to fetch vehicle"
}
```
---
### Status Codes Reference
| HTTP Status Code | Condition |
| --- | --- |
| **`200 OK`** | Vehicle record located and returned. |
| **`404 Not Found`** | No vehicle found matching the specified ID in the path. |
| **`500 Internal Server Error`** | Server or database query error. |
Authentication
AuthorizationBearer
Bearer authentication of the form Bearer <token>, where token is your auth token.