Slack. Web. Admin. Users. Session
(SlackKit v1.0.0-alpha.0)
View Source
Summary
Functions
Clear user-specific session settings—the session duration and what happens when the client closes—for a list of users.
Get user-specific session settings—the session duration and what happens when the client closes—given a list of users.
Revoke a single session for a user. The user will be forced to login to Slack.
List active user sessions for an organization
Wipes all valid sessions on all devices for a given user
Enqueues an asynchronous job to wipe all valid sessions on all devices for a given list of users
Configure the user-level session settings—the session duration and what happens when the client closes—for one or more users.
Functions
Clear user-specific session settings—the session duration and what happens when the client closes—for a list of users.
API reference
Rate limit: Tier 4: 100+ per minute
Scopes:
- User token:
admin.users:write
Required Params
user_ids- The IDs of users you'd like to clear session settings for. ex:['U1234']
Errors the API can return:
admin_unauthorized- The owner of this token isn't authorized to clear sessions.bots_not_allowed- Bot users may not have their settings cleared.feature_not_enabled- This method is only available to Enterprise customers.not_an_admin- The owner of this token isn't an Org Owner or Admin.unknown_method- This method is currently not available.user_not_found- There was an error finding a requested user.
See the Common Errors guide for errors returned by every Web API method.
Get user-specific session settings—the session duration and what happens when the client closes—given a list of users.
API reference
Rate limit: Tier 4: 100+ per minute
Scopes:
- User token:
admin.users:read
Required Params
user_ids- The IDs of users you'd like to fetch session settings for. Note: if a user does not have any active sessions, they will not be returned in the response. ex:['U1234']
Errors the API can return:
admin_unauthorized- The owner of this token isn't authorized to list sessions.bots_not_allowed- Bot sessions are not listed by this method.feature_not_enabled- This method is only available to Enterprise customers.not_an_admin- The owner of this token isn't an Org Owner or Admin.restricted_action- The owner of this token isn't an Org Owner or Admin.unknown_method- This method is currently not available.user_not_found- There was an error finding the requested user.
See the Common Errors guide for errors returned by every Web API method.
Revoke a single session for a user. The user will be forced to login to Slack.
API reference
Rate limit: Tier 2: 20+ per minute
Scopes:
- User token:
admin.users:write
Required Params
session_id- ID of the session to invalidate. ex:12345user_id- ID of the user that the session belongs to. ex:U12345
Optional Params
team_id- ID of the workspace that the session belongs to. ex:T1234
Errors the API can return:
admin_unauthorized- The token provided doesn't have permission to revoke a session.cannot_invalidate_primary_owner- Only the primary owner of an organization can invalidate a primary owner's sessions.feature_not_enabled- The token provided can't call this method.not_an_admin- This method must be called by an Org Owner or Admin.session_invalidation_failed- There was an error invalidating the session.session_not_found- The requested session wasn't found.unknown_method- This method is currently not available.user_not_found- The requested user wasn't found.
See the Common Errors guide for errors returned by every Web API method.
List active user sessions for an organization
API reference
Rate limit: Tier 2: 20+ per minute
Scopes:
- User token:
admin.users:read
Optional Params
cursor- Setcursortonext_cursorreturned by the previous call to list items in the next page. ex:5c3e53d5limit- The maximum number of items to return. Must be between 1 - 1000 both inclusive. ex:100team_id- The ID of the workspace you'd like active sessions for. If you pass ateam_id, you'll need to pass auser_idas well. If nouser_idandteam_idare passed, you'll receive a paginated list of all sessions. When you passuser_idandteam_id(which must be used together), you'll receive a list of active sessions by that user on the workspace specified byteam_id. ex:T1234user_id- The ID of user you'd like active sessions for. If you pass auser_id, you'll need to pass ateam_idas well. If nouser_idandteam_idare passed, you'll receive a paginated list of all sessions. When you passuser_idandteam_id(which must be used together), you'll receive a list of active sessions by that user on the workspace specified byteam_id. ex:U1234
Errors the API can return:
admin_unauthorized- The owner of this token isn't authorized to list sessions.bots_not_allowed- Bot sessions are not listed by this method.feature_not_enabled- This method is only available to Enterprise customers.invalid_cursor- The cursor passed was invalid.missing_team- Ateam_idmust be provided with auser_id.missing_user- Auser_idmust be provided with ateam_id.no_active_sessions- No active sessions were found.not_an_admin- The owner of this token isn't an Org Owner or Admin.team_not_found- There was an error finding the requested workspace.unknown_method- This method is currently not available.user_not_found- There was an error finding the requested user.
See the Common Errors guide for errors returned by every Web API method.
Wipes all valid sessions on all devices for a given user
API reference
Rate limit: Tier 2: 20+ per minute
Scopes:
- User token:
admin.users:write
Required Params
user_id- The ID of the user to wipe sessions for ex:W12345678
Optional Params
mobile_only- Only expire mobile sessions (default: false). Use theweb_onlyandmobile_onlyparameters to wipe only web or only mobile sessions.web_only- Only expire web sessions (default: false). Use theweb_onlyandmobile_onlyparameters to wipe only web or only mobile sessions.
Errors the API can return:
cannot_reset_bot- Cannot reset bot userscannot_reset_primary_owner- Only primary owner can reset primary owner's sessionsfeature_not_enabled- This method is not available for this product levelnot_an_admin- This method is only accessible by org/compliance team owners and adminsunknown_method- This method is currently not availableuser_not_found- Error fetching useruser_session_reset_failed- There was an error starting the session reset. Try again.
See the Common Errors guide for errors returned by every Web API method.
Enqueues an asynchronous job to wipe all valid sessions on all devices for a given list of users
API reference
Rate limit: Tier 2: 20+ per minute
Scopes:
- User token:
admin.users:write
Required Params
user_ids- The list of up to 1,000 user IDs to wipe sessions for ex:["W12345678", "W98765432"]
Optional Params
mobile_only- Only expire mobile sessions (default: false). Use theweb_onlyandmobile_onlyparameters to wipe only web or only mobile sessions.web_only- Only expire web sessions (default: false). Use theweb_onlyandmobile_onlyparameters to wipe only web or only mobile sessions.
Errors the API can return:
cannot_reset_bot- Cannot reset bot userscannot_reset_primary_owner- Only primary owner can reset primary owner's sessionsfailed_for_some_users- Some user ids failed to have their session invalidated. Details in extended commentsfeature_not_enabled- This method is not available for this product levelnot_an_admin- This method is only accessible by org/compliance team owners and adminsrestricted_action- Restricted action.session_reset_not_allowed- Only primary owner can reset primary owner's sessionsunknown_method- This method is currently not availableuser_not_found- Error fetching useruser_session_reset_failed- There was an error starting the session reset. Try again.
See the Common Errors guide for errors returned by every Web API method.
Configure the user-level session settings—the session duration and what happens when the client closes—for one or more users.
API reference
Rate limit: Tier 4: 100+ per minute
Scopes:
- User token:
admin.users:write
Required Params
user_ids- The list of up to 1,000 user IDs to apply the session settings for ex:['U12345','U67890']
Optional Params
desktop_app_browser_quit- Terminate the session when the client—either the desktop app or a browser window—is closed. ex:trueduration- The session duration, in seconds. The minimum value is 28800, which represents 8 hours; the max value is 315569520 or 10 years (that's a long Slack session). ex:86400
Errors the API can return:
admin_unauthorized- The token provided doesn't have permission to revoke a session.at_least_one_session_setting_required- At least one session setting is required.bots_not_allowed- Bot sessions are not listed by this method.feature_not_enabled- This method is only available for Enterprise organizations.not_an_admin- This method is only accessible by Org Owners and Adminsunable_to_update_existing_sessions- The session settings could not be applied to users' existing sessions.unknown_method- This method is currently not available.user_not_found- At least one of the requested users doesn't exist.
See the Common Errors guide for errors returned by every Web API method.