# Can I update (add to) "allowed\_users" of a topic via an API call?

**URL:** <https://meta.discourse.org/t/can-i-update-add-to-allowed-users-of-a-topic-via-an-api-call/67356>\
**Category:** Development\
**Created:** [2017年八月3日 02:48 UTC](https://meta.discourse.org/t/can-i-update-add-to-allowed-users-of-a-topic-via-an-api-call/67356 "2017-08-03T02:48:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mtwomey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mtwomey/32/120809_2.png) [@mtwomey](https://meta.discourse.org/u/mtwomey)\
**Post date:** [2017年八月3日 02:48 UTC](https://meta.discourse.org/t/can-i-update-add-to-allowed-users-of-a-topic-via-an-api-call/67356/1 "2017-08-03T02:48:53Z")

</div>

I’d like to be able to add users to “allowed\_users” of a topic. When I retrieve a topic, one section is details.allowed\_users. Is there a way to add additional users here with a PUT?

---

<div class="post-metadata">

**Author:** ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)\
**Post date:** [2017年八月3日 10:56 UTC](https://meta.discourse.org/t/can-i-update-add-to-allowed-users-of-a-topic-via-an-api-call/67356/2 "2017-08-03T10:56:48Z")

</div>

Yes you can.

> <https://github.com/discourse/discourse/blob/main/spec/models/topic_spec.rb#L495-L496>

As per above code I am sure by inviting you can add any user to `allowed_users` list.

---

<div class="post-metadata">

**Author:** ![mtwomey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mtwomey/32/120809_2.png) [@mtwomey](https://meta.discourse.org/u/mtwomey)\
**Post date:** [2017年八月3日 17:38 UTC](https://meta.discourse.org/t/can-i-update-add-to-allowed-users-of-a-topic-via-an-api-call/67356/3 "2017-08-03T17:38:58Z")

</div>

I apologize, my ruby experience is fairly limited - can you give me a pointer on how to infer the needed API call to do that? Not asking anyone to do it for me, but maybe a pointer?

---

<div class="post-metadata">

**Author:** ![mtwomey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mtwomey/32/120809_2.png) [@mtwomey](https://meta.discourse.org/u/mtwomey)\
**Post date:** [2017年八月7日 22:04 UTC](https://meta.discourse.org/t/can-i-update-add-to-allowed-users-of-a-topic-via-an-api-call/67356/4 "2017-08-07T22:04:22Z")

</div>

_bump_ Anyone know if this is possible via the existing API?

---

<div class="post-metadata">

**Author:** ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)\
**Post date:** [2017年八月7日 23:58 UTC](https://meta.discourse.org/t/can-i-update-add-to-allowed-users-of-a-topic-via-an-api-call/67356/5 "2017-08-07T23:58:04Z")

</div>

You can use this endpoint to [invite a user to a topic](http://docs.discourse.org/#tag/Topics%2Fpaths%2F~1t~1%7Bid%7D~1invite%2Fpost).

```
POST https://discourse.example.com/t/{id}/invite
BODY "username": "string"

```

If you are using the ruby discourse\_api gem you can use this method: `invite_user_to_topic`

> <https://github.com/discourse/discourse_api/blob/main/examples/invite_users.rb#L12>
