- summary - Get the analytics summary
- policies - Get the most flagged policies
- authors - Get the most flagged authors
- channels - Get analytics per channel
- volumes - Get volumes over time
- automation - Get the automation breakdown
Get the totals of the project for a time window: requests, flags, flag rate, allowed, rejected and sent to review, with the window before for the trend. Also the review queue backlog and a flag-rate spike, if there is one.
from moderation_api import ModerationAPI
import os
with ModerationAPI(
secret_key=os.getenv("MODAPI_SECRET_KEY", ""),
) as ma_client:
res = ma_client.analytics.summary(range="30d")
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
range |
Optional[models.GetAnalyticsSummaryQueryParamRange] | ➖ | The time window. 24h is the last 24 hours, in hourly buckets. 7d, 30d and 90d are whole UTC days that end with today, in daily buckets. |
channel |
Optional[str] | ➖ | N/A |
project_id |
Optional[str] | ➖ | The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.GetAnalyticsSummaryResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequestError | 400 | application/json |
| errors.AuthenticationError | 401 | application/json |
| errors.PermissionDeniedError | 403 | application/json |
| errors.NotFoundError | 404 | application/json |
| errors.RateLimitError | 429 | application/json |
| errors.InternalServerError | 500 | application/json |
| errors.ModerationAPIDefaultError | 4XX, 5XX | */* |
Get the policy labels that flagged the most content in a time window, largest first, with the count in the window before.
from moderation_api import ModerationAPI
import os
with ModerationAPI(
secret_key=os.getenv("MODAPI_SECRET_KEY", ""),
) as ma_client:
res = ma_client.analytics.policies(range="30d", limit=8)
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
range |
Optional[models.GetAnalyticsPoliciesQueryParamRange] | ➖ | The time window. 24h is the last 24 hours, in hourly buckets. 7d, 30d and 90d are whole UTC days that end with today, in daily buckets. |
channel |
Optional[str] | ➖ | N/A |
limit |
Optional[int] | ➖ | N/A |
project_id |
Optional[str] | ➖ | The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.GetAnalyticsPoliciesResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequestError | 400 | application/json |
| errors.AuthenticationError | 401 | application/json |
| errors.PermissionDeniedError | 403 | application/json |
| errors.NotFoundError | 404 | application/json |
| errors.RateLimitError | 429 | application/json |
| errors.InternalServerError | 500 | application/json |
| errors.ModerationAPIDefaultError | 4XX, 5XX | */* |
Get the authors with the most flagged content in a time window, largest first.
from moderation_api import ModerationAPI
import os
with ModerationAPI(
secret_key=os.getenv("MODAPI_SECRET_KEY", ""),
) as ma_client:
res = ma_client.analytics.authors(range="30d", limit=6)
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
range |
Optional[models.GetAnalyticsAuthorsQueryParamRange] | ➖ | The time window. 24h is the last 24 hours, in hourly buckets. 7d, 30d and 90d are whole UTC days that end with today, in daily buckets. |
channel |
Optional[str] | ➖ | N/A |
limit |
Optional[int] | ➖ | N/A |
project_id |
Optional[str] | ➖ | The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.GetAnalyticsAuthorsResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequestError | 400 | application/json |
| errors.AuthenticationError | 401 | application/json |
| errors.PermissionDeniedError | 403 | application/json |
| errors.NotFoundError | 404 | application/json |
| errors.RateLimitError | 429 | application/json |
| errors.InternalServerError | 500 | application/json |
| errors.ModerationAPIDefaultError | 4XX, 5XX | */* |
Get requests, flags and flag rate for each channel of the project in a time window.
from moderation_api import ModerationAPI
import os
with ModerationAPI(
secret_key=os.getenv("MODAPI_SECRET_KEY", ""),
) as ma_client:
res = ma_client.analytics.channels(range="30d")
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
range |
Optional[models.GetAnalyticsChannelsQueryParamRange] | ➖ | The time window. 24h is the last 24 hours, in hourly buckets. 7d, 30d and 90d are whole UTC days that end with today, in daily buckets. |
project_id |
Optional[str] | ➖ | The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.GetAnalyticsChannelsResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequestError | 400 | application/json |
| errors.AuthenticationError | 401 | application/json |
| errors.PermissionDeniedError | 403 | application/json |
| errors.NotFoundError | 404 | application/json |
| errors.RateLimitError | 429 | application/json |
| errors.InternalServerError | 500 | application/json |
| errors.ModerationAPIDefaultError | 4XX, 5XX | */* |
Get requests, flags, rejections and reviews per hour (24h) or per day (7d, 30d, 90d), oldest first.
from moderation_api import ModerationAPI
import os
with ModerationAPI(
secret_key=os.getenv("MODAPI_SECRET_KEY", ""),
) as ma_client:
res = ma_client.analytics.volumes(range="30d")
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
range |
Optional[models.GetAnalyticsVolumesQueryParamRange] | ➖ | The time window. 24h is the last 24 hours, in hourly buckets. 7d, 30d and 90d are whole UTC days that end with today, in daily buckets. |
channel |
Optional[str] | ➖ | N/A |
project_id |
Optional[str] | ➖ | The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.GetAnalyticsVolumesResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequestError | 400 | application/json |
| errors.AuthenticationError | 401 | application/json |
| errors.PermissionDeniedError | 403 | application/json |
| errors.NotFoundError | 404 | application/json |
| errors.RateLimitError | 429 | application/json |
| errors.InternalServerError | 500 | application/json |
| errors.ModerationAPIDefaultError | 4XX, 5XX | */* |
Get how flagged content was handled in a time window: settled by rules or the casebook, or sent to human review, and what the reviewers decided.
from moderation_api import ModerationAPI
import os
with ModerationAPI(
secret_key=os.getenv("MODAPI_SECRET_KEY", ""),
) as ma_client:
res = ma_client.analytics.automation(range="30d")
# Handle response
print(res)| Parameter | Type | Required | Description |
|---|---|---|---|
range |
Optional[models.GetAnalyticsAutomationQueryParamRange] | ➖ | The time window. 24h is the last 24 hours, in hourly buckets. 7d, 30d and 90d are whole UTC days that end with today, in daily buckets. |
channel |
Optional[str] | ➖ | N/A |
project_id |
Optional[str] | ➖ | The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.GetAnalyticsAutomationResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.BadRequestError | 400 | application/json |
| errors.AuthenticationError | 401 | application/json |
| errors.PermissionDeniedError | 403 | application/json |
| errors.NotFoundError | 404 | application/json |
| errors.RateLimitError | 429 | application/json |
| errors.InternalServerError | 500 | application/json |
| errors.ModerationAPIDefaultError | 4XX, 5XX | */* |