Skip to navigation

city

View as Markdown

Updates the designated operational city and state for the authenticated driver.


Endpoint Overview

  • Method: PATCH

  • Route: /api/v1/driver/city

  • Authentication: Bearer Token (Driver JWT)

  • Content-Type: application/json


Request Headers

HeaderTypeRequiredDescription
AuthorizationstringYesFormat: Bearer
Content-TypestringYesMust be application/json

Request Body Schema

FieldData TypeRequiredDefaultAllowed Values / ConstraintsDescription
citystringYes—Min length 1 (e.g. "Bengaluru", "Delhi NCR", "Mumbai")Name of operating city
statestringNonullAny string or nullState or province

Example Request Body

{
"city": "Bengaluru",
"state": "Karnataka"
}

Response Body Schema (200 OK)

Top-Level KeyData TypeDescription
messagestringConfirmation message ("Operating city updated successfully")
citystringUpdated operating city name
driverobjectComplete updated driver profile

driver Object Fields

FieldData TypeNullableAllowed Values / ConstraintsDescription
idstringNoPrefixed with drv_Unique driver account ID
namestringYesAny stringFull name of driver
phonestringNoE.164 string formatRegistered phone number
is_phone_verifiedbooleanNotrue, falsePhone verification flag
emailstringYesValid emailRegistered email address
is_email_verifiedbooleanNotrue, falseEmail verification flag
genderenumYes"MALE", "FEMALE", nullDriver gender
date_of_birthstringYesISO 8601 TimestampDriver date of birth
profile_image_urlstringYesValid URLAvatar image URL
is_profile_completebooleanNotrue, falseProfile completion status
statusenumNo"PENDING_ONBOARDING""PENDING_APPROVAL""APPROVED""REJECTED""SUSPENDED""BLOCKED"Onboarding & verification state
duty_statusenumNo"OFFLINE""ONLINE""ON_TRIP"Real-time driver operational state
rejection_reasonstringYesAny stringRejection reason if status is REJECTED
ratingstringNoDecimal string (e.g. "4.85")Driver rating
total_tripsintegerNo>= 0Total completed trips count
wallet_balancestringNoDecimal string (e.g. "3250.00")Driver wallet balance
service_categoryenumNo"BIKE""CAB""AMBULANCE""LOGISTICS"Operating service domain
citystringNoStringUpdated operating city
statestringYesStringUpdated operating state
languagestringNoDefault: "en"Preferred interface language
own_referral_codestringYesPrefixed with CAP_Unique referral code
referred_by_codestringYesStringReferral code used during signup
vehicle_namestringYesStringVehicle make/brand
vehicle_modelstringYesStringVehicle model
vehicle_colorstringYesStringVehicle color
number_platestringYesStringRegistration plate number
vehicleobjectYesSub-object or nullVehicle details
vehicle.idstringNoPrefixed with veh_Vehicle ID
vehicle.namestringNoStringVehicle brand
vehicle.modelstringNoStringVehicle model
vehicle.colorstringNoStringVehicle color
vehicle.number_platestringNoStringPlate number
is_activebooleanNotrue, falseSystem active status
is_blockedbooleanNotrue, falseAccount blocked flag
last_login_atstringYesISO 8601 TimestampTimestamp of last login
created_atstringNoISO 8601 TimestampAccount registration timestamp
updated_atstringNoISO 8601 TimestampTimestamp of this update

Response Examples

1. 200 OK — Success

{
"message": "Operating city updated successfully",
"city": "Bengaluru",
"driver": {
"id": "drv_8a7b6c5d4e",
"name": "Ravi Kumar",
"phone": "+919876543210",
"is_phone_verified": true,
"email": "ravi.kumar@example.com",
"is_email_verified": true,
"gender": "MALE",
"date_of_birth": "1992-05-15T00:00:00.000Z",
"profile_image_url": "https://example.com/profiles/ravi.jpg",
"is_profile_complete": true,
"status": "APPROVED",
"duty_status": "OFFLINE",
"rejection_reason": null,
"rating": "4.85",
"total_trips": 142,
"wallet_balance": "3250.00",
"service_category": "CAB",
"city": "Bengaluru",
"state": "Karnataka",
"language": "en",
"own_referral_code": "CAP_8X9K2",
"referred_by_code": null,
"vehicle_name": "Maruti Suzuki",
"vehicle_model": "Swift Dzire",
"vehicle_color": "White",
"number_plate": "KA-01-AB-1234",
"vehicle": {
"id": "veh_1a2b3c4d5e",
"name": "Maruti Suzuki",
"model": "Swift Dzire",
"color": "White",
"number_plate": "KA-01-AB-1234"
},
"is_active": true,
"is_blocked": false,
"last_login_at": "2026-09-21T04:45:00.000Z",
"created_at": "2026-08-10T12:00:00.000Z",
"updated_at": "2026-09-21T05:08:45.000Z"
}
}

2. 400 Bad Request — Validation Error (Missing city)

{
"success": false,
"message": "Validation failed: city: City name is required",
"errors": [
{
"field": "city",
"message": "City name is required"
}
]
}

3. 401 Unauthorized — Token Missing / Expired / Session Revoked

{
"error": "Unauthorized",
"message": "Invalid or expired driver access token."
}

4. 403 Forbidden — Account Blocked / Deactivated

{
"error": "Forbidden",
"message": "Driver account is blocked or deactivated."
}

5. 404 Not Found — Driver Not Found

{
"error": "Driver not found"
}

6. 500 Internal Server Error

{
"error": "Failed to update operating city"
}

Status Codes Reference

HTTP Status CodeCondition
200 OKOperating city successfully updated in database and returned with driver profile.
400 Bad RequestMissing or empty city field in body.
401 UnauthorizedMissing, invalid, expired token or session revoked.
403 ForbiddenDriver account is deactivated or blocked.
404 Not FoundDriver ID from token does not exist in database.
500 Internal Server ErrorServer or database query failure.

Authentication

AuthorizationBearer

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