> ## 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.

# List subgroups

> Returns groups linked to a community, including the Announcements group

**Auth:** `TokenAccount` or `TokenInstance` • **Rate-limit:** `Global` (100/min) • **Idempotent:** yes

## Description

Lists the subgroups of a community. The **Announcements group** is identified by the flag `isDefaultSubGroup: true`. Unlike the other endpoints, this route requires a **JID** in `?communityJid=` (it does not accept a code / link).

## Examples

### List subgroups

Queries the subgroups of the community `120363406289005073@g.us` by passing the full JID (with the `@g.us` suffix) in the query string.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://ryzeapi.cloud/api/community/listSubGroups/$Instance_Name?communityJid=120363406289005073@g.us" \
    -H "token: $Token_Instance"
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/community/listSubGroups/${process.env.Instance_Name}?communityJid=120363406289005073@g.us`, {
    method: "GET",
    headers: {
      "token": process.env.Token_Instance
    }
  });
  ```

  ```python Python theme={null}
  import os, requests

  requests.get(
      f"https://ryzeapi.cloud/api/community/listSubGroups/{os.environ['Instance_Name']}?communityJid=120363406289005073@g.us",
      headers={
          "token": os.environ["Token_Instance"]
      }
  )
  ```

  ```go Go theme={null}
  package main

  import (
      "net/http"
      "os"
  )

  func main() {
      req, _ := http.NewRequest("GET", "https://ryzeapi.cloud/api/community/listSubGroups/"+os.Getenv("Instance_Name")+"?communityJid=120363406289005073@g.us", nil)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

### Without the @g.us suffix

Same query, but passing only the numeric ID in `communityJid`. The service automatically appends `@g.us` before resolving the community.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://ryzeapi.cloud/api/community/listSubGroups/$Instance_Name?communityJid=120363406289005073" \
    -H "token: $Token_Instance"
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/community/listSubGroups/${process.env.Instance_Name}?communityJid=120363406289005073`, {
    method: "GET",
    headers: {
      "token": process.env.Token_Instance
    }
  });
  ```

  ```python Python theme={null}
  import os, requests

  requests.get(
      f"https://ryzeapi.cloud/api/community/listSubGroups/{os.environ['Instance_Name']}?communityJid=120363406289005073",
      headers={
          "token": os.environ["Token_Instance"]
      }
  )
  ```

  ```go Go theme={null}
  package main

  import (
      "net/http"
      "os"
  )

  func main() {
      req, _ := http.NewRequest("GET", "https://ryzeapi.cloud/api/community/listSubGroups/"+os.Getenv("Instance_Name")+"?communityJid=120363406289005073", nil)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

## Success response

Returns `communityJid` (already normalized with the `@g.us` suffix) and the `subgroups` array with each linked group the bot participates in. Each item carries `jid`, `name`, and the flag `isDefaultSubGroup` that identifies the community's **Announcements group**. The `message` carries the count (`"N subgroup(s) found"`) and the array comes empty when no subgroup is found.

```json 200 OK 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
    }
  ]
}
```

## Path parameters

<ParamField path="instance" type="string" required>
  Instance name.
</ParamField>

## Headers

<ParamField header="token" type="string" required>
  `TokenAccount` or `TokenInstance`.
</ParamField>

## Query

<ParamField query="communityJid" type="string" required>
  Community `@g.us` JID. If you omit the suffix, the service automatically appends `@g.us`.
</ParamField>

## Notes

<Note>
  * The listing **only returns subgroups the bot is in**, if the bot is in the parent only but not in subgroup X, X does not appear in the list.
  * Propagation of new links can take 1-3s, a `GET` right after `POST /link` may temporarily return the list without the freshly linked group.
  * The **Announcements group** always appears with `isDefaultSubGroup: true`. Filter on the client if you need to exclude it from the listing.
</Note>

## Errors

| HTTP | Message                                    |
| ---- | ------------------------------------------ |
| 400  | `communityJid query parameter is required` |
| 400  | `invalid community JID: <reason>`          |
| 400  | `Instance is not connected to WhatsApp`    |
| 500  | `failed to get groups: <reason>`           |

Envelope:

```json theme={null}
{
  "success": false,
  "error": { "message": "communityJid query parameter is required" }
}
```

## Next

<CardGroup cols={2}>
  <Card title="Link groups" icon="link" href="/en/api/communities/link">
    Add new subgroups.
  </Card>

  <Card title="Unlink groups" icon="link-slash" href="/en/api/communities/unlink">
    Remove subgroups from the community.
  </Card>
</CardGroup>
