Authentication
User authentication and registration
Authenticate user and receive JWT tokens
Username or email address
johndoeUser password
Password123!Login successful
Invalid credentials
Account suspended
POST /api/v3/auth/login HTTP/1.1
Host: localhost:8009
Content-Type: application/json
Accept: */*
Content-Length: 54
{
"username_email": "johndoe",
"password": "Password123!"
}{
"success": true,
"code": 200,
"message": "Login successful",
"data": {
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 86400,
"user": {
"id": 1,
"username": "johndoe",
"email": "[email protected]",
"balance": 100.5,
"referral_balance": 25,
"referral_code": "CM12345678",
"role": "user"
}
}
}Register a new user account
johndoePattern: ^[a-zA-Z0-9_]+$[email protected]Must contain uppercase, lowercase, number, and special character
Password123!Optional referral code
CM12345678Device fingerprint for fraud detection
abc123def456Registration successful
Validation error
Username or email already exists
POST /api/v3/auth/register HTTP/1.1
Host: localhost:8009
Content-Type: application/json
Accept: */*
Content-Length: 140
{
"username": "johndoe",
"email": "[email protected]",
"password": "Password123!",
"referral_code": "CM12345678",
"device_fingerprint": "abc123def456"
}{
"success": true,
"code": 201,
"message": "Registration successful",
"data": {
"access_token": "text",
"refresh_token": "text",
"token_type": "text",
"expires_in": 1,
"user": {
"id": 1,
"username": "johndoe",
"email": "[email protected]",
"balance": 100.5,
"referral_balance": 25,
"referral_code": "CM12345678",
"role": "user"
}
}
}Get a new access token using refresh token
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...Token refreshed successfully
Invalid or expired refresh token
POST /api/v3/auth/refresh HTTP/1.1
Host: localhost:8009
Content-Type: application/json
Accept: */*
Content-Length: 59
{
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}{
"success": true,
"code": 200,
"message": "Token refreshed successfully",
"data": {
"access_token": "text",
"refresh_token": "text",
"token_type": "text",
"expires_in": 1
}
}Logout user (client should delete tokens)
JWT token obtained from login or register endpoint
Logout successful
POST /api/v3/auth/logout HTTP/1.1
Host: localhost:8009
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
Logout successful
{
"success": true,
"code": 200,
"message": "Logout successful"
}Request a password reset link
[email protected]Reset link sent (if email exists)
POST /api/v3/auth/password-reset-request HTTP/1.1
Host: localhost:8009
Content-Type: application/json
Accept: */*
Content-Length: 28
{
"email": "[email protected]"
}Reset link sent (if email exists)
{
"success": true,
"code": 200,
"message": "If the email exists, a password reset link has been sent"
}Last updated