{"info":{"_postman_id":"c6541ad4-2457-4da5-a1fb-109286a05a40","name":"Role-Based Access Control API","description":"<html><head></head><body><p>A RESTful API for a role-based access control system built using Express.js and MongoDB.</p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"24544020","collectionId":"c6541ad4-2457-4da5-a1fb-109286a05a40","publishedId":"2sAYQcFAqF","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"},"publishDate":"2025-01-20T22:38:27.000Z"},"item":[{"name":"Authentication","item":[{"name":"Signup","id":"a5f03dcf-25e4-4663-ab75-72ce29ee5760","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"firstname\": \"\",\r\n    \"lastname\": \"\",\r\n    \"email\": \"\",\r\n    \"phone\": \"\",\r\n    \"password\": \"\",\r\n    \"confirmPassword\": \"\"\r\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:4000/api/auth/signup","description":"<p>Allows users to create an account</p>\n","urlObject":{"path":["api","auth","signup"],"host":["http://localhost:4000"],"query":[],"variable":[]}},"response":[],"_postman_id":"a5f03dcf-25e4-4663-ab75-72ce29ee5760"},{"name":"Login","id":"8a04ae3c-5c9d-4511-91c5-60923a1c4323","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"email\": \"\",\r\n    \"password\": \"\"\r\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:4000/api/auth/login","description":"<p>Allows users to login using their email address and password</p>\n","urlObject":{"path":["api","auth","login"],"host":["http://localhost:4000"],"query":[],"variable":[]}},"response":[],"_postman_id":"8a04ae3c-5c9d-4511-91c5-60923a1c4323"},{"name":"Logout","id":"f281c92a-34a9-486b-be26-09928c265e2c","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"url":"http://localhost:4000/api/auth/logout","description":"<p>Allows authenticated users to log out</p>\n","urlObject":{"path":["api","auth","logout"],"host":["http://localhost:4000"],"query":[],"variable":[]}},"response":[],"_postman_id":"f281c92a-34a9-486b-be26-09928c265e2c"},{"name":"Forgot Password","id":"b1932d5f-a01e-46a6-a161-a5bac364293e","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"email\": \"\"\r\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:4000/api/auth/password/forgot","description":"<p>Sends an email to the user with reset password link</p>\n","urlObject":{"path":["api","auth","password","forgot"],"host":["http://localhost:4000"],"query":[],"variable":[]}},"response":[],"_postman_id":"b1932d5f-a01e-46a6-a161-a5bac364293e"},{"name":"Reset Password","id":"d8640ebe-b490-431f-8bcc-69267854106d","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\r\n    \"password\": \"\",\r\n    \"confirmPassword\": \"\"\r\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:4000/api/auth/password/reset/:token","description":"<p>Allows users to reset their account password</p>\n","urlObject":{"path":["api","auth","password","reset",":token"],"host":["http://localhost:4000"],"query":[],"variable":[{"description":{"content":"<p>Reset password token</p>\n","type":"text/plain"},"type":"any","value":"","key":"token"}]}},"response":[],"_postman_id":"d8640ebe-b490-431f-8bcc-69267854106d"}],"id":"2e0a7494-d771-4729-95db-367a31f71e38","description":"<p>API collection for authentication</p>\n","_postman_id":"2e0a7494-d771-4729-95db-367a31f71e38"},{"name":"Users","item":[{"name":"Retrieve profile","id":"459310cf-e18f-4afe-9253-127db9c6ca87","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"http://localhost:4000/api/users/self","description":"<p>Allows authenticated users to retrieve their profile</p>\n","urlObject":{"path":["api","users","self"],"host":["http://localhost:4000"],"query":[],"variable":[]}},"response":[],"_postman_id":"459310cf-e18f-4afe-9253-127db9c6ca87"},{"name":"Update profile","id":"8e66ba55-ac12-4635-9e5a-96c77ba139cb","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\n    \"firstname\": \"\",\n    \"lastname\": \"\",\n    \"phone\": \"\",\n    \"password\": \"\",\n    \"confirmPassword\": \"\" \n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:4000/api/users/self","description":"<p>Allows authenticated users to update their profile</p>\n","urlObject":{"path":["api","users","self"],"host":["http://localhost:4000"],"query":[],"variable":[]}},"response":[],"_postman_id":"8e66ba55-ac12-4635-9e5a-96c77ba139cb"},{"name":"Delete account","id":"cbb64a57-7560-4b9b-a6e4-1e7874a3dc2b","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[],"url":"http://localhost:4000/api/users/self","description":"<p>Allows authenticated users to delete their account</p>\n","urlObject":{"path":["api","users","self"],"host":["http://localhost:4000"],"query":[],"variable":[]}},"response":[],"_postman_id":"cbb64a57-7560-4b9b-a6e4-1e7874a3dc2b"},{"name":"Add profile photo","id":"92c90b37-8845-4bea-96e7-585475c2752c","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"formdata","formdata":[{"key":"avatar","description":"<p>Profile photo</p>\n","type":"file","value":null}]},"url":"http://localhost:4000/api/users/self/avatar","description":"<p>Allows authenticated users to add their profile photo</p>\n","urlObject":{"path":["api","users","self","avatar"],"host":["http://localhost:4000"],"query":[],"variable":[]}},"response":[],"_postman_id":"92c90b37-8845-4bea-96e7-585475c2752c"},{"name":"Remove profile photo","id":"b22aa6d0-f4bb-44d4-ba6b-f168c6a4cc66","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"url":"http://localhost:4000/api/users/self/avatar","description":"<p>Allows authenticated users to remove their profile photo</p>\n","urlObject":{"path":["api","users","self","avatar"],"host":["http://localhost:4000"],"query":[],"variable":[]}},"response":[],"_postman_id":"b22aa6d0-f4bb-44d4-ba6b-f168c6a4cc66"},{"name":"Update profile photo","id":"7cc889b8-46da-4e29-aafc-a072f0dd214f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"formdata","formdata":[{"key":"avatar","description":"<p>Profile photo</p>\n","type":"file","value":null}]},"url":"http://localhost:4000/api/users/self/avatar/update","description":"<p>Allows authenticated users to update their profile photo</p>\n","urlObject":{"path":["api","users","self","avatar","update"],"host":["http://localhost:4000"],"query":[],"variable":[]}},"response":[],"_postman_id":"7cc889b8-46da-4e29-aafc-a072f0dd214f"},{"name":"Retrieve users","id":"b5073c5b-77d0-45fd-80e1-fad769ff131d","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"http://localhost:4000/api/users","description":"<p>Allows authenticated users to retrieve a paginated list of other users</p>\n","urlObject":{"path":["api","users"],"host":["http://localhost:4000"],"query":[{"disabled":true,"description":{"content":"<p>Filter users by role titles</p>\n","type":"text/plain"},"key":"roles","value":""},{"disabled":true,"description":{"content":"<p>Filter users by active status</p>\n","type":"text/plain"},"key":"active","value":""},{"disabled":true,"description":{"content":"<p>Filter archived users</p>\n","type":"text/plain"},"key":"archived","value":""},{"disabled":true,"description":{"content":"<p>Sort by name or created_at field</p>\n","type":"text/plain"},"key":"sortBy","value":""},{"disabled":true,"description":{"content":"<p>Sort by asc or desc order</p>\n","type":"text/plain"},"key":"order","value":""},{"disabled":true,"description":{"content":"<p>Page number</p>\n","type":"text/plain"},"key":"page","value":""},{"disabled":true,"description":{"content":"<p>Number of items per page</p>\n","type":"text/plain"},"key":"limit","value":""}],"variable":[]}},"response":[],"_postman_id":"b5073c5b-77d0-45fd-80e1-fad769ff131d"},{"name":"Retrieve user by ID","id":"b80e55ef-ff25-4546-9846-cf8b070e23a9","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"http://localhost:4000/api/users/:userId","description":"<p>Allows authorized users to retrieve a user by ID</p>\n","urlObject":{"path":["api","users",":userId"],"host":["http://localhost:4000"],"query":[],"variable":[{"description":{"content":"<p>User ID</p>\n","type":"text/plain"},"type":"any","value":"","key":"userId"}]}},"response":[],"_postman_id":"b80e55ef-ff25-4546-9846-cf8b070e23a9"},{"name":"Delete user","id":"9efb9758-2234-410a-98d5-83a09715ed49","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":"http://localhost:4000/api/users/:userId","description":"<p>Allows authorized users to delete another user</p>\n","urlObject":{"path":["api","users",":userId"],"host":["http://localhost:4000"],"query":[],"variable":[{"description":{"content":"<p>User ID</p>\n","type":"text/plain"},"type":"any","value":"","key":"userId"}]}},"response":[],"_postman_id":"9efb9758-2234-410a-98d5-83a09715ed49"},{"name":"Assign role to user","id":"c82ba3bb-e95a-45e4-932e-54f1522b7bb5","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\n    \"role\": \"\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:4000/api/users/:userId/role/assign","description":"<p>Allows authorized users to assign a role to another user</p>\n","urlObject":{"path":["api","users",":userId","role","assign"],"host":["http://localhost:4000"],"query":[],"variable":[{"description":{"content":"<p>User ID</p>\n","type":"text/plain"},"type":"any","value":"","key":"userId"}]}},"response":[],"_postman_id":"c82ba3bb-e95a-45e4-932e-54f1522b7bb5"},{"name":"Unassign role from user","id":"34fe1f84-4102-482d-bbe5-61c473616251","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":"http://localhost:4000/api/users/:userId/role/unassign","description":"<p>Allows authorized users to unassign a role from another user</p>\n","urlObject":{"path":["api","users",":userId","role","unassign"],"host":["http://localhost:4000"],"query":[],"variable":[{"description":{"content":"<p>User ID</p>\n","type":"text/plain"},"type":"any","value":"","key":"userId"}]}},"response":[],"_postman_id":"34fe1f84-4102-482d-bbe5-61c473616251"},{"name":"Activate user","id":"8bd4361a-a102-4a0e-960a-d4383e0f9eae","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"url":"http://localhost:4000/api/users/:userId/activate","description":"<p>Allows authorized users to activate another user</p>\n","urlObject":{"path":["api","users",":userId","activate"],"host":["http://localhost:4000"],"query":[],"variable":[{"description":{"content":"<p>User ID</p>\n","type":"text/plain"},"type":"any","value":"","key":"userId"}]}},"response":[],"_postman_id":"8bd4361a-a102-4a0e-960a-d4383e0f9eae"},{"name":"Deactivate user","id":"4193847d-83e9-420f-928a-daa28ceb4277","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"url":"http://localhost:4000/api/users/:userId/deactivate","description":"<p>Allows authorized users to deactivate another user</p>\n","urlObject":{"path":["api","users",":userId","deactivate"],"host":["http://localhost:4000"],"query":[],"variable":[{"description":{"content":"<p>User ID</p>\n","type":"text/plain"},"type":"any","value":"","key":"userId"}]}},"response":[],"_postman_id":"4193847d-83e9-420f-928a-daa28ceb4277"},{"name":"Archive user","id":"b939093e-2f53-40bd-bd4e-0791ac0319a5","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"url":"http://localhost:4000/api/users/:userId/archive","description":"<p>Allows authorized users to archive another user</p>\n","urlObject":{"path":["api","users",":userId","archive"],"host":["http://localhost:4000"],"query":[],"variable":[{"description":{"content":"<p>User ID</p>\n","type":"text/plain"},"type":"any","value":"","key":"userId"}]}},"response":[],"_postman_id":"b939093e-2f53-40bd-bd4e-0791ac0319a5"},{"name":"Restore archived user","id":"04998ced-e990-4e08-a5a6-580e8096511f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"url":"http://localhost:4000/api/users/:userId/restore","description":"<p>Allows authorized users to restore an archived user</p>\n","urlObject":{"path":["api","users",":userId","restore"],"host":["http://localhost:4000"],"query":[],"variable":[{"description":{"content":"<p>User ID</p>\n","type":"text/plain"},"type":"any","value":"","key":"userId"}]}},"response":[],"_postman_id":"04998ced-e990-4e08-a5a6-580e8096511f"}],"id":"013b3f1f-0e10-4657-9ee9-25fbaf344295","description":"<p>API collection for users</p>\n","_postman_id":"013b3f1f-0e10-4657-9ee9-25fbaf344295"},{"name":"Roles","item":[{"name":"Retrieve roles","id":"413f164f-771a-454c-b092-0994b67d8b37","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"http://localhost:4000/api/roles","description":"<p>Allows authenticated users to retrieve a paginated list of roles</p>\n","urlObject":{"path":["api","roles"],"host":["http://localhost:4000"],"query":[{"disabled":true,"description":{"content":"<p>Filter roles by permissions (view_user, activate_user, deactivate_user, archive_user, restore_user, delete_user, view_role, add_role, update_role, delete_role, assign_role, unassign_role, activate_role, deactivate_role)</p>\n","type":"text/plain"},"key":"permissions","value":""},{"disabled":true,"description":{"content":"<p>Filter roles by active status</p>\n","type":"text/plain"},"key":"active","value":""},{"disabled":true,"description":{"content":"<p>Sort by user_count or created_at field</p>\n","type":"text/plain"},"key":"sortBy","value":""},{"disabled":true,"description":{"content":"<p>Sort by asc or desc order</p>\n","type":"text/plain"},"key":"order","value":""},{"disabled":true,"description":{"content":"<p>Page number</p>\n","type":"text/plain"},"key":"page","value":""},{"disabled":true,"description":{"content":"<p>Number of items per page</p>\n","type":"text/plain"},"key":"limit","value":""}],"variable":[]}},"response":[],"_postman_id":"413f164f-771a-454c-b092-0994b67d8b37"},{"name":"Add new role","id":"f1396cd7-3f3d-43f1-a183-03cda1072d8a","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"title\": \"\",\r\n    \"permissions\": []\r\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:4000/api/roles","description":"<p>Allows authorized users to add a new role</p>\n","urlObject":{"path":["api","roles"],"host":["http://localhost:4000"],"query":[],"variable":[]}},"response":[],"_postman_id":"f1396cd7-3f3d-43f1-a183-03cda1072d8a"},{"name":"Retrieve role by ID","id":"64314eeb-1b34-4523-8b29-08a32a1c0b25","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"http://localhost:4000/api/roles/:roleId","description":"<p>Allows authorized users to retrieve a role by ID</p>\n","urlObject":{"path":["api","roles",":roleId"],"host":["http://localhost:4000"],"query":[],"variable":[{"description":{"content":"<p>Role ID</p>\n","type":"text/plain"},"type":"any","value":"","key":"roleId"}]}},"response":[],"_postman_id":"64314eeb-1b34-4523-8b29-08a32a1c0b25"},{"name":"Update role","id":"5fd5b201-1235-4460-941a-eff416e75854","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\r\n    \"title\": \"\",\r\n    \"permissions\": []\r\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:4000/api/roles/:roleId","description":"<p>Allows authorized users to update an existing role</p>\n","urlObject":{"path":["api","roles",":roleId"],"host":["http://localhost:4000"],"query":[],"variable":[{"description":{"content":"<p>Role ID</p>\n","type":"text/plain"},"type":"any","value":"","key":"roleId"}]}},"response":[],"_postman_id":"5fd5b201-1235-4460-941a-eff416e75854"},{"name":"Delete role","id":"4447fa87-a9f6-42c9-9213-46e4c26706aa","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[],"url":"http://localhost:4000/api/roles/:roleId","description":"<p>Allows authorized users to delete a role</p>\n","urlObject":{"path":["api","roles",":roleId"],"host":["http://localhost:4000"],"query":[],"variable":[{"description":{"content":"<p>Role ID</p>\n","type":"text/plain"},"type":"any","value":"","key":"roleId"}]}},"response":[],"_postman_id":"4447fa87-a9f6-42c9-9213-46e4c26706aa"},{"name":"Activate role","id":"c4b76521-0341-4b8f-a36e-33b421fc5399","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"url":"http://localhost:4000/api/roles/:roleId/activate","description":"<p>Allows authorized users to activate an inactive role</p>\n","urlObject":{"path":["api","roles",":roleId","activate"],"host":["http://localhost:4000"],"query":[],"variable":[{"description":{"content":"<p>Role ID</p>\n","type":"text/plain"},"type":"any","value":"","key":"roleId"}]}},"response":[],"_postman_id":"c4b76521-0341-4b8f-a36e-33b421fc5399"},{"name":"Deactivate role","id":"68d9ab65-d0c2-4dc1-8710-68bc9d05859a","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"url":"http://localhost:4000/api/roles/:roleId/deactivate","description":"<p>Allows authorized users to deactivate an active role</p>\n","urlObject":{"path":["api","roles",":roleId","deactivate"],"host":["http://localhost:4000"],"query":[],"variable":[{"description":{"content":"<p>Role ID</p>\n","type":"text/plain"},"type":"any","value":"","key":"roleId"}]}},"response":[],"_postman_id":"68d9ab65-d0c2-4dc1-8710-68bc9d05859a"}],"id":"5afae2bc-c8c4-49d8-8285-b49ffda9a1a1","description":"<p>API collection for roles</p>\n","_postman_id":"5afae2bc-c8c4-49d8-8285-b49ffda9a1a1"}],"event":[{"listen":"prerequest","script":{"id":"b3a518fe-bbec-4c57-b349-04e0f6daf146","type":"text/javascript","packages":{},"exec":[""]}},{"listen":"test","script":{"id":"ad95d2c4-4c90-4a72-9fa9-b4667818716c","type":"text/javascript","packages":{},"exec":[""]}}],"variable":[{"key":"baseUrl","value":"http://localhost:4000","type":"string"}]}