Prompt PII Redactor and Reversible Anonymizer avatar

Prompt PII Redactor and Reversible Anonymizer

Pricing

from $1.50 / 1,000 prompt scrubbeds

Go to Apify Store
Prompt PII Redactor and Reversible Anonymizer

Prompt PII Redactor and Reversible Anonymizer

Scrubs emails, credit cards, phone numbers, API keys, and SSNs from LLM prompts and provides a reversible mapping table.

Pricing

from $1.50 / 1,000 prompt scrubbeds

Rating

0.0

(0)

Developer

Nadim Hider

Nadim Hider

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

11 days ago

Last modified

Categories

Security

Limited permissions

Share

A deterministic, high-throughput security proxy Actor for Large Language Models (LLMs) and autonomous workflows. Automatically scrubs Personal Identifiable Information (PII) including emails, phone numbers, credit card numbers (verified via Luhn checksum), US Social Security Numbers (SSN), IPv4 addresses, and sensitive API keys.


Why Use This Actor?

Sending customer personally identifiable information into public LLM APIs violates GDPR, HIPAA, and enterprise compliance standards.

This Actor provides reversible anonymization:

  • Replaces PII entities with numbered tokens (<EMAIL_1>, <PHONE_1>, <CREDIT_CARD_1>).
  • Returns a deterministic mapping dictionary alongside the sanitized prompt.
  • Enables your downstream agent to substitute original values back into the LLM output.
  • Operates locally with zero external network transmission.

Dual Output Envelope (Agent Native)

Every response contains structured redactions and a markdown summary ready for context injection:

{
"id": "prompt-001",
"success": true,
"meta": {
"processing_time_ms": 1.2,
"items_count": 1
},
"data": {
"sanitized_text": "Hello, my name is John Doe. My email is <EMAIL_1>, my phone number is <PHONE_1>, and my corporate card is <CREDIT_CARD_1>. Also here is my secret token: <API_KEY_1>.",
"entities_found_count": 4,
"entity_breakdown": {
"EMAIL": 1,
"PHONE": 1,
"CREDIT_CARD": 1,
"API_KEY": 1,
"SSN": 0,
"IP_ADDRESS": 0
},
"detected_types": ["EMAIL", "PHONE", "CREDIT_CARD", "API_KEY"],
"mapping_table": {
"<EMAIL_1>": "john.doe@enterprise.com",
"<PHONE_1>": "+1-555-839-2918",
"<CREDIT_CARD_1>": "4532-0150-1234-5678",
"<API_KEY_1>": "sk-live-99a81b2c3d4e5f"
}
},
"markdown_summary": "### PII Vault Scrubbing Summary\n- Total Entities Redacted: 4\n- Detected Types: EMAIL, PHONE, CREDIT_CARD, API_KEY\n- Latency: 1.2ms\n"
}

Input Schema

FieldTypeDefaultDescription
itemsArray of ObjectsSample PromptArray of objects with id and text to scrub.
mask_credit_cardsBooleantrueValidates numbers via Luhn checksum before masking.
mask_api_keysBooleantrueDetects OpenAI, AWS, GitHub, and Slack secret keys.

Pay-Per-Event (PPE) Pricing

  • Primary Event: prompt-scrubbed
  • Cost: $0.0015 per prompt ($1.50 per 1,000 prompts).
  • Initial 5 seconds of compute are waived via apify-actor-start.

Integration Code in 10+ Languages

cURL

curl -X POST "https://api.apify.com/v2/acts/n4d.h1dr~llm-pii-vault/runs?token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"items": [{"id": "p1", "text": "Contact me at alice@bank.com with card 4532015012345678"}]}'

Python

from apify_client import ApifyClient
client = ApifyClient("YOUR_API_TOKEN")
run = client.actor("n4d.h1dr/llm-pii-vault").call(run_input={
"items": [{"id": "p1", "text": "Call me at +1-555-234-5678"}]
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
print(item["data"]["sanitized_text"])

Node.js / TypeScript

import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });
const run = await client.actor('n4d.h1dr/llm-pii-vault').call({
items: [{ id: 'p1', text: 'Email is user@example.com' }]
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items[0].data.mapping_table);

Go

package main
import (
"bytes"
"net/http"
)
func main() {
url := "https://api.apify.com/v2/acts/n4d.h1dr~llm-pii-vault/runs?token=YOUR_API_TOKEN"
payload := []byte(`{"items": [{"id": "p1", "text": "Email user@domain.com"}]}`)
http.Post(url, "application/json", bytes.NewBuffer(payload))
}

Ruby

require 'net/http'
require 'json'
uri = URI('https://api.apify.com/v2/acts/n4d.h1dr~llm-pii-vault/runs?token=YOUR_API_TOKEN')
req = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
req.body = { items: [{ id: 'p1', text: 'Email me at admin@corp.com' }] }.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }

PHP

<?php
$ch = curl_init('https://api.apify.com/v2/acts/n4d.h1dr~llm-pii-vault/runs?token=YOUR_API_TOKEN');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'items' => [['id' => '1', 'text' => 'Call 555-123-4567']]
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$res = curl_exec($ch);

Java

import java.net.URI;
import java.net.http.*;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.apify.com/v2/acts/n4d.h1dr~llm-pii-vault/runs?token=YOUR_API_TOKEN"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{\"items\": [{\"id\": \"1\", \"text\": \"Card 4532015012345678\"}]}"))
.build();
client.send(request, HttpResponse.BodyHandlers.ofString());
}
}

C# (.NET)

using System.Net.Http.Json;
var client = new HttpClient();
var payload = new { items = new[] { new { id = "1", text = "Card 4532015012345678" } } };
await client.PostAsJsonAsync("https://api.apify.com/v2/acts/n4d.h1dr~llm-pii-vault/runs?token=YOUR_API_TOKEN", payload);

Rust

use reqwest::Client;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let res = client.post("https://api.apify.com/v2/acts/n4d.h1dr~llm-pii-vault/runs?token=YOUR_API_TOKEN")
.json(&serde_json::json!({"items": [{"id": "1", "text": "Call me"}]}))
.send().await?;
Ok(())
}

Swift

import Foundation
var request = URLRequest(url: URL(string: "https://api.apify.com/v2/acts/n4d.h1dr~llm-pii-vault/runs?token=YOUR_API_TOKEN")!)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = try? JSONSerialization.data(withJSONObject: ["items": [["id": "1", "text": "Sensitive data"]]])
URLSession.shared.dataTask(with: request).resume()

n8n / Make.com Webhook Node

Add an HTTP Request node in n8n or Make:

  • Method: POST
  • URL: https://api.apify.com/v2/acts/n4d.h1dr~llm-pii-vault/runs?token=YOUR_API_TOKEN
  • Body Parameters: { "items": [ { "id": "={{ $json.id }}", "text": "={{ $json.user_prompt }}" } ] }