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

# List Vehicles

GET https://driver/#get13

# List Vehicles

Retrieves a list of vehicles registered on the platform, with optional filtering by `driverId` to fetch vehicles assigned to a specific driver.

***

### Endpoint Overview

* **Method:** `GET`

* **Route:** `/api/v1/vehicles`

* **Authentication:** `None (Public)`

* **Content-Type:** `N/A`

***

### Query Parameters

| Parameter  | Data Type | Required | Default | Allowed Values / Constraints | Description                                            |
| ---------- | --------- | -------- | ------- | ---------------------------- | ------------------------------------------------------ |
| `driverId` | `string`  | No       | `null`  | Prefixed with `drv_`         | Filter to return only vehicles owned by this driver ID |

#### Example Request URLs

* GET \{\{baseUrl}}/api/v1/vehicles

* GET \{\{baseUrl}}/api/v1/vehicles?driverId=drv\_8a7b6c5d4e

***

### Request Body Schema

*None (GET request)*

***

### Response Body Schema (`200 OK`)

| Top-Level Key | Data Type | Description             |
| ------------- | --------- | ----------------------- |
| `vehicles`    | `array`   | List of vehicle objects |

#### `Vehicle Item Fields`

| Field          | Data Type | Nullable | Allowed Values / Constraints | Description                                  |
| -------------- | --------- | -------- | ---------------------------- | -------------------------------------------- |
| `id`           | `string`  | No       | Prefixed with `veh_`         | Unique vehicle identifier                    |
| `driverId`     | `string`  | Yes      | Prefixed with `drv_`         | ID of associated driver (`null` if unlinked) |
| `name`         | `string`  | No       | String                       | Vehicle make / brand                         |
| `model`        | `string`  | No       | String                       | Vehicle model                                |
| `color`        | `string`  | Yes      | String                       | Vehicle color                                |
| `number_plate` | `string`  | Yes      | String                       | Registration 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` — Vehicles Returned``

```json
{
  "vehicles": [
    {
      "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. `200 OK` — No Vehicles Found``

```json
{
  "vehicles": []
}

```

#### `` 3. `500 Internal Server Error` ``

```json
{
  "error": "Failed to fetch vehicles"
}

```

***

### `Status Codes Reference`

| HTTP Status Code                | Condition                                                     |
| ------------------------------- | ------------------------------------------------------------- |
| **`200 OK`**                    | Successfully retrieved vehicles list (can be an empty array). |
| **`500 Internal Server Error`** | Server or database query failure.                             |

Reference: https://docs.driver.olycab.in/oly-driver/vehicle/list-vehicles

## 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/#get13"

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

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

print(response.json())
```

```javascript
const url = 'https://driver/#get13';
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/#get13"

	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/#get13")

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/#get13")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

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

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

```csharp
using RestSharp;

var client = new RestClient("https://driver/#get13");
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/#get13")! 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()
```