> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scrape.st/llms.txt
> Use this file to discover all available pages before exploring further.

# Search Channel Messages

> Search messages within a specific Telegram channel

Search for messages matching a specific query within a given Telegram channel or group.

## Path Parameters

<ParamField path="channelId" type="string" required>
  The Telegram channel username (e.g. `@durov`) or numeric ID
</ParamField>

## Query Parameters

<ParamField query="q" type="string">
  Search query string (1-1000 characters). Optional. You can also use `query`
  instead of `q`. If omitted, fetches recent messages.
</ParamField>

<ParamField query="limit" type="number" default="20">
  Number of results to return (1-100)
</ParamField>

## Response

<ResponseField name="total" type="number">
  Total number of matching messages found
</ResponseField>

<ResponseField name="messages" type="array">
  <Expandable title="properties">
    <ResponseField name="id" type="number">
      Message ID
    </ResponseField>

    <ResponseField name="text" type="string">
      Message text content
    </ResponseField>

    <ResponseField name="date" type="number">
      Unix timestamp of the message
    </ResponseField>

    <ResponseField name="channelId" type="string | null">
      ID of the channel
    </ResponseField>

    <ResponseField name="channelTitle" type="string | null">
      Title of the channel
    </ResponseField>

    <ResponseField name="fromId" type="string | null">
      ID of the sender
    </ResponseField>

    <ResponseField name="views" type="number | null">
      Number of views
    </ResponseField>

    <ResponseField name="forwards" type="number | null">
      Number of forwards
    </ResponseField>

    <ResponseField name="hasMedia" type="boolean">
      Whether the message contains media
    </ResponseField>

    <ResponseField name="mediaType" type="string | null">
      Type of media (`photo`, `video`, `document`, `url`, or `null`)
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash theme={null}
  curl -X GET "https://scrape.st/telegram/channel/@durov/search?q=update&limit=20" \
    -H "x-api-key: YOUR_API_KEY"
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "total": 5,
    "messages": [
      {
        "id": 123456,
        "text": "Telegram just got a new update!",
        "date": 1714567890,
        "channelId": "1001234567",
        "channelTitle": "Durov's Channel",
        "fromId": "987654321",
        "views": 500000,
        "forwards": 12000,
        "hasMedia": false,
        "mediaType": null
      }
    ]
  }
  ```
</ResponseExample>
