> ## Documentation Index
> Fetch the complete documentation index at: https://tonapi.ness.su/llms.txt
> Use this file to discover all available pages before exploring further.

# Getting Started

> Python SDK for TONAPI

Query blockchain data via REST, subscribe to real-time events, and receive webhook notifications.

## Installation

```bash theme={"theme":{"light":"github-light-default","dark":"dark-plus"}}
pip install pytonapi
```

| Requirement | Version |
| ----------- | ------- |
| Python      | 3.10+   |
| aiohttp     | 3.9+    |
| pydantic    | 2.0+    |

## Quick Start

```python theme={"theme":{"light":"github-light-default","dark":"dark-plus"}}
import asyncio

from pytonapi.rest import TonapiRestClient
from pytonapi.types import Network
from pytonapi.utils import to_amount


async def main() -> None:
    async with TonapiRestClient(network=Network.MAINNET) as tonapi:
        account = await tonapi.accounts.get_account(
            account_id="EQDtFpEwcFAEcRe5mLVh2N6C0x-_hJEM7W61_JLnSF74p4q2",
        )
        print(f"Balance: {to_amount(account.balance)} TON")


if __name__ == "__main__":
    asyncio.run(main())
```

<Card title="More Examples" icon="github" href="https://github.com/nessshon/tonapi/tree/main/examples">
  REST, streaming, webhooks, and transfers.
</Card>

## Explore

<CardGroup cols={2}>
  <Card title="REST API" icon="bolt" href="/rest/overview">
    Query accounts, Jettons, NFTs, transactions, and more.
  </Card>

  <Card title="Webhooks" icon="bell" href="/webhooks/overview">
    Push notifications for account transactions and mempool messages.
  </Card>

  <Card title="Streaming" icon="satellite-dish" href="/streaming/overview">
    Real-time blockchain events over SSE and WebSocket.
  </Card>

  <Card title="AI Plugin" icon="wand-magic-sparkles" href="/claude-plugin">
    Query TON blockchain through natural language in Claude Code.
  </Card>
</CardGroup>
