Telegram Client API Swagger
Interactive reference for Telegram Client API (MTProto). Find method, check di parameters, example responses and RPC errors, then run request for browser with your own Telegram session.
For developers wey dey build Telegram clients, integrations and automation tools, and wan know which method to call and wetin Telegram go return.
All methods See one example method
Site revision · 38e510b
Use OpenAPI for your own tools
Download di OpenAPI specification for Telegram Client API and use am for your tools.
- Import di JSON for Postman or another tool wey support OpenAPI to build request collections and test cases.
- Use di schemas for your documentation, form builders or to check JSON.
- Use di method descriptions and input schemas as base for MCP tools wey call Telegram through MTProto.
To run requests outside dis site, connect your tool to an MTProto client or HTTP adapter.
OpenAPI JSON dey available for 15 languages. Di file go download for di language wey you choose.
Di source code dey open under MIT license. GitHub stars dey help more developers find di project. Give am star for GitHub
How e dey work
Di build dey turn Telegram TL schema into OpenAPI and static method pages. You fit check request and response schemas before you run any method.
We dey use di official Telegram documentation for method and field descriptions when dem dey available.
Libraries and build tools
Teleproto dey handle MTProto. big-integer dey keep 64-bit numbers exact. esbuild dey bundle di browser client, and Python dey generate di static pages.
Updates
Published version: Teleproto 1.236.0 · TL 236
Every day, GitHub Actions dey compare di Teleproto release wey get latest tag for npm with di version wey we pin. If newer stable release dey, e go read di TL schema for di exact release commit and list methods wey dem add, remove or change.
Di workflow dey check TL layer, run tests and preview build, then open PR. After dem merge am, GitHub Pages go build di catalog and OpenAPI files again.
Security and privacy
For GitHub Pages, requests dey go straight from your browser to Telegram through WebSocket. Di app dey keep connection details for this tab. Clear di session to remove dem from di tab.
How request testing dey work
For this example, ask Telegram for di profile of di current account. inputUserSelf tell Telegram say na di current account you mean.
Wetin you put for our editor
For di users.getFullUser page, na only dis JSON dey inside di request editor. Di page already know di method name.
{
"id": { "_": "inputUserSelf" }
}
1. OpenAPI describe di request as POST
Di path and JSON describe di operation for tools like Postman. GitHub Pages dey serve di specification and no get handler for dis POST.
POST /catalog/users.getFullUser
Content-Type: application/json
{
"id": { "_": "inputUserSelf" }
}
2. Your browser dey send di real request through MTProto
When you click Run request, Teleproto take di method name and JSON fields, encode dem as binary MTProto, and send am straight to Telegram through WebSocket. Di app turn Telegram reply into JSON. Before you run am, di interface show example from di schema.
Teleproto dey turn di method and constructor names into TL IDs. Dis na di eight bytes of di call before envelope and encryption. Each ID dey start with di least significant byte.
users.getFullUser#b60f5918 id:InputUser = users.UserFull
inputUserSelf#f7c1b13f = InputUser
18 59 0f b6 | 3f b1 c1 f7
MTProto add server salt, session ID, message ID, sequence number and length around di TL bytes. E still add random padding.
Teleproto use di authorization key from di session and calculate message key. MTProto 2.0 use SHA-256 derive encryption key and IV, then AES-256-IGE encrypt di packet body. Di packet carry key ID, message key and encrypted body. Di authorization key stay with client and Telegram.
auth_key_id | msg_key | AES-256-IGE(…)
TL → MTProto → WebSocket → Telegram
JSON ← TL ← MTProto ← Telegram
Di eight bytes wey dey above show only TL payload. Di WebSocket frame carry di encrypted packet and transport framing. Telegram run di call, send TL reply, and Teleproto decrypt and decode am so di page fit show JSON.
Telegram MTProto 2.0 specification
3. HTTP adapter fit receive POST
For Postman, send di request to adapter wey dey run. Di local Python server dey accept request for dis format. Telethon encode di call for Telegram, and di server return JSON as HTTP response.
POST /api/method/call
Content-Type: application/json
{
"method": "users.getFullUser",
"request": { "id": { "_": "inputUserSelf" } },
"confirmed": true
}
Dis example show only operation fields. Di local adapter still need API ID and valid session credentials.