# Add a user to a group via API?

**URL:** <https://meta.discourse.org/t/add-a-user-to-a-group-via-api/45077>\
**Category:** Development\
**Tags:** rest-api\
**Created:** [June 1, 2016, 9:42am UTC](https://meta.discourse.org/t/add-a-user-to-a-group-via-api/45077 "2016-06-01T09:42:55Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![jefflau](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jefflau/32/121720_2.png) [@jefflau](https://meta.discourse.org/u/jefflau)\
**Post date:** [June 1, 2016, 9:42am UTC](https://meta.discourse.org/t/add-a-user-to-a-group-via-api/45077/1 "2016-06-01T09:42:55Z")

</div>

I’m trying to use the Discourse API to update a group with a particular user. In the docs that I have found, there wasn’t any information on this, only the ability to create a group.

I also tried to watch the XHR request when I’m actually updating a group on discourse with another user. The API seems to be calling this URL: `groups/[group_name]/members.json`, which I can call with a `GET` and get back the group info, but I get an error when I tried to `PUT` with the `usernames` parameter.

```plaintext
{
  "errors": [
    "You are not permitted to view the requested resource."
  ],
  "error_type": "invalid_access"
}

```

Any advice on how I can get around this? I have put my API key and username as a query as per the API documentation instructions.

Thanks.

---

_[View the full topic](https://meta.discourse.org/t/add-a-user-to-a-group-via-api/45077)._
