Get inactive users (without time constraints) via API

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Close this issue

I'm trying to find inactive members in my GitLab-CE instance via the Gitlab API (v4).

Problem to solve

find inactive members via the API

Further details

my gitlab-ce instance allows login via oauth2-providers (gitlab, github, gmail, g...). the users are locked down (external), but still i have quite a number of users who seem to only sign up for spamming. (e.g. good-looking "people" from south-east asia (mostly, i'm sorry to say) with homepages belonging to shady furniture retailers).

since those people can't do much on the instance (they must be added to a project/group first in order to be bale to commit; they could report issues, but luckily haven't found yet out how to use that to spam), this is just an ever increasing number of inactive users.

i'd like to purge such inactive users from my instance every now and then (automatically, or semi-automatically to prevent false-positives) - mostly because they pollute the user namespace (making it harder to find the real contributors).

so, my target is to use the API to get a list of inactive users. (really i want to get all users who have created their account more than N months ago, and have not shown any active or passive "activity" apart from signing up)

One of the criteria for "(in)activity" is, whether a given user is member of any project or group.

While this information seems to be readily available via the webinterface (Groups and projects tab on the user's overview page in the admin area), I cannot find that information via the API.

The only way i currently found is, to iterate over all projects (resp. groups) and check whether the user is member thereof.

This strikes me as very slow (as their are probably zillions of projects), so I'm looking for a more direct way to query the system for all projects where user is member-of.

Also, the activity feed of each user seems to be clamped to the last 365 days. (which is probably good enough if you just want to display some nice activity graphs on the webpage). However, to get a list of fake users, i need to enlist users who have never shown any activity (apart from signing up).

Proposal

i'd like to be able to access the following information via the API:

  • list all projects/groups a user is a member of
  • get all activity of a user (not just the last year)
    • it would probably sufficient to get an "activity count" for the user (number of actions the user has performed), rather than the actual activities. so the db doesn't need to grow infinitely for very active long-standing users.

What does success look like, and how can we measure that?

if i can tell for each user, how active they've been since they've created their account.

Edited Aug 28, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading