Hello, you can make it with three steps:
first: /api/system/search?pagesize=5000
It will get to you json with users, after that make cicle, which get all users with ['Users']['Status'] = False
(it's your inactive users), you get ID of those users after that yo can call api
/api/system/users/{id}/delete for that inactive users
i try it on 150 000 users, i't not fast, but work, 20 000 i think it's about 2-3 hours of work script