CLI Reference
Command-line interface reference for the fastpii-connect CLI tool.
CLI Reference
The fastpii-connect CLI provides command-line access to the FastPII AI Data Security Platform for quick sensitive data detection, protection, validation, and listing detectors.
Installation
pip install fastpii-connectAuthentication
Before using the CLI, save your API key:
fastpii-connect auth login --api-key fpk_your_api_keyYou can optionally specify a custom base URL:
fastpii-connect auth login --api-key fpk_your_api_key --base-url https://api.fastpii.comThe key is stored at ~/.fastpii/config.json. Check your authentication status:
fastpii-connect auth statusOutput:
API Key: fpk_abc1...xyz4
Base URL: https://api.fastpii.com
Config: /home/user/.fastpii/config.jsonCommands
scan
Detect PII in text.
fastpii-connect scan "My rodné číslo is 900101/1234"Options:
| Option | Short | Description |
|---|---|---|
--country | -c | ISO country code (e.g., CZ, PL, DE, FR) |
--language | -l | Language hint for detection |
--preset | -p | Privacy preset: conservative, balanced, aggressive |
--json | Output as JSON |
Examples:
# Basic detection
fastpii-connect scan "Email: jan.novak@example.cz, RČ: 8001011238"
# With country filter
fastpii-connect scan "RČ: 8001011238" --country CZ
# With privacy preset
fastpii-connect scan "Contact john@example.com" --preset aggressive
# JSON output
fastpii-connect scan "RČ: 8001011238" --country CZ --jsonRich table output:
Detected PII
┌──────────────┬──────────────────────┬─────────┬────────────┬───────────┐
│ Type │ Original │ Country │ Confidence │ Validated │
├──────────────┼──────────────────────┼─────────┼────────────┼───────────┤
│ email │ jan.novak@example.cz │ cz │ 0.95 │ ✗ │
│ rodne_cislo │ 8001011238 │ cz │ 1.00 │ ✓ │
└──────────────┴──────────────────────┴─────────┴────────────┴───────────┘
Countries detected: CZ
Processing time: 3.2msprotect
Protect PII in text using the specified mode.
fastpii-connect protect "My rodné číslo is 900101/1234" --mode replaceOptions:
| Option | Short | Description |
|---|---|---|
--mode | -m | Protection mode: replace, mask, hash, tokenize (default: replace) |
--country | -c | ISO country code |
--json | Output as JSON |
Examples:
# Replace mode (default)
fastpii-connect protect "RČ: 8001011238" --mode replace
# Mask mode
fastpii-connect protect "RČ: 8001011238" --mode mask
# Hash mode
fastpii-connect protect "RČ: 8001011238" --mode hash
# Tokenize mode
fastpii-connect protect "RČ: 8001011238" --mode tokenize
# With country filter
fastpii-connect protect "RČ: 8001011238" --mode mask --country CZ
# JSON output
fastpii-connect protect "RČ: 8001011238" --mode replace --jsonRich output:
Original: My rodné číslo is 900101/1234
Protected: My rodné číslo is [REDACTED]
Mode: replace
Protected Entities
┌──────────────┬──────────────┬──────────────┐
│ Type │ Original │ Protected │
├──────────────┼──────────────┼──────────────┤
│ rodne_cislo │ 900101/1234 │ [REDACTED] │
└──────────────┴──────────────┴──────────────┘
Processing time: 4.1msvalidate
Validate a specific PII identifier.
fastpii-connect validate 9001011234 --type rodne_cisloOptions:
| Option | Short | Description |
|---|---|---|
--type | -t | Entity type to validate against (required) |
--country | -c | ISO country code |
--json | Output as JSON |
Examples:
# Validate a rodné číslo
fastpii-connect validate 9001011234 --type rodne_cislo --country CZ
# Validate a PESEL
fastpii-connect validate 44051401458 --type pesel --country PL
# Validate a Steuer-ID
fastpii-connect validate 86095742719 --type steuer_id --country DE
# JSON output
fastpii-connect validate 9001011234 --type rodne_cislo --jsonOutput:
rodne_cislo: 9001011234
Result: ✓ Valid
Confidence: 1.00
Country: CZdetectors
List available PII detectors.
fastpii-connect detectorsOptions:
| Option | Short | Description |
|---|---|---|
--country | -c | Filter by ISO country code |
--json | Output as JSON |
Examples:
# List all detectors
fastpii-connect detectors
# Filter by country
fastpii-connect detectors --country CZ
# JSON output
fastpii-connect detectors --country CZ --jsonOutput:
Available Detectors (15)
┌──────────────────┬──────────────────────────┬─────────┬────────────┐
│ Name │ Description │ Region │ Category │
├──────────────────┼──────────────────────────┼─────────┼────────────┤
│ rodne_cislo │ Czech birth number │ cz │ personal │
│ ico │ Czech company ID │ cz │ business │
│ email │ Email address │ cz │ personal │
│ ... │ ... │ ... │ ... │
└──────────────────┴──────────────────────────┴─────────┴────────────┘auth login
Save your API key for CLI use.
fastpii-connect auth login --api-key fpk_your_api_keyOptions:
| Option | Short | Description |
|---|---|---|
--api-key | -k | Your FastPII API key (required, will prompt if not provided) |
--base-url | -u | API base URL (default: https://api.fastpii.com) |
auth status
Show saved authentication status.
fastpii-connect auth statusOutput:
API Key: fpk_abc1...xyz4
Base URL: https://api.fastpii.com
Config: /home/user/.fastpii/config.jsonConfig file
Authentication details are stored at ~/.fastpii/config.json:
{
"api_key": "fpk_your_api_key",
"base_url": "https://api.fastpii.com"
}Exit codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Error (authentication, rate limit, quota, or general) |
Error messages
The CLI provides clear error messages:
Error: Invalid API key. Run fastpii-connect auth login first.
Error: Rate limit exceeded. Retry after 60s.
Error: Monthly quota exceeded.
Error: Request error: Text exceeds 50000 character limit