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

# Documents

> Understanding document storage and lifecycle in DocIntell

Documents are the core assets in DocIntell. When you upload a PDF, it's stored in our **Cold Vault** — an immutable, SEC 17a-4 compliant storage system.

## Document Lifecycle

<Steps>
  <Step title="Upload">
    Send a PDF to `POST /v1/documents`. The file is validated (PDF only, max 100MB).
  </Step>

  <Step title="Cold Vault Storage">
    The original file is stored in Google Cloud Storage with **Object Retention Lock**.
    This creates an immutable record that cannot be deleted during the retention period.
  </Step>

  <Step title="Extraction Queue">
    A job is created and published to our processing queue. You receive a `202 Accepted` response.
  </Step>

  <Step title="Processing">
    Extraction workers process the document using AI models.
  </Step>

  <Step title="Hot Index">
    Extracted data is stored in our Hot Index for fast queries (under 100ms).
  </Step>
</Steps>

## Two Storage Tiers

DocIntell uses a **Hot/Cold architecture** to balance performance with compliance requirements.

```mermaid theme={null}
flowchart LR
    Upload["Upload PDF"] --> Cold["Cold Vault<br/>(Immutable)"]
    Cold --> Process["Extract"]
    Process --> Hot["Hot Index<br/>(Queryable)"]
    Hot --> Result["Query Results"]
```

| Tier           | Purpose                      | Key Features                                              |
| -------------- | ---------------------------- | --------------------------------------------------------- |
| **Cold Vault** | Immutable compliance storage | GCS with Object Retention Lock, SEC 17a-4 compliant, WORM |
| **Hot Index**  | Fast queryable database      | Cloud SQL, sub-100ms queries, multi-tenant with RLS       |

## Retention Periods

When uploading, specify the retention period (1-10 years, default 7):

```bash theme={null}
curl -X POST https://api.docintell.com/v1/documents \
  -H "Authorization: Bearer dk_live_YOUR_API_KEY" \
  -F "file=@document.pdf" \
  -F "retention_years=7"
```

<Warning>
  Once set, retention periods **cannot be shortened**. Documents are automatically deleted after expiry.
</Warning>
