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

# Vaults Overview

> Document storage with AI-powered search

## The problem

You have thousands of documents—contracts, depositions, evidence. You need to find the relevant passages, but keyword search fails when documents use different terminology.

## The solution

A vault is a container that **understands** documents. When you upload files, we automatically:

1. Extract text (OCR for scans, transcription for audio)
2. Split content into searchable chunks
3. Create meaning vectors for semantic search

Then you can ask questions in plain English and get relevant results—even if the documents use different terminology.

## How RAG works

Traditional search matches keywords. If you search "timeline" and the document says "schedule," you get nothing.

RAG (Retrieval-Augmented Generation) works differently:

```mermaid theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
flowchart TD
    A["Upload<br/>A user adds a document to a vault"] --> B["Process<br/>Extract text, chunk content, and generate meaning vectors"]
    B --> C["Store<br/>Chunks and vectors are indexed in the vault"]
    C --> D["Search<br/>A natural-language query retrieves semantically related passages"]
```

**The magic is in step 3.** "Timeline" and "schedule" have similar meaning vectors, so they match—even though the words are different.

## What you can upload

| File type            | What happens                    |
| -------------------- | ------------------------------- |
| **PDF (scanned)**    | OCR extracts the text           |
| **PDF (digital)**    | Text extracted directly         |
| **Images**           | OCR extracts any text           |
| **Audio/Video**      | Transcribed with speaker labels |
| **Word, text files** | Indexed directly                |

## Quick start

<CodeGroup>
  ```bash title="CLI" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  # 1. Create a vault
  casedev vault create --name "Documents - User 12345"

  # 2. Upload a document
  casedev vault upload --id $VAULT_ID \
    --filename "contract.pdf" \
    --content-type "application/pdf"

  # 3. Process it
  casedev vault ingest --id $VAULT_ID --object-id $OBJECT_ID

  # 4. Search by meaning
  casedev vault search --id $VAULT_ID --query "termination clauses"
  ```

  ```typescript title="Typescript" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  import Casedev from 'casedev';

  const client = new Casedev({ apiKey: process.env.CASEDEV_API_KEY });

  // 1. Create a vault for your user
  const vault = await client.vault.create({
    name: 'Documents - User 12345'
  });

  // 2. Upload a document
  const upload = await client.vault.upload(vault.id, {
    filename: 'contract.pdf',
    contentType: 'application/pdf'
  });

  // PUT the file to upload.uploadUrl, then:

  // 3. Process it (OCR + vectorization)
  await client.vault.ingest(vault.id, upload.objectId);

  // 4. Enable your user to search by meaning
  const results = await client.vault.search(vault.id, {
    query: userSearchQuery // e.g., "termination clauses"
  });

  console.log(results.chunks[0].text);
  ```

  ```python title="Python" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  import casedev

  client = casedev.Casedev(api_key=os.environ['CASEDEV_API_KEY'])

  # 1. Create a vault for your user
  vault = client.vault.create(name='Documents - User 12345')

  # 2. Upload a document
  upload = client.vault.upload(vault.id,
      filename='contract.pdf',
      content_type='application/pdf'
  )

  # PUT the file to upload.upload_url, then:

  # 3. Process it (OCR + vectorization)
  client.vault.ingest(upload.object_id, id=vault.id)

  # 4. Enable your user to search by meaning
  results = client.vault.search(vault.id,
      query=user_search_query  # e.g., "termination clauses"
  )

  print(results.chunks[0].text)
  ```

  ```go title="Go" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  // 1. Create a vault for your user
  vault, _ := client.Vault.New(ctx, casedev.VaultNewParams{
  	Name: casedev.F("Documents - User 12345"),
  })

  // 2. Upload a document
  upload, _ := client.Vault.Upload(ctx, vault.ID, casedev.VaultUploadParams{
  	Filename:    casedev.F("contract.pdf"),
  	ContentType: casedev.F("application/pdf"),
  })

  // PUT the file to upload.UploadURL via net/http, then:

  // 3. Process it (OCR + vectorization)
  client.Vault.Ingest(ctx, vault.ID, upload.ObjectID)

  // 4. Enable your user to search by meaning
  results, _ := client.Vault.Search(ctx, vault.ID, casedev.VaultSearchParams{
  	Query: casedev.F("termination clauses"),
  })

  fmt.Println(results.Chunks[0].Text)
  ```
</CodeGroup>

## Security

Each vault is isolated and encrypted:

* **Encryption at rest** — AES-256 via AWS KMS
* **Isolation** — Separate storage per vault
* **Zero-knowledge** — We cannot read your documents
* **Audit trail** — Every access logged

<Info>
  **One vault per case** is the recommended pattern. Keeps search results focused and data isolated.
</Info>

## Next steps

<CardGroup>
  <Card title="Groups" href="/vault/groups">
    Organize vaults and scope API key access by client or team
  </Card>

  <Card title="Upload & Process" href="/vault/upload">
    Integrate document uploads and make them searchable
  </Card>

  <Card title="Webhooks" href="/vault/webhooks">
    Receive ingestion lifecycle events without polling
  </Card>

  <Card title="Search" href="/vault/search">
    Build semantic search—including GraphRAG for complex questions
  </Card>

  <Card title="Chunk Retrieval" href="/vault/chunks">
    Pull full-text chunk ranges when search previews are too short
  </Card>

  <Card title="Memory" href="/vault/memory">
    Store and retrieve structured facts per vault
  </Card>

  <Card title="Manage" href="/vault/manage">
    List vaults, download files, delete documents
  </Card>
</CardGroup>

## Related services

<CardGroup>
  <Card title="OCR" href="/ocr">
    Pre-process scanned documents before uploading to vaults
  </Card>

  <Card title="Voice" href="/voice">
    Transcribe audio recordings, then store transcripts in vaults
  </Card>

  <Card title="LLMs" href="/llms">
    Combine vault search with AI to summarize and answer questions
  </Card>
</CardGroup>
