Add the power of the Box AI API to your custom apps at Content Cloud Summit on May 15

Learn more and register!

Create jobs to terminate users session

post
https://api.box.com/2.0
/users/terminate_sessions

Validates the roles and permissions of the user, and creates asynchronous jobs to terminate the user's sessions. Returns the status for the POST request.

Request

bearer [ACCESS_TOKEN]
application/json

Request Body

string arrayin bodyrequired
["123456","456789"]

A list of user IDs

string arrayin bodyrequired
["user@sample.com","user2@sample.com"]

A list of user logins

Response

Returns a message about the request status.

application/jsonClient error

Returns an error if some of the parameters are not valid.

  • Users can not be NULL or EMPTY when no value is provided
  • User id format is string when the provided user id format is incorrect
  • Supported payload format is JSON when the provided payload format is incorrect
application/jsonClient error

Returns an error if there are insufficient permissions.

application/jsonClient error

Returns an error if the resource could not be found.

application/jsonClient error

Returns an error if the rate limit is exceeded.

application/jsonClient error

Returns an error if there is an internal server issue.

application/jsonClient error

Returns an error if the request timed out.

application/jsonClient error

An unexpected client error.

post
Create jobs to terminate users session
You can now try out some of our APIs live, right here in the documentation.
Log in

Request Example

cURL
curl -i -X POST "https://api.box.com/2.0/users/terminate_sessions" \
    -H "authorization: Bearer <ACCESS_TOKEN>" \
    -H "content-type: application/json" \
    -H "accept: application/json" \
    -d 
  {
      user_ids: ["6178859178", "4824866571"]  
      user_logins: ["user@example.com", "user2@example.com",]
  }
Node
var userIDs = ['33333', '44444'];
var userLogins = ['user1@example.com', 'user2@example.com'];

client.users.terminateSession({
    user_ids: userIDs,
    user_logins: userLogins
}).then((result) => {
        /* result -> {
            message: "Request is successful, please check the admin events for the status of the job" }
        */
    });
TypeScript (Beta)
await client.sessionTermination.terminateUsersSessions({
  userIds: [getEnvVar('USER_ID')],
  userLogins: [user.login!],
} satisfies TerminateUsersSessionsRequestBody);
Python (Beta)
client.session_termination.terminate_users_sessions([get_env_var('USER_ID')], [user.login])
.NET (Beta)
await client.SessionTermination.TerminateUsersSessionsAsync(requestBody: new TerminateUsersSessionsRequestBody(userIds: Array.AsReadOnly(new [] {Utils.GetEnvVar(name: "USER_ID")}), userLogins: Array.AsReadOnly(new [] {NullableUtils.Unwrap(user.Login)})));

Response Example

{
  "message": "Request is successful, please check the admin\nevents for the status of the job"
}