
Redact PDF API
Black out text and images in a PDF for real: redacted pages are flattened so the hidden content is gone, not just covered. Find emails, phone numbers and more.
All API requests require a valid API key passed in the Authorization header as a Bearer token.
20 requests per minute
1 endpoint available
Overview
Permanently remove text and areas from a PDF. Find text with preset patterns and plain search terms, and/or give exact areas. Every page with a redaction is replaced by a picture of the page with the redacted areas filled in, so the text, images and drawings underneath are removed from the file, not just covered. Those pages lose selectable text.
Pages without redactions keep their text but lose annotations (comments, links, form fields). The output also drops document metadata, bookmarks, attachments and scripts.
Finding text
presets: comma-separated, any ofemail,phone,id-number(SIN/SSN),card(13 to 19 digit card numbers),date,url.terms: a JSON array of plain text to find. Spaces also match line breaks. Regular expressions are not supported in the API.- Only real text is found. Scanned pages (pictures of text) need
areas. Boxes are placed from estimated character widths with some padding, so check the result.
Areas
areas is a JSON array of boxes in PDF points (72 per inch), measured from the top-left corner of the page as displayed (after rotation), x to the right and y down: [{"page": 1, "x": 50, "y": 80, "width": 200, "height": 20}].
Response
The redacted PDF. Headers: X-Redacted-Pages (e.g. 1-2, 5) and X-Match-Count (text matches found). If nothing matches and no areas are given, the request fails with 422 rather than returning an unredacted file.
Limits
- One PDF up to 25 MB and 500 pages; redactions on at most 100 pages per request.
- Up to 50 search terms and 1000 areas.
Endpoints
https://opentools.ca/api/v1/tools/redact-pdfRequest Body
Content-Type: multipart/form-data
| Parameter | Type | Required | Description |
|---|---|---|---|
| file | file | Required | The PDF to redact. |
| presets | string | Optional | Comma-separated patterns to find: email, phone, id-number, card, date, url. |
| terms | string (JSON array) | Optional | Plain text to find, e.g. ["Jane Doe", "Project Bluebird"]. Up to 50 terms of 500 characters. |
| caseSensitive | boolean | Optional | Match terms with exact case. Presets always ignore case.Default: false |
| areas | string (JSON array) | Optional | Boxes to redact: [{"page": 1, "x": 50, "y": 80, "width": 200, "height": 20}]. page starts at 1; the rest are points from the top-left of the displayed page. |
| color | string | Optional | Fill colour as #rrggbb.Default: #000000 |
| dpi | integer Enum: 150, 200, 300 | Optional | Resolution of the redacted pages.Default: 200 |
| format | string Enum: jpg, png | Optional | Image format of the redacted pages. png is sharper for text, jpg smaller.Default: jpg |
Response Example
The redacted PDF (Content-Type: application/pdf, filename <name>-redacted.pdf). Headers: X-Redacted-Pages, X-Match-Count.Error Codes
Code Examples
curl -X POST https://opentools.ca/api/v1/tools/redact-pdf \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@statement.pdf" \
-F "presets=email,phone,card" \
-F 'terms=["Jane Doe"]' \
-F 'areas=[{"page": 1, "x": 400, "y": 40, "width": 150, "height": 60}]' \
-D headers.txt \
-o statement-redacted.pdfRather use it in your browser? Open the Redact PDF