The users with the prefix service-account-
are automatically created by Keycloak for each client that has the OAuth2 flow client credentials
enabled, which is represented in Keycloak with the option Service Accounts Enabled
.
Therefore, you can query for the list of clients using the endpoint:
GET /{realm}/clients
filter to only get the clients with the field "serviceAccountsEnabled"
set to true
.
Then you can use that list to filter the users that you do not want, knowing that those users will have the name service-account-clientID
where clientID is the clientID of the clients with the service account enabled.