Public API
Access Telegram channel data through our free REST API. No API key required. All endpoints return JSON and support CORS.
Free, no API key required
Rate Limits
Requests are rate-limited to ensure fair usage. Current limits:
- 60 requests/minute per IP address
- Responses are cached for 60 seconds server-side
- Exceeding limits returns
429 Too Many Requests
GET
/api/telegram/resolve/:usernameResolve a Telegram entity (channel, group, or user) by username.
Example
fetch('https://tg.me/api/telegram/resolve/durov')
.then(res => res.json())
.then(data => {
console.log(data.title); // "Pavel Durov"
console.log(data.about); // Bio text
console.log(data.participantsCount); // 1234567
});Response
{
"className": "Channel",
"id": "...",
"title": "Pavel Durov",
"username": "durov",
"about": "...",
"participantsCount": 1234567,
"verified": true,
"megagroup": false
}GET
/api/telegram/messages/:channelGet recent messages from a channel. Supports ?limit=N (1-50, default 20).
Example
fetch('https://tg.me/api/telegram/messages/durov?limit=5')
.then(res => res.json())
.then(data => {
for (const msg of data.messages) {
console.log(`#${msg.id}: ${msg.message?.slice(0, 80)}`);
console.log(` Views: ${msg.views}, Date: ${new Date(msg.date * 1000)}`);
}
});Response
{
"messages": [
{
"id": 1234,
"date": 1711234567,
"message": "Post text...",
"views": 50000,
"forwards": 120,
"media": { "className": "MessageMediaPhoto" },
"entities": [...]
}
]
}GET
/api/avatar/:usernameGet a user or channel avatar image. Returns the image binary with appropriate Content-Type.
Example
// Use directly in <img> tags
<img src="https://tg.me/api/avatar/durov" alt="durov" />
// Or fetch programmatically
fetch('https://tg.me/api/avatar/durov')
.then(res => res.blob())
.then(blob => {
const url = URL.createObjectURL(blob);
document.getElementById('avatar').src = url;
});Response
Binary image data (JPEG/PNG). Returns 404 if no avatar is set.
Embed Widget
Embed a channel's latest posts or a single post on your website using an iframe.
Channel embed
<iframe src="https://tg.me/embed/durov?posts=3&theme=dark" width="400" height="500" frameborder="0" style="border: none; border-radius: 12px;" ></iframe>
Single post embed
<iframe src="https://tg.me/embed/durov/1234?theme=dark" width="400" height="300" frameborder="0" style="border: none; border-radius: 12px;" ></iframe>
Query params:
?posts=N (1-10, default 3), ?theme=dark|lightRSS Feeds
Subscribe to any channel's posts via RSS. Feed URL format:
RSS feed URL
https://tg.me/{username}/rss.xmlFeeds update every 5 minutes and include the latest 20 posts.
Error Codes
400Invalid request parameters
404Entity or resource not found
429Rate limit exceeded. Retry after the specified time.
503Service temporarily unavailable. All worker accounts are busy.