--- name: redact-before-sharing description: Permanently remove personal data from a PDF, scan, photo or screenshot before it is sent, filed or attached, or anonymize it so the document stays readable with tags such as [Person 1]. Use when the user asks to redact, black out, anonymize or pseudonymize names, addresses, phone numbers, emails, bank details, card numbers or ID numbers in a document. --- # Redact or anonymize a document ## 1. Get the document Call `create_upload_link` and give the user the `upload_url` as a link. They choose the file on that page and it goes straight to Redact PDF AI, not through this conversation. Do not read an attached copy of the document before redacting it. ## 2. Run it When the user says the file is uploaded, call `redact_pdf_and_wait` with the `upload_id`. - To black out personal data, leave `mode` at its default. - To keep the document readable, pass `mode: "pseudonymize"`: every person, company and address becomes a consistent tag such as [Person 1], and the result includes `document_text`, the document with tags in place of names. - `pii_excluded_terms` keeps words visible, such as the employer's name on a payslip. `pii_included_terms` always removes extra words, such as a reference number. If the answer is `waiting_for_upload`, the user has not finished: ask them, then call it again. ## 3. Report back Give the user the `download_url` as a link and the page count. The removed text is deleted from the file, not hidden under a box. Automatic detection can miss something, so for a filing or anything public the user should check the redacted PDF before sending it. In pseudonymize mode, work only from `document_text` and keep every tag exactly as written. When the user wants the real names back in what you wrote, call `restore_names` with the `document_id`, the `text_version` and your text, and give them the link it returns. Never open the correspondence link yourself: it contains the real names. ## 4. Delete on request When the user asks to delete a document, confirm first, then call `delete_job` with the `job_id`. The files and links stop working at once.