GDPR
Confused about "GDPR"?
Let us know how we can improve our documentation:
- On This Page:
- Deactivate a User
- Delete a User
To export user data, Stream Chat exposes an exportUser
method. This method can only be called server-side due to security concerns, so please keep this in mind when attempting to make the call.
Below is an example of how to execute the call to export user data:
1
const data = await client.exportUser(userID);
1
response = client.export_user("user_id");
1
response = client.export_user('user_id')
1
$response = $this->client->exportUser($user["id"]);
1
user, err := client.ExportUser(userID, nil)
1
var exportedUser = await client.Users.Export(userID);
The export will return all data about the user, including:
User ID
Messages
Reactions
Custom Data
Deactivate a User
Copied!Confused about "Deactivate a User"?
Let us know how we can improve our documentation:
To deactivate a user, Stream Chat exposes a deactivateUser
method. This method can only be called server-side due to security concerns, so please keep this in mind when attempting to make the call.
Deactivated users cannot:
Connect to Stream Chat
Send or receive messages
(deactivated users can be reactivated, see below)
Below is an example of how to execute the call to deactivateUser
:
mark_messages_deleted
parameter is optional. This parameter will delete all messages associated with the user. If you would like to keep message history, ensure that mark_messages_deleted
is set to false
. To remove all messages related to the user, set the value to true
.1
2
3
4
5
6
const deactivate = await client.deactivateUser(userID);
const deactivate = await client.deactivateUser(userID, {
mark_messages_deleted: true,
created_by_id: "god",
});
1
2
3
4
5
response = client.deactivate_user(user_id)
response = client.deactivate_user(user_id,
mark_messages_deleted=True,
created_by_id="god")
1
2
3
4
5
response = client.deactivate_user(user_id)
response = client.deactivate_user(user_id,
mark_messages_deleted: true,
created_by_id: "god")
1
2
3
4
5
6
$response = $this->client->deactivateUser($user["id"]);
$response = $this->client->deactivateUser($user["id"], [
"mark_messages_deleted" => true,
"created_by_id" => "god",
]);
1
2
3
4
5
6
err := client.DeactivateUser(userID, nil)
err := client.DeactivateUser(userID, map[string]interface{}{
"mark_messages_deleted": true,
"created_by_id": "god",
})
1
2
3
var result = await client.Users.Deactivate(userID);
var result = await client.Users.Deactivate(userID, markMessagesDeleted = true, createdByID = "god");
The response will contain an object with the user ID that was deactivated. Further, the user will no longer be able to connect to Stream Chat as an error will be thrown.
To reinstate the user as active, use the reactivateUser
method by passing the users ID as a parameter:
1
2
3
4
5
6
7
const reactivate = await client.reactivateUser(userID);
const reactivate = await client.reactivateUser(userID, {
restore_messages: true,
name: "I am back",
created_by_id: "god",
});
1
2
3
4
5
6
response = client.reactivate_user(user_id)
response = client.reactivate_user(user_id,
restore_messages=True,
name="I am back",
created_by_id="god")
1
2
3
4
5
6
response = client.reactivate_user(user_id)
response = client.reactivate_user(user_id,
restore_messages: true,
name: "I am back",
created_by_id: "god")
1
2
3
4
5
6
7
$response = $this->client->reactivateUser($user["id"]);
$response = $this->client->reactivateUser($user["id"], [
"restore_messages" => true,
"name" => "I am back",
"created_by_id" => "god",
]);
1
2
3
4
5
6
7
err := client.ReactivateUser(userID, nil)
err := client.ReactivateUser(userID, map[string]interface{}{
"restore_messages": true,
"name": "I am back",
"created_by_id": "god",
})
1
2
3
var result = await client.Users.Reactivate(userID);
var result = await client.Users.Reactivate(userID, restoreMessages = true, name = "I am back", createdByID = "god");
Delete a User
Copied!Confused about "Delete a User"?
Let us know how we can improve our documentation:
To delete user data, Stream Chat exposes a deleteUser
method. This method can only be called server-side due to security concerns, so please keep this in mind when attempting to make the call.
Below is an example of how to execute the call to deleteUser
:
1
2
3
const destroy = await client.deleteUser(userID, {
mark_messages_deleted: false,
});
1
response = client.delete_user(user_id)
1
response = client.delete_user(user_id)
1
$response = $this->client->deleteUser($user["id"]);
1
err := client.DeleteUser(userID, nil)
1
await client.Users.Delete(userID);
mark_messages_deleted
parameter is optional. This parameter will delete all messages associated with the user. If you would like to keep message history, ensure that mark_messages_deleted
is set to false
. To remove all messages related to the user, set the value to true
.To perform a "hard delete" on the user, you must set mark_messages_deleted
to true and provide an additional parameter called hard_delete
with the value set to true
. This method will delete all messages, reactions, and any other associated data with the user. Another option is delete_conversation_channels
, if set true
the deleted user is removed from all one-to-one channels.
1
2
3
4
5
const destroy = await client.deleteUser('user_id', {
delete_conversation_channels: true,
mark_messages_deleted: true,
hard_delete: true,
});
1
2
3
4
5
$response = $client->deleteUser($user["id"], [
"mark_messages_deleted" => true,
"hard_delete" => true,
"delete_conversation_channels" => true,
]);
1
2
3
4
5
6
7
options := map[string]interface{}{
"mark_messages_deleted": true,
"hard_delete": true,
"delete_conversation_channels": true,
}
err := client.DeleteUser(userID, options)
1
await client.Users.Delete(user.ID, markMessagesDeleted = true, hardDelete = true, deleteConversations = true);
1
2
3
4
client.delete_user(user_id,
mark_messages_deleted=True,
hard_delete=True,
delete_conversation_channels=True)
1
2
3
4
response = client.delete_user(user_id,
mark_messages_deleted: true,
hard_delete: true,
delete_conversation_channels: true)
After deleting or hard deleting a user, the user will no longer be able to:
Connect to Stream Chat
Send or receive messages
Be displayed when querying users
Have messages stored in Stream Chat (depending on whether or not
mark_messages_deleted
is set totrue
orfalse
)