Skip to navigation

List Vehicles

View as Markdown

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

ParameterData TypeRequiredDefaultAllowed Values / ConstraintsDescription
driverIdstringNonullPrefixed 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 KeyData TypeDescription
vehiclesarrayList of vehicle objects

Vehicle Item Fields

FieldData TypeNullableAllowed Values / ConstraintsDescription
idstringNoPrefixed with veh_Unique vehicle identifier
driverIdstringYesPrefixed with drv_ID of associated driver (null if unlinked)
namestringNoStringVehicle make / brand
modelstringNoStringVehicle model
colorstringYesStringVehicle color
number_platestringYesStringRegistration plate number
created_atstringNoISO 8601 TimestampRegistration timestamp
updated_atstringNoISO 8601 TimestampLast update timestamp

Response Examples

1. `200 OK` — Vehicles Returned

{
"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

{
"vehicles": []
}

3. `500 Internal Server Error`

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

Status Codes Reference

HTTP Status CodeCondition
200 OKSuccessfully retrieved vehicles list (can be an empty array).
500 Internal Server ErrorServer or database query failure.

Authentication

AuthorizationBearer

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