π¦ Cladfy Member API Documentation
Version: v1.0
Base URL: https://{appname}.cladfy.app/api
π― Purpose
For external developers to integrate Cladfy Microlender System features into their mobile apps, websites, or third-party systems.
π₯ Who Uses This API
- π± Mobile Apps (iOS, Android, Flutter, React Native)
- π Web Apps or Websites
- π External Systems & Platforms
π Authentication
API Keys (for registration & login)
X-API-Key: pk_your_branch_key
X-API-Secret: sk_your_branch_secret
JWT Token (for all other endpoints)
Authorization: Bearer {jwt_token}
Tokens expire in 1 hour and can be refreshed using /auth/refresh
.
π Environments
Environment | Base URL |
---|---|
Production | https://{appname}.cladfy.app/api |
Staging | http://localhost:8000/api |
π 1. Authentication
1.1 Register Member
Endpoint:
POST /auth/register
Headers
X-API-Key: {{api_key}}
X-API-Secret: {{api_secret}}
Content-Type: application/json
Accept: application/json
Body
{
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"password": "SecurePass123!",
"password_confirmation": "SecurePass123!",
"country_code": "+1",
"mobile": "1234567890",
"gender": "male",
"city": "New York",
"state": "NY",
"zip": "10001",
"address": "123 Main Street",
"credit_source": "salary"
}
Sample Response
{
"success": true,
"message": "Member registered successfully. Awaiting approval.",
"data": {
"member": {
"id": 10,
"member_no": "MBR00010",
"status": 0
},
"user": {
"id": 45,
"email": "[email protected]"
}
}
}
PHP Example
$ch = curl_init('https://demo.cladfy.app/api/auth/register');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-API-Key: '.$apiKey,
'X-API-Secret: '.$apiSecret,
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
1.2 Login (Get JWT Token)
Endpoint:
POST /auth/login
Body
{
"email": "[email protected]",
"password": "SecurePass123!"
}
Sample Response
{
"success": true,
"data": {
"access_token": "eyJhbGciOiJIUzI1NiIs...",
"token_type": "bearer",
"expires_in": 3600,
"member": {
"id": 10,
"member_no": "MBR00010"
}
}
}
π€ 2. Profile Management
2.1 Get Profile
Endpoint:
GET /members/profile
Headers
Authorization: Bearer {{jwt_token}}
Accept: application/json
Sample Response
{
"success": true,
"data": {
"member": {
"id": 10,
"first_name": "John",
"last_name": "Doe",
"business_name": "John's Business Solutions",
"city": "New York"
}
}
}
π° 3. Loan Products
3.1 Get All Loan Products
Endpoint:
GET /loans/products
Sample Response
{
"success": true,
"data": {
"loan_products": [
{
"id": 1,
"name": "Business Loan",
"min_amount": 1000,
"max_amount": 10000,
"interest_rate": "10%",
"term": "12 months"
}
]
}
}
π 4. Loan Applications
4.1 Apply for Loan
Endpoint:
POST /loans/apply
Body
{
"loan_product_id": 1,
"currency_id": 1,
"first_payment_date": "2025-02-01",
"applied_amount": 5000,
"description": "For inventory expansion"
}
Sample Response
{
"success": true,
"data": {
"loan": {
"id": 30,
"loan_number": "LN00030",
"status": "pending"
}
}
}
π³ 5. Repayments
5.1 Get Upcoming Repayments
Endpoint:
GET /repayments/upcoming
Sample Response
{
"success": true,
"data": {
"upcoming_repayments": [
{
"loan_id": 30,
"due_date": "2025-03-01",
"amount_due": 550.0
}
]
}
}
5.2 Make Payment
Endpoint:
POST /repayments/make-payment
Body
{
"loan_id": 30,
"repayment_id": 1,
"principal_amount": 550,
"account_id": 2
}
Sample Response
{
"success": true,
"data": {
"payment": {
"id": 101,
"amount": 550,
"status": "paid",
"receipt_no": "PAY000101"
}
}
}
βοΈ Summary
Section | Endpoints | Description |
---|---|---|
Authentication | 7 | Register, login, logout, refresh |
Profile Management | 5 | Get/update profile, upload docs |
Loan Products | 2 | Browse and view products |
Loan Applications | 4 | Apply, view, and track loans |
Repayments | 5 | View and make payments |