Teams

class matterapi.endpoints.async_api.TeamsApi(client: matterapi.client.base.BaseClient, skip_response_parsing: bool = False)

Endpoints for creating, getting and interacting with teams.

async add_team_member(team_id: str, *, json_body: Union[matterapi.models.AddTeamMemberJsonBody, Dict]) matterapi.models.TeamMember

Add user to team

Add user to the team by user_id.

Permissions:

Must be authenticated and team be open to add self. For adding another user, authenticated user must have the add_user_to_team permission.

Api Reference:

AddTeamMember

async add_team_member_from_invite(*, token: str) matterapi.models.TeamMember

Add user to team from invite

Using either an invite id or hash/data pair from an email invite link, add a user to a team.

Permissions:

Must be authenticated.

Api Reference:

AddTeamMemberFromInvite

async add_team_members(team_id: str, *, json_body: Union[List[matterapi.models.TeamMember], Dict], graceful: Optional[bool] = None) List[matterapi.models.TeamMember]

Add multiple users to team

Add a number of users to the team by user_id.

Permissions:

Must be authenticated. Authenticated user must have the add_user_to_team permission.

Api Reference:

AddTeamMembers

async create_team(*, json_body: Union[matterapi.models.CreateTeamJsonBody, Dict]) matterapi.models.Team

Create a team

Create a new team on the system.

Permissions:

Must be authenticated and have the create_team permission.

Api Reference:

CreateTeam

async get_all_teams(*, page: Optional[int] = 0, per_page: Optional[int] = 60, include_total_count: Optional[bool] = False, exclude_policy_constrained: Optional[bool] = False) List[matterapi.models.Team]

Get teams

For regular users only returns open teams. Users with the “manage_system” permission will return teams regardless of type. The result is based on query string parameters - page and per_page.

Permissions:

Must be authenticated. “manage_system” permission is required to show all teams.

Api Reference:

GetAllTeams

async get_team(team_id: str) matterapi.models.Team

Get a team

Get a team on the system.

Permissions:

Must be authenticated and have the view_team permission.

Api Reference:

GetTeam

async get_team_by_name(name: str) matterapi.models.Team

Get a team by name

Get a team based on provided name string

Permissions:

Must be authenticated, team type is open and have the view_team permission.

Api Reference:

GetTeamByName

async get_team_icon(team_id: str) None

Get the team icon

Get the team icon of the team.

Permissions:

User must be authenticated. In addition, team must be open or the user must have the view_team permission.

Minimum Server Version:

4.9

Api Reference:

GetTeamIcon

async get_team_invite_info(invite_id: str) matterapi.models.GetTeamInviteInfoResponse200

Get invite info for a team

Get the name, display_name, description and id for a team from the invite id.

Permissions:

No authentication required.

Minimum Server Version:

4.0

Api Reference:

GetTeamInviteInfo

async get_team_member(team_id: str, user_id: str) matterapi.models.TeamMember

Get a team member

Get a team member on the system.

Permissions:

Must be authenticated and have the view_team permission.

Api Reference:

GetTeamMember

async get_team_members(team_id: str, *, page: Optional[int] = 0, per_page: Optional[int] = 60) List[matterapi.models.TeamMember]

Get team members

Get a page team members list based on query string parameters - team id, page and per page.

Permissions:

Must be authenticated and have the view_team permission.

Api Reference:

GetTeamMembers

async get_team_members_by_ids(team_id: str, *, json_body: Union[List[str], Dict]) List[matterapi.models.TeamMember]

Get team members by ids

Get a list of team members based on a provided array of user ids.

Permissions:

Must have view_team permission for the team.

Api Reference:

GetTeamMembersByIds

async get_team_members_for_user(user_id: str) List[matterapi.models.TeamMember]

Get team members for a user

Get a list of team members for a user. Useful for getting the ids of teams the user is on and the roles they have in those teams.

Permissions:

Must be logged in as the user or have the edit_other_users permission.

Api Reference:

GetTeamMembersForUser

async get_team_stats(team_id: str) matterapi.models.TeamStats

Get a team stats

Get a team stats on the system.

Permissions:

Must be authenticated and have the view_team permission.

Api Reference:

GetTeamStats

