> ## Documentation Index
> Fetch the complete documentation index at: https://docs.landing.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Parse Password-Protected Files

export const adePythonLibrary = 'ade-python';

export const dpt2mini = 'DPT-2 mini';

export const dpt2 = 'DPT-2';

export const dpt1 = 'DPT-1';

export const dpt = 'Document Pre-Trained Transformer';

export const companyName = 'LandingAI';

export const extract = 'ADE Extract';

export const parse = 'ADE Parse';

export const ade = 'Agentic Document Extraction';

Organizations that have [Zero Data Retention (ZDR)](./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:

| Category       | Extensions     |
| -------------- | -------------- |
| PDF            | PDF            |
| Text Documents | DOC, DOCX, ODT |
| Presentations  | PPT, PPTX      |
| Spreadsheets   | XLSX           |

## 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.

<CodeGroup>
  ```bash Parse theme={null}
  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"
  ```

  ```bash Parse Jobs theme={null}
  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"
  ```
</CodeGroup>

<Info>
  If you submit a password-protected file without the `password` parameter, the request returns a 422 error. For more information, go to [Troubleshoot Parsing](./ade-parse-troubleshoot).
</Info>

## Parse Password-Protected Files with Our Libraries

### Parse

<CodeGroup>
  ```python Python theme={null}
  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)
  ```

  ```typescript TypeScript theme={null}
  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");
  }
  ```
</CodeGroup>

### Parse Jobs

<CodeGroup>
  ```python Python [expandable] theme={null}
  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)
  ```

  ```typescript TypeScript [expandable] theme={null}
  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));
  }
  ```
</CodeGroup>
