Docs
Redact PDF text and page areas
Create a shareable PDF with selected content removed from the returned document. Match literal text in an existing text layer, or supply page areas for scanned text, images, and other visible content.
POST /v1/pdf/redact. Authenticated with your RelayPDF API key. Choose binary output, a temporary download URL, or an asynchronous job.
Request example
Replace the input URL and sample selections with your document and redaction targets. This example uses both text and an area; either is sufficient. The spending cap authorizes at most $1. Use a new idempotency key for a different request.
curl https://api.relaypdf.com/v1/pdf/redact \
-H "Authorization: Bearer $RELAYPDF_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: redact-example-001" \
-H "X-RelayPDF-Max-Charge-Microdollars: 1000000" \
--data '{"url":"https://example.com/input.pdf","response":"url","filename":"redacted.pdf","options":{"texts":["Account 1234"],"areas":[{"page":1,"x":72,"y":144,"width":216,"height":36}]}}'What the output retains
Every page is rendered, selected pixels are replaced with opaque black, and a new PDF is built from those images. Original text objects, hidden content, metadata, attachments, links, form fields, layers, and digital signatures are not copied. Visible unselected content remains in the page images.
The entire output is image-only: text is no longer selectable or searchable, vector graphics become pixels, and accessibility tags are removed. Page count and displayed page sizes are retained. Even pages outside options.pages are rebuilt; that option limits where redaction targets are applied.
This operation creates a separate file. It does not delete or modify your source, earlier job outputs, or uploaded originals. Delete owned uploads separately through DELETE /v1/files/:id when appropriate.
Inputs and options
Provide exactly one of url, base64 file, or an account-owned uploaded fileId. options is required, with at least one nonempty texts or areas list. Unknown redaction options are rejected.
| Field | Meaning |
|---|---|
| options.texts | Up to 100 literal strings, 1–500 characters each. All occurrences on selected pages are targeted. Every requested string must match at least once or the job fails. No regex or automatic personal-data detection. |
| options.areas | Up to 500 rectangles: {page, x, y, width, height}. Page numbers start at 1; dimensions are PDF points (72 points = 1 inch). |
| Area coordinates | Top-left of the displayed page after crop and rotation. x increases rightward; y increases downward. Rectangles must fit fully within the displayed page. |
| options.pages | Optional 1-based page selection such as 1-3,5 or [1,3]. Defaults to all pages. Every area must be on a selected page. |
| options.matchCase | false by default. Set true for case-sensitive literal matching. |
| options.dpi | Integer from 144 to 300; default 144. Higher resolution improves visual detail and increases processing and output size. |
| options.password | Password to open an encrypted input. The rebuilt output is not password-protected. |
| response | binary (default), url, or async. URL outputs expire after 24 hours; poll async jobs at GET /v1/jobs/:id. |
Scans, matches, and review
Text matching uses the PDF text layer and does not run OCR. Use areas for scans, handwriting, form values, or text in images. A match elsewhere does not prove that an image containing the same text was redacted. Text encoded with unusual glyphs or split across lines may not match the expected string.
Matched character boxes include a small safety margin, which can cover adjacent content. Review the rendered output before sharing. Inspect the redacted areas and confirm that unselected content remains useful. Empty text extraction alone is insufficient evidence: image-only output always has no text layer.
Unmatched terms, invalid coordinates, unsupported XFA forms, rendering errors, and exceeded limits fail without a completed output or a charge. There is no partial-success response. This is not an automatic detection or compliance-certification service.
Limits and billing
Maximum input: 100 MiB through private uploads, or 15 MiB for inline/public URL input. Maximum 500 PDF pages, 40 million rendered pixels per page, 200 million pixels across the full document, 100,000 matched characters, and 32 MiB output. Rendering is bounded by a 300-second native-process timeout. Split larger inputs or lower DPI when limits are exceeded.
Uses the account’s assigned native processing rate and existing spending caps, usage receipts, idempotency, async jobs, and webhooks. Failed operations are never billed. The published native rate is $0.0004/job plus $0.0005/execution second; existing accounts retain their assigned rates.
SDK
Use process / ProcessAsync with Node SDK 0.1.7, Python 0.1.6, PHP 0.1.2, C# 0.1.2, or Java 0.1.3 and later.
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/input.pdf",
options: { texts: ["Account 1234"] },
response: "url",
});
console.log(result);CLI
Run setup to approve browser authentication before processing local files. Requires CLI 0.1.9 or later.
relaypdf setup
relaypdf process redact input.pdf --options '{"texts":["Account 1234"]}' --out redacted.pdfMCP
Hosted and stdio MCP expose document_redact with url, file, or fileId and the same options object. The default result is a temporary download URL. Set async: true for durable processing. Agents must supply explicit targets and should arrange output review before sharing.
{
"url": "https://example.com/input.pdf",
"options": {
"texts": [
"Account 1234"
]
}
}