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.

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"
curl -X POST "https://api.va.landing.ai/v1/ade/parse/jobs" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "document_url=https://example.com/path/to/file.pdf" \
  -F "password=YOUR_DOCUMENT_PASSWORD" \
  -F "output_save_url=https://example.com/path/to/output"
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)
import LandingAIADE from "landingai-ade";
import fs from "fs";

const client = new LandingAIADE();

// Replace with your file path
const response = await client.parse({
  document: fs.createReadStream("/path/to/file/document"),
  password: "YOUR_DOCUMENT_PASSWORD",
});

console.log(response.chunks);

// Save Markdown to a file
if (response.markdown) {
  fs.writeFileSync("output.md", response.markdown, "utf-8");
} else {
  console.log("No 'markdown' field found in the response");
}

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)
import LandingAIADE from "landingai-ade";

const client = new LandingAIADE();

// Step 1: Create a parse job
const job = await client.parseJobs.create({
  document_url: "https://example.com/path/to/file.pdf",
  password: "YOUR_DOCUMENT_PASSWORD",
  output_save_url: "https://example.com/path/to/output",
});

const jobId = job.job_id;
console.log(`Job ${jobId} created.`);

// Step 2: Get the parsing results
while (true) {
  const response = await client.parseJobs.get(jobId);
  if (response.status === "completed") {
    console.log(`Job ${jobId} completed.`);
    break;
  }
  console.log(`Job ${jobId}: ${response.status} (${(response.progress * 100).toFixed(0)}% complete)`);
  await new Promise(resolve => setTimeout(resolve, 5000));
}