# 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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.whapi.cloud/help-desk/communities/add-a-group-exclude-a-group-from-the-community.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
