How can I delete users in bulk?

Knowledge Drop

Last tested: Apr 5, 2019
 

There is currently no way to delete users in bulk via the UI, and we do recommend that users be disabled rather than deleted.

However It is possible to delete a list of users by their ID number using the delete_user API endpoint.

It is very important to note that this action cannot be undone and any content or schedules owned by these users will be lost permanently! A better alternative is to update users with the update_user endpoint and disable them by setting is_disabled = true

Curl API Example with bash to delete user IDs in a range

 

#!/bin/bash

startID= #set user ID to start with

endID= #set user ID to finish; it will also be deleted

clientID= #your client ID

secret= #your client secret

url= #your looker API URL e.g. https://mycompany.looker.com:19999

token=`curl -d "client_id=$clientID&client_secret=$secret" https://mycompany.looker.com:19999/login | jq '.access_token' | sed 's/\"//g'`

# echo $token

for ((i=$startID; i<=$endID; i++))

do

# echo $i

curl -X "DELETE" -H "Authorization: token $token" -H "Content-Type: application/json" -d "{\"user_id\": $i}" $url/api/3.0/users/$i

done

This content is subject to limited support.                

Version history
Last update:
‎05-07-2021 09:48 AM
Updated by: