# Getting Started

Stream's Moderation API lets you integrate content moderation into any application. This guide walks you through installing one of the [backend SDKs](https://getstream.io/docs/platform/backend-sdks/), configuration, and your first moderation check.

Moderation lives in the [Stream Dashboard](https://getstream.io/signin/?product=moderation), where you can create and tune policies, manage AI rules and blocklists, and review flagged content across your app.

## Start here

- [Policies](https://getstream.io/moderation/docs/dotnet-csharp/configuration/policies/): Choose which engines run and what happens when content matches.
- [Stream Chat integration](https://getstream.io/moderation/docs/dotnet-csharp/integrations/stream-chat/): Moderate chat messages with no code changes.
- [Stream Feeds integration](https://getstream.io/moderation/docs/dotnet-csharp/integrations/stream-feeds/): Automatically moderate activities and comments as they are created or updated.

## Stream CLI and Agent Skills

Manage moderation from your terminal with the [Stream CLI](https://getstream.io/cli/docs/), including scripting policy setup and AI-agent workflows. Install the CLI and the default [Agent Skills](https://getstream.io/agent-skills/docs/):

```bash
curl -fsSL https://getstream.io/cli.sh | bash
getstream skills
```

Then ask your agent in plain English, for example:

```text
/stream Show flagged content in the review queue.
```

See the [CLI docs](https://getstream.io/cli/docs/) and [Agent Skills docs](https://getstream.io/agent-skills/docs/) for more.

## 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](https://getstream.io/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)

The check returns a recommendation for your code to enforce. Stream adds flagged and removed content to the review queue:

```mermaid
flowchart LR
  content[User content] --> check[Moderation check]
  check --> rec{recommended_action}
  rec -->|keep| keep[Your app keeps it]
  rec -->|flag| queue[Review queue]
  rec -->|remove| removed[Your app removes it]
  removed -.->|for audit and appeals| queue
```

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

## What's next

- [Review queue](https://getstream.io/moderation/docs/dotnet-csharp/content-moderation/review-queue/): Query and act on flagged content.
- [Webhooks](https://getstream.io/moderation/docs/dotnet-csharp/content-moderation/webhooks/): Get review queue events delivered to your backend.
- [Client configuration](https://getstream.io/moderation/docs/dotnet-csharp/guides/client-configuration/): HTTP defaults, timeouts, and connection pooling.

## FAQ

**Which engines can check content?**

LLM and NLP text engines, plus image, video and audio moderation. Start with the [LLM text engine](https://getstream.io/moderation/docs/dotnet-csharp/engines/ai-llm-text/).

**Do messages sent from my server get moderated?**

Content sent to the Check API is always moderated. Chat messages sent from the server skip moderation by default; set `ForceModeration` to `true` to include them. See [chat moderation](https://getstream.io/moderation/docs/dotnet-csharp/integrations/stream-chat/#server-side-integration).

**Can tenants manage their own moderation?**

Yes, for chat. Tenants manage their own policies, with client-side access restricted to their team, and team blocklists need a feature flag from support. See [multitenancy](https://getstream.io/moderation/docs/dotnet-csharp/configuration/multitenancy/).

**Can I build my own review dashboard?**

Yes, on the same APIs Stream's dashboard uses. The [dashboard guide](https://getstream.io/moderation/docs/dotnet-csharp/guides/build-moderation-dashboard/) walks through it.

---

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