Deep PII/secret guard for documents and URLs (paid)
pii_guard_documentsDetect, redact, or restore PII and secrets in documents and URLs, including person names, addresses, and PDFs, when you need NER or hosted file scanning.
Instructions
WHAT: Runs the Fairquery Apify Actor llm-data-guard-pii-secrets: everything pii_scan_text does PLUS person-name/location NER, street addresses, public document URLs (txt/md/json/csv/HTML/PDF text layer, <= 10 MB) and restore mode (put originals back into LLM output using a placeholder map). WHEN: Only when you need NER names/addresses, files at URLs/PDFs, or the hosted pipeline; for plain text with regex-detectable PII/secrets use pii_scan_text / pii_redact_text (free, local). WHEN NOT: Plain text scans (pii_scan_text / pii_redact_text, free), restoring placeholders in an LLM answer (pii_restore_text, free, same result as restore mode), images (no OCR), email deliverability. COST: Paid, billed to YOUR Apify account via your APIFY_TOKEN: $0.0015 per document + $0.0002 per finding. Example: 10 docs with 20 findings ~ $0.02. RETURNS: Paged "document" rows (findings masked; output_text in redact/restore modes) or "error" rows. Tool errors: APIFY_TOKEN_MISSING, APIFY_TOKEN_INVALID, APIFY_PAYMENT_REQUIRED, APIFY_ACTOR_RUN_FAILED, APIFY_TIMEOUT, INPUT_EMPTY. BEHAVIOR: Makes network calls: runs the Actor in your Apify account, which may fetch documentUrls. Latency seconds to a few minutes (300 s actor timeout). Up to 1000 texts / 100 URLs (10 MB each). PARAMETERS: texts and/or documentUrls: at least one non-empty (the schema marks both optional; neither -> INPUT_EMPTY, not billed); both may be combined and each text or URL becomes one billed document row. mode picks which other fields matter: "detect" ignores redactionStyle/returnPlaceholderMap; "redact" uses them; "restore" ignores all detector flags and only replaces placeholders found in texts using placeholderMap (pass the map from an earlier redact call; a placeholder missing from the map stays as is). returnPlaceholderMap works only with mode="redact" + redactionStyle="placeholder". detectNames / detectAddresses enable English NER (PERSON, LOCATION, STREET_ADDRESS; lower precision, slower) and are required before those names can be used in entityTypes. entityTypes / allowList: same semantics as pii_scan_text (case-insensitive, whole-value allow-list) but up to 1000 allow-list values. Cost scales with documents and findings, so narrow entityTypes to cut finding charges. limit/offset only page the returned rows: every call processes and bills the whole input again (also when only offset changes), so pick a limit (max 1000) that covers all rows instead of paging. EXAMPLE: {"documentUrls":["https://example.com/report.pdf"],"mode":"redact","detectNames":true}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Optional, one of "detect" | "redact" | "restore", default "redact". "detect" = findings only; "redact" = findings + output_text; "restore" = replace placeholders in texts with originals from placeholderMap. Example: "detect" | redact |
| limit | No | Optional page size: items to return, integer 1-1000 (default 100). Example: 50 | |
| texts | No | Optional if documentUrls is given (at least one of the two is required). 0-1000 documents as plain strings, each <= 1,000,000 chars; one billed document row each. Example: ["Mail jane@acme.com, key AKIAIOSFODNN7EXAMPLE"] | |
| offset | No | Optional zero-based number of items to skip, integer 0-1000000 (default 0); pass nextOffset from the previous response, e.g. 100 | |
| allowList | No | Optional, default []. 0-1000 exact values never flagged (whole value, case-insensitive). Example: ["support@yourco.com"] | |
| detectNames | No | Optional boolean, default false. true enables English person-name NER (type PERSON; lower precision, slower) | |
| entityTypes | No | Optional, default omitted = all enabled detectors. 0-40 type names from pii_list_detectors (case-insensitive), e.g. ["EMAIL","PERSON"]; PERSON/LOCATION/STREET_ADDRESS also need detectNames/detectAddresses | |
| entropyScan | No | Optional boolean, default false. true also flags unlabeled random-looking tokens (20+ chars) as HIGH_ENTROPY_STRING | |
| documentUrls | No | Optional if texts is given. 0-100 public http(s) URLs (<= 2000 chars) of txt/md/json/csv/HTML/PDF files (<= 10 MB each, PDF text layer only), fetched by the Actor in Apify cloud. Example: ["https://example.com/a.pdf"] | |
| placeholderMap | No | Optional; used only with mode="restore". Object mapping placeholder -> original value, as returned by an earlier redact call. Example: {"[EMAIL_1]":"jane@acme.com"} | |
| redactionStyle | No | Optional, one of "placeholder" | "mask" | "hash", default "placeholder"; used in mode="redact" only. placeholder = [EMAIL_1] (reversible), mask = j***@a***.com, hash = [EMAIL:3f2a9c0d1b7e] | placeholder |
| detectAddresses | No | Optional boolean, default false. true enables street-address patterns (STREET_ADDRESS) and place-name NER (LOCATION) | |
| returnPlaceholderMap | No | Optional boolean, default false. true adds placeholder_map (ORIGINAL values) to each row; only with mode="redact" and redactionStyle="placeholder" |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| meta | No | Tool-specific context (summary counts, cost notes, ...) | |
| count | Yes | Number of items in this page | |
| items | Yes | Result rows for this page | |
| total | Yes | Total items before paging | |
| offset | Yes | Offset of the first item in this page | |
| hasMore | Yes | True if more items exist after this page | |
| nextOffset | Yes | Offset to pass for the next page, or null |