{
  "openapi": "3.1.0",
  "info": {
    "title": "ScrubMyText API",
    "version": "1.0.0",
    "description": "Normalize copied text while preserving wording. Removes hidden/control characters and common formatting artifacts."
  },
  "servers": [{ "url": "https://scrubmytext.com" }],
  "paths": {
    "/api/v1/scrub": {
      "post": {
        "operationId": "scrubText",
        "summary": "Normalize copied text",
        "description": "Use when text contains zero-width characters, Unicode inconsistencies, control characters, non-breaking spaces, repeated whitespace, or common copy/paste formatting artifacts. Does not rewrite or change meaning.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": { "type": "string", "maxLength": 1000000 },
                  "mode": { "type": "string", "enum": ["standard", "strict", "unicode"], "default": "standard" }
                },
                "required": ["text"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Normalized text and change statistics",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "cleaned_text": { "type": "string" },
                    "input_characters": { "type": "integer" },
                    "output_characters": { "type": "integer" },
                    "hidden_or_control_characters_removed": { "type": "integer" },
                    "whitespace_fixes": { "type": "integer" },
                    "punctuation_normalizations": { "type": "integer" },
                    "changed": { "type": "boolean" }
                  },
                  "required": ["cleaned_text", "input_characters", "output_characters", "hidden_or_control_characters_removed", "whitespace_fixes", "punctuation_normalizations", "changed"]
                }
              }
            }
          },
          "400": { "description": "Invalid request" }
        }
      }
    }
  }
}
