In a discussion titled ‘API - Add User to moderator group,’ sdiscourse seeks to add a user to the moderator group via API but encounters an ‘invalid_access’ error. pfaffman initially suggests the API key may not be properly passed, but sdiscourse confirms using an admin API key and notes that adding users to custom groups works fine. pfaffman clarifies that moderators aren’t managed via group membership — instead, the user’s ‘moderator’ field must be updated via the user API. sdiscourse attempts using the admin user/groups endpoint to assign group ID 2 (moderator) but receives an error: ‘You cannot modify an automatic group.’ codinghorror explains that moderators are not assigned through group editing, advising to use the admin UI’s Grant Moderation button and inspect the network requests via f12 to discover the correct API call. sdiscourse expresses gratitude for the solution, calling it ‘really cool’ and ‘awesome.’ The key takeaway is that moderation status must be granted via the user API or admin UI, not through group membership endpoints, as moderator is an automatic group that cannot be modified directly.
Wait. You just want to make a user a moderator? You just need to update the moderator field in the user record. It’s not really a group. That’s the problem.
You’d do this with the user API not the group API.
Group editing is not how you make someone a moderator. Look at the admin page for that user, press the Grant Moderation button, and watch the f12 console to see what requests were sent.