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

# close

> Close the HTTP session or client

> [tab] Sync
>
> ```python theme={null}
> def close() -> None
> ```

> [tab] Async
>
> ```python theme={null}
> async def close() -> None
> ```

## Parameters

None

## Returns

None

## Examples

> [tab] Sync
>
> ```python theme={null}
> from morphik import Morphik
>
> db = Morphik()
>
> # Perform operations
> doc = db.ingest_text("Sample content")
>
> # Close the session when done
> db.close()
> ```

> [tab] Async
>
> ```python theme={null}
> import asyncio
> from morphik import AsyncMorphik
>
> async def main():
>     db = AsyncMorphik()
>
>     # Perform operations
>     doc = await db.ingest_text("Sample content")
>
>     # Close the client when done
>     await db.close()
>
> asyncio.run(main())
> ```

## Context Manager Alternative

Instead of manually calling `close()`, you can use the Morphik client as a context manager:

> [tab] Sync
>
> ```python theme={null}
> from morphik import Morphik
>
> with Morphik() as db:
>     doc = db.ingest_text("Sample content")
>     # Session is automatically closed when exiting the with block
> ```

> [tab] Async
>
> ```python theme={null}
> from morphik import AsyncMorphik
>
> async with AsyncMorphik() as db:
>     doc = await db.ingest_text("Sample content")
>     # Client is automatically closed when exiting the with block
> ```


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