Datenmaske

For system integrators and firm IT

Automating Datenmaske Secure.

Four interfaces, one principle: everything runs on the same machine as the app. The API server binds 127.0.0.1 only — no document byte ever crosses a network interface.

The pipeline behind the API is identical to the UI: same detection, same fail-closed verification, same residual check after export.

Four ways to integrate

REST API (local)

Detect and redact over HTTP on 127.0.0.1 — for scripts and integrations on the same machine.

Hot folder

Watch a folder: new files flow into review automatically — or, in “Auto” mode, straight into a fail-closed export.

Explorer context menu

Right-click a PDF → “Schwärzen mit Datenmaske” — open from any folder with one click.

MSI + GPO

Deploy via group policy or Intune; central settings for updates, model download and the hot folder.

Requirements

Enabling the REST API

The API ships off. Enable it in Settings, per workstation; you choose the key yourself (it is not generated) and it stays local to the app.

  1. Settings → System → “Local REST API”.
  2. Enter a port (default 47190) and an API key of your choosing. Without a key the server refuses to start at all (fail-closed).
  3. Click “Start”. The status turns active and the API is reachable.
  4. From the next app start onward the API starts automatically as long as key and switch are set.

First request (health)

curl.exe

curl.exe http://127.0.0.1:47190/api/v1/health

PowerShell

Invoke-RestMethod http://127.0.0.1:47190/api/v1/health

→ {"status":"ok"} (no key required — liveness only, no document data)

Detect: POST /api/v1/detect

The request carries the PDF Base64-encoded. The response lists every finding with page number, box coordinates (PDF points, origin top-left), type, confidence and source (regex/model). These exact boxes are what you pass to redact next.

PowerShell

$key  = "MEIN-SCHLUESSEL"
$pdf  = [Convert]::ToBase64String([IO.File]::ReadAllBytes("C:\Akten\gutachten.pdf"))

$det = Invoke-RestMethod -Method Post -Uri http://127.0.0.1:47190/api/v1/detect  -Headers @{ Authorization = "Bearer $key" } -ContentType "application/json"  -Body (@{ pdfB64 = $pdf } | ConvertTo-Json)

$det.suggestions | Select-Object pageNumber, sensitivityType, confidence, source
suggestions[].pageNumber Page, 1-based
suggestions[].bboxX / bboxY / bboxWidth / bboxHeight Box in PDF points
suggestions[].sensitivityType e.g. name, iban, birth_date
suggestions[].confidence 0–99
suggestions[].source regex (rules/checksums) or ner (language model)

Redact: POST /api/v1/redact

The detect boxes are grouped into pages. The response returns the redacted PDF (Base64) and a report; report.outputUsable is the trust signal: false means verification found a leftover and the file was discarded.

! Without human review: the script redacts only what detection finds. outputUsable confirms removal, not completeness. For files with names, free text or scans: spot-check the results or use the hot folder in “Review” mode.

PowerShell

# Boxen aus $det nach Seite gruppieren und schwärzen
$pages = $det.suggestions | Group-Object pageNumber | ForEach-Object {
  @{
    pageNumber = [int]$_.Name
    rects      = $_.Group | ForEach-Object {
      @{ x = $_.bboxX; y = $_.bboxY; width = $_.bboxWidth; height = $_.bboxHeight }
    }
  }
}

$resp = Invoke-RestMethod -Method Post  -Uri     http://127.0.0.1:47190/api/v1/redact  -Headers @{ Authorization = "Bearer $key" } -ContentType "application/json"  -Body    (@{ pdfB64 = $pdf; pages = $pages; style = "black" } | ConvertTo-Json -Depth 6)

if ($resp.report.outputUsable) {
  [IO.File]::WriteAllBytes("C:\Akten\gutachten_geschwaerzt.pdf",
    [Convert]::FromBase64String($resp.pdfB64))
} else {
  # Fail-closed: Ausgabe wurde verworfen — Funde prüfen (remainingPii)
  $resp.report.remainingPii
}
pages[].pageNumber / rects[].x,y,width,height Boxes from detect, 1-based pages
style black (default), white, blur or pixelate
anonymize Placeholders like [NAME_1] instead of bars
resiscan Image-only PDF (text layer destroyed)
report.outputUsable / remainingPii Verification passed / number of leftovers

