Add generic /api/mask endpoint for standalone text masking
authorStefan Gasser <redacted>
Wed, 21 Jan 2026 06:14:05 +0000 (07:14 +0100)
committerStefan Gasser <redacted>
Wed, 21 Jan 2026 06:43:21 +0000 (07:43 +0100)
commit2616333de57733fadece292ae43e1f174b298151
treefb63eb2bf99d7c00760bd725a13204fca38d236f
parent4d2a80a4bd362dcb11dc78a5832afbb6e11af2e3
Add generic /api/mask endpoint for standalone text masking

Adds a new POST /api/mask endpoint that can be used by browser extensions,
CLIs, or any client that needs to mask PII and secrets independently of
the OpenAI/Anthropic proxy routes.

Features:
- Detects and masks both PII and secrets (configurable via detect param)
- Returns context mapping for client-side unmasking
- Supports multi-turn conversations via startFrom counters
- Auto-detects language or accepts explicit language parameter
- Logs requests to dashboard for visibility
- Rejects whitespace-only text input
- Consistent error handling for both PII and secrets detection
docs/api-reference/mask.mdx [new file with mode: 0644]
docs/mint.json
src/index.ts
src/routes/api.test.ts [new file with mode: 0644]
src/routes/api.ts [new file with mode: 0644]
src/routes/utils.ts
src/services/logger.ts
git clone https://git.99rst.org/PROJECT