Skip to navigation

signin

View as Markdown

Authenticate an existing driver or register a new driver using their mobile phone number. On registration, a new driver record, referral code, and auth session tokens are generated.


Endpoint Overview

  • Method: POST

  • Route: /api/v1/driver/signin

  • Authentication: None (Public)

  • Content-Type: application/json


Request Headers

HeaderTypeRequiredDescription
Content-TypestringYesMust be application/json
User-AgentstringNoClient device info (used for session tracking)
X-Forwarded-ForstringNoClient IP address (used for session logging)

Request Body Schema

FieldData TypeRequiredDefaultAllowed Values / ConstraintsDescription
phonestringYes—Min length 1Driver’s phone number with country code (e.g. +919876543210)
namestringNonullAny stringFull name of the driver
emailstringNonullValid email formatEmail address
genderenumNonull"MALE", "FEMALE"Driver gender
profile_image_urlstringNonullValid URL formatHosted profile picture URL
service_categoryenumNo"CAB""BIKE", "CAB", "AMBULANCE", "LOGISTICS"Primary operational vehicle category
citystringNo"DEFAULT"Any stringOperating city name
statestringNonullAny stringOperating state/province
languagestringNo"en"e.g. "en", "hi"Preferred app language code
referred_by_codestringNonullExisting referral codeReferral code of inviter (strictly validated on signup)
is_phone_verifiedbooleanNotruetrue, falseStatus of client-side OTP verification
device_idstringNonullAny unique device IDDevice identifier used for single-device session tracking

Request Body Example

{
"phone": "+919876543210",
"name": "Ravi Kumar",
"email": "ravi.kumar@example.com",
"gender": "MALE",
"profile_image_url": "https://example.com/profiles/ravi.jpg",
"service_category": "CAB",
"city": "Bengaluru",
"state": "Karnataka",
"language": "en",
"referred_by_code": "CAP_XYZ12",
"is_phone_verified": true,
"device_id": "d1234567-89ab-cdef-0123-456789abcdef"
}

Response Body Schema (200 OK)

Top-Level Response Fields

FieldData TypeDescription
messagestringStatus message ("Signed in successfully")
driverobjectComplete driver profile details (see sub-fields below)
accessTokenstringJWT access token to send in Authorization: Bearer (expires in 1h)
refreshTokenstringOpaque refresh token string to rotate tokens via /driver/refresh-token (expires in 30d)

driver Object Fields

FieldData TypeNullableAllowed Values / ConstraintsDescription
idstringNoPrefixed with drv_Unique driver account ID
namestringYesAny stringFull name of driver
phonestringNoUnique stringRegistered mobile phone number
is_phone_verifiedbooleanNotrue, falseWhether phone number is verified via OTP
emailstringYesValid email stringRegistered email address
is_email_verifiedbooleanNotrue, falseWhether email is verified
genderenumYes"MALE", "FEMALE", nullDriver gender
date_of_birthstringYesISO 8601 TimestampDriver date of birth
profile_image_urlstringYesValid URLAvatar image URL
is_profile_completebooleanNotrue, falseOnboarding profile completion indicator
statusenumNo"PENDING_ONBOARDING""PENDING_APPROVAL""APPROVED""REJECTED""SUSPENDED""BLOCKED"Operational & verification state
duty_statusenumNo"OFFLINE""ONLINE""ON_TRIP"Real-time driver availability status
rejection_reasonstringYesAny stringReason provided by admin if status is REJECTED
ratingstringNoDecimal string (default: "5.00")Average driver customer rating
total_tripsintegerNo>= 0 (default: 0)Total number of completed trips
wallet_balancestringNoDecimal string (default: "0.00")Current driver wallet balance
service_categoryenumNo"BIKE""CAB""AMBULANCE""LOGISTICS"Registered domain of service
citystringNoDefault: "DEFAULT"Operating city
statestringYesAny stringOperating state/province
languagestringNoDefault: "en"Driver app interface language
own_referral_codestringYesPrefixed with CAP_ (e.g. CAP_8X9K2)Unique code for inviting other drivers/riders
referred_by_codestringYesAny stringReferral code used when registering
vehicle_namestringYesAny string (e.g. "Maruti Suzuki")Flattened vehicle brand/make
vehicle_modelstringYesAny string (e.g. "Swift Dzire")Flattened vehicle model
vehicle_colorstringYesAny string (e.g. "White")Flattened vehicle paint color
number_platestringYesAny string (e.g. "KA-01-AB-1234")Flattened vehicle license registration number
vehicleobjectYesSub-object or nullNested vehicle details (null if not registered)
vehicle.idstringNoPrefixed with veh_Unique vehicle ID
vehicle.namestringNoAny stringVehicle make/brand name
vehicle.modelstringNoAny stringVehicle model name
vehicle.colorstringNoAny stringVehicle color
vehicle.number_platestringNoAny stringVehicle license number plate
is_activebooleanNotrue, falseWhether driver is active in platform
is_blockedbooleanNotrue, falseWhether driver has been blocked
last_login_atstringYesISO 8601 TimestampTimestamp when driver last authenticated
created_atstringNoISO 8601 TimestampRecord creation timestamp
updated_atstringNoISO 8601 TimestampRecord last update timestamp

