FastPII Docs
Integrations

CLI

Use the FastPII command-line interface to detect PII, validate identifiers, and list available detectors.

CLI reference

FastPII ships with a fastpii command that supports detection, validation, and detector listing from the terminal.

Installation

pip install fastpii

Setup

After installation, the CLI entry point is available as:

fastpii

Usage examples

Detect PII in inline text

fastpii detect "Jan Novak, rodne cislo 8001011234"

Detect PII from a file

fastpii detect --file ./document.txt

Detect PII and write JSON output to a file

fastpii detect "Jan Novak, rodne cislo 8001011234" --format json --output ./result.json

Validate an identifier

fastpii validate 8001011234 --detector rodne_cislo

List available detectors

fastpii list-detectors

Commands reference

fastpii detect <text>

You can pass text directly:

fastpii detect "some text"

Or read from a file:

fastpii detect --file ./document.txt

Options:

  • --file, -f: read text from a file path
  • --regions, -r: list of regions, default cz
  • --format, -fmt: json or text, default text
  • --output, -o: write output to a file

If neither text nor --file is provided, the command exits with an error.

fastpii validate <value> --detector <name>

fastpii validate 8001011234 --detector rodne_cislo

Options:

  • --detector, -d: required detector name
  • --regions, -r: list of regions, default cz
  • --format, -fmt: json or text, default text

If the detector is unknown, the CLI prints an error and shows available detectors.

fastpii list-detectors

fastpii list-detectors

Options:

  • --regions, -r: list of regions, default cz
  • --format, -fmt: json or text, default text

Output reference

Detect output fields

JSON output from detect contains:

{
  "text": "string",
  "findings": [
    {
      "type": "string",
      "value": "string",
      "start": 0,
      "end": 0,
      "confidence": 0.0,
      "region": "string",
      "metadata": {}
    }
  ],
  "detector_names": ["string"],
  "processing_time_ms": 0
}

Validate output fields

JSON output from validate contains:

{
  "detector": "string",
  "value": "string",
  "is_valid": true,
  "metadata": {}
}

On this page