# Automate user invitation in Vaultwarden for AD users, seeking API assistance

**URL:** <https://vaultwarden.discourse.group/t/automate-user-invitation-in-vaultwarden-for-ad-users-seeking-api-assistance/2874>\
**Category:** Help\
**Created:** [August 25, 2023, 8:34am UTC](https://vaultwarden.discourse.group/t/automate-user-invitation-in-vaultwarden-for-ad-users-seeking-api-assistance/2874 "2023-08-25T08:34:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![RoninJaeger](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@RoninJaeger](https://vaultwarden.discourse.group/u/RoninJaeger)\
**Post date:** [August 25, 2023, 8:34am UTC](https://vaultwarden.discourse.group/t/automate-user-invitation-in-vaultwarden-for-ad-users-seeking-api-assistance/2874/1 "2023-08-25T08:34:22Z")

</div>

Hey,

I use Vaultwarden and Active Directory in a larger organization.

I want to write a PS1 script that connects to Vaultwarden and checks whether a user from AD is also created in Vaultwarden. If the user is not created in Vaultwarden, the script should send an invitation via email to an organization. The script will be automated, so I will have less manual work finding the email of a user in AD and inviting them to Vaultwarden. This will reduce the time spent on invitations, allowing more time for other workloads. 😊

I already tried to find the API using the Bitwarden CLI, but that did not work. I also attempted to locate it using the developer console (F12), but that also failed. Is there any way to invite users to an organization using a function? Alternatively, how can I find the required API?

Thank you for any assistance. \<3

---

<div class="post-metadata">

**Author:** ![BlackDex](https://yyz2.discourse-cdn.com/free1/user_avatar/vaultwarden.discourse.group/blackdex/32/8_2.png) [@BlackDex](https://vaultwarden.discourse.group/u/BlackDex)\
**Post date:** [August 25, 2023, 9:04am UTC](https://vaultwarden.discourse.group/t/automate-user-invitation-in-vaultwarden-for-ad-users-seeking-api-assistance/2874/2 "2023-08-25T09:04:17Z")

</div>

Maybe you should take a look at: [About Directory Connector | Bitwarden Help Center](https://bitwarden.com/help/directory-sync/)

---

<div class="post-metadata">

**Author:** ![RoninJaeger](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@RoninJaeger](https://vaultwarden.discourse.group/u/RoninJaeger)\
**Post date:** [September 8, 2023, 8:48am UTC](https://vaultwarden.discourse.group/t/automate-user-invitation-in-vaultwarden-for-ad-users-seeking-api-assistance/2874/3 "2023-09-08T08:48:16Z")

</div>

Hello again 🙂

I use “Directory Connecter” and it works fine so far. ( Sync with AD and thx for your previos help!)

How can I make it so that the user is also added to a collection directly after the sync, without having to do this manually?  
For this I noticed in the json file that there is an item called “collections” and the question is what should I enter there?

Many Thanks in Advance

---

<div class="post-metadata">

**Author:** ![BlackDex](https://yyz2.discourse-cdn.com/free1/user_avatar/vaultwarden.discourse.group/blackdex/32/8_2.png) [@BlackDex](https://vaultwarden.discourse.group/u/BlackDex)\
**Post date:** [September 8, 2023, 12:18pm UTC](https://vaultwarden.discourse.group/t/automate-user-invitation-in-vaultwarden-for-ad-users-seeking-api-assistance/2874/4 "2023-09-08T12:18:43Z")

</div>

Create groups and link those groups to collection, and link those users to the correct groups.

---

<div class="post-metadata">

**Author:** ![RoninJaeger](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@RoninJaeger](https://vaultwarden.discourse.group/u/RoninJaeger)\
**Post date:** [September 15, 2023, 5:19am UTC](https://vaultwarden.discourse.group/t/automate-user-invitation-in-vaultwarden-for-ad-users-seeking-api-assistance/2874/5 "2023-09-15T05:19:32Z")

</div>

Good Morning,

so I really searched for how to create groups etc., but I cant find how i can do these things. Could you elaborate on how to do it?

Thanks again 🙂

---

<div class="post-metadata">

**Author:** ![BlackDex](https://yyz2.discourse-cdn.com/free1/user_avatar/vaultwarden.discourse.group/blackdex/32/8_2.png) [@BlackDex](https://vaultwarden.discourse.group/u/BlackDex)\
**Post date:** [September 15, 2023, 6:24am UTC](https://vaultwarden.discourse.group/t/automate-user-invitation-in-vaultwarden-for-ad-users-seeking-api-assistance/2874/6 "2023-09-15T06:24:58Z")

</div>

See [Sync with Active Directory or LDAP | Bitwarden Help Center](https://bitwarden.com/help/ldap-directory/) it explains how to configure the tool including how to sync the groups.

---

<div class="post-metadata">

**Author:** ![stefan0xC](https://yyz2.discourse-cdn.com/free1/user_avatar/vaultwarden.discourse.group/stefan0xc/32/1765_2.png) [@stefan0xC](https://vaultwarden.discourse.group/u/stefan0xC)\
**Post date:** [September 15, 2023, 6:57am UTC](https://vaultwarden.discourse.group/t/automate-user-invitation-in-vaultwarden-for-ad-users-seeking-api-assistance/2874/7 "2023-09-15T06:57:52Z")

</div>

In Vaultwarden you also have to set [`ORG_GROUPS_ENABLED=true`](https://github.com/dani-garcia/vaultwarden/blob/bbd630f1ee8f1f223a075a7d4b424e16cd10e6d9/.env.template#L104-L109) to enable the groups feature.
