curl https://api-verifier-2.onrender.com/api/users \
-H "Authorization: Bearer <admin-token>"
[
{
"_id": "65a1b2c3d4e5f6g7h8i9j0k1",
"user_id": "sha256hash...",
"firstName": "John",
"lastName": "Doe",
"email": "john@example.com",
"role": "user",
"profilePic": "",
"likedPosts": [],
"createdAt": "2024-01-10T08:00:00.000Z"
},
{
"_id": "65a1b2c3d4e5f6g7h8i9j0k2",
"user_id": "sha256hash...",
"firstName": "Jane",
"lastName": "Smith",
"email": "jane@example.com",
"role": "moderator",
"profilePic": "https://example.com/pic.jpg",
"likedPosts": ["post-id-1", "post-id-2"],
"createdAt": "2024-01-05T12:00:00.000Z"
}
]
Users
Get all users
Retrieve all users (admin only)
GET
/
api
/
users
curl https://api-verifier-2.onrender.com/api/users \
-H "Authorization: Bearer <admin-token>"
[
{
"_id": "65a1b2c3d4e5f6g7h8i9j0k1",
"user_id": "sha256hash...",
"firstName": "John",
"lastName": "Doe",
"email": "john@example.com",
"role": "user",
"profilePic": "",
"likedPosts": [],
"createdAt": "2024-01-10T08:00:00.000Z"
},
{
"_id": "65a1b2c3d4e5f6g7h8i9j0k2",
"user_id": "sha256hash...",
"firstName": "Jane",
"lastName": "Smith",
"email": "jane@example.com",
"role": "moderator",
"profilePic": "https://example.com/pic.jpg",
"likedPosts": ["post-id-1", "post-id-2"],
"createdAt": "2024-01-05T12:00:00.000Z"
}
]
This endpoint requires admin role.
Response
Returns an array of all users (excluding passwords), sorted by creation date (newest first).Array of user objects
Show user object
Show user object
curl https://api-verifier-2.onrender.com/api/users \
-H "Authorization: Bearer <admin-token>"
[
{
"_id": "65a1b2c3d4e5f6g7h8i9j0k1",
"user_id": "sha256hash...",
"firstName": "John",
"lastName": "Doe",
"email": "john@example.com",
"role": "user",
"profilePic": "",
"likedPosts": [],
"createdAt": "2024-01-10T08:00:00.000Z"
},
{
"_id": "65a1b2c3d4e5f6g7h8i9j0k2",
"user_id": "sha256hash...",
"firstName": "Jane",
"lastName": "Smith",
"email": "jane@example.com",
"role": "moderator",
"profilePic": "https://example.com/pic.jpg",
"likedPosts": ["post-id-1", "post-id-2"],
"createdAt": "2024-01-05T12:00:00.000Z"
}
]
⌘I