We have been using ArcGIS on a very limited basis for a couple of years now. When we first started thinking about using the platform with our students, I decided to provision accounts for all of them. This was a mistake.
ArcGIS allows you to bulk invite users but once the users have been invited, there aren’t bulk actions to manage them. Through numerous support requests and persistence we ended up with a technician from ESRI that said that he needed to close the ticket (ESRI) and open a new ticket with ArcGIS online. As an afterthought he mentioned using as 3rd party tool.
Admin Tools for ArcGIS Online does exactly what we needed. We were able to remove approximately 800 users that had since graduated within a few minutes.
https://www.esri.com/en-us/arcgis-marketplace/listing/products/c34019b0623041608df4d06970a7a96a
ESRI and ArcGIS along with all of the huge number of partner products makes navigating their system difficult but we highly recommend this tool.
Note: We tried using the REST APIs but were unable to find what we needed. It is likely that we had the wrong site URL or that we were missing something obvious but support was not helpful. Our results while testing in Postman returned 200 success codes but didn’t return the information that we desired. Instead it returned links to the Portal API documentation. Maybe someone will want to weigh in on a possible alternative if you are programmatically minded.