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

# Overview

> Create and manage communities (parent groups) via /api/community/*

**Auth:** `TokenAccount` or `TokenInstance` on every route. Each call validates the instance ownership.

Communities are WhatsApp "parent groups" that bundle other groups as subgroups. This section covers the `/api/community/*` routes for creating, linking, unlinking, and listing subgroups. For regular groups, see [Groups](/en/api/groups/overview).

## Endpoints

| Method | Path                                     | Function                                             |
| ------ | ---------------------------------------- | ---------------------------------------------------- |
| POST   | `/api/community/create/:instance`        | [Create community](/en/api/communities/create)       |
| POST   | `/api/community/link/:instance`          | [Link groups to community](/en/api/communities/link) |
| POST   | `/api/community/unlink/:instance`        | [Unlink groups](/en/api/communities/unlink)          |
| GET    | `/api/community/listSubGroups/:instance` | [List subgroups](/en/api/communities/list-subgroups) |

## How it works

A WhatsApp community is composed of:

* **Parent group** (the community itself), where you manage everything
* **Announcements group**, created automatically. Only admins post, but every member of the subgroups receives the messages
* **Subgroups**, regular groups linked to the community

<Note>
  Each group belongs to **at most one community** at a time. To move a group from one community to another, unlink first and then link to the destination.
</Note>

## Identifiers

* Most routes expect **JIDs `@g.us`** in `communityJid` and `groupJid`.
* `GET /listSubGroups` requires `?communityJid=` in the query string.

## Response shapes

### `/create` response

```json theme={null}
{
  "success": true,
  "message": "Community created successfully",
  "linkedGroups": ["120363406289005074@g.us"],
  "failedGroups": [],
  "imageError": null,
  "group": {
    "name": "Alpha Community",
    "jid": "120363406289005073@g.us",
    "isCommunity": true,
    "isParent": true,
    "linkedParentJid": null
  }
}
```

### `/link` and `/unlink` response

```json theme={null}
{
  "success": true,
  "message": "Linked 2 of 2 groups to community",
  "linked": ["120363406289005074@g.us", "120363406289005075@g.us"],
  "failed": []
}
```

<Warning>
  On the `/unlink` endpoint, the field is named `linked` but contains the JIDs **successfully unlinked** (shared DTO). Use the `message` (`"Unlinked N of M ..."`) to disambiguate.
</Warning>

### `/listSubGroups` response

```json theme={null}
{
  "success": true,
  "message": "2 subgroup(s) found",
  "communityJid": "120363406289005073@g.us",
  "subgroups": [
    { "jid": "120363406289005074@g.us", "name": "Announcements", "isDefaultSubGroup": true },
    { "jid": "120363406289005075@g.us", "name": "General", "isDefaultSubGroup": false }
  ]
}
```

`isDefaultSubGroup=true` indicates the community's default **Announcements group**.

## Error envelope

```json theme={null}
{
  "success": false,
  "error": { "message": "community jid is required" }
}
```

## Next

<CardGroup cols={2}>
  <Card title="Create community" icon="building" href="/en/api/communities/create">
    Create the parent group and link initial subgroups.
  </Card>

  <Card title="List subgroups" icon="list" href="/en/api/communities/list-subgroups">
    Return the linked groups.
  </Card>
</CardGroup>
