Skip to main content
Question

Delete deactivated users via API call

  • May 22, 2025
  • 2 replies
  • 31 views

Forum|alt.badge.img

Hi :)

I need help to create API call that delete users when their status is "Deactivate".

Which authentication method should i use?

Can you show me an example script?

*I'm using Python

 

Thanks!

2 replies

Forum|alt.badge.img

Hi @KobiVaknin,

 

You'll want to use JWT auth with enterprise access if you are monitoring / deleting users for an enterprise. Here's a guide on setting that up with the different configuration options. Here's a sample on how to delete a user with the different SDKs.

 

Thanks,

Jon


Forum|alt.badge.img
So the request should be like this?
Thanks!
 
from boxsdk import JWTAuth
import requests
import json
from boxsdk import Client
 
config = JWTAuth.from_settings_file("<file_path>\\config.json")
client = Client(config)
 
users = client.users(user_type='managed')
for user in users:
  if user.status == 'inactive':
    print('User Login: {1}'.format(user.login))