Free & Open
API Documentation
Integrate PII redaction and prompt cleaning into your pipeline. No API key required. All processing happens server-side with zero data retention.
Base URL
https://cleanmyprompt.ioRate Limits
The free public API is rate-limited to 30 requests per minute per IP. For higher limits or dedicated endpoints, contact us.
POST
/api/v1/cleanClean, compress, and redact PII from text in a single call.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| text | string | Yes | The text to process (max 100,000 chars). |
| mode | "standard" | "squeeze" | "json" | No | Cleaning mode. Default: "standard". |
| redact | boolean | No | Redact PII (emails, phones, SSNs, etc). Default: true. |
| aggressive | boolean | No | Aggressive compression (squeeze mode only). Default: false. |
| lang | "en" | "de" | "fr" | "es" | No | Language for stop-word aware compression. Default: "en". |
Example Request
curl -X POST https://cleanmyprompt.io/api/v1/clean \
-H "Content-Type: application/json" \
-d '{
"text": "Contact Dr. Sarah Johnson at sarah@company.com or call +1-555-0123. My key is sk-proj-abc123def456.",
"mode": "standard",
"redact": true
}'Response
{
"cleaned": "Your processed text here...",
"stats": {
"originalChars": 1250,
"cleanedChars": 980,
"originalTokens": 312,
"cleanedTokens": 245,
"tokensSaved": 67,
"reductionPercent": 21,
"piiFound": 3,
"secretsFound": 1,
"linksFound": 0
}
}POST
/api/v1/analyzeScan text for secrets, PII, and links without modifying it.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| text | string | Yes | The text to analyze (max 100,000 chars). |
Example Request
curl -X POST https://cleanmyprompt.io/api/v1/analyze \
-H "Content-Type: application/json" \
-d '{
"text": "My SSN is 123-45-6789 and email is test@example.com"
}'Response
{
"isClean": false,
"findings": {
"secrets": 1,
"pii": 3,
"links": 0
}
}New
AI Agent / MCP Integration
CleanMyPrompt is an MCP-compatible tool that AI agents can call directly. Use it to clean prompts before sending them to any LLM.
MCP Tool Spec
// Add to your MCP client config:
{
"mcpServers": {
"cleanmyprompt": {
"url": "https://cleanmyprompt.io/api/v1"
}
}
}
// Tools available:
// - clean_text: Clean, compress, redact
// - analyze_text: Scan for PII/secretsDownload mcp.json →OpenAI Plugin / ChatGPT
// Plugin manifest:
GET /.well-known/ai-plugin.json
// OpenAPI spec:
GET /openapi.json
// Both are auto-discoverable
// No API key requiredDownload openapi.json →Quick Integration
Python
import requests
r = requests.post(
"https://cleanmyprompt.io/api/v1/clean",
json={
"text": "Email me at john@corp.com",
"redact": True
}
)
print(r.json()["cleaned"])JavaScript / Node
const res = await fetch(
"https://cleanmyprompt.io/api/v1/clean",
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
text: "Email me at john@corp.com",
redact: true,
}),
}
);
const { cleaned } = await res.json();Error Codes
| Status | Meaning |
|---|---|
| 400 | Invalid or missing request body |
| 429 | Rate limit exceeded (30 req/min) |
| 500 | Internal server error |
Need Higher Limits?
Self-host CleanMyPrompt or contact us for a dedicated enterprise endpoint.