CodeCleano API Documentation

Programmatic access to our code cleaning and refactoring engine. Process individual files or entire repositories.

Authentication

All API requests require an API key sent in the X-API-Key header.

curl -H "X-API-Key: your_api_key_here" https://api.codecleano.ai/v1/clean

Endpoints

POST /v1/clean

Clean and refactor a single code file.

Request

{
  "code": "def messy(x,y):\n    return x+y if x>y else 0",
  "language": "python",
  "options": {
    "rename_vars": true,
    "extract_methods": true,
    "optimize": true
  }
}

Response

{
  "cleaned_code": "def calculate_sum(x, y):\n    return x + y if x > y else 0",
  "changes_made": 2,
  "execution_time": "0.45s"
}
POST /v1/clean-repo

Process an entire repository from GitHub, GitLab, or Bitbucket.

Request

{
  "repo_url": "https://github.com/user/repo",
  "language": "javascript",
  "branch": "main",
  "options": {
    "max_file_size": 10000,
    "ignore_tests": true
  }
}

Response

{
  "repo_name": "user/repo",
  "files_processed": 42,
  "issues_found": 127,
  "download_url": "https://storage.codecleano.ai/clean-repos/abc123.zip",
  "summary": "Found 15 variables to rename\nExtracted 8 methods\nFixed 32 style violations...",
  "execution_time": "2m 15s"
}

Rate Limits

Free Tier

  • 20 requests/hour
  • Max file size: 50KB
  • Basic refactoring

Pro Tier

  • 100 requests/hour
  • Max file size: 500KB
  • Advanced optimizations

Enterprise

  • Unlimited requests
  • No size limits
  • Custom models