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
Check text, images, audio, and video from your own product.
Choose which engines run and what happens when content matches.
Moderate chat messages with no code changes.
Automatically moderate activities and comments as they are created or updated.
Review flagged content and act on it: approve, delete, or ban.
Moderate calls and livestreams in real time with keyframes and captions.
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 skillsThen 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
The SDK is published to the Stream Maven repository. Add the repository and the dependency to your build.gradle:
repositories {
mavenCentral()
maven { url "https://stream-io-repo.com" }
}
dependencies {
implementation 'io.getstream:stream-sdk-java:11.0.0'
}Or Maven pom.xml:
<repositories>
<repository>
<id>stream</id>
<url>https://stream-io-repo.com</url>
</repository>
</repositories>
<dependency>
<groupId>io.getstream</groupId>
<artifactId>stream-sdk-java</artifactId>
<version>11.0.0</version>
</dependency>Use the latest available SDK release when starting a new integration.
11.0.0is the current release. Check stream-sdk-java releases if a newer one is available.
Initialize the client
import io.getstream.services.framework.StreamSDKClient;
var client = new StreamSDKClient("YOUR_API_KEY", "YOUR_API_SECRET");Create a moderation policy
Before checking content, create a policy that defines which rules to apply:
client.moderation()
.upsertConfig(UpsertConfigRequest.builder()
.key("my_config")
.aiTextConfig(AITextConfig.builder()
.rules(List.of(
BodyguardRule.builder().label("SPAM").action("flag").build(),
BodyguardRule.builder().label("HATRED").action("remove").build()
))
.build())
.blockListConfig(BlockListConfig.builder()
.rules(List.of(
BlockListRule.builder().name("profanity_en").action("remove").build()
))
.build())
.build())
.execute();For Stream Chat, use config key
chat:messaging. For Stream Feeds, usefeeds. See Configuration for details.
Check content
var response = client.moderation()
.check(CheckRequest.builder()
.entityType("post")
.entityID("post-123")
.entityCreatorID("user-456")
.moderationPayload(ModerationPayload.builder()
.texts(List.of("Selling a bike, pickup in the city"))
.build())
.configKey("my_config")
.build())
.execute();
System.out.println(response.getData().getRecommendedAction()); // "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"(pendingmeans 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]String action = response.getData().getRecommendedAction();
switch (action) {
case "keep":
// Content is safe, no action needed
break;
case "flag":
// Content is suspicious; Stream has queued it for review
System.out.println("Flagged for review: " + response.getData().getItem());
break;
case "remove":
// Content violates policies, remove it
System.out.println("Content removed: " + response.getData().getItem());
break;
}What's next
Choose which engines run and what happens when content matches.
Query and act on flagged content.
Get review queue events delivered to your backend.
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.
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.