# Cannot fathom the API for adding and removing group owners

**URL:** https://meta.discourse.org/t/cannot-fathom-the-api-for-adding-and-removing-group-owners/379454
**Category:** Support
**Tags:** rest-api
**Created:** [August 20, 2025, 11:55am UTC](https://meta.discourse.org/t/cannot-fathom-the-api-for-adding-and-removing-group-owners/379454 "2025-08-20T11:55:27Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Nikki\_Locke](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nikki_locke/32/146184_2.png) [@Nikki\_Locke](https://meta.discourse.org/u/Nikki_Locke)
#### Post date: [August 20, 2025, 11:55am UTC](https://meta.discourse.org/t/cannot-fathom-the-api-for-adding-and-removing-group-owners/379454/1 "2025-08-20T11:55:28Z")

</div>

I wish to add and remove group owners using the API. This is not documented in the api docs.

Tracing the calls while logged in as admin, make user owner is

PUT `groups/<gid>/owners` with a payload of `usernames=nikkilocke`(note no admin!)

Remove user from owners is

DELETE `admin/groups/<gid>/owners` with a payload of `user_id=<uid>`

Studying the source code shows:

```plaintext

      def group_add_owners(group_id, args)
        args = API.params(args).required(:usernames).to_h
        put("/admin/groups/#{group_id}/owners.json", group: args)
      end

      def group_remove_owners(group_id, args)
        args = API.params(args).required(:usernames).to_h
        delete("/admin/groups/#{group_id}/owners.json", group: args)
      end

```

and this code doesn’t seem to have changed since 2023.

I am running Discourse 3.4.7, and the add owners entry point in the source code gives a 404 error.

Urls I have tried:

`PUT /groups/384/owners usernames=nikkilocke` OK

`PUT /admin/groups/384/owners group[usernames]=nikkilocke` 404 error

`DEL /admin/groups/384/owners group[usernames]=nikkilocke` OK

`DEL /admin/groups/384/owners user_id = 12` OK

Can anyone advise me what’s going on, and which urls to use for this, please?

---

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [August 20, 2025, 12:05pm UTC](https://meta.discourse.org/t/cannot-fathom-the-api-for-adding-and-removing-group-owners/379454/2 "2025-08-20T12:05:38Z")

</div>

> [@Nikki\_Locke](#):
>
> goup

I assume that that’s a typo and not the cause of your error?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [August 20, 2025, 12:48pm UTC](https://meta.discourse.org/t/cannot-fathom-the-api-for-adding-and-removing-group-owners/379454/3 "2025-08-20T12:48:35Z")

</div>

> [@Nikki\_Locke](#):
>
> I wish to add and remove group owners using the API. This is not documented in the api docs.

The best and surest documentation for the API is [Reverse engineer the Discourse API](https://meta.discourse.org/t/reverse-engineer-the-discourse-api/20576)

> [@Nikki\_Locke](#):
>
> the add owners entry point in the source code gives a 404 error.

Are you sure that you have a valid API key and that you are passing it correctly? A 404 error is expected if you are not properly authenticated.

Are you able to do any requests that require authorization?

---

<div class="post-metadata">

### Author: ![Nikki\_Locke](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nikki_locke/32/146184_2.png) [@Nikki\_Locke](https://meta.discourse.org/u/Nikki_Locke)
#### Post date: [August 20, 2025, 3:36pm UTC](https://meta.discourse.org/t/cannot-fathom-the-api-for-adding-and-removing-group-owners/379454/4 "2025-08-20T15:36:37Z")

</div>

As I said in the original post, 3 out of the 4 possibilities work fine (with the same API key).

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [August 20, 2025, 3:54pm UTC](https://meta.discourse.org/t/cannot-fathom-the-api-for-adding-and-removing-group-owners/379454/5 "2025-08-20T15:54:25Z")

</div>

> [@Nikki\_Locke](#):
>
> As I said in the original post, 3 out of the 4 possibilities work fine

Ah. Sorry. The “OK” at the end of the line was somehow too subtle for me to follow.

When I add an owner, I see this PUT request `https://example.com/groups/75/owners.json` with `usernames= pfaffman123` in the form data.

Did you follow the reverse engineering steps I linked to?

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [September 23, 2025, 1:58pm UTC](https://meta.discourse.org/t/cannot-fathom-the-api-for-adding-and-removing-group-owners/379454/6 "2025-09-23T13:58:29Z")

</div>

@Nikki_Locke were you able to resolve your issue?

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [September 29, 2025, 3:01pm UTC](https://meta.discourse.org/t/cannot-fathom-the-api-for-adding-and-removing-group-owners/379454/7 "2025-09-29T15:01:15Z")

</div>

This topic was automatically closed after 6 days. New replies are no longer allowed.
