# 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
go get github.com/GetStream/getstream-go/v4
```

## Initialize the Client

```go
package main

import (
    "context"
    getstream "github.com/GetStream/getstream-go/v4"
)

func main() {
    client := getstream.NewStream("YOUR_API_KEY", "YOUR_API_SECRET")
    ctx := context.Background()
}
```

## Create a Moderation Policy

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

```go
_, err := client.Moderation().UpsertConfig(ctx, &getstream.UpsertConfigRequest{
    Key: "my_config",
    AiTextConfig: &getstream.AiTextConfig{
        Rules: []getstream.AiTextRule{
            {Label: "SPAM", Action: "flag"},
            {Label: "HARASSMENT", Action: "remove"},
        },
    },
    BlockListConfig: &getstream.BlockListConfig{
        Rules: []getstream.BlockListRule{
            {Name: "profanity_en", Action: "remove"},
        },
    },
})
```

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

## Check Content

```go
response, err := client.Moderation().Check(ctx, &getstream.CheckRequest{
    EntityType:      "stream:chat:v1:message",
    EntityID:        "message-123",
    EntityCreatorID: "user-456",
    ModerationPayload: &getstream.ModerationPayload{
        Texts: []string{"Hello, this is a test message"},
    },
    ConfigKey: getstream.PtrTo("my_config"),
})

fmt.Println(response.Data.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)

```go
switch response.Data.RecommendedAction {
case "keep":
    // Content is safe, no action needed
case "flag":
    // Content is suspicious, send to review queue
    fmt.Println("Flagged for review:", response.Data.Item)
case "remove":
    // Content violates policies, remove it
    fmt.Println("Content removed:", response.Data.Item)
}
```

## Next Steps

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


---

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

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