Create & Register Vehicle
Registers a new vehicle record (make, model, color, license number plate) and links it to a driver. If the request includes a driver Bearer token in the Authorization header, the vehicle is automatically associated with that driver without needing to pass driverId in the body.
Endpoint Overview
-
Method:
POST -
Route:
/api/v1/vehicles -
Authentication:
Optional Bearer Token (Driver JWT)or viadriverIdin body -
Content-Type:
application/json
Request Headers
Request Body Schema
Example Request Body
Response Body Schema (201 Created)
vehicle Object Fields
Response Examples
1. 201 Created — Vehicle Registered Successfully
2. 400 Bad Request — Validation Error (Missing Required Fields)
3. 500 Internal Server Error
Status Codes Reference
Authentication
AuthorizationBearer
Bearer authentication of the form Bearer <token>, where token is your auth token.