---
title: "Server-side document redaction using preset patterns"
canonical_url: "https://www.nutrient.io/guides/document-engine/redaction/preset-patterns/"
md_url: "https://www.nutrient.io/guides/document-engine/redaction/preset-patterns.md"
last_updated: "2026-06-09T10:25:14.400Z"
description: "Document Engine lets you create redactions on top of text matching predefined patterns, such as email addresses, URLs, and more."
---

# Preset pattern redaction

Document Engine lets you create redactions on top of text matching predefined patterns, such as email addresses, URLs, and more. To create redactions, use the [`createRedactions` action](https://www.nutrient.io/api/reference/document-engine/upstream/#model/BuildInstructions) with the following `preset` strategy:

```json

{
  type: "createRedactions",
  strategy: "preset",
  strategyOptions: {
    preset: "email-address"
  }
}

```

> For a complete list of presets, see the [API Reference](https://www.nutrient.io/api/reference/document-engine/upstream/#tag/Build-API).

<!-- This partial is rendered in guide articles describing redaction strategies. -->

### Applying redactions

After redaction annotations are created, they need to be applied to the document to effectively and permanently remove the covered content. You can achieve this by adding the [`applyRedactions` action](https://www.nutrient.io/api/reference/document-engine/upstream/#model/BuildInstructions) to the `/build` [instructions](https://www.nutrient.io/api/reference/document-engine/upstream/#model/BuildInstructions).

- Ensure [Document Engine is up and running](https://www.nutrient.io/sdk/document-engine/getting-started.md).

- Send a [multipart POST request](https://www.baeldung.com/postman-form-data-raw-x-www-form-urlencoded) with [instructions](https://www.nutrient.io/api/reference/document-engine/upstream/#tag/Build-API) to Document Engine’s `/api/build` endpoint.

For more information, refer to the [API reference](https://www.nutrient.io/api/reference/document-engine/upstream/#tag/Build-API) to learn about the `/api/build` endpoint and all the actions you can perform on PDFs with Document Engine.

For an overview of multipart requests, refer to the [brief tour of multipart requests](https://www.nutrient.io/blog/a-brief-tour-of-multipart-requests/) blog post.









## Creating and Applying Redactions in a File on Disk

Send a multipart request to the [`/api/build` endpoint](https://www.nutrient.io/api/reference/document-engine/upstream/#tag/Document-Editing/operation/build-document) attached with the input file and the [`instructions` JSON](https://www.nutrient.io/api/reference/document-engine/upstream/#model/BuildInstructions):

### SHELL

```shell

curl -X POST http://localhost:5000/api/build \
  -H "Authorization: Token token=<API token>" \
  -F file=@/path/to/example-document.pdf \
  -F instructions='{
  "parts": [
    {
      "file": "document",
      "actions": [

        {
          type: "createRedactions",
          strategy: "preset",
          strategyOptions: {
            preset: "email-address"
          }
        },

        {
          "type": "applyRedactions"
        }
      ]
    }
  ]
}' \
  -o result.pdf

```

### HTTP

```http

POST /api/build HTTP/1.1
Content-Type: multipart/form-data; boundary=customboundary
Authorization: Token token=<API token>

--customboundary
Content-Disposition: form-data; name="file"; filename="example-document.pdf"
Content-Type: application/pdf

<PDF data>
--customboundary
Content-Disposition: form-data; name="instructions"
Content-Type: application/json

{
  "parts": [
    {
      "file": "document",
      "actions": [

        {
          type: "createRedactions",
          strategy: "preset",
          strategyOptions: {
            preset: "email-address"
          }
        },

        {
          "type": "applyRedactions"
        }
      ]
    }
  ]
}
--customboundary--

```

This creates redaction annotations and applies them to the file, removing the content beneath them.

## Creating and Applying Redactions in a File from a URL

Send a request to the [`/api/build` endpoint](https://www.nutrient.io/api/reference/document-engine/upstream/#tag/Document-Editing/operation/build-document) and include a URL pointing to the file you want to redact:

### SHELL

```shell

curl -X POST http://localhost:5000/api/build \
  -H "Authorization: Token token=<API token>" \
  -F instructions='{
  "parts": [
    {
      "file": {
        "url": "https://pspdfkit.com/downloads/examples/credit-card-application.pdf"
      },
      "actions": [

        {
          type: "createRedactions",
          strategy: "preset",
          strategyOptions: {
            preset: "email-address"
          }
        },

        {
          "type": "applyRedactions"
        }
      ]
    }
  ]
}' \
  -o result.pdf

```

### HTTP

```http

POST /api/build HTTP/1.1
Content-Type: multipart/form-data; boundary=customboundary
Authorization: Token token=<API token>

--customboundary
Content-Disposition: form-data; name="instructions"
Content-Type: application/json

{
  "parts": [
    {
      "file": {
        "url": "https://pspdfkit.com/downloads/examples/credit-card-application.pdf"
      },
      "actions": [

        {
          type: "createRedactions",
          strategy: "preset",
          strategyOptions: {
            preset: "email-address"
          }
        },

        {
          "type": "applyRedactions"
        }
      ]
    }
  ]
}
--customboundary--

```

This creates redaction annotations and applies them to the file, removing the content beneath them.
---

## Related pages

- [PDF Redaction Server](/guides/document-engine/redaction.md)
- [Introduction to PDF redaction](/guides/document-engine/redaction/introduction.md)
- [Search and redact PDFs](/guides/document-engine/redaction/search-and-redact.md)
- [Redact PDFs using RegEx](/guides/document-engine/redaction/regex-patterns.md)

