Skip to main content

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.

Base URL
https://cleantextlab.com/api/v1
Authentication
x-api-key: YOUR_API_KEY

Available Endpoints

POST/v1/run

Execute 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:

trim-linescollapse-spacesupper-caselower-caseremove-line-breakssort-remove-duplicatesjson-formattertitle-casesanitize-url

Rate Limits

API access requires a Pro subscription.

PlanRequestsWindowPrice
Pro5,00024 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.

Example Key: ctl_live_a1b2c3d4e5f6g7h8...
curl -H "x-api-key: YOUR_API_KEY" \
  https://cleantextlab.com/api/v1/sanitize

Getting Your API Key

  1. Upgrade to Pro at /pricing
  2. Navigate to Settings
  3. Find the "API Keys" section
  4. Click "Generate New API Key" (or "Retrieve Key")
  5. Copy and securely store your key (keys are shown masked by default)
  6. You can rotate your key at any time for security

Error Codes

401

Unauthorized

Missing or invalid API key

429

Too Many Requests

Rate limit exceeded (5,000 requests per 24 hours for Pro)

400

Bad 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 GitHub

Support & Feedback

API Version 1.0 • Last updated December 2025 • For enterprise API needs, contact our team.

API Documentation | CleanTextLab