Add rate limit to billable member delete API
What does this MR do and why?
Adds the members_delete rate limit to DELETE /groups/:id/billable_members/:user_id. This is the same limit that DELETE /groups/:id/members/:user_id already uses.
- The limit is scoped to the group and the current user. It's checked after the group lookup, so a group that doesn't exist or that the user can't see still returns
404. - A request over the limit returns
429 Too Many Requestswith aRetry-Afterheader, and the user isn't scheduled for removal. - Admins control the limit with the existing Members API rate limits setting (
members_delete_limit, 60 per minute by default). Both endpoints count toward it, so no new setting is needed. - SCIM deprovisioning and dormant member removal call
Members::ScheduleDeletionServicedirectly, not through this endpoint, so they aren't affected. - Docs: adds a note to the billable member API section, lists both endpoints on the rate limits page, and fixes the settings section name there to match the UI.
References
- Closes https://gitlab.com/gitlab-org/gitlab/-/work_items/638935
- The limit on the member delete endpoint was added in !118296 (merged) and made configurable in !140633 (merged).
Screenshots or screen recordings
Tested on a local GDK with Members API rate limits set to 1, so the second request in each pair is over the limit. The curl output is filtered to the status line, Retry-After and the body.
Setup:
| Before | After |
|---|---|
![]() |
![]() |
The user from the rejected request isn't scheduled for removal:
New specs:
How to set up and validate locally
-
In Admin > Settings > Network, expand Members API rate limits, set the limit to
1, and save. -
As the owner of a top-level group, remove two different users in a row:
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" \ --url "http://127.0.0.1:3000/api/v4/groups/<group_id>/billable_members/<user_id>" -
The first request returns
204. The second returns429withRetry-After: 60, and that user isn't scheduled for removal. -
Set the limit back to
60.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.




