---
source_url: https://www.pubnub.com/docs/chat/sdks/moderation/mute
title: Muting users (deprecated)
updated_at: 2026-06-04T11:09:38.070Z
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# Muting users (deprecated)

:::warning Use Chat SDKs
This documentation is deprecated. Use any of our dedicated [Chat SDKs](https://www.pubnub.com/docs/chat/overview) to quickly implement chat functionality in your application.
:::

[Access Manager](https://www.pubnub.com/docs/general/security/access-control) enables you to manage access for individual users so they can be muted on specific channels.

## Mute user in channels

To mute `user-1` in specific channels, call the grant token method and request only `read` permissions on these channels.

### Node.js

```javascript
pubnub.grantToken(
  {
    ttl: 15,
    authorizedUserId: "user-1",
    resources: {
      spaces: {
        "channel-a": {
          read: true
        },
        "channel-b": {
          read: true
        }
      }
    }
  }, function(status, token) {
    console.log(token);
  }
);
```

### Python

```python
spaces = [
    Space.id("channel-a").read(),
    Space.id("channel-b").read()
    ]
envelope = pubnub.grant_token()
    .spaces(spaces)
    .ttl(15)
    .authorized_user("user-1")
    .sync()
```

### Java

```java
pubnub.grantToken()
    .ttl(15)
    .authorizedUserId("user-1")
        .spacesPermissions(Arrays.asList(
                SpacePermissions.id(SpaceId("channel-a")).read()
                SpacePermissions.id(SpaceId("channel-b")).read()))
    .async(result -> { /* check result */ });
```

### Kotlin

```kotlin
pubnub.grantToken(
    ttl = 15,
    authorizedUserId = "user-1",
    spacesPermissions = listOf(
        SpacesPermissions.name(name = "channel-a", read = true, write = false),
        SpacesPermissions.name(name = "channel-b", read = true, write = false)
    )
)
    .async { result, status ->
        if (status.error) {
            // Handle error
        } else {
            // Handle result
        }
    }
```