Version 1.0.0
Base URL: http://localhost:8000/api
Authentication: Bearer Token (Laravel Sanctum)
Response Format: JSON
📱 Firebase Required:
All authentication endpoints require a valid Firebase ID token obtained from Firebase Authentication.
/api/validate-pincode
Validate Indian pincode and get location details
📍 Pincode-First Approach:
User enters pincode → API validates → Returns state, city, district → User confirms/edits → Enters area manually
→ Request Body:
{
"pincode": "400053"
}
✓ Success Response (200):
{
"success": true,
"message": "Pincode validated successfully",
"data": {
"pincode": "400053",
"area": "Andheri West H.O",
"city": "Mumbai",
"state": "Maharashtra",
"country": "India"
}
}
⚠️ Uses India Post API in real-time. May have occasional timeouts.
/api/auth/register
Register a new user
⚠️ Content-Type: multipart/form-data
Required Fields:
firebase_token - Firebase ID tokenphone - 10 digits (6-9xxxxxxxxx)name - User name (2-100 chars)email - Valid email (unique)profile_picture - Image file (JPG/PNG, max 2MB)pincode - 6 digit Indian pincodestate - State name (from pincode API)city - City name (from pincode API)area - Area/locality (user enters manually)Optional Fields:
district - District name (auto-filled from pincode API)distributor_name - Distributor nameretailer_name - Retailer namegarage_name - Garage namereferral_code - Referral code from existing user✓ Success Response (201):
{
"success": true,
"message": "Registration successful",
"data": {
"user": {
"id": 1,
"phone": "9876543210",
"name": "John Doe",
"email": "john@example.com",
"profile_picture_url": "https://.../storage/profiles/...",
"state": "Maharashtra",
"city": "Mumbai",
"district": "Mumbai",
"referral_code": "VRD4X8K2",
"wallet_balance": "0.00",
"kyc_status": "pending"
},
"token": "1|sanctum_token_here"
}
}
/api/auth/login
Login existing user
→ Request Body:
{
"firebase_token": "eyJhbGciOiJSUzI1NiIs...",
"phone": "9876543210"
}
✓ Success Response (200):
{
"success": true,
"message": "Login successful",
"data": {
"user": { ... },
"token": "2|new_sanctum_token_here"
}
}
/api/auth/logout
Protected
Logout current user and revoke token
Headers:
Authorization: Bearer {token}
/api/auth/me
Protected
Get current authenticated user details
/api/profile
Protected
Get user profile with statistics
✓ Success Response:
{
"success": true,
"data": {
"user": { ... },
"statistics": {
"total_referrals": 5,
"wallet_balance": "500.00",
"total_earned": "1500.00"
}
}
}
/api/profile/update
Protected
Update user profile (all fields optional)
Updatable Fields (All Optional):
name, email, profile_picture (file)state_id, city_id, area, pincodedistributor_name, retailer_name, garage_name💡 Note: Old profile picture is automatically deleted when uploading new one.
/api/profile/delete
Protected
Delete user account permanently
→ Request Body:
{
"confirmation": "DELETE"
}
User enters pincode → App calls /api/validate-pincode
API returns state, city, district → App pre-fills these fields
User confirms/edits state & city, enters area manually
App sends OTP to user's phone via Firebase
User enters OTP → Firebase verifies and returns ID token
App sends all data + Firebase token to /api/auth/register
API validates everything and returns user + Sanctum token
storage/app/firebase-credentials.jsonFIREBASE_PROJECT_ID to .envRun on server:
php artisan storage:link
© 2026 Vardhan Oil. Powered by <TAG97>