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

# Document Ingestion

> Upload or queue documents for Context Vault processing.

Use `POST /api/context-vault/documents` for text, Markdown, public URLs, and
remote file URLs. Use `POST /api/context-vault/documents/upload` when the client
has a local file.

## Supported sources

* Plain text and Markdown
* HTML and documentation URLs
* CSV
* PDF
* DOCX
* Images such as PNG, JPG, WebP, and TIFF

Text-like sources are decoded directly. PDFs, DOCX files, and images can be
stored and processed through OCR. Documentation URLs can be crawled when
`crawlSubpages` is enabled.

## Documentation URLs

For documentation sites, MemContext works best when the site exposes an
`llms.txt` file, such as `https://docs.example.com/llms.txt`.

When you submit a documentation URL with `crawlSubpages: true`, MemContext first
checks for a docs index like `llms.txt`, discovers the listed pages, ranks the
most useful pages, and ingests only the selected priority pages. This keeps the
surface area smaller while giving retrieval more relevant context.

If you want a URL to be scraped well, make sure the documentation URL is public,
uses normal HTTP/HTTPS links, and exposes a clean `llms.txt` page map whenever
possible.

## Processing lifecycle

1. The API validates workspace membership.
2. The document is queued as a source.
3. The processor resolves the source content.
4. Content is normalized and split into chunks.
5. Chunk embeddings are generated.
6. Atomic memories are extracted from each chunk.
7. Evidence links each memory to its source chunk.

The ingest endpoint returns `202 Accepted`; processing continues in the
background.

## Document limits

Context Vault document limits are enforced at the workspace subscription level.
If an invited admin or member uploads a document, it still counts against that
workspace's document allowance.

## Scope and project on ingestion

Set `scope` when the document should only appear in a specific hard lane, such
as `hr`, `engineering`, or `billing`.

Set `project` when the document is part of a softer collection inside that
scope, such as `onboarding`, `api-platform`, or `q3-invoices`.
