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

# Unlink groups

> Remove groups from a community. The groups continue to exist as independent groups

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

## Description

Unlinks groups from a community. The groups **are not deleted**, they simply become independent again (no `linkedParentJid`). Same body and response as `/link` (shared DTO).

<Warning>
  The `linked` field in the response contains the JIDs **successfully unlinked** (because of the reuse of the `CommunityLinkResponse` DTO). The `message` (`"Unlinked N of M ..."`) confirms the semantics.
</Warning>

## Examples

### Unlink groups

Removes 2 subgroups from the community `120363406289005073@g.us`. The groups become independent again (no `linkedParentJid`) but continue to exist with their members.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/community/unlink/$Instance_Name" \
    -H "token: $Token_Instance" \
    -H "Content-Type: application/json" \
    -d '{
      "communityJid": "120363406289005073@g.us",
      "groupJid": [
        "120363406289005074@g.us",
        "120363406289005075@g.us"
      ]
    }'
  ```

  ```javascript JavaScript theme={null}
  await fetch(`https://ryzeapi.cloud/api/community/unlink/${process.env.Instance_Name}`, {
    method: "POST",
    headers: {
      "token":        process.env.Token_Instance,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      communityJid: "120363406289005073@g.us",
      groupJid: [
        "120363406289005074@g.us",
        "120363406289005075@g.us"
      ]
    })
  });
  ```

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

  requests.post(
      f"https://ryzeapi.cloud/api/community/unlink/{os.environ['Instance_Name']}",
      headers={
          "token":        os.environ["Token_Instance"],
          "Content-Type": "application/json"
      },
      json={
          "communityJid": "120363406289005073@g.us",
          "groupJid": [
              "120363406289005074@g.us",
              "120363406289005075@g.us"
          ]
      }
  )
  ```

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

  import (
      "net/http"
      "os"
      "strings"
  )

  func main() {
      body := strings.NewReader(`{
          "communityJid": "120363406289005073@g.us",
          "groupJid": [
              "120363406289005074@g.us",
              "120363406289005075@g.us"
          ]
      }`)
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/community/unlink/"+os.Getenv("Instance_Name"), body)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      req.Header.Set("Content-Type", "application/json")
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

## Success response

Confirms the unlink by returning the count in `message` (format `"Unlinked N of M groups from community"`). Because of the DTO shared with `/link`, the `linked` array here contains the JIDs **successfully unlinked**, and `failed` contains the ones that failed. `success` is `true` when at least one group was unlinked, even on partial success, always check `failed[]` to detect per-group errors.

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

## Path parameters

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

## Headers

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

<ParamField header="Content-Type" type="string" required>
  `application/json`
</ParamField>

## Request body

<ParamField body="communityJid" type="string" required>
  Community `@g.us` JID.
</ParamField>

<ParamField body="groupJid" type="string[]" required>
  JIDs of the groups to unlink. At least **1** item.
</ParamField>

## Notes

<Note>
  * The community's Announcements group **cannot be unlinked**, to remove the announcement group, you must delete the entire community (not exposed in this API).
  * The members of the groups stay where they were, only the parent-child relationship is removed.
  * To move a group between communities, unlink it here and use [`/link`](/en/api/communities/link) on the new one.
</Note>

## Errors

| HTTP | Message                                 |
| ---- | --------------------------------------- |
| 400  | `community jid is required`             |
| 400  | `group jid is required`                 |
| 400  | `Instance is not connected to WhatsApp` |
| 500  | `error parse community jid: <reason>`   |

Envelope:

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

## Next

<CardGroup cols={2}>
  <Card title="Link groups" icon="link" href="/en/api/communities/link">
    Reconnect to another community.
  </Card>

  <Card title="List subgroups" icon="list" href="/en/api/communities/list-subgroups">
    Confirm the group has been removed.
  </Card>
</CardGroup>
