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

# Custom Telegram API

> Use a self-hosted Telegram Bot API server

BotMux supports pointing at a custom Telegram Bot API server (e.g., [tdlib/telegram-bot-api](https://github.com/tdlib/telegram-bot-api)).

## Setup

```bash theme={null}
# Via flag
./botmux -token "TOKEN" -tg-api "http://localhost:8081"

# Via environment variable
TELEGRAM_API_URL="http://localhost:8081" ./botmux
```

## What It Affects

All Telegram API calls are routed through the custom URL:

* Bot polling (`getUpdates`)
* Bot API methods (send, ban, pin, etc.)
* API proxy (`/tgapi/` forwards to custom URL instead of `api.telegram.org`)
* Media file downloads
