Users
Users export
note
This endpoint requires a server-side authentication.
Stream allows you to export users with their data, including the calls they participated in.
- JavaScript
await client.exportUsers({ user_ids: ['<user id1>', '<user id1>'] });
Exporting users can take some time, this is how you can check the progress:
- JavaScript
- Python
- cURL
- JavaScript@0.3 (deprecated)
// Example of monitoring the status of an async task
// The logic is same for all async tasks
const response = await client.<async operation>();
// you need to poll this endpoint
const taskResponse = await client.getTask({id: response.task_id})
console.log(taskResponse.status === 'completed');
# Example of monitoring the status of an async task
# The logic is same for all async tasks
response = client.<async operation>()
task_id = response.data.task_id
# get information about the task
task_status = client.get_task(task_id)
# just an example, in reality it can take a few seconds for a task to be processed
if task_status.data.status == "completed":
print(task_status.data.result)
# When an operation is async, a task_id will be included in the API response
# That task_id can be used to monitor the status of the task
# When finished, task status will be completed
curl -X GET https://video.stream-io-api.com/api/v2/tasks/${TASK_ID}?api_key=${API_KEY} \
-H "Authorization: ${TOKEN}" \
-H "stream-auth-type: jwt"
// Example of monitoring the status of an async task
// The logic is same for all async tasks
const response = await client.<async operation>();
// you need to poll this endpoint
const taskResponse = await client.getTaskStatus({id: response.task_id})
console.log(taskResponse.status === 'completed');
For more informiation, please refer to the async operations guide
Users deletion
note
This endpoint requires a server-side authentication.
Stream allows you to delete users and optionally the calls they were part of.
Note that this apply only to 1:1 calls, not group calls.
Deleting a user means:
- the user can't connect to Stream API
- their data won't appear in user queries
Delete has the following opitions:
Name | Type | Description | Optional |
---|---|---|---|
user | Enum (soft, pruning, hard) | - Soft: marks user as deleted and retains all user data. - Pruning: marks user as deleted and nullifies user information. - Hard: deletes user completely - this requires hard option for messages and conversation as well. | Yes |
conversations | Enum (soft, hard) | - Soft: marks all conversation channels as deleted (same effect as Delete Channels with 'hard' option disabled). - Hard: deletes channel and all its data completely including messages (same effect as Delete Channels with 'hard' option enabled). | Yes |
messages | Enum (soft, pruning, hard) | - Soft: marks all user messages as deleted without removing any related message data. - Pruning: marks all user messages as deleted, nullifies message information and removes some message data such as reactions and flags. - Hard: deletes messages completely with all related information. | Yes |
new_channel_owner_id | string | Channels owned by hard-deleted users will be transferred to this userID. If you doesn't provide a value, the channel owner will have a system generated ID like delete-user-8219f6578a7395g | Yes |
calls | Enum (soft, hard) | - Soft: marks calls and related data as deleted. - Hard: deletes calls and related data completely Note that this applies only to 1:1 calls, not group calls | Yes |
- JavaScript
- Python
- cURL
client.deleteUsers({ user_ids: ['<id>'] });
//restore
client.restoreUsers({ user_ids: ['<id>'] });
client.delete_users(user_ids=["<id>"])
# restore
client.restore_users(user_ids=["<id>"])
# Delete users
curl -X POST https://video.stream-io-api.com/api/v2/users/delete?api_key=${API_KEY} \
-H "Authorization: ${TOKEN}" \
-H "stream-auth-type: jwt" \
-H "Content-Type: application/json" \
-d '{
"user_ids": ["sara"]
}'
# Restore users
curl -X POST https://video.stream-io-api.com/api/v2/users/restore?api_key=${API_KEY} \
-H "Authorization: ${TOKEN}" \
-H "stream-auth-type: jwt" \
-H "Content-Type: application/json" \
-d '{
"user_ids": ["sara"]
}'
Deleting and restoring users in bulk can take some time, this is how you can check the progress:
- JavaScript
- Python
- cURL
- JavaScript@0.3 (deprecated)
// Example of monitoring the status of an async task
// The logic is same for all async tasks
const response = await client.<async operation>();
// you need to poll this endpoint
const taskResponse = await client.getTask({id: response.task_id})
console.log(taskResponse.status === 'completed');
# Example of monitoring the status of an async task
# The logic is same for all async tasks
response = client.<async operation>()
task_id = response.data.task_id
# get information about the task
task_status = client.get_task(task_id)
# just an example, in reality it can take a few seconds for a task to be processed
if task_status.data.status == "completed":
print(task_status.data.result)
# When an operation is async, a task_id will be included in the API response
# That task_id can be used to monitor the status of the task
# When finished, task status will be completed
curl -X GET https://video.stream-io-api.com/api/v2/tasks/${TASK_ID}?api_key=${API_KEY} \
-H "Authorization: ${TOKEN}" \
-H "stream-auth-type: jwt"
// Example of monitoring the status of an async task
// The logic is same for all async tasks
const response = await client.<async operation>();
// you need to poll this endpoint
const taskResponse = await client.getTaskStatus({id: response.task_id})
console.log(taskResponse.status === 'completed');
For more informiation, please refer to the async operations guide