Users API
API endpoints to manage user data, roles, and statuses.
Get All Users
Retrieve a paginated list of all users.
GET /api/admin/usersResponse Example
{
"users": [
{
"id": 1,
"email": "user1@example.com",
"fullName": "User One",
"role": "USER",
"isVerified": true,
"createdAt": "2025-01-20T14:45:00Z"
},
/* ...more users */
],
"pagination": {
"page": 1,
"pageSize": 20,
"total": 100
}
}Get User by ID
Retrieve detailed info for a specific user.
GET /api/admin/users/{id}Response Example
{
"id": 1,
"email": "user1@example.com",
"fullName": "User One",
"role": "USER",
"isVerified": true,
"wallet": {
"balance": 150.50
},
"createdAt": "2025-01-20T14:45:00Z"
}Update User Role
Change the user's role. Only Super Admins can perform this action.
PATCH /api/admin/users/{id}/roleRequest Body
{
"role": "ADMIN" // Valid values: USER, DEVELOPER, ADMIN, SUPERADMIN
}Response Example
{
"message": "User role updated successfully",
"user": {
"id": 1,
"role": "ADMIN"
}
}Delete User
Permanently delete a user account. Only Super Admins can perform this action.
DELETE /api/admin/users/{id}Response Example
{
"message": "User deleted successfully"
}Common Errors
| Status Code | Error | Description |
|---|---|---|
| 400 | Bad Request | Invalid or missing parameters |
| 401 | Unauthorized | Authentication failed or token expired |
| 403 | Forbidden | Insufficient permissions |
| 404 | Not Found | User not found |
| 500 | Internal Server Error | Unexpected error occurred |
Back to Introduction
Next: Coins API