---
title: "Redaction API"
canonical_url: "https://www.nutrient.io/guides/dws-processor/tools-and-api/redaction-api/"
md_url: "https://www.nutrient.io/guides/dws-processor/tools-and-api/redaction-api.md"
last_updated: "2026-05-27T19:59:03.131Z"
description: "Permanently redact and remove sensitive information from PDF files using the redaction API. The API removes text, images, and vector content from specified regions."
---

# Redaction API

This guide shows you how to use the redaction API to permanently remove sensitive information — including PII and content subject to compliance requirements — from PDF documents. For an overview of the redaction API with signup, pricing, and code examples, see the [redaction API task page](https://www.nutrient.io/api/redaction-api/).

## Introduction to PDF redaction

Redaction is the process of removing image, text, and vector content from a PDF page. This not only involves obscuring the content, but also removing the data in the document within the specified region.

Redaction is generally used when you want to remove personally identifiable or sensitive information from a document to ensure confidentiality and conform to regulations and privacy laws, such as General Data Protection Regulation (GDPR) or Health Insurance Portability and Accountability Act (HIPAA). By using the Redaction component, the original content of a PDF can't be restored, thereby guaranteeing privacy.

Redaction is a two-step process:

- First, redaction annotations are created in the areas that are to be redacted. This step won't remove any content from the document yet; it just marks regions for redaction.

- Second, to actually remove the content, the redaction annotations need to be applied. In this step, the page content within the region of the redaction annotations is irreversibly removed.

The actual removal of content happens only after redaction annotations are applied to the document. Before applying them, you can edit and remove them the same as any other annotation.

## Creating redactions with text search

In this example, you'll create redactions using a text search rule. Any text matching a provided query will be covered by redaction annotations. To create redactions, use the `createRedactions` action with a `text` strategy.

To do this, add a `document.pdf` file to the same folder as your code. You can use any document containing text, or use our provided [sample document](https://www.nutrient.io/api/assets/downloads/samples/pdf/document.pdf/).

Run the code, and you'll get a `result.pdf` with all occurrences of the searched text marked with redaction annotations.

Create redactions from search (basic API):

### Shell

### Shell (Windows)

### Java

### C#

### JavaScript

### Python

### PHP

### HTTP

Advanced API:

### Shell

### Shell (Windows)

### Java

### C#

### JavaScript

### Python

### PHP

### HTTP

## Preset pattern redaction

The redaction API enables you to create redactions on top of text matching predefined patterns, such as email addresses, URLs, and more.

For our example, you can create redactions using the `email-address` preset to search for all occurrences of email addresses. To do this, add a `document.pdf` file to the same folder as your code. You can use any document containing text, or use our provided [sample document](https://www.nutrient.io/api/assets/downloads/samples/pdf/document.pdf/).

Run the code, and you'll get a `result.pdf` file with all occurrences of email addresses marked with redaction annotations.

For a complete list of supported presets, refer to our [API reference](https://www.nutrient.io/api/reference/public/#model/CreateRedactionsStrategyOptionsPreset).

Create redactions by searching for a pattern (basic API):

### Shell

### Shell (Windows)

### Java

### C#

### JavaScript

### Python

### PHP

### HTTP

Advanced API:

### Shell

### Shell (Windows)

### Java

### C#

### JavaScript

### Python

### PHP

### HTTP

## Create redactions with regex search

The redaction API enables you to create redactions on top of text matching a provided regular expression. This is the most versatile redaction creation strategy.

In the example below, you'll create redactions using a regex pattern. Any text matching the pattern will be covered by redaction annotations. To create redactions, use the `createRedactions` action with a `regex` strategy. To do this, add a `document.pdf` file to the same folder as your code. You can use any document containing text, or use our provided [sample document](https://www.nutrient.io/api/assets/downloads/samples/pdf/document.pdf/).

Run the code, and you'll get a `result.pdf` file with all text matching the regex pattern marked with redaction annotations.

Create redactions by searching with regular expression (basic API):

### Shell

### Shell (Windows)

### Java

### C#

### JavaScript

### Python

### PHP

### HTTP

Advanced API:

### Shell

### Shell (Windows)

### Java

### C#

### JavaScript

### Python

### PHP

### HTTP

## Applying redactions

After you create redaction annotations, apply them to the document to permanently remove the covered content. You can achieve this by adding the `applyRedactions` action to the instructions.

The redact API automatically creates and applies redactions in a single step — permanently removing content immediately. To review redactions before applying them, set `redactionState` to `"stage"`. This creates redaction annotations without removing the underlying content.

To do this, use the `result.pdf` file from the previous example. Make sure it's in the same folder as your code.

Stage redactions to stop applying them automatically (basic API):

### Shell

### Shell (Windows)

### Java

### C#

### JavaScript

### Python

### PHP

### HTTP

Advanced API:

### Shell

### Shell (Windows)

### Java

### C#

### JavaScript

### Python

### PHP

### HTTP
---

## Related pages

- [Document-to-image API](/guides/dws-processor/tools-and-api/document-to-image-api.md)
- [Image-to-PDF API](/guides/dws-processor/tools-and-api/image-to-pdf-api.md)
- [DOCX templating API](/guides/dws-processor/tools-and-api/docx-templating-api.md)
- [Office-to-PDF API](/guides/dws-processor/tools-and-api/office-to-pdf-api.md)
- [PDF-to-image API](/guides/dws-processor/tools-and-api/pdf-to-image-api.md)
- [PDF OCR API](/guides/dws-processor/tools-and-api/pdf-ocr-api.md)
- [PDF security API](/guides/dws-processor/tools-and-api/pdf-security-api.md)
- [PDF-to-PDF/A API](/guides/dws-processor/tools-and-api/pdf-to-pdfa-api.md)
- [Tools and APIs](/guides/dws-processor/tools-and-api.md)
- [PDF/UA auto-tagging API](/guides/dws-processor/tools-and-api/pdfua-api.md)
- [PDF generator API](/guides/dws-processor/tools-and-api/pdf-generator-api.md)
- [PDF watermark API](/guides/dws-processor/tools-and-api/pdf-watermark-api.md)
- [Markdown-to-PDF API](/guides/dws-processor/tools-and-api/markdown-to-pdf-api.md)

