Guides / PDF

Sanitize PDF

POST /v1/pdf/sanitize  · 

Strip the invisible: JavaScript actions, open-actions, form fields and embedded files are removed and the file is rewritten, so orphaned objects are gone too. The counterpart to redact before handing a document out.

Parameters

NameTypeDescription
filefile · requiredPDF to clean.
flattenboolean · optionalFlatten annotations and form fields, default true.
removeAttachmentsboolean · optionalDefault true.
removeMetadataboolean · optionalAlso clear title/author/producer, default false.

Example request

curl -X POST https://api.bigapi.dev/v1/pdf/sanitize -H 'Authorization: Bearer $KEY' -F 'file=@case-file.pdf' -o clean.pdf

Example response

HTTP/1.1 200 OK
Content-Type: application/pdf
X-BigAPI-Sanitized: annotations,attachments(1),javascript,open-action,form-fields
X-BigAPI-Pages: 12

(cleaned PDF – the removed objects are gone from the bytes, not just unlinked)

Why a second pass matters

Deleting the reference to a JavaScript action is not enough: the object itself stays in the file and can still be read with a hex editor. This operation therefore rewrites the document from the objects that are actually reachable — what nothing points to any more is physically gone.

Related guides