AnonAPI is a lightweight and modular FastAPI-based web service designed to scramble, encrypt, and decrypt text data securely and efficiently. Ideal for developers building anonymization, obfuscation, or text protection tools in applications ranging from testing to privacy-focused deployments.
AnonAPI is a privacy-focused, FastAPI-powered microservice designed for scrambling and unscrambling text data. It allows developers and testers to anonymize sensitive information quickly and securely via a RESTful API. Perfect for use in data masking, testing pipelines, secure logging, or any situation where text obfuscation is required.
http://127.0.0.1:8000/docs#/default/scramble_file_api_scramble_upload_post
- ✅ Build a lightweight API to scramble and unscramble sensitive text.
- ✅ Enable easy integration into any service using simple HTTP endpoints.
- ✅ Ensure the application is containerized and production-ready using Docker.
- ✅ Provide flexible text processing with features like: - Character-level scrambling - Word-level scrambling - Sentence-level permutation - Reversible unscrambling (optional, using deterministic methods)
In many real-world applications, especially in testing or demo environments, exposing real user or sensitive data can violate compliance rules (like GDPR, HIPAA). AnonAPI is designed to:
- 🛡 Protect real data by obfuscating it
- 🔁 Reverse scrambling when needed
- ⚙️ Easily deploy and integrate with other tools
- 🐳 Run in isolated environments using Docker
-
Description: Returns the input text as-is, with no modification.
-
Example:
Input: Hello World Output: Hello World
-
Description: Produces a consistent random shuffling of characters based on a fixed seed value.
-
Example:
Input: Hello Seed: 42 Output: loHel (consistent for seed=42)
-
Description: Applies a Caesar cipher by shifting each letter by a fixed number of positions in the alphabet.
-
Example:
Input: Hello Shift: 3 Output: Khoor
###4. Rot13 Model:
-
Description: A special case of Caesar cipher with a fixed shift of 13.
-
Example:
Input: Hello Output: Uryyb
-
Description: Reverses the input string.
-
Example:
Input: Hello Output: olleH
-
Description: Converts English words into Pig Latin.
-
Example:
Input: Hello World Output: elloHay orldWay
-
Description: Applies the Vigenère cipher using a keyword.
-
Example:
Input: Hello Keyword: key Output: Rijvs
-
Description: Encodes the input text to Base64 format.
-
Example:
Input: Hello Output: SGVsbG8=
-
Description: Translates text to Morse code.
-
Example:
Input: Hello Output: .... . .-.. .-.. ---
-
Description: Converts each character to its binary (ASCII) representation.
-
Example:
Input: Hi Output: 01001000 01101001
-
Description: Converts text to "leet speak" (1337), replacing letters with look-alike numbers or symbols.
-
Example:
Input: Hello Output: H3ll0
-
Description: Replaces words with their synonyms using an NLP library like WordNet.
-
Example:
Input: Fast runner Output: Quick sprinter
-
Description: Translates words or concepts into emojis when possible.
-
Example:
Input: I love pizza Output: I ❤️ 🍕
-
✅ Scramble API
Accepts plain text and scrambles predefined sensitive entities (names, locations, etc.). Returns scrambled version along with mapping key.
-
✅ Descramble API
Accepts scrambled text and a mapping key to return the original text. Helpful for reversible anonymization during debugging or controlled testing.
-
✅ NLTK Support
Uses NLTK models (e.g., named entity recognition) to identify PII.
-
✅ Regex-based Fallback
For cases where NLTK fails, regex-based matching ensures fallback anonymization.
-
✅ Modular Design
Code is cleanly separated into modules for app logic, routing, and utility functions.
-
✅ Dockerized Deployment
Container-ready for easy deployment using:
docker build -t fastapi-scrambler . docker run -d -p 8000:8000 fastapi-scrambler
-
✅ Test Files Support
Includes test_files/ folder with sample inputs for local experiments.
-
Clone the Repo
git clone https://github.com/your-username/data-scrambler-api.git cd data-scrambler-api
-
Install Dependencies
pip install -r requirements.txt python nltk_setup.py
-
Run Locally
uvicorn app.main:app --reload Visit: http://localhost:8000/docs for Swagger UI.
-
🐳 Run with Docker
docker build -t fastapi-scrambler . docker run -d -p 8000:8000 fastapi-scrambler
Use files inside test_files/ for testing the API endpoints with real-world examples.
- Only anonymizes named entities (persons, locations, dates).
- You can extend it to support emails, phone numbers, or custom regex patterns.
- Key mappings are stored in-memory or passed externally — ensure security in real deployments.