Skip to main content

getAll


id: getAllUsers title: Get All Users​

GET /api/users​

Retrieve a list of all users. Only accessible to authenticated users with the admin role.

Response​

  • 200 OK

    { "success": true, "users": [ { "id": 1, "name": "Jane", "email": "jane@example.com", "role": "user" } ] }
    • Returns an array of users. Password hashes are excluded from the response.
  • 403 Forbidden

    { "success": false, "error": "Forbidden" }
    • The authenticated user is not an admin.
  • 500 Internal Server Error

    { "success": false, "error": "Internal server error" }

Example​

curl -X GET http://localhost:8080/api/users \
--cookie "token=your_jwt_token"