---
title: "Search one chat"
method: POST
path: "/bot/searchMessages"
tags: ["Bot"]
---

# Search one chat

`POST /bot/searchMessages`

Searches messages within exactly one accessible chat, newest first.

## Headers

- `authorization` string, required

## Request body

- SearchMessagesInput — Searches messages within exactly one accessible chat.
  - `user_id` integer — Target a private conversation with this user. Supply exactly one of user_id or chat_id.
  - `chat_id` integer — Target this chat. Supply exactly one of chat_id or user_id.
  - `query` string, required
  - `filter` 'photo' | 'video' | 'photo_video' | 'document' | 'link' | 'voice'
  - `offset_message_id` integer — A positive Inline message identifier
  - `limit` integer — An integer that can be represented exactly by a JavaScript number

## Response `200`

Successful exact-message read or search response.

- BotMessagesSuccess — unresolved $ref

## Other responses

- `400` — The request parameters are missing or invalid.
- `401` — The bot token is missing or invalid.
- `403` — The bot is not allowed to perform this action.
- `404` — The requested method or resource was not found.
- `500` — The server could not complete the request.

---

[API](https://skmtc.dev/inline/apis/inline-bot-http-api-docs.md) · [All operations](https://skmtc.dev/inline/apis/inline-bot-http-api-docs/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/inline/inline-bot-http-api-docs/revisions/69017b8dc5fe/schema)
