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, creating a policy, and running your first moderation check.

Moderation lives in the Stream Dashboard, where you can create and tune policies, manage AI rules and blocklists, and review flagged content across your app.

Start here

Stream CLI and Agent Skills

Manage moderation from your terminal with the Stream CLI, including scripting policy setup and AI-agent workflows. Install the CLI and the default Agent Skills:

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

Then ask your agent in plain English, for example:

/stream Show flagged content in the review queue.

See the CLI docs and Agent Skills docs for more.

Installation

go get github.com/GetStream/getstream-go/v8

Initialize the client

package main

import getstream "github.com/GetStream/getstream-go/v8"

func main() {
    client, err := getstream.NewClient("YOUR_API_KEY", "YOUR_API_SECRET")
    if err != nil {
        panic(err)
    }
    _ = client
}

Create a moderation policy

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

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

For Stream Chat, use config key chat:messaging. For Stream Feeds, use feeds. See Configuration for details.

Check content

response, err := client.Moderation().Check(ctx, &getstream.CheckRequest{
    EntityType:      "post",
    EntityID:        "post-123",
    EntityCreatorID: "user-456",
    ModerationPayload: &getstream.ModerationPayload{
        Texts: []string{"Selling a bike, pickup in the city"},
    },
    ConfigKey: getstream.PtrTo("my_config"),
})

fmt.Println(response.Data.RecommendedAction) // "keep", "flag", "remove", "shadow", or "bounce"

Handle the response

The response includes:

  • RecommendedAction -- "keep", "flag", "remove", "shadow", "bounce", "bounce_flag", "bounce_remove", "mask", or "mask_flag"
  • Status -- "completed" or "pending" (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:

flowchart TD
  content[Your content] --> check[Check API]
  check --> rec{recommended_action}
  rec -->|keep| keep[Publish it]
  rec -->|flag| queue[Review queue]
  rec -->|shadow| hidden[Show it only to the author]
  rec -->|remove| removed[Do not publish it]
  rec -->|bounce| bounced[Reject it before it is published]
  hidden --> queue
  removed --> queue
  queue --> review[Moderator marks it reviewed, restores it, or bans the user]
switch response.Data.RecommendedAction {
case "keep":
    // Content is safe, no action needed
case "flag":
    // Content is suspicious; Stream has queued it for review
    fmt.Println("Flagged for review:", response.Data.Item)
case "remove":
    // Content violates policies, remove it
    fmt.Println("Content removed:", response.Data.Item)
}

What's next

FAQ

Which engines can check content?

LLM and NLP text engines, plus image, video and audio moderation. Start with the LLM text engine.

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.

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.

Can I build my own review dashboard?

Yes, on the same APIs Stream's dashboard uses. The dashboard guide walks through it.