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"
}text (required): The text content to moderate. Must be a non-empty string.
model (optional): The moderation model to use. Defaults to english-basic.
{
"id": "log_abc123...",
"model": "english-basic",
"provider": "unitary",
"providerModel": "unitary/multilingual-toxic-xlm-roberta",
"decision": "flag",
"overall_score": 0.91,
"threshold": 0.8,
"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.
categories: Per-category scores for different types of harmful content.
Automatically check new comments using CleanMod and hold or spam comments based on the AI decision.
For now, install from GitHub:
/wp-content/plugins/Once approved on WordPress.org, you'll be able to install it directly from your WP admin.
When decision = "flag":
When decision = "block":
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."
}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"
}'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. Once approved on WordPress.org you'll be able to install it directly from your WP admin.