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

# ingest_text

> Ingest a text document into Morphik

> [tab] Sync
>
> ```python theme={null}
> def ingest_text(
>     content: str,
>     filename: Optional[str] = None,
>     metadata: Optional[Dict[str, Any]] = None,
>     use_colpali: bool = True,
> ) -> Document
> ```

> [tab] Async
>
> ```python theme={null}
> async def ingest_text(
>     content: str,
>     filename: Optional[str] = None,
>     metadata: Optional[Dict[str, Any]] = None,
>     use_colpali: bool = True,
> ) -> Document
> ```

## Parameters

* `content` (str): Text content to ingest
* `filename` (str, optional): Optional filename for the document
* `metadata` (Dict\[str, Any], optional): Optional metadata dictionary
* `use_colpali` (bool, optional): Whether to use ColPali-style embedding model to ingest the text (slower, but significantly better retrieval accuracy for text and images). Defaults to True.

### Typed Metadata

Pass native Python types for metadata (e.g., `datetime`, `date`, `Decimal`, `bool`). The SDK normalizes them, forwards the appropriate `metadata_types`, and unlocks range queries described in the [Metadata Filtering guide](https://morphik.ai/docs/concepts/metadata-filtering.md). Example:

```python theme={null}
from datetime import datetime, date
from decimal import Decimal

doc = db.ingest_text(
    "SOW details …",
    metadata={
        "priority": 42,
        "start_date": datetime.utcnow(),
        "end_date": date(2024, 12, 31),
        "cost": Decimal("1234.56")
    }
)
```

## Returns

* `Document`: Metadata of the ingested document

## Examples

> [tab] Sync
>
> ```python theme={null}
> from morphik import Morphik
>
> db = Morphik()
>
> doc = db.ingest_text(
>     "Machine learning is fascinating...",
>     metadata={"category": "tech"},
>     use_colpali=True,
> )
> ```

> [tab] Async
>
> ```python theme={null}
> from morphik import AsyncMorphik
>
> async with AsyncMorphik() as db:
>     doc = await db.ingest_text(
>         "Machine learning is fascinating...",
>         metadata={"category": "tech"},
>         use_colpali=True,
>     )
> ```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.