async get_team_unread(user_id: str, team_id: str) matterapi.models.TeamUnread

Get unreads for a team

Get the unread mention and message counts for a team for the specified user.

Permissions:

Must be the user or have edit_other_users permission and have view_team permission for the team.

Api Reference:

GetTeamUnread

async get_teams_for_user(user_id: str) List[matterapi.models.Team]

Get a user’s teams

Get a list of teams that a user is on.

Permissions:

Must be authenticated as the user or have the manage_system permission.

Api Reference:

GetTeamsForUser

async get_teams_unread_for_user(user_id: str, *, exclude_team: str, include_collapsed_threads: Optional[bool] = False) List[matterapi.models.TeamUnread]

Get team unreads for a user

Get the count for unread messages and mentions in the teams the user is a member of.

Permissions:

Must be logged in.

Api Reference:

GetTeamsUnreadForUser

async import_team(team_id: str, *, multipart_data: Union[matterapi.models.ImportTeamMultipartData, Dict]) matterapi.models.ImportTeamResponse200

Import a Team from other application

Import a team into a existing team. Import users, channels, posts, hooks.

Permissions:

Must have permission_import_team permission.

Api Reference:

ImportTeam

async invalidate_email_invites() matterapi.models.StatusOK

Invalidate active email invitations

Invalidate active email invitations that have not been accepted by the user.

Permissions:

Must have sysconsole_write_authentication permission.

Api Reference:

InvalidateEmailInvites

async invite_guests_to_team(team_id: str, *, json_body: Union[matterapi.models.InviteGuestsToTeamJsonBody, Dict]) matterapi.models.StatusOK

Invite guests to the team by email

Invite guests to existing team channels usign the user’s email.

The number of emails that can be sent is rate limited to 20 per hour with a burst of 20 emails. If the rate limit exceeds, the error message contains details on when to retry and when the timer will be reset.

Permissions:

Must have invite_guest permission for the team.

Minimum Server Version:

5.16

Api Reference:

InviteGuestsToTeam

async invite_users_to_team(team_id: str, *, json_body: Union[List[str], Dict]) matterapi.models.StatusOK

Invite users to the team by email

Invite users to the existing team using the user’s email.

The number of emails that can be sent is rate limited to 20 per hour with a burst of 20 emails. If the rate limit exceeds, the error message contains details on when to retry and when the timer will be reset.

Permissions:

Must have invite_user and add_user_to_team permissions for the team.

Api Reference:

InviteUsersToTeam

async patch_team(team_id: str, *, json_body: Union[matterapi.models.PatchTeamJsonBody, Dict]) matterapi.models.Team

Patch a team

Partially update a team by providing only the fields you want to update. Omitted fields will not be updated. The fields that can be updated are defined in the request body, all other provided fields will be ignored.

Permissions:

Must have the manage_team permission.

Api Reference:

PatchTeam

async regenerate_team_invite_id(team_id: str) matterapi.models.Team

Regenerate the Invite ID from a Team

Regenerates the invite ID used in invite links of a team

Permissions:

Must be authenticated and have the manage_team permission.

Api Reference:

RegenerateTeamInviteId

async remove_team_icon(team_id: str) matterapi.models.StatusOK

Remove the team icon

Remove the team icon for the team.

Permissions:

Must be authenticated and have the manage_team permission.

Minimum Server Version:

4.10

Api Reference:

RemoveTeamIcon

async remove_team_member(team_id: str, user_id: str) matterapi.models.StatusOK

Remove user from team

Delete the team member object for a user, effectively removing them from a team.

Permissions:

Must be logged in as the user or have the remove_user_from_team permission.

Api Reference:

RemoveTeamMember

async restore_team(team_id: str) matterapi.models.Team

Restore a team

Restore a team that was previously soft deleted.

Permissions:

Must have the manage_team permission.

Minimum Server Version:

5.24

Api Reference:

RestoreTeam

async search_files(team_id: str, *, multipart_data: Union[matterapi.models.SearchFilesMultipartData, Dict]) matterapi.models.FileInfoList

Search files in a team

Search for files in a team based on file name, extention and file content (if file content extraction is enabled and supported for the files).

Permissions:

Must be authenticated and have the view_team permission.