401 unauthorized · 400 bad body/base64 · 404 not found · 500 {error}

Three recipes

A · Route RA-MICRO / e-file exports into a hot folder

  1. In RA-MICRO, point the file export (PDF) at a network folder, e.g. \\firm-server\datenmaske\eingang.
  2. In Datenmaske: Settings → Folders → add that folder as a hot folder.
  3. Mode “Review” (default): every new file lands in the library for review; the original moves to the verarbeitet subfolder after processing.
  4. Mode “Auto” only for stocks of structured data: exports automatically, fail-closed, to redigiert/<name>_redigiert.pdf. Names and free text ALWAYS go to review — the automation is deliberately narrower than detection.
  5. SHA-256 dedup: the same file (even renamed) is never processed twice per user.

B · Nightly batch via script

  1. On the workstation running Datenmaske, create a scheduled task (PowerShell).
  2. The script below reads a folder, detects, redacts and checks outputUsable — discarded outputs stay visible in the rejected folder.
  3. Note: the script runs in the logged-in user’s context; the API listens on that user’s 127.0.0.1 only.

C · Roll out three workstations via MSI and GPO

  1. Put the MSI on a network share; assign it via GPO (Computer Configuration → Software Installation) or Intune — silent: msiexec /i Datenmaske-Secure-setup.msi /qn.
  2. For air-gapped networks use the full installer (Datenmaske-Secure-full.msi): it bundles the AI models; the first start downloads nothing.
  3. Place the ADMX templates centrally; policies under HKLM\SOFTWARE\Policies\Mokka\Datenmaske are read on every start: AutoUpdateMode (disable/notify/auto), BlockModelDownload (1 = block model download, for air-gap), HotFolderPath (central watch folder).
  4. Enter the license key on each workstation (app start or via key file); the Explorer context menu is enabled once per user in Settings → System.

B · Nightly batch via script

PowerShell · batch.ps1

$key  = "MEIN-SCHLUESSEL"
$eingang = "C:\Akten\eingang"
$ok      = "C:\Akten\geschwaerzt"
$nein    = "C:\Akten\abgelehnt"
$archiv = Join-Path $eingang "verarbeitet"
New-Item -ItemType Directory -Force $ok, $nein, $archiv | Out-Null

Get-ChildItem $eingang -Filter *.pdf | ForEach-Object {
  $pdf = [Convert]::ToBase64String([IO.File]::ReadAllBytes($_.FullName))
  $det = Invoke-RestMethod -Method Post -Uri http://127.0.0.1:47190/api/v1/detect  -Headers @{ Authorization = "Bearer $key" } -ContentType "application/json" -Body (@{ pdfB64 = $pdf } | ConvertTo-Json)

  $pages = @($det.suggestions | Group-Object pageNumber | ForEach-Object {
    @{ pageNumber = [int]$_.Name; rects = @($_.Group | ForEach-Object {
      @{ x = $_.bboxX; y = $_.bboxY; width = $_.bboxWidth; height = $_.bboxHeight } }) } })

  $resp = Invoke-RestMethod -Method Post -Uri http://127.0.0.1:47190/api/v1/redact  -Headers @{ Authorization = "Bearer $key" } -ContentType "application/json" -Body (@{ pdfB64 = $pdf; pages = $pages } | ConvertTo-Json -Depth 6)

  if ($resp.report.outputUsable) {
    [IO.File]::WriteAllBytes((Join-Path $ok $_.Name),
      [Convert]::FromBase64String($resp.pdfB64))
    Move-Item $_.FullName (Join-Path $archiv $_.Name) -Force
  } else {
    Move-Item $_.FullName $nein -Force   # fail-closed: bleibt sichtbar
  }
}

! Without human review: the script redacts only what detection finds. outputUsable confirms removal, not completeness. For files with names, free text or scans: spot-check the results or use the hot folder in “Review” mode.

What the interfaces do not do

Distinction from the web API

This page describes the local desktop API. The web/cloud edition of Datenmaske (redact_pdf, detect_pii, get_report with an API key) is documented on the API documentation page — same ideas, different infrastructure. → /en/api-dokumentation

Further reading