GDPR

Companies conducting business within the European Union are legally required to comply with the General Data Protection Regulation (GDPR).

While many aspects of this regulation may not significantly affect your integration with Stream, the GDPR provisions regarding the right to data access and the right to erasure are directly pertinent.

These provisions relate to data that is stored and managed on Stream’s servers.

The Right to Access Data

GDPR gives EU citizens the right to request access to their information and the right to have access to this information in a portable format. Stream covers this requirement with the export method.

The Feeds export method will export the following data where the user id the owner:

  • User data
  • Feeds
  • Follows
  • Activities
  • Comments
  • Reactions
  • Bookmarks
  • Bookmark folders
  • Collections

This method can only be used with server-side authentication:

// Start the export task
const response = await client.feeds.exportFeedUserData({
  user_id: userToExport.id,
});

// You have to poll this endpoint
const taskResponse = await client.getTask({ id: response.task_id });
console.log(taskResponse.status === "completed");

Accessing the exported data

You can check the status of an export request using the task ID returned when the task was created. The result of the task contains the URL to the JSON file.

The URL to the export file has an expiration of 24-hours. The link is generated every time you request the export status. The export will be available for 60 days.

const response = await client.getTask({ id: response.task_id });

if (response.status === "completed") {
  console.log(response.result.url);
}

The Right to Erasure

The GDPR also grants EU citizens the right to request the deletion of their personal information. Stream offers mechanisms to delete users and feeds data in accordance with various use cases, ensuring compliance with these regulations.

The following data will be deleted:

  • Follows where the user is owner of either source or target feed
  • Feeds owned by the user - will follow the logic for deleting feeds as described here
  • Activities owned by the user
  • Comments owned by the user
  • Reactions owned by the user
  • Bookmarks owned by the user
  • Bookmark folders owned by the user
  • Collections owned by the user

NOTE: This does not delete the user's account, only their Feeds data. If you want to delete the user please refer to deleting a user

What hard_delete controls

The hard_delete flag only affects how the following entities are removed:

  • Feeds owned by the user
  • Activities, comments and reactions owned by the user
  • Bookmarks and bookmark folders owned by the user
  • Collections owned by the user

When hard_delete: false (the default), these entities are soft-deleted — their rows remain in the database with a deleted_at timestamp set, and they are filtered out of reads. When hard_delete: true, the rows are physically removed.

Follows are always hard-deleted regardless of the hard_delete flag. Both follow rows where the user is the source and rows where the user is the target are physically removed from the database; there is no soft-delete state for follows. As a result, the deleted user's activities will immediately stop appearing in the feeds of users who used to follow them, and the deleted user's own following list is cleared in full.

Deleting user data is an irreversible operation. This goes for both soft and hard deletes.

// Start the delete task
const response = await serverClient.feeds.deleteFeedUserData({
  user_id: userToDelete.id,
  hard_delete: false,
});

// You have to poll this endpoint
const taskResponse = await client.getTask({ id: response.task_id });
console.log(taskResponse.status === "completed");

Deleting a user

client.deleteUsers({ user_ids: ["<id>"] });

//restore
client.restoreUsers({ user_ids: ["<id>"] });

By default users are soft deleted. If you need control over deleting chat/video data please refer to the Chat documentation.