API Docs
Users Model
Delete a User
11min
api endpoint documentation /api/users/remove description this endpoint allows the removal of a specific user from the system by sending a post request with the user's id and an authorization token endpoint post https //\<your site>/api/users/remove headers accept application/json specifies that the request expects a json response authorization bearer \<jwt token> a json web token (jwt) that authenticates the request replace \<jwt token> with a valid token content type application/json specifies that the request body is in json format request body the request body should be in json format and contain the following fields id string the id of the user to be removed token string a valid authentication token (jwt) for the request example request body { "id" "6706a2390d654864b3ac1981", "token" "eyjhbgcioijiuzi1niisinr5cci6ikpxvcj9 " } method post sends a request to remove the specified user from the system example request (node js) const fetch = require('node fetch'); const url = 'https //\<your site>/api/users/remove'; const options = { method 'post', headers { 'accept' 'application/json', 'authorization' 'bearer eyjhbgcioijiuzi1niisinr5cci6ikpxvcj9 ', 'content type' 'application/json', }, body json stringify({ id "6706a2390d654864b3ac1981", token "eyjhbgcioijiuzi1niisinr5cci6ikpxvcj9 " }) }; fetch(url, options) then(response => response json()) then(data => console log(data)) catch(error => console error('error ', error)); response the api will return a json response indicating the success or failure of the operation success response (200) { "message" "user removed successfully", "status" "success" } error response (400/401) { "message" "invalid token or user id", "status" "error" } authentication this api requires a valid jwt token for authentication ensure that the token is included in the authorization header as bearer \<jwt token> usage notes ensure that the id in the request body matches the user you wish to remove the request must include a valid jwt token for authentication, without which the request will be rejected with a 401 unauthorized error