Blog/Product updates

Introducing PDF Redaction in RelayPDF

Remove literal text or selected page areas with the new PDF redaction API. Learn how image-only output removes source objects, how coordinates work, and how to verify the result.

Product updates··4 min read

RelayPDF adds POST /v1/pdf/redact: send an existing PDF and the content you want removed, and receive a new PDF built from redacted page images. Select literal text, page rectangles, or both through REST, SDK, CLI, and MCP.

Use it to remove an account number from a report, hide a signature image on a scanned form, or prepare a document excerpt for external review. You supply the targets; the endpoint does not automatically identify personal or confidential information.

What redaction changes

A rectangle drawn over text can leave the original text underneath. Cropping can leave content outside the visible page boundary. Neither is sufficient when the recipient must not recover the selected content.

The redaction endpoint renders each page, replaces the selected pixels with opaque black, and builds a separate PDF from those images. It does not copy the original text objects, hidden layers, attachments, metadata, links, form fields, or digital signatures into the output.

The result is image-only. Visible content outside the selected regions remains, but text is no longer selectable or searchable, vector graphics become pixels, and accessibility tags are removed. This applies to every output page, including pages without a redaction target. Page count and displayed page sizes are retained.

Your original file is not changed or deleted. Treat the returned document as a separate output and manage retention of the original independently.

Redact literal text with REST

Authenticate with relaypdf setup, then use your configured environment variable. Replace the example URL and account number with your own input and target:

curl https://api.relaypdf.com/v1/pdf/redact \
  -H "Authorization: Bearer $RELAYPDF_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "url": "https://example.com/report.pdf",
    "options": { "texts": ["Account 1234"] },
    "response": "url",
    "filename": "report-redacted.pdf"
  }'

Matching is case-insensitive by default. Set matchCase: true for case-sensitive matching. The endpoint targets every occurrence on the selected pages and adds a small margin around matched character boxes. That margin can also cover adjacent content.

Every requested string must match at least once. If one does not, the job fails without a completed output or a charge. This catches misspellings and inputs without the expected text layer. It does not prove that every visible occurrence was found: a scanned image can contain the same words without searchable text.

Redact areas in scans and images

For a scanned signature, handwritten note, image, or form value, specify its displayed page area:

{
  "url": "https://example.com/scanned-form.pdf",
  "options": {
    "areas": [
      { "page": 1, "x": 72, "y": 144, "width": 216, "height": 36 }
    ]
  },
  "response": "url"
}

Coordinates use PDF points: 72 points equal one inch. The origin is the top-left of the displayed page, after crop and rotation. The example removes an area one inch from the left and two inches from the top, measuring three inches wide and half an inch high. Page numbers start at one.

Text matching does not run OCR. Use rectangles for scanned content, and review the output to confirm that your areas cover the intended information. Literal matching also has limits with unusual font encodings and phrases split across lines. This release does not support regex matching or XFA forms.

Use the SDK, CLI, or MCP

The updated Node SDK source exposes redaction through the native processing method:

import { RelayPDF } from "@relaypdf/sdk";

const client = new RelayPDF({ apiKey: process.env.RELAYPDF_API_KEY! });
const result = await client.process("redact", {
  url: "https://example.com/report.pdf",
  options: { texts: ["Account 1234"] },
  response: "url",
});
console.log(result);

Redaction is available in Node SDK 0.1.7, Python 0.1.6, PHP 0.1.2, C# 0.1.2, and Java 0.1.3 or later through process or ProcessAsync.

With CLI 0.1.9 or later:

relaypdf process redact report.pdf \
  --options '{"texts":["Account 1234"]}' \
  --out report-redacted.pdf

Hosted and stdio MCP expose document_redact, with the same input and options. The default MCP result is a temporary download URL.

Processing and verification

Redaction supports binary, URL, and async responses. Private uploads accept up to 100 MiB; inline files and public URL inputs retain the 15 MiB limit. The default resolution is 144 DPI, configurable up to 300. Page, rendered-pixel, processing-time, and 32 MiB output limits also apply; see the API guide.

Jobs use the account's existing native processing rate, spending caps, usage receipts, and async delivery. Failed operations are never billed.

Before sharing a result, inspect the rendered pages. Check the removed areas and confirm that the remaining content is useful. Searching for a removed string is not a sufficient verification step: every image-only output has an empty text layer, even if a rectangle was placed incorrectly.

Start with the PDF redaction feature page or the redaction API reference. For scanned documents that need searchable text instead, see the OCR guide.

Ready to generate?

One API for HTML, Markdown, URLs, and Office. REST, SDK, CLI, or MCP.