How DO you search by user enabled status?

Let’s say I have 7 users in keycloak, 6 of them are enabled, 1 is disabled.
I now want to filter by their enabled status.

Keycloak documentation is… of limited use. But I do find a search function that accepts an enabled boolean:

It’s worth nothing that this enabled boolean does not show up in the API documentations under e.g.
Returns the number of users that match the given criteria.
( )

But let’s give it a try anyway:

private fun getBriefUserRepresentations(offset: Int, limit: Int, filter: KeycloakUserFilter): List<UserRepresentation> {
    return realm.users().search(

If I pass null as filter.isActive it gets ignored, as expected.

If I pass true, however, I get 0 results. I should be getting 6 because 6/7 users are enabled.

If I pass false, I get 8 results, I should be getting 1 because 1/7 users are disabled.
And yes, I did say that I only had 7 users set up… so where does that extra user come from?

Well it’s apparently a user that’s “enabled” and has the username service-account-<realm-name>

So … what’s the correct way to search for the user enabled status?