# 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:** [01.Июнь.2016 09:42:55 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:** 6

<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: [04.Июнь.2016 09:36:17 UTC](https://meta.discourse.org/t/add-a-user-to-a-group-via-api/45077/6 "2016-06-04T09:36:17Z")

</div>

Managed to figure it out, but I used a completely different method:

```js
addUserToGroup(userId, groupId){
    let url = `${this.url}admin/users/${userId}/groups`;
    let options = {
      params: {
        group_id: groupId
      },
      query: this.defaultQuery
    }
    return httpPromise('POST', url, options);
}

```

Uses post and uses a different url related to the user. Is there a difference to doing it one way or the other? I just couldn’t figure out what I was doing wrong with the other way.

Feel like someone should be keeping the API docs up to date. Shouldn’t have to go around fishing for what API calls work and what not!

---

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