> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wadial.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Groups and communities

> Create groups, manage participants, handle invites, approve join requests, and administer communities.

Groups and communities require a paired, connected token. Group JIDs end in `@g.us`.

## List and inspect groups

```http theme={null}
GET /api/v1/sessions/{sessionId}/groups
Authorization: Bearer <api_key>
```

```http theme={null}
GET /api/v1/sessions/{sessionId}/groups/{groupJid}
Authorization: Bearer <api_key>
```

The response includes the group subject, participants, admin flags, invite settings, disappearing-message settings, and community flags.

## Create and update groups

```http theme={null}
POST /api/v1/sessions/{sessionId}/groups
Authorization: Bearer <api_key>
Content-Type: application/json
```

```json theme={null}
{
  "subject": "Customer updates",
  "participants": ["15551234567@s.whatsapp.net"],
  "description": "Order and delivery updates"
}
```

Update the name or description:

```http theme={null}
PATCH /api/v1/sessions/{sessionId}/groups/{groupJid}/profile
Authorization: Bearer <api_key>
Content-Type: application/json
```

```json theme={null}
{
  "subject": "Priority customers",
  "description": "High-priority support updates"
}
```

## Participants and settings

Use participant actions to add, remove, promote, or demote members:

```http theme={null}
POST /api/v1/sessions/{sessionId}/groups/{groupJid}/participants
Authorization: Bearer <api_key>
Content-Type: application/json
```

```json theme={null}
{
  "action": "add",
  "participants": ["15551234567@s.whatsapp.net"]
}
```

Use settings to control announcement mode, admin-only editing, membership approval, invite sharing, and disappearing-message duration:

```http theme={null}
PATCH /api/v1/sessions/{sessionId}/groups/{groupJid}/settings
Authorization: Bearer <api_key>
Content-Type: application/json
```

```json theme={null}
{
  "setting": "announcement",
  "enabled": true
}
```

```json theme={null}
{
  "ephemeralDurationSeconds": 604800
}
```

## Invites and membership requests

Preview or join with an invite code:

```http theme={null}
POST /api/v1/sessions/{sessionId}/groups/invite/preview
POST /api/v1/sessions/{sessionId}/groups/join
Authorization: Bearer <api_key>
Content-Type: application/json
```

```json theme={null}
{
  "code": "AbCdEfGhIjK"
}
```

Admin tokens can fetch or rotate a group invite code:

```http theme={null}
GET /api/v1/sessions/{sessionId}/groups/{groupJid}/invite-code
POST /api/v1/sessions/{sessionId}/groups/{groupJid}/invite/revoke
Authorization: Bearer <api_key>
```

For groups that require approval:

```http theme={null}
GET /api/v1/sessions/{sessionId}/groups/{groupJid}/membership-requests
POST /api/v1/sessions/{sessionId}/groups/{groupJid}/membership-requests
Authorization: Bearer <api_key>
Content-Type: application/json
```

```json theme={null}
{
  "action": "approve",
  "participants": ["15551234567@s.whatsapp.net"]
}
```

## Communities

Create a community:

```http theme={null}
POST /api/v1/sessions/{sessionId}/communities
Authorization: Bearer <api_key>
Content-Type: application/json
```

```json theme={null}
{
  "subject": "Customer community",
  "description": "Product announcements and support",
  "membershipApprovalMode": "request_required"
}
```

Link, unlink, or join subgroups:

```http theme={null}
POST /api/v1/sessions/{sessionId}/communities/{communityJid}/subgroups
Authorization: Bearer <api_key>
Content-Type: application/json
```

```json theme={null}
{
  "action": "link",
  "subGroupJids": ["120363000000000001@g.us"]
}
```

Community endpoints also support listing subgroups, listing merged participants, transferring ownership, fetching subgroup suggestions, and deactivating a community.
