# Telegram Search in channel API (telegram.search_in_channel)

- Canonical page: [https://everyinfra.com/en/telegram-api/search_in_channel](https://everyinfra.com/en/telegram-api/search_in_channel?utm_medium=ai_doc&utm_campaign=page_md)
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "telegram", "action": "search_in_channel", "params": {...}}
- Price: $0.000556 per call ($0.56 per 1,000 requests); failed calls and empty results are not charged
- Returns: list, default 20, max 100 per call (larger values are capped)
- Pagination: pass next_page_token back as page_token for the next page, other params unchanged; one call per page, tokens last 24 hours
- Mode: sync; add "mode": "async" for slow tasks

## Health

- Live health (24h percent, hourly and daily trends): https://api.everyinfra.com/api/v1/social/availability?platform=telegram&action=search_in_channel

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| username | not declared | yes | not declared | The public channel to search in: name, @name, t.me/name or t.me/s/name. A channel that does not exist returns 200 with an empty result and `empty_reason` set to `account_not_found`, and the call is not charged. |
| keyword | not declared | yes | not declared | The word or phrase to look for, up to 100 characters. Telegram's own in-channel search runs across the channel's whole history; no match returns an empty list and is not charged. |
| page_token | not declared | no | not declared | Page token. Leave it out for the first page, then pass back the previous response's `next_page_token` exactly as received, with the other parameters unchanged. Each page holds up to 100 messages (`limit`, default 20) and counts as one call; only a page without `next_page_token` is the last one. |
| limit | integer (1–100) | no | 20 | The most rows to return in this call, an integer from 1 to 100. The default applies when you leave it out, and a call can return fewer rows. Larger values are accepted and capped at the maximum. |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | The record's unique ID on the platform. Unique only within one platform; IDs can repeat across platforms. |
| url | Link to the record on the platform. |
| channel_username | Channel username (the public identifier starting with @). |
| channel_title | Channel name. |
| text | Body text with HTML removed, returned in full and never cut short (on a few platforms the list results themselves carry only an excerpt; the platform's field notes say so). |
| view_count | Views or plays. null means not disclosed, not 0. |
| posted_at | Publish time in ISO 8601, UTC (for example 2026-08-07T12:34:56+00:00). Non-standard strings from the platform are passed through as is, so parse defensively. null means the platform does not disclose it. |
| media_type | Media type (photo / video / file / voice); in post_comments and search_in_channel an album of several photos or videos is album, and text-only messages have no media_type. |
| media_url | Media file link. |
| author | Message sender. |
| is_forwarded | Whether the message is forwarded. |
| forwarded_from | Forward source. Used to trace how information spread. |
| reply_to_url | Link to the message being replied to. |
| platform | Source platform identifier, the same as platform in the request (for example xiaohongshu, tiktok). |
| link_preview_url | URL the post's link preview points to (channel_posts / post_detail); absent when the post has no link preview. |
| reactions | Emoji reactions with their counts; in post_comments and search_in_channel each is {emoji, emoji_id, count, is_paid}, and a custom emoji has emoji_id instead of emoji. |
| text_html | The text as HTML, keeping its links and formatting (post_comments, search_in_channel). |
| image_urls | Array of image links in the platform's display order; absent when there are no images. |
| video_url | Link to the video file (post_comments, search_in_channel); signed and expires, absent when there is no video. |
| media | Each photo or video in the message (post_comments, search_in_channel): [{type, url, id, width, height, thumbnail_url, duration_sec}], each only when it has a value; links expire. |
| reaction_count | Total number of emoji reactions (post_comments, search_in_channel). |
| reaction_count_estimated | Whether reaction_count is a rounded figure: true when Telegram's page shows it in a form like 9.37K (post_comments, search_in_channel). |
| links | Links in the text, in order of appearance (post_comments, search_in_channel); absent when there are none. |
| reply_to_id | Number of the message or comment being replied to (post_comments, search_in_channel); absent when Telegram does not give it. |
| reply_to_name | Name of the person being replied to (post_comments, search_in_channel). |
| reply_to_text | Text of the message being replied to, as Telegram's page quotes it (post_comments, search_in_channel). |
| is_edited | Whether the message was edited after it was posted (search_in_channel). |
| image_count | Number of photos in the message (search_in_channel). |
| video_urls | Link to each video in the message (search_in_channel); an album can have several; signed and expire. |
| thumbnail_url | Thumbnail link, lower resolution than image_url. |
| duration_sec | Video length in seconds (search_in_channel), the same value as duration_seconds. |
| duration_seconds | Duration in seconds. null for content that is not video or audio. |
| width | Width of the photo or video in pixels (search_in_channel). |
| height | Height of the photo or video in pixels (search_in_channel). |
| hashtags | Hashtags in the text, in order of appearance; absent when there are none. |
| mentions | Usernames mentioned with @ in the text (search_in_channel). |
| is_reply | Whether the message replies to another message (search_in_channel). |
| view_count_estimated | Whether view_count is a rounded figure: true when Telegram's page shows it in a form like 2.57M (search_in_channel). |
| link_preview | The link preview card in the message (search_in_channel): {url, site_name, title, description, image_url}, each only when it has a value; url is the same as link_preview_url. |
| reposted_post | Details of where a forwarded message came from, as given (search_in_channel); present only on forwarded messages. |
| poll_question | The poll question (search_in_channel); present only on poll messages. |
| poll_options | The poll's options, as given (search_in_channel). |
| poll_total_votes | Total votes in the poll (search_in_channel). |
| poll_total_votes_estimated | Whether poll_total_votes is a rounded figure (search_in_channel), by the same rule as view_count_estimated. |
| channel_id | The channel's numeric ID (search_in_channel). |
| channel_url | Link to the channel, https://t.me/<channel> (search_in_channel). |
| channel_avatar_url | Link to the channel's avatar image (search_in_channel). |
| channel_description | Channel description. |
| channel_subscriber_count | Number of channel subscribers. |
| channel_subscriber_count_estimated | Whether channel_subscriber_count is a rounded figure (in search_in_channel it is the rounded count Telegram's page shows, such as 9.83M stored as 9830000, and this is true). |

## Example

```bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "telegram",
  "action": "search_in_channel",
  "params": {
    "username": "durov",
    "keyword": "TON"
  }
}'
```

```python
import os
import requests

response = requests.post(
    "https://api.everyinfra.com/api/v1/social",
    headers={"Authorization": f"Bearer {os.environ['EVERYINFRA_API_KEY']}"},
    json={
        "platform": "telegram",
        "action": "search_in_channel",
        "params": {
            "username": "durov",
            "keyword": "TON",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

No real sample for these example parameters yet: structure only, every value is a placeholder (…).

```text
{
  "id": "req_…",
  "platform": "telegram",
  "action": "search_in_channel",
  "results": [
    {
      "id": …,
      "url": …,
      "channel_username": …,
      "channel_title": …,
      "text": …,
      "view_count": …,
      "posted_at": …,
      "media_type": …,
      "media_url": …,
      "author": …,
      "is_forwarded": …,
      "forwarded_from": …,
      "reply_to_url": …,
      "platform": …,
      "link_preview_url": …,
      "reactions": …,
      "text_html": …,
      "image_urls": …,
      "video_url": …,
      "media": …,
      "reaction_count": …,
      "reaction_count_estimated": …,
      "links": …,
      "reply_to_id": …,
      "reply_to_name": …,
      "reply_to_text": …,
      "is_edited": …,
      "image_count": …,
      "video_urls": …,
      "thumbnail_url": …,
      "duration_sec": …,
      "duration_seconds": …,
      "width": …,
      "height": …,
      "hashtags": …,
      "mentions": …,
      "is_reply": …,
      "view_count_estimated": …,
      "link_preview": …,
      "reposted_post": …,
      "poll_question": …,
      "poll_options": …,
      "poll_total_votes": …,
      "poll_total_votes_estimated": …,
      "channel_id": …,
      "channel_url": …,
      "channel_avatar_url": …,
      "channel_description": …,
      "channel_subscriber_count": …,
      "channel_subscriber_count_estimated": …
    }
  ],
  "next_page_token": …,
  "pagination": { … },
  "count": …,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## Also

- Capability catalog (no key): https://api.everyinfra.com/api/v1/social/catalog?platform=telegram
- OpenAPI: https://everyinfra.com/openapi.json · Agents guide: https://everyinfra.com/agents.md
