Get Customers
GET /api/admin/customers?search=john&limit=10&page=1
Retrieves a paginated list of customers with their statistics, including total spent and order information.
Authentication: Admin access required
Query Parameters
Search customers by username or email (case-insensitive)
Number of customers to return per page
Page number for pagination
Response
Indicates if the request was successful
Array of user objects with spending statistics Wallet information (address only, private key excluded)
Whether the user account is active (not blocked)
Account creation timestamp
Total amount spent (completed orders minus refunded orders)
Total number of customers
All-time transaction volume (completed - refunded)
Percentage change in new customers (last 30 days vs previous 30 days), e.g. “+12.5%”
Percentage change in transaction volume (last 30 days vs previous 30 days)
Total number of customers matching the search query
Response Example
{
"success" : true ,
"users" : [
{
"_id" : "user123" ,
"username" : "john_doe" ,
"email" : "[email protected] " ,
"wallet" : {
"address" : "TXYZabc123..."
},
"isActive" : true ,
"createdAt" : "2025-12-01T10:00:00.000Z" ,
"lastLogin" : "2026-03-04T08:30:00.000Z" ,
"totalSpent" : 1250.50
}
],
"stats" : {
"total" : 180 ,
"totalVolume" : 50000 ,
"totalChange" : "+12.5%" ,
"volumeChange" : "+8.3%"
},
"pagination" : {
"total" : 180 ,
"page" : 1 ,
"pages" : 18 ,
"limit" : 10
}
}
Block/Unblock Customer
PATCH /api/admin/customers/:id/block
Blocks or unblocks a customer account by updating their isActive status.
Authentication: Admin access required
Path Parameters
Body Parameters
Set to false to block the user, true to unblock
Request Example
Response
Indicates if the request was successful
Confirmation message (“User blocked” or “User unblocked”)
Response Example
{
"success" : true ,
"message" : "User blocked" ,
"user" : {
"_id" : "user123" ,
"username" : "john_doe" ,
"email" : "[email protected] " ,
"isActive" : false
}
}
Error Responses
{
"error" : "User not found"
}
Export Customers
POST /api/admin/customers/export
Exports all customer data as a CSV file including username, email, wallet address, total spent, active status, and timestamps.
Authentication: Admin access required
Response
Returns a CSV file with the following columns:
id - User ID
username - Username
email - Email address
walletAddress - Wallet address
totalSpent - Total amount spent (completed - refunded orders)
isActive - Active status (true/false)
createdAt - Account creation date (ISO 8601)
lastLogin - Last login date (ISO 8601)
Content-Type: text/csv
Content-Disposition: attachment; filename="customers.csv"
CSV Example
"id", "username", "email", "walletAddress", "totalSpent", "isActive", "createdAt", "lastLogin"
"user123", "john_doe", "[email protected] ", "TXYZabc123...", "1250.50", "true", "2025-12-01T10:00:00.000Z", "2026-03-04T08:30:00.000Z"
Error Response
{
"error" : "Error message"
}