Logs & Analytics
Query moderation logs to audit who took which action. Flag counts use entity_creator_id. There is no export, analytics, or usage-stats endpoint. Use queryReviewQueue and queryModerationLogs instead.
Query Moderation Logs
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.
response, err := client.Moderation().QueryModerationLogs(ctx, &getstream.QueryModerationLogsRequest{
Filter: getstream.PtrTo(map[string]interface{}{"entity_type": "stream:chat:v1:message"}),
Sort: []getstream.SortParam{{Field: "created_at", Direction: getstream.PtrTo(-1)}},
Limit: getstream.PtrTo(50),
})Request Parameters
| 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. |
Response
| Key | Type | Description |
|---|---|---|
| logs | array | List of moderation log entries. Each entry includes action type, actor, target, timestamp, and details. reason holds the moderator's note, if one was sent. See Moderator notes. |
| next | string | Next cursor for pagination. |
Get Flag Count
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.
response, err := client.Moderation().GetFlagCount(ctx, &getstream.GetFlagCountRequest{
UserID: "user_123",
})Request Parameters
| Key | Required | Type | Description |
|---|---|---|---|
| user_id | true | string | User ID to get flag count for. |
| entity_type | false | string | Optionally filter by entity type. |
Response
| Key | Type | Description |
|---|---|---|
| count | number | Total number of flags for the specified user. |