Docs
API Documentation
Integrate CleanTextLab's text processing tools into your applications with our REST API.
Pro Feature
API access requires a Pro subscription for secure, high-volume integration.
Overview
The CleanTextLab API provides programmatic access to our text processing tools via simple REST endpoints. Perfect for automation, batch processing, and integrating text cleaning into your workflows.
https://cleantextlab.com/api/v1x-api-key: YOUR_API_KEYAvailable Endpoints
/v1/runExecute any CleanTextLab tool chain server-side. Pass a list of steps to run sequentially.
View Example
curl -X POST https://cleantextlab.com/api/v1/run \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": " Hello World ",
"steps": [
"trim-lines",
"upper-case"
]
}'
// Response:
{
"result": "HELLO WORLD",
"meta": {
"stepsExecuted": 2,
"processingTimeMs": 12
}
}Available Tools:
Rate Limits
API access requires a Pro subscription.
| Plan | Requests | Window | Price |
|---|---|---|---|
| Pro | 5,000 | 24 hours | $10/month |
Rate limit headers are included in all API responses: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
Authentication
All API requests require authentication via an API key. Include your key in the x-api-key header with every request.
curl -H "x-api-key: YOUR_API_KEY" \ https://cleantextlab.com/api/v1/sanitize
Error Codes
401Unauthorized
Missing or invalid API key
429Too Many Requests
Rate limit exceeded (5,000 requests per 24 hours for Pro)
400Bad Request
Invalid request body or parameters
Code Examples
JavaScript / Node.js
const response = await fetch('https://cleantextlab.com/api/v1/run', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
input: " messy set of words ",
steps: ["trim-lines", "title-case"]
})
});
const data = await response.json();
console.log(data.result);
// "Messy Set Of Words"Python
import requests
response = requests.post(
'https://cleantextlab.com/api/v1/run',
headers={'x-api-key': 'YOUR_API_KEY'},
json={
'input': ' messy set of words ',
'steps': ['trim-lines', 'title-case']
}
)
data = response.json()
print(data['result'])
# "Messy Set Of Words"cURL
curl -X POST https://cleantextlab.com/api/v1/run \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": " messy set of words ",
"steps": ["trim-lines", "title-case"]
}'Complete API Reference
For detailed parameter descriptions, response schemas, and advanced examples, see our complete API reference documentation.
View on GitHubSupport & Feedback
- Questions: Email gravitasse@gmail.com
- Bug Reports: Use the bug report form
- Feature Requests: Contact us at /contact