Submit content
from moderation_api import ModerationAPI
import os
with ModerationAPI(
secret_key=os.getenv("MODAPI_SECRET_KEY", ""),
) as ma_client:
res = ma_client.content.submit(content={
"type": "text",
"text": "Hey, check out my profile for a deal!",
}, content_id="message-48213", author_id="user-1092", conversation_id="room-general", metadata={
"platform": "ios",
})
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
content |
models.ContentRequest |
✔️ |
The content sent for moderation |
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. |
timestamp |
Optional[float] |
➖ |
Unix timestamp (in milliseconds) of when the content was created. Use if content is not submitted in real-time. |
channel |
Optional[str] |
➖ |
Provide a channel ID or key. Will use the project's default channel if not provided. |
content_id |
Optional[str] |
➖ |
The unique ID of the content in your database. |
meta_type |
Optional[models.SubmitContentMetaType] |
➖ |
The meta type of content being moderated |
author_id |
Optional[str] |
➖ |
The author of the content. |
conversation_id |
Optional[str] |
➖ |
For example the ID of a chat room or a post |
metadata |
Dict[str, Any] |
➖ |
Any metadata you want to store with the content |
client_action |
Optional[models.SubmitContentClientAction] |
➖ |
A recommendation from your own client-side flagging (e.g. a banned-IP list or a third-party tool). Feeds the rules engine and can escalate or override the recommended action. Does not change whether our analysis flagged the content. |
do_not_store |
Optional[bool] |
➖ |
Process the content without saving it on our servers. The item is still created and appears in the review queue, analytics and author history with its moderation results, but its content is empty, so reviewers cannot see what was submitted. |
policies |
List[models.PolicyRequest] |
➖ |
(Enterprise) override the channel policies for this moderation request only. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.SubmitContentResponse
| Error Type |
Status Code |
Content Type |
| errors.BadRequestError |
400 |
application/json |
| errors.AuthenticationError |
401 |
application/json |
| errors.PermissionDeniedError |
403 |
application/json |
| errors.RateLimitError |
429 |
application/json |
| errors.InternalServerError |
500 |
application/json |
| errors.ModerationAPIDefaultError |
4XX, 5XX |
*/* |