All API requests require authentication using an API key. You can obtain an API key from your dashboard.
Include your API key in requests using one of the following methods:
Recommended: Authorization Header
Authorization: Bearer <API_KEY>Alternative: Custom Header
x-api-key: <API_KEY>⚠️ Security Warning
API keys are secret credentials. Never expose them in client-side JavaScript, public repositories, or client-side code. Always use server-side code or environment variables to store and use API keys.
Analyze text content for toxicity, insults, threats, and other harmful content.
Endpoint
POST https://cleanmod.dev/api/v1/moderateContent-Type
application/json{
"text": "You are an idiot",
"model": "english-basic",
"mode": "strict"
}text (required): The text content to moderate. Must be a non-empty string.
model (optional): The moderation model to use. Defaults to english-basic.
mode (optional): The moderation sensitivity mode. Controls the thresholds used for flagging and blocking content. Must be one of: lenient, default, or strict. If not provided, uses your organization's default mode (set in dashboard), or falls back to default.
Mode Thresholds:
{
"id": "log_abc123...",
"model": "english-basic",
"provider": "unitary",
"providerModel": "unitary/multilingual-toxic-xlm-roberta",
"decision": "flag",
"overall_score": 0.91,
"mode": "strict",
"thresholds": {
"flag": 0.3,
"block": 0.6
},
"categories": {
"toxicity": 0.91,
"insult": 0.88
},
"created_at": "2025-11-16T15:00:00.000Z"
}id: Unique identifier for this moderation log entry.
decision: One of allow, flag, or block.
overall_score: Overall toxicity score (0-1), where higher values indicate more toxic content.
mode: The moderation mode that was used for this request (either from the request body or your organization's default).
thresholds: The flag and block thresholds that were used for this request, based on the mode.
categories: Per-category scores for different types of harmful content.
CleanMod has an official WordPress plugin for moderating comments. It uses the same API as the examples above, just wrapped in a plugin UX for easy WordPress integration. Perfect for blogs, WooCommerce stores, and content-heavy sites.
Note: If the plugin is not searchable yet, you can manually download it from the WordPress.org plugin page and upload as a ZIP under "Plugins → Add New → Upload Plugin".
The plugin lets you configure how to handle different moderation decisions:
For decision = "flag":
Flag decisions indicate "suspicious but not necessarily terrible" content—recommended: hold for manual review.
For decision = "block":
Block decisions indicate "likely very toxic" content—recommended: mark as spam or hold.
The plugin hooks into WordPress's pre_comment_approved filter:
https://cleanmod.dev/api/v1/moderate with your configured API key.allow, flag, or block, the plugin applies your chosen behavior setting.Privacy Note: If the API fails, the plugin fails open (doesn't break comment submission). Comments are sent as text only—no user identities are shared with CleanMod.
CleanMod provides an official JavaScript/TypeScript SDK for easy integration in Node.js, serverless functions, and backend frameworks.
npm install @cleanmod/js
# or
yarn add @cleanmod/js
# or
pnpm add @cleanmod/jsimport { createCleanModClient } from "@cleanmod/js";
const client = createCleanModClient({
apiKey: process.env.CLEANMOD_API_KEY!,
});
const res = await client.moderate({
text: "you are an idiot"
});
console.log(res);The SDK uses the same moderation engine as the REST API and supports all models and future features.
The API returns standard HTTP status codes and JSON error responses.
Invalid or missing request body fields.
{
"error": "Missing or invalid \"text\" field in request body."
}Invalid mode value.
{
"error": "Invalid \"mode\" value. Must be one of: \"lenient\", \"default\", \"strict\"."
}Missing or invalid API key.
{
"error": "Missing API key. Use Authorization: Bearer <KEY> or x-api-key."
}Monthly quota exceeded.
{
"error": "Monthly quota exceeded. Upgrade your CleanMod plan to continue.",
"quota": 2000,
"used": 2000
}An unexpected error occurred on the server.
{
"error": "Internal server error."
}import { CleanModClient } from "@cleanmod/js";
const client = new CleanModClient({
apiKey: process.env.CLEANMOD_API_KEY!,
// baseUrl is optional, defaults to https://cleanmod.dev
baseUrl: "https://cleanmod.dev",
});
async function run() {
const result = await client.moderate({
text: "You are an idiot",
model: "english-basic",
});
console.log(result.decision, result.overallScore);
}
run().catch(console.error);curl -X POST https://cleanmod.dev/api/v1/moderate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "You are an idiot",
"model": "english-basic",
"mode": "strict"
}'const response = await fetch('https://cleanmod.dev/api/v1/moderate', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
text: 'You are an idiot',
model: 'english-basic',
}),
});
const result = await response.json();
console.log(result);import requests
response = requests.post(
'https://cleanmod.dev/api/v1/moderate',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
json={
'text': 'You are an idiot',
'model': 'english-basic',
},
)
result = response.json()
print(result)<?php
$url = 'https://cleanmod.dev/api/v1/moderate';
$data = [
'text' => 'You are an idiot',
'model' => 'english-basic',
];
$options = [
'http' => [
'method' => 'POST',
'header' => [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json',
],
'content' => json_encode($data),
],
];
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
$result = json_decode($response, true);
var_dump($result);CleanMod provides official SDKs and integrations to make integration easier. All SDKs and plugins are open source.
Use this in Node.js / Next.js / serverless functions instead of hand-rolling fetch calls to /api/v1/moderate.
Automatically moderate WordPress comments using CleanMod. Install it directly from your WP admin or download from WordPress.org.