Response Examples

1. 200 OK — Successful Registration (New Driver, No Vehicle Yet)

{
"message": "Signed in successfully",
"driver": {
"id": "drv_8a7b6c5d4e",
"name": "Ravi Kumar",
"phone": "+919876543210",
"is_phone_verified": true,
"email": "ravi.kumar@example.com",
"is_email_verified": false,
"gender": "MALE",
"date_of_birth": null,
"profile_image_url": "https://example.com/profiles/ravi.jpg",
"is_profile_complete": false,
"status": "PENDING_ONBOARDING",
"duty_status": "OFFLINE",
"rejection_reason": null,
"rating": "5.00",
"total_trips": 0,
"wallet_balance": "0.00",
"service_category": "CAB",
"city": "Bengaluru",
"state": "Karnataka",
"language": "en",
"own_referral_code": "CAP_8X9K2",
"referred_by_code": "CAP_XYZ12",
"vehicle_name": null,
"vehicle_model": null,
"vehicle_color": null,
"number_plate": null,
"vehicle": null,
"is_active": true,
"is_blocked": false,
"last_login_at": "2026-09-21T04:45:00.000Z",
"created_at": "2026-09-21T04:45:00.000Z",
"updated_at": "2026-09-21T04:45:00.000Z"
},
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkcnZfOGE3YjZjNWQ0ZSIsInNlc3Npb25fdmVyc2lvbiI6MSwiaWF0IjoxNzU4NDI5OTAwLCJleHAiOjE3NTg0MzM1MDB9.SIGNATURE",
"refreshToken": "drtok_7f8e9d0c1b2a345678901234567890ab"
}

2. 200 OK — Successful Sign-in (Existing Approved Driver with Vehicle)

{
"message": "Signed in successfully",
"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-21T04:45:00.000Z"
},
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkcnZfOGE3YjZjNWQ0ZSIsInNlc3Npb25fdmVyc2lvbiI6MiwiaWF0IjoxNzU4NDI5OTAwLCJleHAiOjE3NTg0MzM1MDB9.SIGNATURE",
"refreshToken": "drtok_99aa88bb77cc66dd55ee44ff33aa22bb"
}

3. 400 Bad Request — Validation Error

Returned when input validation fails (e.g. missing phone or invalid enum/format):

{
"success": false,
"message": "Validation failed: phone: Phone number is required",
"errors": [
{
"field": "phone",
"message": "Phone number is required"
}
]
}

4. 400 Bad Request — Invalid Referral Code

Returned when a new driver registers with a referral code that does not exist:

{
"error": "Invalid referral code"
}

5. 403 Forbidden — Account Blocked / Deactivated

Returned when the driver account is deactivated or blocked (is_blocked = true or account deleted):

{
"error": "Driver account is blocked or deactivated"
}

6. 500 Internal Server Error — Server / Database Failure

{
"error": "Failed to process driver signin"
}

Or:

{
"error": "Internal server error during driver signin"
}

Status Codes Reference

HTTP Status CodeCondition
200 OKSuccessfully registered or logged in; profile and auth tokens returned.
400 Bad RequestValidation failure on request body, or invalid referral code.
403 ForbiddenDriver account is blocked or soft-deleted.
500 Internal Server ErrorUncaught database or server processing error.

Authentication

AuthorizationBearer

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

Request

This endpoint expects an object.
phonestringRequired