API Docs
Users

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:

Text


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:

JSON


Method:

  • POST: Sends a request to remove the specified user from the system.

Example Request (Node.js):

JS


Response:

The API will return a JSON response indicating the success or failure of the operation.

Success Response (200):

JSON


Error Response (400/401):

JSON


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.