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

<Tabs>
  <Tab title="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>

  <Tab title="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
    ```
  </Tab>
</Tabs>

## 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](/concepts/metadata-filtering). 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

<Tabs>
  <Tab title="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>

  <Tab title="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,
        )
    ```
  </Tab>
</Tabs>
