> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.driver.olycab.in/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.driver.olycab.in/_mcp/server.

# Get Vehicle by ID

GET https://driver/#get14

# 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.                         |

Reference: https://docs.driver.olycab.in/oly-driver/vehicle/get-vehicle-by-id

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Examples

**SDK Code**

```python
import requests

url = "https://driver/#get14"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://driver/#get14';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://driver/#get14"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://driver/#get14")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://driver/#get14")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://driver/#get14', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://driver/#get14");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://driver/#get14")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```