Redact a PDF
POST/pdf/redact
Removes what lies under rectangles of the pages, and every place where a text you name stands,
from the file itself, not just from view: text is taken out (a line keeps its other words),
the pixels of an image under a rectangle turn black, drawn shapes are cut, and a link or a
comment a rectangle or a found text touches goes whole, with its address. A box in fill is
drawn over each rectangle and each found text, black unless you name another colour or null.
Rectangles are given as a viewer shows the page: points from its top-left corner, y running
down, the page's rotation applied (72 points are an inch, about 2.83 a millimetre). A text in
text is found on every page, in form fields too, whatever its whitespace (DE36000000…
finds an IBAN printed in groups of four), ignoring case unless match_case is true, and only
as a whole word with whole_words. Afterwards Formfeed reads the result again and answers 422
redaction_incomplete, delivering no file, while text still lies under a rectangle, a named
text can still be found on a page or in the document's metadata, bookmarks, attachments, form
or annotations, or the file keeps an earlier revision; the problem names rectangles and texts
by their number, never a text. A text that does not occur is no error. The source is a stored
PDF named as source in a JSON body, or an upload as multipart/form-data with the PDF as
file (never stored). Costs 0.5 units on live keys; Starter plan and above. A PDF/A answers
422 source_invalid, a signed or password-protected PDF 422 source_invalid or
source_encrypted, a rectangle that covers part of a form field 422 invalid_request. Needs
render:create.
Request
Responses
- 200
- 413
- 415
- 422
- 429
- 503
- default
The render of the redacted PDF.
The upload is larger than the plan's output size or 100 MB.
file_type_unsupported: the upload is no PDF.
redaction_incomplete (text still lay under a rectangle; regions names each with its page and how many text_items were left, and no file was delivered), source_not_found, source_invalid (unreadable, signed, or a PDF/A), source_encrypted, page_limit_exceeded, output_too_large, or invalid_request for a rectangle on a page the document lacks or outside its page.
rate_limited: the workspace's bucket of the plan's requests per second is empty (Free test keys also have 30 a minute). The problem names the bucket's limit and its window_seconds. Retry after Retry-After seconds.
Response Headers
Seconds until a request is let through again.
Size of the workspace's request bucket: the plan's requests per second. Free test keys are also held to 30 requests a minute, and the headers then describe whichever bucket is closer to empty.
Requests left in the bucket.
Seconds until the bucket is full again.
tool_unavailable: the PDF tools are busy; retry after Retry-After seconds.
Error (RFC 9457 problem details).