Skip to main content

Remove User

Use this API endpoint to remove a user from the system. This action will flag the user as removed, erase their membership in all chat rooms, and if they have an active WebSocket connection, it will send them an "user_not_found" error message.


DELETE
    https://api.deadsimplechat.com/consumer/api/v2/user

Request

DELETE /consumer/api/v2/user

info

The auth query parameter is your private key. You can find it in your Dashboard under Developer -> Private Key.

Query Parameters

ParameterDescriptionData Type
authGo to Dashboard -> Developer -> Private Key is your authString

Request Body

The request body can have one of the two properties:

ParameterDescriptionData Type
userIdThe unique ID of the user to be removedString
uniqueUserIdentifierAn alternative unique identifier for a userString

Note: Either userId or uniqueUserIdentifier is required, but not both.

Responses

Success Response

A JSON object containing the following fields:

FieldDescriptionData Type
successIndicates operation successBoolean
messageA success messageString

HTTP Status: 200 OK

Body:

{
"success": true,
"message": "user removed"
}

Error Responses

  • User Not Found:

    HTTP Status: 400 Bad Request

    Body:

    {
    "message": "user not found"
    }
  • Validation Error:

    HTTP Status: 400 Bad Request

    Body:

    {
    "error": "[Detailed validation error]"
    }
  • Internal Server Error:

    HTTP Status: 500 Internal Server Error

    Body:

    {
    "message": "Internal server error occurred, please try again. If the problem persists then contact support and mention the eventId",
    "eventId": "[UUID representing the event]"
    }

Code Examples

JavaScript (Fetch API)

fetch("/consumer/api/v2/user?auth="+private_key, {
method: "DELETE",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
uniqueUserIdentifier: "<UNIQUE_USER_IDENTIFIER>"
// OR
// userId: "<USER_ID_TO_REMOVE>"
})
})