# Stream Feeds

Integrating moderation in Activity Feeds is straightforward and requires minimal code changes. Once you configure a moderation policy, Stream automatically moderates activities and comments as they are created or updated. This guide walks you through setting up moderation and monitoring flagged content.

## Configure Moderation Policy

A moderation policy defines how content should be moderated. You can configure your [policy](https://getstream.io/moderation/docs/dotnet-csharp/configuration/policies/) through the [dashboard](https://getstream.io/signin/?product=moderation) or via the API. Activity and comment `custom` is included in the moderation payload, so [content custom-property rules](https://getstream.io/moderation/docs/dotnet-csharp/configuration/rules/#custom-properties-stream-chat-and-feeds-only) match Feeds the same way they match Chat.

For Feeds v3, Stream picks a policy in this order:

1. `feed.custom.moderation_policy` -- if that exact config exists
2. `feeds:{group_id}:{feed_id}` -- individual feed
3. `feeds:{group_id}` -- feed group
4. `feeds` -- app-wide default

If `custom.moderation_policy` is missing, empty, or names a config that does not exist, Stream continues with the `feeds:...` keys. Activity or comment `custom.moderation_policy` is ignored for this assignment.

To set up an app-wide policy for all feeds content:

```csharp label="C#"
await client.UpsertConfigAsync(new UpsertConfigRequest
{
    Key = "feeds",
    AiTextConfig = new AITextConfig
    {
        Rules = new List<BodyguardRule>
        {
            new BodyguardRule { Label = "SPAM", Action = "flag" },
            new BodyguardRule { Label = "HATRED", Action = "remove" },
        },
    },
    BlockListConfig = new BlockListConfig
    {
        Rules = new List<BlockListRule>
        {
            new() { Name = "profanity_en", Action = "remove" },
        },
    },
    AiImageConfig = new AIImageConfig
    {
        Rules = new List<AWSRekognitionRule>
        {
            new() { Label = "Non-Explicit Nudity", Action = "flag" },
        },
    },
});
```

You can also configure policies per feed group (e.g., `feeds:user` for user feeds, `feeds:timeline` for timeline feeds) to apply different moderation rules to different feed types.

### Assign a named policy to a feed

To share one policy across many feeds without cloning feed groups, upsert a config under any key (for example `pm:acme`) and set that key on each feed. The field is writable on create and update.

```csharp label="C#"
await feed.UpdateAsync(new UpdateFeedRequest
{
    Custom = new Dictionary<string, object> { ["moderation_policy"] = "pm:acme" },
});
```

## Auto-Moderation on Activities

Once the policy is configured, activities are automatically moderated when created or updated. No additional code is needed -- just add activities as you normally would.

Server-side requests skip moderation by default. Set `force_moderation: true` to moderate an activity or comment created from your backend.

>
> **Warning:** `force_moderation` is **server-side only** and ignored when sent from a client-side SDK.
>

When an activity contains content that violates your policy, Stream takes the configured action:

- **remove** -- the activity is removed and appears in the review queue
- **flag** -- the activity is published but flagged for review
- **bounce** -- the activity is rejected entirely and not saved
- **shadow** -- the activity is hidden from other users but visible to the creator
- **mask_flag** (blocklists only) -- blocklisted words in the text are replaced with asterisks, and the activity is published and flagged for review. See [Mask Sensitive Content](https://getstream.io/moderation/docs/dotnet-csharp/content-moderation/actions/#mask)
- **mask** (blocklists only) -- blocklisted words in the text are replaced with asterisks, without flagging

The API response includes a `moderation` object with details about the action taken:

```json
{
  "id": "activity-123",
  "type": "post",
  "text": "the activity text",
  "moderation": {
    "action": "remove",
    "original_text": "the activity text",
    "text_harms": ["HATRED"],
    "blocklists_matched": ["profanity_en"]
  }
}
```

Feeds returns `ModerationV2Response`. It does not include `status` or `recommended_action`.

| Field                | Type     | Description                                                                                          |
| -------------------- | -------- | ---------------------------------------------------------------------------------------------------- |
| `action`             | string   | `keep`, `flag`, `remove`, `shadow`, `bounce`, `bounce_flag`, `bounce_remove`, `mask`, or `mask_flag` |
| `original_text`      | string   | Text before masking                                                                                  |
| `text_harms`         | string[] | NLP or LLM labels, such as `HATRED` or `SPAM`                                                        |
| `image_harms`        | string[] | Image labels, such as `Explicit`                                                                     |
| `blocklists_matched` | string[] | Blocklists that matched                                                                              |

## Auto-Moderation on Comments

Comments are also automatically moderated using the same policy. When a user adds a comment, Stream checks the content and applies the configured action.

If a comment is removed, other users do not see it. The response includes the moderation action:

```json
{
  "id": "comment-789",
  "text": "...",
  "moderation": {
    "action": "remove",
    "original_text": "...",
    "text_harms": ["HATRED"]
  }
}
```

>
> **Info:** Reactions (likes, etc.) are not auto-moderated, only activities and comments.
>

## Policy keys

Feeds looks up `feeds:{group}` and `feeds:{group}:{id}`. Set `custom.moderation_policy` on a feed to name an exact policy instead. Poll text uses `polls:default`.

## User-Driven Actions

In addition to automated moderation, users can flag content or other users for review.

### Flag a User

```csharp label="C#"
await client.FlagAsync(new FlagRequest
{
    EntityType = "stream:user",
    EntityID = targetUserID,
    Reason = "harassment",
    UserID = reportingUserID,
});
```

### Ban a User

```csharp label="C#"
await client.BanAsync(new BanRequest
{
    TargetUserID = targetUserID,
    BannedByID = moderatorId,
    Reason = "Repeated violations",
});
```

Banned users are prevented from reading feeds and creating activities or reactions.

---

For the most recent version of this documentation, visit [https://getstream.io/moderation/docs/dotnet-csharp/integrations/stream-feeds/](https://getstream.io/moderation/docs/dotnet-csharp/integrations/stream-feeds/).