How PHI removal works
What Lype removes from your PDFs, and how
What is removed
Every occurrence of detected PHI is deleted from the PDF, not hidden:
- Text is removed from the page content, so it cannot be selected, copied, searched or extracted.
- Images (scans, faxes, screenshots) have the pixels under the PHI overwritten.
- Faces in photos (ID cards, patient photos) are blacked out, including hair and ears around them.
- Text drawn as vector shapes (common in print-to-PDF output) has those shapes removed.
- Text that was invisible on the page (hidden OCR layers, white-on-white, off-page text) is removed too.
- Layers that are hidden by default are made visible and checked like the rest of the page, so the output has no hidden layers. Image areas drawn outside the page are erased.
Where something visible was removed, a black box marks the spot. Everything else on the page is left exactly as it was.
The document is also cleaned of places where PHI often hides outside the page: document metadata (title, author, XMP), annotations and comments, form field data, bookmarks, embedded and associated files, alt text and other tags, layer names, and earlier revisions of the file. Only what is needed to draw the pages is kept.
Documents over 500 pages are rejected.
How PHI is found
- Each page's text layer is read with exact character positions.
- Each page is rendered and OCR'd, so text inside images, scanned pages and handwriting is found too. The same rendering is checked for faces.
- The text is analyzed for PHI: names, dates, ages, addresses, phone and fax numbers, emails, IDs (MRN, member, SSN) and URLs. Professions are not removed.
- Every other occurrence of each detected value is removed as well, including slightly misread OCR copies.
- The output is OCR'd and checked for faces again. Anything still legible or visible is removed in another pass; if the result still cannot be verified, processing fails instead of returning a PDF that may contain PHI.
Detection is automated. Handwriting that OCR cannot read at all cannot be detected, and very small, blurry or side-on faces may be missed. Review redacted documents before sharing them where that matters.
Input limits
| Limit | Value |
|---|---|
| File type | PDF (application/pdf) |
| Max file size | 50 MB |
| Password-protected PDFs | Not supported (processing fails) |
Uploading a file you have already processed successfully returns the existing attachment (200) instead of processing it again.
Attachment status
status | Meaning |
|---|---|
pending | Uploaded, waiting to be processed |
processing | Being processed; progress goes from 0 to 100 |
completed | Done; downloadUrl is set |
failed | Processing failed; see the progress event's error |
Failure reasons: File is not a valid PDF, PDF is password protected, PDF is too large or complex to process, PHI removal could not be verified, PHI removal failed after retries.
Progress events
GET /api/attachments/progress is a Server-Sent Events stream of progress for all of your account's attachments:
curl -N https://api.lype.com/api/attachments/progress \
-H "x-api-key: $LYPE_API_KEY"event: progress
data: {"attachmentId":"f7831202-...","status":"processing","progress":28,"step":"Reading pages..."}
event: progress
data: {"attachmentId":"f7831202-...","status":"completed","progress":100,"step":"Complete"}A ping event is sent every 30 seconds to keep the connection open. Failed events include an error field.
The redacted file
GET /api/attachments/{id}/download returns the PDF as <id>-redacted.pdf. The original file name is not reused, since file names often contain patient names.