Author: Refferq Team
Complete API reference for Refferq affiliate management platform.
All API endpoints (except auth endpoints) require authentication via JWT token stored in cookies.
POST /api/auth/register
Request Body:
{
"name": "John Doe",
"email": "john@example.com",
"password": "securePassword123"
}Response:
{
"success": true,
"message": "Registration successful",
"user": {
"id": "user_id",
"name": "John Doe",
"email": "john@example.com",
"role": "AFFILIATE"
}
}POST /api/auth/login
Request Body:
{
"email": "john@example.com",
"password": "securePassword123"
}Response:
{
"success": true,
"user": {
"id": "user_id",
"name": "John Doe",
"email": "john@example.com",
"role": "AFFILIATE",
"hasAffiliate": true
}
}POST /api/auth/logout
Response:
{
"success": true,
"message": "Logged out successfully"
}GET /api/auth/me
Response:
{
"user": {
"id": "user_id",
"name": "John Doe",
"email": "john@example.com",
"role": "AFFILIATE",
"hasAffiliate": true
}
}GET /api/admin/dashboard
Response:
{
"success": true,
"stats": {
"totalRevenue": 50000,
"totalPartners": 125,
"activePartners": 98,
"totalReferrals": 450,
"pendingReferrals": 23,
"approvedReferrals": 380,
"totalCommissions": 12500,
"paidCommissions": 8000,
"conversionRate": 15.5
}
}GET /api/admin/affiliates
Response:
{
"success": true,
"affiliates": [
{
"id": "affiliate_id",
"userId": "user_id",
"referralCode": "JOHN123",
"balanceCents": 25000,
"createdAt": "2025-01-01T00:00:00Z",
"user": {
"name": "John Doe",
"email": "john@example.com",
"status": "ACTIVE"
}
}
]
}GET /api/admin/referrals
Query Parameters:
status(optional): Filter by status (PENDING, APPROVED, REJECTED)
Response:
{
"success": true,
"referrals": [
{
"id": "referral_id",
"leadName": "Jane Smith",
"leadEmail": "jane@example.com",
"status": "PENDING",
"metadata": {
"estimatedValue": 5000
},
"createdAt": "2025-01-10T00:00:00Z",
"affiliate": {
"user": {
"name": "John Doe"
}
}
}
]
}PUT /api/admin/referrals/[id]
PATCH /api/admin/referrals/[id]
Request Body:
{
"action": "approve",
"reviewNotes": "Verified lead"
}Response:
{
"success": true,
"message": "Referral approved successfully",
"referral": {
"id": "referral_id",
"status": "APPROVED",
"reviewedAt": "2025-01-10T10:00:00Z"
}
}GET /api/admin/settings
Response:
{
"success": true,
"settings": {
"productName": "BsBot",
"programName": "BsBot's Affiliate Program",
"websiteUrl": "https://kyns.com",
"currency": "INR",
"minimumPayoutThreshold": 1000,
"payoutTerm": "NET-15"
}
}PUT /api/admin/settings
Request Body:
{
"productName": "NewProduct",
"programName": "New Program Name",
"minimumPayoutThreshold": 2000
}Response:
{
"success": true,
"message": "Settings updated successfully"
}GET /api/admin/payouts
Response:
{
"success": true,
"payouts": [
{
"id": "payout_id",
"userId": "user_id",
"amountCents": 5000,
"method": "PAYPAL",
"status": "COMPLETED",
"processedAt": "2025-01-15T00:00:00Z"
}
]
}GET /api/affiliate/profile
Response:
{
"success": true,
"user": {
"id": "user_id",
"name": "John Doe",
"email": "john@example.com"
},
"affiliate": {
"id": "affiliate_id",
"referralCode": "JOHN123",
"balanceCents": 25000
},
"stats": {
"totalEarnings": 25000,
"pendingEarnings": 5000,
"totalCommissions": 15,
"totalConversions": 45,
"conversionRate": 12.5
},
"referrals": [],
"commissions": []
}PUT /api/affiliate/profile
Request Body:
{
"name": "John Updated",
"email": "john.new@example.com",
"company": "Company Name",
"country": "India",
"paymentMethod": "PayPal",
"paymentEmail": "john@paypal.com"
}Response:
{
"success": true,
"message": "Profile updated successfully"
}GET /api/affiliate/referrals
Response:
{
"success": true,
"referrals": [
{
"id": "referral_id",
"leadName": "Jane Smith",
"leadEmail": "jane@example.com",
"status": "APPROVED",
"estimatedValue": 5000,
"createdAt": "2025-01-10T00:00:00Z"
}
]
}POST /api/affiliate/referrals
Request Body:
{
"lead_name": "Jane Smith",
"lead_email": "jane@example.com",
"estimated_value": "5000"
}Response:
{
"success": true,
"message": "Referral submitted successfully",
"referral": {
"id": "referral_id",
"status": "PENDING"
}
}GET /api/affiliate/payouts
Response:
{
"success": true,
"payouts": [
{
"id": "payout_id",
"amount": 5000,
"status": "COMPLETED",
"method": "PAYPAL",
"createdAt": "2025-01-01T00:00:00Z",
"paidAt": "2025-01-15T00:00:00Z"
}
]
}{
"success": true,
"message": "Operation completed successfully",
"data": {}
}{
"success": false,
"error": "Error message",
"code": "ERROR_CODE"
}| Status Code | Description |
|---|---|
| 200 | Success |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
| 500 | Internal Server Error |
No authentication token- User not logged inAdmin access required- User is not adminAffiliate role required- User is not affiliateInvalid credentials- Wrong email/passwordUser not found- User doesn't existEmail already in use- Email taken during registration
Currently, there are no rate limits. In production, consider implementing rate limiting for security.
Webhook support for external integrations is planned for future releases.
Documentation by Refferq Team Last Updated: October 2025