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

# Leave Group

> Remove the instance from the specified group

**Auth:** `TokenAccount` or `TokenInstance` • **Rate-limit:** `Global` (100/min) • **Idempotent:** yes (leaving a group you have already left returns 404)

## Description

Makes the instance leave a group. The identifier goes in the **query string** (not in the body) since this is a `DELETE`.

## Examples

### Leave (by JID)

Removes the instance from the group `120363406289005073@g.us` by passing the JID in the query string. This is the most direct format when you already have the JID at hand.

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

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

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

  requests.delete(
      f"https://ryzeapi.cloud/api/group/leave/{os.environ['Instance_Name']}?identifier=120363406289005073@g.us",
      headers={
          "token": os.environ["Token_Instance"]
      }
  )
  ```

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

  import (
      "net/http"
      "os"
  )

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

### Leave (by link)

Leaves the group by passing the invite link (`https://chat.whatsapp.com/ABC123XYZ`) in `identifier`. The service extracts the code, resolves the JID, and performs the leave.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X DELETE -G "https://ryzeapi.cloud/api/group/leave/$Instance_Name" \
    --data-urlencode "identifier=https://chat.whatsapp.com/ABC123XYZ" \
    -H "token: $Token_Instance"
  ```

  ```javascript JavaScript theme={null}
  const url = new URL(`https://ryzeapi.cloud/api/group/leave/${process.env.Instance_Name}`);
  url.searchParams.set("identifier", "https://chat.whatsapp.com/ABC123XYZ");

  await fetch(url, {
    method: "DELETE",
    headers: {
      "token": process.env.Token_Instance
    }
  });
  ```

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

  requests.delete(
      f"https://ryzeapi.cloud/api/group/leave/{os.environ['Instance_Name']}",
      headers={
          "token": os.environ["Token_Instance"]
      },
      params={
          "identifier": "https://chat.whatsapp.com/ABC123XYZ"
      }
  )
  ```

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

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

  func main() {
      q := url.Values{}
      q.Set("identifier", "https://chat.whatsapp.com/ABC123XYZ")
      req, _ := http.NewRequest("DELETE", "https://ryzeapi.cloud/api/group/leave/"+os.Getenv("Instance_Name")+"?"+q.Encode(), nil)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

## Success response

Confirms the leave by returning the `groupJid` of the group you left. Leaving a community (parent group) also unlinks the instance from the subgroups linked through that community. To return to the group, you will need a new invite.

```json 200 OK theme={null}
{
  "success": true,
  "message": "Successfully left the group",
  "groupJid": "120363406289005073@g.us"
}
```

## 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="identifier" type="string" required>
  Group JID, invite code, or link.
</ParamField>

## Notes

<Note>
  * Leaving a community (parent group) also unlinks the instance from the subgroups linked through that community.
  * To return to the group, you must obtain a new invite.
</Note>

## Errors

| HTTP | Message                                                 |
| ---- | ------------------------------------------------------- |
| 400  | `Identifier is required`                                |
| 403  | `Not allowed to leave this group`                       |
| 404  | `Group not found or you are not a member of this group` |

Envelope:

```json theme={null}
{
  "success": false,
  "error": { "message": "Group not found or you are not a member of this group" }
}
```
