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

# batch_get_chunks

> Retrieve specific chunks by their document ID and chunk number

> [tab] Sync
>
> ```python theme={null}
> def batch_get_chunks(
>     sources: List[Union[ChunkSource, Dict[str, Any]]],
>     folder_name: Optional[Union[str, List[str]]] = None,
>     use_colpali: bool = True,
>     output_format: Optional[str] = None,
> ) -> List[FinalChunkResult]
> ```

> [tab] Async
>
> ```python theme={null}
> async def batch_get_chunks(
>     sources: List[Union[ChunkSource, Dict[str, Any]]],
>     folder_name: Optional[Union[str, List[str]]] = None,
>     use_colpali: bool = True,
>     output_format: Optional[str] = None,
> ) -> List[FinalChunkResult]
> ```

## Parameters

* `sources` (List\[Union\[ChunkSource, Dict\[str, Any]]]): List of ChunkSource objects or dictionaries with document\_id and chunk\_number
* `folder_name` (str | List\[str], optional): Optional folder scope. Accepts canonical paths or a list of paths/names.
* `use_colpali` (bool, optional): Whether to request multimodal chunks when available. Defaults to True.
* `output_format` (str, optional): Controls how image chunks are returned. Set to `"url"` to receive presigned URLs; omit or set to `"base64"` (default) to receive base64 content.

## Returns

* `List[FinalChunkResult]`: List of chunk results

## Examples

> [tab] Sync
>
> ```python theme={null}
> from morphik import Morphik
> from morphik.models import ChunkSource
>
> db = Morphik()
>
> # Using dictionaries
> sources = [
>     {"document_id": "doc_123", "chunk_number": 0},
>     {"document_id": "doc_456", "chunk_number": 2}
> ]
>
> # Or using ChunkSource objects
> sources = [
>     ChunkSource(document_id="doc_123", chunk_number=0),
>     ChunkSource(document_id="doc_456", chunk_number=2)
> ]
>
> chunks = db.batch_get_chunks(sources)
> for chunk in chunks:
>     print(f"Chunk from {chunk.document_id}, number {chunk.chunk_number}: {chunk.content[:50]}...")
> ```

> [tab] Async
>
> ```python theme={null}
> from morphik import AsyncMorphik
> from morphik.models import ChunkSource
>
> async with AsyncMorphik() as db:
>     # Using dictionaries
>     sources = [
>         {"document_id": "doc_123", "chunk_number": 0},
>         {"document_id": "doc_456", "chunk_number": 2}
>     ]
>
>     # Or using ChunkSource objects
>     sources = [
>         ChunkSource(document_id="doc_123", chunk_number=0),
>         ChunkSource(document_id="doc_456", chunk_number=2)
>     ]
>
>     chunks = await db.batch_get_chunks(sources)
>     for chunk in chunks:
>         print(f"Chunk from {chunk.document_id}, number {chunk.chunk_number}: {chunk.content[:50]}...")
> ```

## FinalChunkResult Properties

Each `FinalChunkResult` object in the returned list has the following properties:

* `content` (str | PILImage): Chunk content (text or image)
* `score` (float): Relevance score
* `document_id` (str): Parent document ID
* `chunk_number` (int): Chunk sequence number
* `metadata` (Dict\[str, Any]): Document metadata
* `content_type` (str): Content type
* `filename` (Optional\[str]): Original filename
* `download_url` (Optional\[str]): URL to download full document


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