Authentication API
Authenticate users and manage sessions with the BRDZ API.
Login User
Login User
Authenticate a user with email/username and password. Returns JWT token for subsequent API calls.
Parameters
usernameoremailstringrequiredUser's email address or username
passwordstringrequiredUser's password
Request Body
{
"usernameoremail": "user@example.com",
"password": "securepassword123"
}Response
{
"success": true,
"message": "Login berhasil",
"requires_2fa": false,
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"user_id": 123,
"email": "user@example.com",
"role": "admin",
"username": "user123",
"phone": "+6281234567890",
"ekyc_status": "PENDING"
},
"client": {
"client_id": 45,
"client_type": "BUSINESS",
"client_status": "ACTIVE",
"ekyc_status": "PENDING",
"ekyb_status": "PENDING"
}
}
}{
"success": false,
"error": "Incorrect username or password"
}{
"success": false,
"error": "Incorrect username or password"
}{
"success": false,
"error": "Account is not active or rejected"
}{
"success": true,
"requires_2fa": true,
"message": "Password verified. Please provide 2FA verification code.",
"data": {
"user_id": 123,
"email": "user@example.com"
}
}curl -X POST https://api.brdz.link/api/auth/login \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"usernameoremail": "user@example.com",
"password": "securepassword123"
}'Complete Login with 2FA
Complete Login with 2FA
Complete the login process when 2FA is enabled. Use this after initial login returns requires_2fa: true.
Parameters
user_idnumberrequiredUser ID from initial login response
two_fa_tokenstringrequired6-digit code from authenticator app
Request Body
{
"user_id": 123,
"two_fa_token": "123456"
}Response
{
"success": true,
"message": "2FA verification successful. Login completed.",
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"user_id": 123,
"email": "user@example.com",
"role": "admin",
"username": "user123",
"phone": "+6281234567890",
"ekyc_status": "PENDING"
},
"client": {
"client_id": 45,
"client_type": "BUSINESS",
"client_status": "ACTIVE",
"ekyc_status": "PENDING",
"ekyb_status": "PENDING"
}
}
}{
"success": false,
"error": "User ID and 2FA token are required"
}{
"success": false,
"error": "Invalid 2FA verification code"
}{
"success": false,
"error": "Account is not active"
}{
"success": false,
"error": "User not found"
}curl -X POST https://api.brdz.link/api/auth/complete-login \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"user_id": 123,
"two_fa_token": "123456"
}'Forgot Password
Forgot Password
Request password reset email for user account.
Parameters
emailstringrequiredUser's email address
Request Body
{
"email": "user@example.com"
}Response
{
"success": true,
"message": "Password reset email sent"
}{
"success": false,
"error": "Email is required"
}{
"success": false,
"error": "An error occurred while processing request",
"details": "Error details"
}curl -X POST https://api.brdz.link/api/password/request_reset \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"email": "user@example.com"
}'Register Client with Admin
Register Client with Admin
Register a new client and automatically create an admin user. Password is auto-generated and sent via email.
Parameters
emailstringrequiredClient's email address
client_aliasstringrequiredClient's display name/alias
client_typestringrequiredType of client (e.g., 'BUSINESS', 'INDIVIDUAL')
country_codestringrequiredISO country code (e.g., 'ID', 'US')
phonestringrequiredClient's phone number
client_statusstringClient status (defaults to 'PENDING')
Request Body
{
"email": "newclient@example.com",
"client_alias": "My Company",
"client_type": "BUSINESS",
"country_code": "ID",
"phone": "+6281234567890"
}Response
{
"message": "Client & Admin successfully created! Admin must complete KYC before being able to use the account.",
"client": {
"client_id": 124,
"client_code": "CL-202501-0001",
"email": "newclient@example.com",
"client_alias": "My Company",
"client_type": "BUSINESS",
"client_status": "PENDING",
"ekyc_status": "PENDING",
"country_code": "ID",
"psp_id": 1,
"phone": "+6281234567890"
},
"admin_user": {
"user_id": 456,
"email": "newclient@example.com",
"username": "My Company",
"role": "admin",
"user_status": "ACTIVE"
},
"ekyc_status": "PENDING"
}{
"error": "Email, Name, Type, Country and Mobile Number are required!"
}{
"error": "Email is already in use by another client."
}curl -X POST https://api.brdz.link/api/clients/create_with_admin \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"email": "newclient@example.com",
"client_alias": "My Company",
"client_type": "BUSINESS",
"country_code": "ID",
"phone": "+6281234567890"
}'Get User Profile
Get User Profile
Get user profile information. Requires authentication.
Parameters
user_idstringrequiredUser ID (path parameter)
Response
{
"success": true,
"data": {
"user": {
"user_id": 123,
"email": "user@example.com",
"username": "user123",
"role": "admin",
"phone": "+6281234567890",
"user_status": "ACTIVE",
"ekyc_status": "PENDING"
}
}
}{
"success": false,
"error": "Authentication required"
}{
"success": false,
"error": "User not found"
}curl -X GET https://api.brdz.link/api/users/123 \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "x-api-key: YOUR_API_KEY"Most BRDZ API endpoints require authentication. Include the JWT token in the Authorization header:
Authorization: Bearer YOUR_JWT_TOKEN
All requests must include your API key in the x-api-key header. Get your API key from the Dashboard.