TextPurify API
The same engine behind this site, as a REST API. Detect and strip invisible characters, zero-width spaces, AI watermarks, smart quotes and em dashes from text — programmatically, at scale, in one call.
Free tier: 1,000 requests/month. No credit card to start. Managed subscriptions, keys and billing are handled by RapidAPI.
When you need the API instead of the free tool
The browser tool on this site is perfect for cleaning one piece of text by hand. The API is for everything else: cleaning user-generated content on submit, sanitizing thousands of records in a data pipeline, stripping AI watermarks before publishing programmatically, or checking documents for zero-width fingerprints as part of a moderation flow. It runs server-side, returns structured JSON, and scales to whatever volume your plan allows.
Endpoints
| Method & path | What it does |
|---|---|
POST /v1/detect | Scan text and return every hidden character with its Unicode code point, name, category and count. Non-destructive — answers "is this text watermarked?" |
POST /v1/clean | Return a cleaned copy. Toggle categories (invisible, spaces, dashes, quotes, markdown) and choose how em dashes are replaced (comma / hyphen / space / keep). |
GET /v1/health | Liveness probe and capability list. |
Quick start
Subscribe (the free plan is enough to start) on RapidAPI to get your X-RapidAPI-Key, then call the gateway host textpurify.p.rapidapi.com.
curl
curl -X POST https://textpurify.p.rapidapi.com/v1/clean \
-H "Content-Type: application/json" \
-H "X-RapidAPI-Key: YOUR_KEY" \
-H "X-RapidAPI-Host: textpurify.p.rapidapi.com" \
-d '{"text":"Helloworld “quote” — test"}'
JavaScript (fetch)
const res = await fetch("https://textpurify.p.rapidapi.com/v1/clean", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-RapidAPI-Key": "YOUR_KEY",
"X-RapidAPI-Host": "textpurify.p.rapidapi.com",
},
body: JSON.stringify({ text: dirtyText, emDash: "comma" }),
});
const { cleaned, removed } = await res.json();
Python (requests)
import requests
r = requests.post(
"https://textpurify.p.rapidapi.com/v1/clean",
headers={
"X-RapidAPI-Key": "YOUR_KEY",
"X-RapidAPI-Host": "textpurify.p.rapidapi.com",
},
json={"text": dirty_text, "categories": {"markdown": False}},
)
print(r.json()["cleaned"])
Example response
{
"cleaned": "Helloworld \"quote\", test",
"removed": 4,
"originalLength": 26,
"cleanedLength": 24
}
Pricing
| Plan | Price | Requests / month |
|---|---|---|
| Basic | Free | 1,000 |
| ProPopular | $9.99/mo | 500,000 |
| Ultra | $29.99/mo | 1,499,000 |
Text up to 100,000 characters per request. No request logging. Emoji and joining scripts (Arabic, Persian, Indic) are guarded and never corrupted.
FAQ
Do I call textpurify.com directly?
No — call the RapidAPI gateway host textpurify.p.rapidapi.com with the X-RapidAPI-Key you get after subscribing. RapidAPI handles authentication, rate limiting and billing; the origin only accepts requests proxied through it.
What's the difference between /detect and /clean?
/detect is read-only: it tells you exactly which hidden characters a string contains, by code point and category, without changing anything. /clean returns a sanitized copy. Use detect for auditing/moderation and clean for normalization.
Will it corrupt emoji or non-Latin text?
No. Emoji sequences, emoji variation selectors, and the zero-width joiners that are required inside Arabic, Persian and Indic words are detected and preserved. Only stray, unnecessary invisible characters are removed.
Is there a free tier?
Yes — 1,000 requests per month at no cost, no credit card required to start. Upgrade to Pro or Ultra when you need more volume.