Stream provides APIs to query moderation logs, export them for compliance, retrieve analytics, and track usage statistics. These endpoints help you audit moderation activity, monitor moderator performance, and generate reports.
POST /api/v2/moderation/logs
Query moderation action logs with filtering, sorting, and pagination. Logs record every moderation action taken -- who did what, when, and on which content.
Node Python Go Java PHP Ruby .NET
const response = await client.moderation. queryModerationLogs ({
filter: { entity_type: "stream:chat:v1:message" },
sort: [{ field: "created_at" , direction: - 1 }],
limit: 50 ,
}); response = client.moderation().query_moderation_logs(
filter = { "entity_type" : "stream:chat:v1:message" },
sort = [{ "field" : "created_at" , "direction" : - 1 }],
limit = 50 ,
) response, err := client. Moderation (). QueryModerationLogs (ctx, & getstream . QueryModerationLogsRequest {
Filter: map [ string ] interface {}{ "entity_type" : "stream:chat:v1:message" },
Sort: [] getstream . SortParam {{Field: "created_at" , Direction: getstream. PtrTo ( - 1 )}},
Limit: getstream. PtrTo ( 50 ),
}) client. moderation (). queryModerationLogs (QueryModerationLogsRequest. builder ()
. filter (Map. of ( "entity_type" , "stream:chat:v1:message" ))
. sort (List. of (SortParam. builder (). field ( "created_at" ). direction ( - 1 ). build ()))
. limit ( 50 )
. build ()). execute (); $response = $client -> moderation () -> queryModerationLogs ( new QueryModerationLogsRequest (
filter : ( object )[ 'entity_type' => 'stream:chat:v1:message' ],
sort : [ new SortParam ( field : 'created_at' , direction : - 1 )],
limit : 50 ,
)); response = client. moderation . query_moderation_logs (
GetStream :: Generated :: Models :: QueryModerationLogsRequest . new (
filter: { "entity_type" => "stream:chat:v1:message" },
sort: [ GetStream :: Generated :: Models :: SortParam . new ( field: "created_at" , direction: - 1 )],
limit: 50
)
) var response = await client.Moderation. QueryModerationLogsAsync ( new QueryModerationLogsRequest
{
Filter = new Dictionary < string , object > { { "entity_type" , "stream:chat:v1:message" } },
Sort = new List < SortParam > { new () { Field = "created_at" , Direction = - 1 } },
Limit = 50 ,
});
Key Required Type Description filter false object Filter conditions for logs. sort false array Sort parameters (e.g., by created_at). limit false number Maximum number of logs to return. next false string Cursor for pagination.
Key Type Description logs array List of moderation log entries. Each entry includes action type, actor, target, timestamp, and details. next string Next cursor for pagination.
POST /api/v2/moderation/logs/export
Export moderation logs for external analysis or compliance purposes. The export can be filtered by time range, entity type, or any other supported filter condition.
Node Python Go Java PHP Ruby .NET
const response = await client.moderation. exportModerationLogs ({
filter: { created_at: { $gte: "2024-01-01T00:00:00Z" } },
}); response = client.moderation().export_moderation_logs(
filter = { "created_at" : { "$gte" : "2024-01-01T00:00:00Z" }},
) response, err := client. Moderation (). ExportModerationLogs (ctx, & getstream . ExportModerationLogsRequest {
Filter: map [ string ] interface {}{
"created_at" : map [ string ] interface {}{ "$gte" : "2024-01-01T00:00:00Z" },
},
}) client. moderation (). exportModerationLogs (ExportModerationLogsRequest. builder ()
. filter (Map. of ( "created_at" , Map. of ( "$gte" , "2024-01-01T00:00:00Z" )))
. build ()). execute (); $response = $client -> moderation () -> exportModerationLogs ( new ExportModerationLogsRequest (
filter : ( object )[ 'created_at' => ( object )[ '$gte' => '2024-01-01T00:00:00Z' ]],
)); response = client. moderation . export_moderation_logs (
GetStream :: Generated :: Models :: ExportModerationLogsRequest . new (
filter: { "created_at" => { "$gte" => "2024-01-01T00:00:00Z" } }
)
) var response = await client.Moderation. ExportModerationLogsAsync ( new ExportModerationLogsRequest
{
Filter = new Dictionary < string , object >
{
{ "created_at" , new Dictionary < string , object > { { "$gte" , "2024-01-01T00:00:00Z" } } }
},
});
Key Required Type Description filter false object Filter conditions for which logs to export.
Key Type Description export_url string URL to download the exported logs file. status string Status of the export operation.
POST /api/v2/moderation/analytics
Retrieve moderation analytics for a specified time range. This is a server-side only endpoint that returns aggregate statistics about moderation activity.
Node Python Go Java PHP Ruby .NET
const response = await client.moderation. getModerationAnalytics ({
from: "2024-01-01T00:00:00Z" ,
to: "2024-01-31T23:59:59Z" ,
}); response = client.moderation().get_moderation_analytics(
from_ = "2024-01-01T00:00:00Z" ,
to = "2024-01-31T23:59:59Z" ,
) response, err := client. Moderation (). GetModerationAnalytics (ctx, & getstream . GetModerationAnalyticsRequest {
From: getstream. PtrTo ( "2024-01-01T00:00:00Z" ),
To: getstream. PtrTo ( "2024-01-31T23:59:59Z" ),
}) client. moderation (). getModerationAnalytics (GetModerationAnalyticsRequest. builder ()
. from ( "2024-01-01T00:00:00Z" )
. to ( "2024-01-31T23:59:59Z" )
. build ()). execute (); $response = $client -> moderation () -> getModerationAnalytics ( new GetModerationAnalyticsRequest (
from : '2024-01-01T00:00:00Z' ,
to : '2024-01-31T23:59:59Z' ,
)); response = client. moderation . get_moderation_analytics (
GetStream :: Generated :: Models :: GetModerationAnalyticsRequest . new (
from: "2024-01-01T00:00:00Z" ,
to: "2024-01-31T23:59:59Z"
)
) var response = await client.Moderation. GetModerationAnalyticsAsync ( new GetModerationAnalyticsRequest
{
From = "2024-01-01T00:00:00Z" ,
To = "2024-01-31T23:59:59Z" ,
});
Key Required Type Description from false string Start of time range (ISO 8601 datetime). to false string End of time range (ISO 8601 datetime).
Key Type Description analytics object Aggregate moderation analytics data for the specified time range.
POST /api/v2/moderation/usage_stats
Query moderation usage statistics -- number of checks, flags, actions, and other operational metrics over a given time period.
Node Python Go Java PHP Ruby .NET
const response = await client.moderation. queryUsageStats ({
from: "2024-01-01T00:00:00Z" ,
to: "2024-01-31T23:59:59Z" ,
}); response = client.moderation().query_usage_stats(
from_ = "2024-01-01T00:00:00Z" ,
to = "2024-01-31T23:59:59Z" ,
) response, err := client. Moderation (). QueryUsageStats (ctx, & getstream . QueryUsageStatsRequest {
From: getstream. PtrTo ( "2024-01-01T00:00:00Z" ),
To: getstream. PtrTo ( "2024-01-31T23:59:59Z" ),
}) client. moderation (). queryUsageStats (QueryUsageStatsRequest. builder ()
. from ( "2024-01-01T00:00:00Z" )
. to ( "2024-01-31T23:59:59Z" )
. build ()). execute (); $response = $client -> moderation () -> queryUsageStats ( new QueryUsageStatsRequest (
from : '2024-01-01T00:00:00Z' ,
to : '2024-01-31T23:59:59Z' ,
)); response = client. moderation . query_usage_stats (
GetStream :: Generated :: Models :: QueryUsageStatsRequest . new (
from: "2024-01-01T00:00:00Z" ,
to: "2024-01-31T23:59:59Z"
)
) var response = await client.Moderation. QueryUsageStatsAsync ( new QueryUsageStatsRequest
{
From = "2024-01-01T00:00:00Z" ,
To = "2024-01-31T23:59:59Z" ,
});
Key Required Type Description from false string Start of time range (ISO 8601 datetime). to false string End of time range (ISO 8601 datetime).
Key Type Description stats object Usage statistics including counts for checks, flags, and actions within the time range.
GET /api/v2/moderation/user_report
Retrieve a comprehensive moderation report for a specific user, including moderation history, flags received, and actions taken against their content.
Node Python Go Java PHP Ruby .NET
const response = await client.moderation. getUserModerationReport ({
user_id: "user_123" ,
}); response = client.moderation().get_user_moderation_report(
user_id = "user_123" ,
) response, err := client. Moderation (). GetUserModerationReport (ctx, & getstream . GetUserModerationReportRequest {
UserID: "user_123" ,
}) client. moderation (). getUserModerationReport (GetUserModerationReportRequest. builder ()
. userId ( "user_123" )
. build ()). execute (); $response = $client -> moderation () -> getUserModerationReport ( new GetUserModerationReportRequest (
userId : 'user_123' ,
)); response = client. moderation . get_user_moderation_report (
GetStream :: Generated :: Models :: GetUserModerationReportRequest . new (
user_id: "user_123"
)
) var response = await client.Moderation. GetUserModerationReportAsync ( new GetUserModerationReportRequest
{
UserId = "user_123" ,
});
Key Required Type Description user_id true string The ID of the user to get the report for.
Key Type Description report object Comprehensive moderation report for the user, including history, flags, and actions.
POST /api/v2/moderation/flag_count
Get the number of moderation flags created against a specific user's content. Useful for building moderation dashboards and identifying repeat offenders.
Node Python Go Java PHP Ruby .NET
const response = await client.moderation. getFlagCount ({
user_id: "user_123" ,
}); response = client.moderation().get_flag_count(
user_id = "user_123" ,
) response, err := client. Moderation (). GetFlagCount (ctx, & getstream . GetFlagCountRequest {
UserID: "user_123" ,
}) client. moderation (). getFlagCount (GetFlagCountRequest. builder ()
. userId ( "user_123" )
. build ()). execute (); $response = $client -> moderation () -> getFlagCount ( new GetFlagCountRequest (
userId : 'user_123' ,
)); response = client. moderation . get_flag_count (
GetStream :: Generated :: Models :: GetFlagCountRequest . new (
user_id: "user_123"
)
) var response = await client.Moderation. GetFlagCountAsync ( new GetFlagCountRequest
{
UserId = "user_123" ,
});
Key Required Type Description user_id true string User ID to get flag count for. entity_type false string Optionally filter by entity type.
Key Type Description count number Total number of flags for the specified user.