This document describes all API endpoints exposed by the Fin-Trust backend.
- Development URL:
http://localhost:5000/api - Headers:
Content-Type: application/jsonAuthorization: Bearer <JWT_TOKEN>(Required for all protected routes)
Creates a new unverified user account. Sends a verification OTP to the user's email.
- Method:
POST - Endpoint:
/auth/register - Auth Required: No
- Request Body:
{ "name": "Asha Rao", "email": "asharao@example.com", "password": "SecurePassword123!", "role": "borrower" } - Success Response (201 Created):
{ "success": true, "message": "Registration successful. Please check your email for a verification code.", "user": { "name": "Asha Rao", "email": "asharao@example.com", "role": "borrower", "isActive": true, "isVerified": false, "_id": "6a6a3e1f6c4695c3a0a44ccc", "createdAt": "2026-07-29T17:53:35.451Z" } }
Verifies the user's email using the sent 6-digit OTP code.
- Method:
POST - Endpoint:
/auth/verify-email - Auth Required: No
- Request Body:
{ "email": "asharao@example.com", "otp": "579525" } - Success Response (200 OK):
{ "success": true, "message": "Email verified successfully. You can now log in." }
Validates credentials and issues a JWT token.
- Method:
POST - Endpoint:
/auth/login - Auth Required: No
- Request Body:
{ "email": "asharao@example.com", "password": "SecurePassword123!" } - Success Response (200 OK):
{ "success": true, "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "user": { "_id": "6a6a3e1f6c4695c3a0a44ccc", "name": "Asha Rao", "email": "asharao@example.com", "role": "borrower", "isActive": true, "isVerified": true } }
Submits loan requirements and coordinates for trust analysis.
- Method:
POST - Endpoint:
/borrowers - Auth Required: Yes (
borrowerrole only) - Request Body:
{ "amount": 50000, "duration": 12, "purpose": "Home renovation", "income": 45000, "employmentStatus": "salaried", "city": "Mumbai", "latitude": 19.0760, "longitude": 72.8777 } - Success Response (201 Created):
{ "success": true, "borrower": { "user": "6a6a3e1f6c4695c3a0a44ccc", "amount": 50000, "duration": 12, "purpose": "Home renovation", "income": 45000, "employmentStatus": "salaried", "city": "Mumbai", "latitude": 19.0760, "longitude": 72.8777, "trustScore": 65, "isApproved": true } }
Uploads files (Aadhaar, PAN, Bank Statement) for OCR processing and name verification.
- Method:
POST - Endpoint:
/borrowers/upload-kyc - Auth Required: Yes (
borrowerrole only) - Request Format:
multipart/form-data - Parameters:
file: (File binary)type:aadhaar|pan|bank
- Success Response (200 OK):
{ "success": true, "message": "KYC file uploaded and verified successfully", "extractedName": "ASHA RAO", "scoreChange": 15 }
Configures preferences and limits.
- Method:
POST - Endpoint:
/lenders - Auth Required: Yes (
lenderrole only) - Request Body:
{ "minAmount": 10000, "maxAmount": 100000, "minTrustScore": 60, "preferredDuration": 12, "city": "Mumbai", "latitude": 19.0760, "longitude": 72.8777 } - Success Response (201 Created):
{ "success": true, "lender": { "user": "6a6a3e1f6c4695c3a0a44ddd", "minAmount": 10000, "maxAmount": 100000, "minTrustScore": 60, "preferredDuration": 12, "city": "Mumbai" } }
- Method:
PUT - Endpoint:
/matches/:id/accept - Auth Required: Yes (Either role)
- Request Body:
{ "agreedToDisclaimer": true } - Success Response (200 OK):
{ "success": true, "message": "Match accepted successfully" }
Returns the private contact details once both parties have accepted.
- Method:
GET - Endpoint:
/matches/:id/contact - Auth Required: Yes (Either matching profile owner)
- Success Response (200 OK):
{ "success": true, "contact": { "name": "Nikhitha J Gadad", "email": "nikhithagadad@gmail.com", "phone": "+919876543210" } }
Returns high-level user and matching statistics.
- Method:
GET - Endpoint:
/admin/stats - Auth Required: Yes (
adminrole only) - Success Response (200 OK):
{ "success": true, "stats": { "totalUsers": 24, "totalBorrowers": 12, "totalLenders": 8, "totalMatches": 45, "acceptedMatches": 14, "rejectedMatches": 5, "pendingApplications": 3 } }