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

<Tabs>
  <Tab title="Sync">
    ```python theme={null}
    def close() -> None
    ```
  </Tab>

  <Tab title="Async">
    ```python theme={null}
    async def close() -> None
    ```
  </Tab>
</Tabs>

## Parameters

None

## Returns

None

## Examples

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

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

## Context Manager Alternative

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

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

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