Skip to main content
Organizations that have Zero Data Retention (ZDR) enabled can parse password-protected files. To parse a password-protected file, pass the document’s password in the password parameter when calling the API.

Why does parsing password-protected documents require ZDR?

Because passwords must be transmitted to decrypt documents, ZDR ensures that sensitive credentials are not stored or logged by .

Supported File Types for Password-Protected Parsing

The following file types support password-protected parsing:
CategoryExtensions
PDFPDF
Text DocumentsDOC, DOCX, ODT
PresentationsPPT, PPTX
SpreadsheetsXLSX

Parse Password-Protected Files with the API

Add the password parameter to your request when parsing a password-protected file. The parameter is optional. If the file is not password-protected, the value is ignored.
curl -X POST "https://api.va.landing.ai/v1/ade/parse" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "document=@path/to/file.pdf" \
  -F "password=YOUR_DOCUMENT_PASSWORD"
If you submit a password-protected file without the password parameter, the request returns a 422 error. For more information, go to Troubleshoot Parsing.

Parse Password-Protected Files with Our Libraries

Parse

from pathlib import Path
from landingai_ade import LandingAIADE

client = LandingAIADE()

# Replace with your file path
response = client.parse(
    document=Path("/path/to/file/document"),
    password="YOUR_DOCUMENT_PASSWORD",
)

print(response.chunks)

# Save Markdown output (useful if you plan to run extract on the Markdown)
with open("output.md", "w", encoding="utf-8") as f:
    f.write(response.markdown)

Parse Jobs

import time
from landingai_ade import LandingAIADE

client = LandingAIADE()

# Step 1: Create a parse job
job = client.parse_jobs.create(
    document_url="https://example.com/path/to/file.pdf",
    password="YOUR_DOCUMENT_PASSWORD",
    output_save_url="https://example.com/path/to/output",
)

job_id = job.job_id
print(f"Job {job_id} created.")

# Step 2: Get the parsing results
while True:
    response = client.parse_jobs.get(job_id)
    if response.status == "completed":
        print(f"Job {job_id} completed.")
        break
    print(f"Job {job_id}: {response.status} ({response.progress * 100:.0f}% complete)")
    time.sleep(5)