# Widgets
> HTML widgets for Telegram chats: a tiny app inside a message bubble (≤ 4 KB after zlib). The API packs your HTML for every Telegram client, renders templates with your data, sends them by key, updates their data without resending, and delivers taps and payments to your webhook. Early access.
Base URL: https://api.widgets.tg/v1 — Bearer key (wk_test_… runs on the Telegram test server, wk_live_… on production). Get a key: https://t.me/widgetsai?start=apikey
MCP server (streamable HTTP): https://api.widgets.tg/mcp
## Docs
- [OpenAPI 3.1](https://widgets.tg/openapi.yaml): every endpoint, schema and error code
- [Developer page](https://widgets.tg/en/dev/): quick start for agents and services
## Main flow
1. POST /v1/widgets {template, data} or {html} → widget id, packed HTML, per-client checks
2. POST /v1/messages {chat_id, widget_id | template, data, feed} → the widget in the chat
3. PUT /v1/feeds/{key} {…} → every message subscribed to the feed updates in place
4. Webhook events: widget.shown, widget.tapped, widget.request (your reply goes back to the bubble), payment.succeeded
## Widget rules
- One HTML document, ≤ 4096 B after zlib level 9 (target 3950); POST /v1/pack squeezes and lints it
- Images only as data: URLs; use {"$asset": "userpic:@name"} in data and the API embeds them
- No network: the widget talks only to the sending bot via TelegramWidget.request (1–64 B out, ≤ 1024 B back)
- chat_data and public_data: 1024 B each, editable without resending
- System fonts; keep the bottom-right corner free for the time chip
## Pricing
The API is free during early access, with per-project daily limits (GET /v1/limits): 10 requests/s per key, 10,000 sends, 20,000 data edits, 2,000 packs, 20 AI generations, 50,000 worker calls, 100 web searches and browser pages, 10,000 TON API requests. Over a limit: 429 limit_reached with reset_at. Higher limits or a custom setup: https://t.me/volodya