Prepare to Bulk Delete Users

Here's what you need to get started with bulk deleting users from Control Hub:

About the reference script:

  • We provide this Python script as an example only. We do not officially support or maintain this script - or any of your scripts or API clients - but we do support the API calls used in the script.

  • The script is limited to remove up to 100 users, by default. You can increase the limit if necessary. This proportionally increases the time required to run the script.

  • If you're using Python, you'll need to install the following modules:

    • requests

    • json

    • os

    • csv

    • urllib

    • time

Bulk Delete Users With Scripted API Calls

The script is limited to 100 users by default, but you can modify that limit up to the number of rows in your CSV file.

1

Sign in to Control Hub.

2

Export your users into a CSV file.

You may need more than one CSV file if you have a large organization. See Ways to Add and Manage Users in Cisco Webex Control Hub.

3

Save the CSV files to the computer where you're running the script.

4

Open the CSV files for editing, and remove the rows that contain the users you want to keep.

You will be asked by the script to confirm the deletion of the users, so you can cancel if you make a mistake here. You could go back to Control Hub at that point and export (remaining) users into fresh CSV files.

5

Run the script. For example, at your shell enter python BulkDeleteUsers.py.

6

Enter the full path and name of your CSV file, when prompted. For example, ~/Downloads/exported_users.csv.

The script prompts you to enter your access token, so it can check whether the token is still valid to authenticate you.

7

Enter your access token.

The script does a dry run, returns a count of users it will delete, and asks you to confirm that you want to delete N users.

If there are any errors, it could be that the user IDs are corrupted in the CSV files.

8

Confirm that you want to delete the users.

The API calls required to delete each user take about two to three seconds, so you can expect the script to run for about five minutes when your CSV file has 100 users.

The script writes any errors to a CSV file in the same directory as the input files.

9

Repeat this process if you have more than one CSV file.