# Add a group / Exclude a group from the community

To connect a group to a community, you will need to know the Community ID, as well as the ID of the group you want to connect.

You can get the community ID using endpoint `GET https://gate.whapi.cloud/communities`:

{% embed url="<https://whapi.readme.io/reference/getcommunities>" %}
This method is responsible for get a communities
{% endembed %}

To get the group identifier, use endpoint `GET https://gate.whapi.cloud/groups`:

{% embed url="<https://whapi.readme.io/reference/getgroups>" %}

To add a group to the community, use endpoint&#x20;

`PUT https://gate.whapi.cloud/communities/{CommunityID}/{GroupID}`:

{% embed url="<https://whapi.readme.io/reference/linkgrouptocommunity>" %}
This method is responsible for link group to community
{% endembed %}

To exclude a group from the community, you need endpoint&#x20;

`DELETE https://gate.whapi.cloud/communities/{CommunityID}/{GroupID}`:

{% embed url="<https://whapi.readme.io/reference/unlinkgroupfromcommunity>" %}
This method is responsible for unlink group from community
{% endembed %}

To get a list of groups already connected to the community use the “Get community subgroups” endpoint:

{% embed url="<https://whapi.readme.io/reference/getcommunitysubgroups>" %}
This method is responsible for get a community subgroups
{% endembed %}
