# Redact personal data from text before sending it to an LLM

**Use case:** 

Replace e-mails, phone numbers, IBANs, card numbers, national ID numbers, IP addresses and API keys in a text with placeholders such as [EMAIL_1], so the text can be sent to an LLM safely.

## Input

```json
{
  "texts": [
    "Hi, I am Maria Example (maria@example.com, +44 20 7946 0958). Please refund card 4111 1111 1111 1111 or pay to IBAN GB82 WEST 1234 5698 7654 32. Our server is 203.0.113.7 and the AWS key is AKIAIOSFODNN7EXAMPLE."
  ],
  "urls": [],
  "inlineDocuments": [],
  "entities": [
    "EMAIL",
    "PHONE",
    "IBAN",
    "PAYMENT_CARD",
    "BG_EGN",
    "NATIONAL_ID",
    "IP_ADDRESS",
    "SECRET"
  ],
  "customTerms": [
    "Maria Example"
  ],
  "mode": "placeholder",
  "includeDetails": true,
  "includeOriginalValues": false,
  "removeHeadersFooters": false,
  "maxPagesPerDocument": 200,
  "maxFileSizeMb": 25
}
```

## Output

```json
{
  "source": {
    "label": "Source",
    "format": "string"
  },
  "status": {
    "label": "Status",
    "format": "string"
  },
  "format": {
    "label": "Format",
    "format": "string"
  },
  "totalFindings": {
    "label": "Findings",
    "format": "integer"
  },
  "findings": {
    "label": "By type",
    "format": "object"
  },
  "warnings": {
    "label": "Warnings",
    "format": "array"
  },
  "error": {
    "label": "Error",
    "format": "string"
  },
  "redactedText": {
    "label": "Redacted text",
    "format": "string"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The PII Redactor for GDPR & LLM Pipelines Actor is ready to run with the inputs already set for "Redact personal data from text before sending it to an LLM". [Sign up or log in](https://console.apify.com/create-task-from-example/mkeH20dbptmjeUTsS) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Redact personal data from text before sending it to an LLM" task

The PII Redactor for GDPR & LLM Pipelines Actor will start running based on the input automatically. You can also change all the input fields, like texts, document urls, and more, to match your specific use case.

### 3. Receive the "Redact personal data from text before sending it to an LLM" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as source, status, format, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Redact personal data from text before sending it to an LLM" task via API](https://apify.com/praised_tumbler/pii-redactor-eu-gdpr.md).

## FAQ

### Is my data sent to an external AI service?

No. Everything runs inside the Actor on the Apify platform; no external AI, OCR or redaction API is called.

### Will random numbers be masked by mistake?

Rarely. Cards must pass the Luhn check, IBANs their checksum and national ID numbers the rule of their country, so order numbers are mostly left alone.

### Can it redact names?

Names are not guessed. List the names or other terms you want removed in "customTerms".

## About this Actor

This example demonstrates how to use [PII Redactor for GDPR & LLM Pipelines](https://apify.com/praised_tumbler/pii-redactor-eu-gdpr.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/praised_tumbler/pii-redactor-eu-gdpr.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/praised_tumbler/pii-redactor-eu-gdpr.md

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).
