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

> Cancels the account's subscription to a newsletter

**Auth:** `TokenAccount` or `TokenInstance` • **Rate-limit:** `Global` (100/min) • **Idempotent:** partial (leaving a newsletter you don't follow may return `not found`)

## Description

Cancels the subscription (unfollow). Future messages stop arriving and the newsletter disappears from [`GET /list`](/en/api/newsletter/list). The identifier is passed as a **query string** (not in the body), since this is a `DELETE`.

## Examples

### By JID

Cancels the subscription by passing the canonical newsletter JID through the query string. Future messages stop arriving and the newsletter disappears from `GET /list`.

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

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

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

  requests.delete(
      f"https://ryzeapi.cloud/api/newsletter/leave/{os.environ['Instance_Name']}",
      params={"identifier": "120363422585881117@newsletter"},
      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/newsletter/leave/"+os.Getenv("Instance_Name")+"?identifier=120363422585881117@newsletter", nil)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

### By link

Cancels the subscription by passing the full invite link. The server extracts the code, resolves the JID and runs the unfollow.

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

  ```javascript JavaScript theme={null}
  const params = new URLSearchParams({ identifier: "https://whatsapp.com/channel/120363422585881117" });
  await fetch(`https://ryzeapi.cloud/api/newsletter/leave/${process.env.Instance_Name}?${params}`, {
    method: "DELETE",
    headers: {
      "token": process.env.Token_Instance
    }
  });
  ```

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

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

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

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

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

### By code

Cancels the subscription by passing only the invite code. Same as the link, without the domain prefix.

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

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

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

  requests.delete(
      f"https://ryzeapi.cloud/api/newsletter/leave/{os.environ['Instance_Name']}",
      params={"identifier": "120363422585881117"},
      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/newsletter/leave/"+os.Getenv("Instance_Name")+"?identifier=120363422585881117", nil)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

## Success response

The response returns the canonical newsletter JID in `channelJid` (resolved from the `identifier` passed in the query, even if it was a link or code). After this return, the newsletter is removed from [`/list`](/en/api/newsletter/list) and future messages stop arriving.

```json 200 OK theme={null}
{
  "success": true,
  "message": "Successfully left newsletter",
  "channelJid": "120363422585881117@newsletter"
}
```

## 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>
  `@newsletter` JID, full link or invite code.
</ParamField>

## Notes

<Note>
  * If you are the **owner / admin** of the newsletter, `leave` only unsubscribes you, the newsletter keeps existing. To delete the newsletter, use the official WhatsApp interface.
  * `DELETE` without a body is the convention; a JSON body is ignored.
  * There is no dedicated "unfollowed" event on the webhook; newsletter messages simply stop arriving.
</Note>

## Errors

| HTTP | Message                                                                              |
| ---- | ------------------------------------------------------------------------------------ |
| 400  | `The 'identifier' query parameter is required (JID @newsletter or invite link/code)` |
| 400  | `Invalid newsletter identifier (use JID @newsletter or invite link/code)`            |
| 500  | `failed to leave newsletter: <reason>`                                               |
| 501  | `WhatsApp client does not support UnfollowNewsletter`                                |

Envelope:

```json theme={null}
{
  "success": false,
  "error": { "message": "Invalid newsletter identifier (use JID @newsletter or invite link/code)" }
}
```

## Next

<CardGroup cols={2}>
  <Card title="List newsletters" icon="list" href="/en/api/newsletter/list">
    Confirm that the newsletter was removed.
  </Card>

  <Card title="Join again" icon="plus" href="/en/api/newsletter/join">
    Subscribe to another newsletter.
  </Card>
</CardGroup>
