Documentation
One host, one key, 19 endpoints, every one a plain GET.
Authentication
Keys are issued and billed by RapidAPI. Every request carries two headers and nothing else — no phone number, no api_id, no session file.
x-rapidapi-key: YOUR_KEY
x-rapidapi-host: telegram155.p.rapidapi.com
Three full calls with the responses they return are on the quickstart page, and four things worth building on them are in the cookbook.
Endpoints
| Path | Returns |
|---|---|
GET /v1/usernames/{username} | Resolve a public @username to a numeric peer id |
GET /v1/contacts/search?q= | Search the public directory by keyword, four characters or more |
GET /v1/messages/search?q= | Directory search under its earlier path, kept working for callers written against it |
GET /v1/channels/{peer_id} | Full channel info: members, description, linked discussion group, boosts |
GET /v1/channels?ids= | Batch fetch channels by id |
GET /v1/channels/recommendations?peer_id= | Channels Telegram recommends alongside this one |
GET /v1/channels/{peer_id}/participants | Channel participants, where Telegram exposes them |
GET /v1/channels/{peer_id}/messages?ids= | Specific channel messages by id |
GET /v1/peers/{peer_id}/history | Message history with views and forwards, paginated |
GET /v1/peers/{peer_id}/messages/{msg_id}/replies | The reply thread under a post |
GET /v1/peers/{peer_id}/messages/{msg_id}/discussion | The post as it appears in the linked discussion group |
GET /v1/peers/{peer_id}/stories | Active stories |
GET /v1/peers/{peer_id}/stories/{ids} | Specific stories by id |
GET /v1/users/{peer_id} | Full public user profile |
GET /v1/users/{peer_id}/photos | A user’s profile photos |
GET /v1/phones/{phone} | Resolve a phone number to a Telegram account |
GET /v1/files/{file_id} | Download a file or photo by id |
GET /v1/openapi.json | The OpenAPI document the API serves about itself |
GET /health | Liveness probe, free and meant to be polled |
The machine-readable version of this table — parameters, response shapes and worked examples — is /openapi.json, OpenAPI 3.1.
The same specification also ships as a Postman collection: /tgatlas.postman_collection.json. In Postman pick Import, paste that link, and all 19 requests arrive grouped by subject with both RapidAPI headers already in place and the path parameters pre-filled from the examples, so the only empty field left is your key.
Pagination
History and replies use Telegram’s own cursor scheme: offset_id, add_offset, max_id, min_id. Pass the id of the oldest message you received as offset_id to get the page before it. History responses also carry next_page, which does the same walk without any bookkeeping on your side.
Two preconditions worth knowing
Member lists. Telegram hides the member list of a broadcast channel from everyone who is not an admin — that is the platform, not the API. full_chat.can_view_participants on /v1/channels/{peer_id} tells you in advance which way the participants call will go, and groups with an open list answer it in full.
Comment threads. A post has a thread when it has comments: every message in /v1/peers/{peer_id}/history carries replies.comments, and full_chat.linked_chat_id tells you whether the channel has a discussion group at all. Check either one and the replies and discussion calls land every time.
Errors
Every non-2xx response arrives in one envelope, so a single error path covers the whole API:
{ "error": "service temporarily unavailable", "code": "SERVICE_UNAVAILABLE", "hint": "retry shortly" }
error is for your logs, code is for your code, and hint appears wherever there is a concrete next step. There are seven codes and the list does not grow quietly:
| Code | What it means | What to do |
|---|---|---|
INVALID_REQUEST | A parameter is missing or malformed | Check the call against the spec — directory search needs a q of four characters or more |
NOT_FOUND | No such object, or it is not public | Re-resolve the handle; an id taken from the Bot API needs its -100 prefix stripped |
RESOURCE_UNAVAILABLE | The peer has not been seeded yet | Follow the hint: resolve it through /v1/usernames/{username} first, then repeat the call |
RATE_LIMITED | You are over your plan’s rate | Back off and retry, then read the headers on the response: they name which of the three budgets you spent |
SERVICE_UNAVAILABLE | Upstream is briefly unreachable | Retry shortly — the hint says so explicitly |
TIMEOUT | Upstream did not answer in time | Retry the same call |
INTERNAL_ERROR | Our side | Retry; if it persists it is worth telling us, and it gets looked at |
Three budgets are metered independently, and every response reports what is left of each one: monthly requests, discovery lookups and phone resolution. Only four paths spend a lookup: /v1/usernames/{username}, /v1/contacts/search, /v1/messages/search and /v1/channels/recommendations. Reading a channel and walking its history draws on requests alone. Resolving a run of handles back to back is the sequence that moves the lookup counter, and x-ratelimit-lookups-remaining shows the room you have before it does.
Every response reports what is left of all three budgets
2,500 calls a month, no card. No bot token and no phone number.