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, DEFAULT_PRIORITY
from fastpii.countries.fr import FrenchPack

engine = FastPII(priority=DEFAULT_PRIORITY)
engine.register(FrenchPack())
result = engine.detect("SIREN: 552120222", detector_names=["siren"])

Validate a value directly

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

engine = FastPII(priority=DEFAULT_PRIORITY)
engine.register(FrenchPack())
result = engine.validate("552120222", "siren")

print(result.is_valid)

Detect in free text

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

engine = FastPII(priority=DEFAULT_PRIORITY)
engine.register(FrenchPack())
result = engine.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