> ## Documentation Index
> Fetch the complete documentation index at: https://microstrate-1133-notifications-prefs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Search stream messages by subject pattern

> Searches for stream messages by subject pattern



## OpenAPI

````yaml /api-reference/endpoint/storage/openapi.json get /storage/streams/{stream}/search-by-subject
openapi: 3.0.3
info:
  title: quiva.ai Gateway
  description: >-
    A comprehensive interface for managing key-value stores, object stores,
    streams, and search indexing
  contact:
    name: quiva.ai Support
    url: https://quiva.ai/help-center/
  version: 1.0.0
servers:
  - url: https://api.quiva.ai
    description: Production API server
security:
  - bearerAuth: []
  - apiKeyAuth: []
paths:
  /storage/streams/{stream}/search-by-subject:
    get:
      tags:
        - Stream Search
      summary: Search stream messages by subject pattern
      description: Searches for stream messages by subject pattern
      operationId: searchStreamBySubject
      parameters:
        - $ref: '#/components/parameters/stream'
        - name: search
          in: query
          description: Subject pattern to search for (supports wildcards)
          required: true
          schema:
            type: string
          examples:
            exact:
              summary: Exact subject match
              value: events.user.login
            wildcard_single:
              summary: Single-level wildcard
              value: events.user.*
            wildcard_multi:
              summary: Multi-level wildcard
              value: events.>
        - name: limit
          in: query
          description: Maximum number of results to return
          required: false
          schema:
            type: integer
            default: 10
            minimum: 1
            maximum: 1000
          examples:
            default:
              summary: Default limit
              value: 10
            large:
              summary: Large result set
              value: 100
      responses:
        '200':
          description: Search results
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StreamSearchResponse'
              examples:
                user_events:
                  summary: User event search results
                  value:
                    body:
                      results:
                        - subject: events.user.login
                          value: >-
                            {"user_id":"usr_abc123","timestamp":"2024-03-15T14:30:00Z"}
                          created: '2024-03-15T14:30:00Z'
                        - subject: events.user.logout
                          value: >-
                            {"user_id":"usr_abc123","timestamp":"2024-03-15T16:45:00Z"}
                          created: '2024-03-15T16:45:00Z'
                        - subject: events.user.profile_update
                          value: >-
                            {"user_id":"usr_def456","field":"email","timestamp":"2024-03-15T17:00:00Z"}
                          created: '2024-03-15T17:00:00Z'
                      results_total: 3
                    metadata:
                      stream: user-events
                      search: events.user.*
                      hits: 3
                      duration: 8ms
                no_results:
                  summary: No matching messages
                  value:
                    body:
                      results: []
                      results_total: 0
                    metadata:
                      stream: user-events
                      search: events.admin.*
                      hits: 0
                      duration: 2ms
        '400':
          $ref: '#/components/responses/BadRequestError'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          $ref: '#/components/responses/NotFoundError'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    stream:
      name: stream
      in: path
      description: Name of the stream
      required: true
      schema:
        type: string
  schemas:
    StreamSearchResponse:
      type: object
      properties:
        body:
          type: object
          properties:
            results:
              type: array
              items:
                $ref: '#/components/schemas/SearchStreamItem'
            results_total:
              type: integer
        metadata:
          $ref: '#/components/schemas/Metadata'
    SearchStreamItem:
      type: object
      properties:
        subject:
          type: string
        value:
          type: string
        created:
          type: string
          format: date-time
    Metadata:
      type: object
      properties:
        bucket:
          type: string
          description: Bucket name
        duration:
          type: string
          description: Operation duration
        field:
          type: string
          description: Search field
        hits:
          type: integer
          description: Number of hits
        index_duration:
          type: string
          description: Index search duration
        index_hits:
          type: integer
          description: Number of index hits
        index_name:
          type: string
          description: Index name
        index_partitions:
          type: integer
          description: Number of index partitions
        key:
          type: string
          description: Entry key
        limit:
          type: integer
          description: Query limit
        partitions:
          type: integer
          description: Number of partitions
        search:
          type: string
          description: Search term
        stream:
          type: string
          description: Stream name
        subject:
          type: string
          description: Subject pattern
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Error message
  responses:
    BadRequestError:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: validation_error
    UnauthorizedError:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: unauthorized
    NotFoundError:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: not_found
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: internal_error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key

````