FastPII Docs
Detectors

SIREN

Detect and validate French business identification numbers with Luhn checksum.

Purpose

Use the siren detector for French business identification numbers (SIREN — Système d'Identification du Répertoire des Entreprises).

Detector Name

siren

Supported Formats

  • 9 digits: 552120222

SIREN is always exactly 9 digits.

Validation Logic

  1. Require exactly 9 digits.
  2. Run the Luhn checksum algorithm.

Checksum Algorithm (Luhn)

  1. Starting from the rightmost digit, double every second digit.
  2. If doubling produces a number greater than 9, subtract 9.
  3. Sum all digits.
  4. The total must be divisible by 10.

Python Examples

from fastpii import FastPII
from fastpii.countries.fr import FrenchPack

priority = {"siren": 100, "email": 70, "name": 50, "phone": 20}
engine = FastPII(priority=priority)
engine.register(FrenchPack())
result = engine.detect("SIREN: 552120222", detector_names=["siren"])

Convenience API

from fastpii import PrivacyGuard

guard = PrivacyGuard(regions=["fr"])
result = guard.validate("552120222", "siren")

print(result.is_valid)

Convenience API — Detect in free text

from fastpii import PrivacyGuard

guard = PrivacyGuard(regions=["fr"])
result = guard.detect("SIREN: 552120222")

for finding in result.findings:
    print(finding.type, finding.value)

Limitations

  • SIREN is specific to French business identification.
  • The detector requires context words like "SIREN" or nearby business terms to reduce false positives on other 9-digit numbers.

On this page