Groups API: Using User IDs instead of Usernames?

Hello everyone,

I’m currently working with the Discourse API, specifically with the groups endpoints. I’ve noticed something that I’d like to get your opinion on.

The Problem

For adding and removing users from groups, I’m using:

  • POST /groups/{id}/members.json for adding
  • DELETE /groups/{id}/members.json for removing

According to the documentation, both endpoints expect usernames in the request body (as the usernames parameter). This means when I only have User IDs, I first need to make an additional API call to GET /admin/users/{id}.json for each ID to retrieve the corresponding username.

The Question

Is there a way to use User IDs directly instead of usernames? This would save me an additional API call per user and significantly improve performance, especially for larger batch operations.

Background

I’m working on an application that frequently needs to manage larger groups of users based on their IDs. The additional step of fetching usernames makes the process considerably slower and more complex.

Thank you for your help!

API Version Used: Discourse API v2