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

# Получить историю поиска

> Fetch past search queries for the authenticated user.

Args:
    limit: Maximum number of queries to return (default 100)
    filter_days: Only return queries from the last N days (optional)

Returns:
    SearchHistoryResponse with list of search queries, ordered by most recent first.

> [!NOTE]
>
> **Необходимое право:** «Поиск — чтение» (`read:search`), которое включает `basic`,
> поэтому оно есть у любого вошедшего пользователя.
> Ограниченному [персональному токену доступа](https://docs.yahont.ai/developers/overview.md#personal-access-tokens)
> нужна область «Поиск — чтение».

> [!NOTE]
>
> Возвращает только собственные запросы вызывающего пользователя, самые свежие первыми, и только те,
> что отправлены через [Handle Send Search Message](https://docs.yahont.ai/developers/api_reference/search/handle_send_search_message.md)
> — сообщения чата и вызовы `POST /search` здесь не записываются.
> Значение `limit` вне диапазона 1–1000 или `filter_days` не больше нуля отклоняются с ошибкой `400`.


## OpenAPI

````yaml GET /search/search-history
openapi: 3.1.0
info:
  title: Yahont API
  description: Yahont API для поиска и чата по данным компании на базе ИИ
  version: Development
servers:
  - url: https://your-yahont-domain.com/api
security: []
paths:
  /search/search-history:
    get:
      tags:
        - public
      summary: Get Search History
      description: |-
        Fetch past search queries for the authenticated user.

        Args:
            limit: Maximum number of queries to return (default 100)
            filter_days: Only return queries from the last N days (optional)

        Returns:
            SearchHistoryResponse with list of search queries, ordered by most recent first.
      operationId: get_search_history
      parameters:
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            default: 100
            title: Limit
        - name: filter_days
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
              - type: 'null'
            title: Filter Days
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchHistoryResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    SearchHistoryResponse:
      properties:
        search_queries:
          items:
            $ref: '#/components/schemas/SearchQueryResponse'
          type: array
          title: Search Queries
      type: object
      required:
        - search_queries
      title: SearchHistoryResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SearchQueryResponse:
      properties:
        query:
          type: string
          title: Query
        query_expansions:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Query Expansions
        created_at:
          type: string
          format: date-time
          title: Created At
      type: object
      required:
        - query
        - query_expansions
        - created_at
      title: SearchQueryResponse
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Authorization header with Bearer token

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.