Is it possible to list all users in a certain state via the API? For example, list all users that have been locked. If not, is this a feature that would be considered for implementation?
there isn’t. Filtering users is limited, probably to only what is needed for core functionality.
You could always put in a Jira request and ask for that feature but I wouldn’t get my hopes up.
If you really have an urgent need for that feature you could always write your own provider and extend Keycloak yourself. There are a couple of provider examples in the git repo and together with the source code itself you could easily have something to your needs. In this case The UserResource is a good starting point.
One thing to watch out for when extending things like this is to make sure there are good indexes on the fields your are searching in the DB or else it could become a bottleneck fast when a lot of users are involved.
Or when you have access to the DB directly you could do it that way from your own app.