Minimum Server Version:

5.34

Api Reference:

SearchFiles

async search_teams(*, json_body: Union[matterapi.models.SearchTeamsJsonBody, Dict]) matterapi.models.SearchTeamsResponse200

Search teams

Search teams based on search term and options provided in the request body.

Logged in user with “manage_system” permission shows all teams

Permissions:

Logged in user only shows open teams

Api Reference:

SearchTeams

async set_team_icon(team_id: str, *, multipart_data: Union[matterapi.models.SetTeamIconMultipartData, Dict]) matterapi.models.StatusOK

Sets the team icon

Sets the team icon for the team.

Permissions:

Must be authenticated and have the manage_team permission.

Minimum Server Version:

4.9

Api Reference:

SetTeamIcon

async soft_delete_team(team_id: str, *, permanent: Optional[bool] = False) matterapi.models.StatusOK

Delete a team

Soft deletes a team, by marking the team as deleted in the database. Soft deleted teams will not be accessible in the user interface.

Optionally use the permanent query parameter to hard delete the team for compliance reasons. As of server version 5.0, to use this feature ServiceSettings.EnableAPITeamDeletion must be set to true in the server’s configuration.

Permissions:

Must have the manage_team permission.

Api Reference:

SoftDeleteTeam

async team_exists(name: str) matterapi.models.TeamExists

Check if team exists

Check if the team exists based on a team name.

Permissions:

Must be authenticated.

Api Reference:

TeamExists

async team_members_minus_group_members(team_id: str, *, group_ids: str = '', page: Optional[int] = 0, per_page: Optional[int] = 0) None

Team members minus group members.

Get the set of users who are members of the team minus the set of users who are members of the given groups. Each user object contains an array of group objects representing the group memberships for that user. Each user object contains the boolean fields scheme_guest, scheme_user, and scheme_admin representing the roles that user has for the given team.

Permissions:

Must have manage_system permission.

Minimum Server Version:

5.14

Api Reference:

TeamMembersMinusGroupMembers

async update_team(team_id: str, *, json_body: Union[matterapi.models.UpdateTeamJsonBody, Dict]) matterapi.models.Team

Update a team

Update a team by providing the team object. The fields that can be updated are defined in the request body, all other provided fields will be ignored.

Permissions:

Must have the manage_team permission.

Api Reference:

UpdateTeam

async update_team_member_roles(team_id: str, user_id: str, *, json_body: Union[matterapi.models.UpdateTeamMemberRolesJsonBody, Dict]) matterapi.models.StatusOK

Update a team member roles

Update a team member roles. Valid team roles are “team_user”, “team_admin” or both of them. Overwrites any previously assigned team roles.

Permissions:

Must be authenticated and have the manage_team_roles permission.

Api Reference:

UpdateTeamMemberRoles

async update_team_member_scheme_roles(team_id: str, user_id: str, *, json_body: Union[matterapi.models.UpdateTeamMemberSchemeRolesJsonBody, Dict]) matterapi.models.StatusOK

Update the scheme-derived roles of a team member.

Update a team member’s scheme_admin/scheme_user properties. Typically this should either be scheme_admin=false, scheme_user=true for ordinary team member, or scheme_admin=true, scheme_user=true for a team admin.

Permissions:

Must be authenticated and have the manage_team_roles permission.

Minimum Server Version:

5.0

Api Reference:

UpdateTeamMemberSchemeRoles

async update_team_privacy(team_id: str, *, json_body: Union[matterapi.models.UpdateTeamPrivacyJsonBody, Dict]) matterapi.models.Team

Update teams’s privacy

Updates team’s privacy allowing changing a team from Public (open) to Private (invitation only) and back.

Permissions:

manage_team permission for the team of the team.

Minimum Server Version:

5.24

Api Reference:

UpdateTeamPrivacy

async update_team_scheme(team_id: str, *, json_body: Union[matterapi.models.UpdateTeamSchemeJsonBody, Dict]) matterapi.models.StatusOK

Set a team’s scheme

Set a team’s scheme, more specifically sets the scheme_id value of a team record.

Permissions:

Must have manage_system permission.

Minimum Server Version:

5.0

Api Reference:

UpdateTeamScheme