Skip to navigation

Get Driver Referral Network

View as Markdown

Retrieves the authenticated driver’s personal referral code, the total count of referees, and the detailed list of users and drivers who registered using their referral code.


Endpoint Overview

  • Method: GET

  • Route: /api/v1/driver/referrals

  • Authentication: Bearer Token (Driver JWT)

  • Content-Type: N/A


Request Headers

HeaderTypeRequiredDescription
AuthorizationstringYesFormat: Bearer

Request Body Schema

None (GET request)


Response Body Schema (200 OK)

Top-Level KeyData TypeDescription
referral_codestringDriver’s own unique referral code (e.g. "CAP_8X9K2")
total_referredintegerTotal count of registered referees
referred_usersarrayList of referees (both drivers and riders)

Referee Item Fields

FieldData TypeNullableAllowed Values / ConstraintsDescription
idstringNoPrefixed with drv_ or usr_Unique account ID of referee
namestringYesStringFull name of referee
phonestringNoE.164 string formatRegistered phone number
profile_image_urlstringYesValid URLAvatar image URL
typeenumNo"DRIVER", "USER"Platform role of referee
referred_atstringNoISO 8601 TimestampRegistration timestamp

Response Examples

1. `200 OK` — Referrals Found

{
"referral_code": "CAP_8X9K2",
"total_referred": 2,
"referred_users": [
{
"id": "drv_1a2b3c4d5e",
"name": "Suresh Patel",
"phone": "+919811122233",
"profile_image_url": "https://example.com/profiles/suresh.jpg",
"type": "DRIVER",
"referred_at": "2026-09-15T10:30:00.000Z"
},
{
"id": "usr_9z8y7x6w5v",
"name": "Priya Sharma",
"phone": "+919844455566",
"profile_image_url": null,
"type": "USER",
"referred_at": "2026-09-18T14:15:22.000Z"
}
]
}

2. `200 OK` — No Referrals Yet

{
"referral_code": "CAP_8X9K2",
"total_referred": 0,
"referred_users": []
}

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

{
"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` — Referral Code Not Found

{
"error": "Referral code not found for driver"
}

6. `500 Internal Server Error`

{
"error": "Failed to fetch referral data"
}

Status Codes Reference

HTTP Status CodeCondition
200 OKSuccessfully retrieved driver referral code and referee network.
401 UnauthorizedMissing, invalid, expired token or session revoked.
403 ForbiddenDriver account has been deactivated or blocked.
404 Not FoundDriver has no referral code assigned.
500 Internal Server ErrorDatabase or query execution failure.

Authentication

AuthorizationBearer

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