Multi-Tenant & Teams
Confused about "Multi-Tenant & Teams"?
Let us know how we can improve our documentation:
Many apps that add chat have customers of their own. If you're building something like Slack, or a SaaS application like InVision you want to make sure that one customer can't read the messages of another customer. Stream Chat can be configured in multi-tenant mode so that users are organized in separated teams that cannot interact with each other.
Teams
Copied!Confused about "Teams"?
Let us know how we can improve our documentation:
Stream Chat has the concept of teams for users and channels. The purpose of teams is to provide a simple way to separate different groups of users and channels within a single application.
If a user belongs to a team, the API will ensure that such user will only be able to connect to channels from the same team. Features such as user search are limited so that a user can only search for users from the same team by default.
When enabling multi-tenant mode all user requests will always ensure that the request applies to a team the user belongs to. For instance, if a user from team "blue" tries to delete a message that was created on a channel from team "red" the API will return an error. If user doesn't have team set, it will only have access to users and channels that don't have team.
Enable Teams for your application
Copied!Confused about "Enable Teams for your application"?
Let us know how we can improve our documentation:
In order to use Teams, your application must have multi-tenant mode enabled. You can ensure your app is in multi-tenant mode by calling the Application Settings endpoint.
User teams
Copied!Confused about "User teams"?
Let us know how we can improve our documentation:
When using teams, users must be created from your back-end and specify which teams they are a member of.
UpdateUserTeam
action is granted to the userChannel team
Copied!Confused about "Channel team"?
Let us know how we can improve our documentation:
Channels can be associated with a team. Users can create channels client-side but if their user is part of a team, they will have to specify a team or the request will be rejected with an error.
User Search
Copied!Confused about "User Search"?
Let us know how we can improve our documentation:
By default the user search will only return results from teams that user is a part of. API injects filter {teams: {$in: ["red", "blue"]}}
for every request that doesn't already contain filter for teams
field. If you want to query users from all teams, you have to provide empty filter like this: {teams:{}}
. For server-side requests, this filter does not apply.
Query Channels
Copied!Confused about "Query Channels "?
Let us know how we can improve our documentation:
When using multi-tenant, the query channels endpoint will only return channels that match the query and are on the same team as the user. API injects filter {team: {$in: [<user_teams>]}}
for every request that doesn't already contain filter for team
field. If you want to query channels from all teams, you have to provide empty filter like this: {team:{}}
. For server-side requests, this filter does not apply.
Multi-Tenant Permissions
Copied!Confused about "Multi-Tenant Permissions"?
Let us know how we can improve our documentation:
In tables below you will find default permission grants for builtin roles that designed for multi-tenant applications. They are useful for multi-tenant applications only.
By default, for multi-tenant applications, all objects (users, channels, and messages) must belong to the same team to be able to interact. These multi-tenant permissions enable overriding that behavior, so that certain users can have permissions to interact with objects on any team
Scope video:livestream
Permission ID |
---|
Scope video:development
Permission ID |
---|
Scope .app
Permission ID | global_moderator | global_admin |
---|---|---|
flag-user-any-team | ✅ | ✅ |
mute-user-any-team | ✅ | ✅ |
read-flag-reports-any-team | ✅ | ✅ |
search-user-any-team | ✅ | ✅ |
update-flag-report-any-team | ✅ | ✅ |
update-user-owner | ✅ | ✅ |
Scope video:audio_room
Permission ID |
---|
Scope video:default
Permission ID |
---|
Scope messaging
Permission ID | global_moderator | global_admin |
---|---|---|
add-links-any-team | ✅ | ✅ |
ban-channel-member-any-team | ✅ | ✅ |
ban-user-any-team | ✅ | ✅ |
create-call-any-team | ✅ | ✅ |
create-channel-any-team | ✅ | ✅ |
create-message-any-team | ✅ | ✅ |
create-attachment-any-team | ✅ | ✅ |
create-mention-any-team | ✅ | ✅ |
create-reaction-any-team | ✅ | ✅ |
create-system-message-any-team | ✅ | ✅ |
delete-attachment-any-team | ✅ | ✅ |
delete-channel-any-team | ✖️ | ✅ |
delete-channel-owner-any-team | ✅ | ✖️ |
delete-message-any-team | ✅ | ✅ |
delete-reaction-any-team | ✅ | ✅ |
flag-message-any-team | ✅ | ✅ |
join-call-any-team | ✅ | ✅ |
mute-channel-any-team | ✅ | ✅ |
pin-message-any-team | ✅ | ✅ |
read-channel-any-team | ✅ | ✅ |
read-channel-members-any-team | ✅ | ✅ |
read-message-flags-any-team | ✅ | ✅ |
recreate-channel-any-team | ✖️ | ✅ |
recreate-channel-owner-any-team | ✅ | ✖️ |
remove-own-channel-membership-any-team | ✅ | ✅ |
run-message-action-any-team | ✅ | ✅ |
send-custom-event-any-team | ✅ | ✅ |
skip-channel-cooldown-any-team | ✅ | ✅ |
skip-message-moderation-any-team | ✅ | ✅ |
truncate-channel-any-team | ✖️ | ✅ |
truncate-channel-owner-any-team | ✅ | ✖️ |
unblock-message-any-team | ✅ | ✅ |
update-channel-any-team | ✅ | ✅ |
update-channel-cooldown-any-team | ✅ | ✅ |
update-channel-frozen-any-team | ✅ | ✅ |
update-channel-members-any-team | ✅ | ✅ |
update-message-any-team | ✅ | ✅ |
upload-attachment-any-team | ✅ | ✅ |
Scope livestream
Permission ID | global_moderator | global_admin |
---|---|---|
add-links-any-team | ✅ | ✅ |
ban-channel-member-any-team | ✅ | ✅ |
ban-user-any-team | ✅ | ✅ |
create-call-any-team | ✅ | ✅ |
create-channel-any-team | ✅ | ✅ |
create-message-any-team | ✅ | ✅ |
create-attachment-any-team | ✅ | ✅ |
create-mention-any-team | ✅ | ✅ |
create-reaction-any-team | ✅ | ✅ |
create-system-message-any-team | ✅ | ✅ |
delete-attachment-any-team | ✅ | ✅ |
delete-channel-any-team | ✖️ | ✅ |
delete-message-any-team | ✅ | ✅ |
delete-reaction-any-team | ✅ | ✅ |
flag-message-any-team | ✅ | ✅ |
join-call-any-team | ✅ | ✅ |
mute-channel-any-team | ✅ | ✅ |
pin-message-any-team | ✅ | ✅ |
read-channel-any-team | ✅ | ✅ |
read-channel-members-any-team | ✅ | ✅ |
read-message-flags-any-team | ✅ | ✅ |
recreate-channel-any-team | ✖️ | ✅ |
remove-own-channel-membership-any-team | ✖️ | ✅ |
run-message-action-any-team | ✅ | ✅ |
send-custom-event-any-team | ✅ | ✅ |
skip-channel-cooldown-any-team | ✅ | ✅ |
skip-message-moderation-any-team | ✅ | ✅ |
truncate-channel-any-team | ✖️ | ✅ |
unblock-message-any-team | ✅ | ✅ |
update-channel-any-team | ✖️ | ✅ |
update-channel-cooldown-any-team | ✅ | ✅ |
update-channel-frozen-any-team | ✅ | ✅ |
update-channel-members-any-team | ✖️ | ✅ |
update-message-any-team | ✅ | ✅ |
upload-attachment-any-team | ✅ | ✅ |
Scope team
Permission ID | global_moderator | global_admin |
---|---|---|
add-links-any-team | ✅ | ✅ |
ban-channel-member-any-team | ✅ | ✅ |
ban-user-any-team | ✅ | ✅ |
create-call-any-team | ✅ | ✅ |
create-channel-any-team | ✅ | ✅ |
create-message-any-team | ✅ | ✅ |
create-attachment-any-team | ✅ | ✅ |
create-mention-any-team | ✅ | ✅ |
create-reaction-any-team | ✅ | ✅ |
create-system-message-any-team | ✅ | ✅ |
delete-attachment-any-team | ✅ | ✅ |
delete-channel-any-team | ✖️ | ✅ |
delete-channel-owner-any-team | ✅ | ✖️ |
delete-message-any-team | ✅ | ✅ |
delete-reaction-any-team | ✅ | ✅ |
flag-message-any-team | ✅ | ✅ |
join-call-any-team | ✅ | ✅ |
mute-channel-any-team | ✅ | ✅ |
pin-message-any-team | ✅ | ✅ |
read-channel-any-team | ✅ | ✅ |
read-channel-members-any-team | ✅ | ✅ |
read-message-flags-any-team | ✅ | ✅ |
recreate-channel-any-team | ✖️ | ✅ |
recreate-channel-owner-any-team | ✅ | ✖️ |
remove-own-channel-membership-any-team | ✅ | ✅ |
run-message-action-any-team | ✅ | ✅ |
send-custom-event-any-team | ✅ | ✅ |
skip-channel-cooldown-any-team | ✅ | ✅ |
skip-message-moderation-any-team | ✅ | ✅ |
truncate-channel-any-team | ✖️ | ✅ |
truncate-channel-owner-any-team | ✅ | ✖️ |
unblock-message-any-team | ✅ | ✅ |
update-channel-any-team | ✅ | ✅ |
update-channel-cooldown-any-team | ✅ | ✅ |
update-channel-frozen-any-team | ✅ | ✅ |
update-channel-members-any-team | ✅ | ✅ |
update-message-any-team | ✅ | ✅ |
upload-attachment-any-team | ✅ | ✅ |
Scope commerce
Permission ID | global_moderator | global_admin |
---|---|---|
add-links-any-team | ✅ | ✅ |
ban-channel-member-any-team | ✅ | ✅ |
ban-user-any-team | ✅ | ✅ |
create-call-any-team | ✅ | ✅ |
create-channel-any-team | ✅ | ✅ |
create-message-any-team | ✅ | ✅ |
create-attachment-any-team | ✅ | ✅ |
create-mention-any-team | ✅ | ✅ |
create-reaction-any-team | ✅ | ✅ |
create-system-message-any-team | ✅ | ✅ |
delete-attachment-any-team | ✅ | ✅ |
delete-channel-any-team | ✖️ | ✅ |
delete-message-any-team | ✅ | ✅ |
delete-reaction-any-team | ✅ | ✅ |
flag-message-any-team | ✅ | ✅ |
join-call-any-team | ✅ | ✅ |
mute-channel-any-team | ✅ | ✅ |
pin-message-any-team | ✅ | ✅ |
read-channel-any-team | ✅ | ✅ |
read-channel-members-any-team | ✅ | ✅ |
read-message-flags-any-team | ✅ | ✅ |
recreate-channel-any-team | ✖️ | ✅ |
remove-own-channel-membership-any-team | ✅ | ✅ |
run-message-action-any-team | ✅ | ✅ |
send-custom-event-any-team | ✅ | ✅ |
skip-channel-cooldown-any-team | ✅ | ✅ |
skip-message-moderation-any-team | ✅ | ✅ |
truncate-channel-any-team | ✖️ | ✅ |
unblock-message-any-team | ✅ | ✅ |
update-channel-any-team | ✅ | ✅ |
update-channel-cooldown-any-team | ✅ | ✅ |
update-channel-frozen-any-team | ✅ | ✅ |
update-channel-members-any-team | ✅ | ✅ |
update-message-any-team | ✅ | ✅ |
upload-attachment-any-team | ✅ | ✅ |
Scope gaming
Permission ID | global_moderator | global_admin |
---|---|---|
add-links-any-team | ✅ | ✅ |
ban-channel-member-any-team | ✅ | ✅ |
ban-user-any-team | ✅ | ✅ |
create-call-any-team | ✅ | ✅ |
create-channel-any-team | ✖️ | ✅ |
create-message-any-team | ✅ | ✅ |
create-attachment-any-team | ✅ | ✅ |
create-mention-any-team | ✅ | ✅ |
create-reaction-any-team | ✅ | ✅ |
create-system-message-any-team | ✅ | ✅ |
delete-attachment-any-team | ✅ | ✅ |
delete-channel-any-team | ✖️ | ✅ |
delete-message-any-team | ✅ | ✅ |
delete-reaction-any-team | ✅ | ✅ |
flag-message-any-team | ✅ | ✅ |
join-call-any-team | ✅ | ✅ |
mute-channel-any-team | ✅ | ✅ |
pin-message-any-team | ✅ | ✅ |
read-channel-any-team | ✅ | ✅ |
read-channel-members-any-team | ✅ | ✅ |
read-message-flags-any-team | ✅ | ✅ |
recreate-channel-any-team | ✖️ | ✅ |
remove-own-channel-membership-any-team | ✅ | ✅ |
run-message-action-any-team | ✅ | ✅ |
send-custom-event-any-team | ✅ | ✅ |
skip-channel-cooldown-any-team | ✅ | ✅ |
skip-message-moderation-any-team | ✅ | ✅ |
truncate-channel-any-team | ✖️ | ✅ |
unblock-message-any-team | ✅ | ✅ |
update-channel-any-team | ✖️ | ✅ |
update-channel-cooldown-any-team | ✅ | ✅ |
update-channel-frozen-any-team | ✅ | ✅ |
update-channel-members-any-team | ✖️ | ✅ |
update-message-any-team | ✅ | ✅ |
upload-attachment-any-team | ✅ | ✅ |