Expand AI logo
DocsDocs
API Reference
Login

Documentation

Start

WelcomeQuickstartCLI & AgentsAPI Reference

Concepts

Progressive DisclosureState JSONAppendixCitationsSearch & HighlightingSpatial MarkdownInclude OptionsBatched Fetch

Product

FetchMCPCLI

SDKs

SDKsTypeScript SDKPython SDK

Python SDK

Official Python client for expand.ai.

Use the Python SDK when application code needs Fetch.

Installation

pip install expandai
uv add expandai
poetry add expandai

Fetch Markdown

fetch() returns Markdown.

from expandai import Expand, FetchParams

client = Expand(api_key="{{API_KEY}}")

markdown = client.fetch(FetchParams(url="https://example.com"))
print(markdown)

Batched Fetch

from expandai import BatchedParams, Expand

client = Expand(api_key="{{API_KEY}}")

run = client.batched(BatchedParams(urls=["https://example.com", "https://example.com/about"]))
status = client.get_batched(run.id)

print(status.results)

Async

import asyncio
from expandai import AsyncExpand, FetchParams

async def main() -> None:
    async with AsyncExpand(api_key="{{API_KEY}}") as client:
        markdown = await client.fetch(FetchParams(url="https://example.com"))
        print(markdown)

asyncio.run(main())
PreviousTypeScript SDK

On This Page

InstallationFetch MarkdownBatched FetchAsync