# Getting Started

Stream's Moderation API lets you integrate content moderation into any application. This guide walks you through installation, configuration, and your first moderation check.

## Installation

```bash
dotnet add package GetStream
```

## Initialize the Client

```csharp
using GetStream;

var client = ClientBuilder
    .ApiKey("YOUR_API_KEY")
    .ApiSecret("YOUR_API_SECRET")
    .BuildModerationClient();
```

## Create a Moderation Policy

Before checking content, create a moderation configuration that defines which rules to apply:

```csharp
await client.UpsertConfigAsync(new UpsertConfigRequest
{
    Key = "my_config",
    AiTextConfig = new AiTextConfig
    {
        Rules = new List<AiTextRule>
        {
            new AiTextRule { Label = "SPAM", Action = "flag" },
            new AiTextRule { Label = "HARASSMENT", Action = "remove" },
        },
    },
    BlockListConfig = new BlockListConfig
    {
        Rules = new List<BlockListRule>
        {
            new BlockListRule { Name = "profanity_en", Action = "remove" },
        },
    },
});
```

> For Stream Chat, use config key `chat:messaging`. For Stream Feeds, use `feeds`. See [Configuration](/moderation/docs/dotnet-csharp/configuration/policies/) for details.

## Check Content

```csharp
var response = await client.CheckAsync(new CheckRequest
{
    EntityType = "stream:chat:v1:message",
    EntityID = "message-123",
    EntityCreatorID = "user-456",
    ModerationPayload = new ModerationPayload
    {
        Texts = new List<string> { "Hello, this is a test message" },
    },
    ConfigKey = "my_config",
});

Console.WriteLine(response.RecommendedAction); // "keep", "flag", or "remove"
```

## Handle the Response

The response includes:

- `RecommendedAction` -- `"keep"`, `"flag"`, or `"remove"`
- `Status` -- `"complete"` or `"partial"` (if async checks are still running)
- `Item` -- the review queue item (if content was flagged or removed)

```csharp
switch (response.RecommendedAction)
{
    case "keep":
        // Content is safe, no action needed
        break;
    case "flag":
        // Content is suspicious, send to review queue
        Console.WriteLine($"Flagged for review: {response.Item}");
        break;
    case "remove":
        // Content violates policies, remove it
        Console.WriteLine($"Content removed: {response.Item}");
        break;
}
```

## Next Steps

- [Configuration](/moderation/docs/dotnet-csharp/configuration/policies/) -- Advanced policy setup
- [Stream Chat Integration](/moderation/docs/dotnet-csharp/integrations/stream-chat/) -- Chat moderation
- [Stream Feeds Integration](/moderation/docs/dotnet-csharp/integrations/stream-feeds/) -- Feeds moderation
- [Review Queue](/moderation/docs/dotnet-csharp/content-moderation/review-queue/) -- Query and act on flagged content
- [Client Configuration](/moderation/docs/dotnet-csharp/guides/client-configuration/) — HTTP defaults, timeouts, and connection pooling


---

This page was last updated at 2026-04-16T18:29:43.559Z.

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