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

# Filings Embeddings Search

> The Filings Embeddings Search API retrieves the nearest chunks of text (based on semantic similarity) from our database for specified filings (earnings transcripts and annual reports) for any given user query/prompt in natural langauge. Users can utilize this functionality for various purposes, such as building an AI-search engine, AI-tagging, etc., using the associated text from these filings.



## OpenAPI

````yaml openapi-india post /api/in/v0/documents/embeddings-search
openapi: 3.0.0
info:
  title: stockinsights.ai APIs
  description: All the APIs of stockinsights.ai
  version: 1.0.0
servers:
  - url: https://stockinsights-ai-main-95a26a0.zuplo.app
security:
  - bearerAuth: []
paths:
  /api/in/v0/documents/embeddings-search:
    post:
      summary: Filings Embeddings Search
      description: >-
        The Filings Embeddings Search API retrieves the nearest chunks of text
        (based on semantic similarity) from our database for specified filings
        (earnings transcripts and annual reports) for any given user
        query/prompt in natural langauge. Users can utilize this functionality
        for various purposes, such as building an AI-search engine, AI-tagging,
        etc., using the associated text from these filings.
      operationId: documentEmbeddingSearch
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - query
              properties:
                query:
                  type: string
                  description: >-
                    The user query in natural language for which similar chunks
                    of filings text is retrieved using OpenAI embeddings.
                top_k:
                  type: integer
                  default: 10
                  maximum: 100
                  description: >-
                    Number of top matching chunks to return in the response.
                    This parameter is optional and defaults to 20 if not
                    specified. Maximum value is 50.
                filters:
                  type: object
                  description: >-
                    Filters to narrow the search scope. For example, the search
                    can be limited to few companies only. Without filters,
                    search will be performed across all the filings.
                  properties:
                    types:
                      type: array
                      items:
                        type: string
                        enum:
                          - earnings-transcript
                          - annual-report
                      description: >-
                        The type of filings to include in the search. Choose
                        from 'earnings-transcript', 'annual-report'.
                    tickers:
                      type: array
                      items:
                        type: string
                        example: NSE:OLECTRA
                      maxItems: 100
                      description: >-
                        Exchange:Ticker of companies. Multiple tickers can be
                        provided separated by commas. Example - NSE:ZOMATO,
                        BSE:TCS. Get tickers from [Company
                        Details](https://drive.google.com/file/d/1oeghBbg6HmW5hl5MDR4CUFZDYYIjJorQ/view).
                    sectors:
                      type: array
                      items:
                        type: string
                      maxItems: 5
                      description: >-
                        Sector classification of the companies. Multiple values
                        can be provided separated by commas. Get valid sector
                        values from [Company
                        Details](https://drive.google.com/file/d/1oeghBbg6HmW5hl5MDR4CUFZDYYIjJorQ/view).
                    industries:
                      type: array
                      items:
                        type: string
                      maxItems: 5
                      description: >-
                        Industry classification of the companies. Multiple
                        values can be provided separated by commas. Check valid
                        industry values from [Company
                        Details](https://drive.google.com/file/d/1oeghBbg6HmW5hl5MDR4CUFZDYYIjJorQ/view).
                    years:
                      type: array
                      items:
                        type: string
                        pattern: ^[0-9]{4}$
                      description: >-
                        Fiscal year values in the format YYYY (e.g., 2024,
                        2023). Multiple values can be provided separated by
                        commas. Use this parameter to filter data by specific
                        years.
                    quarters:
                      type: array
                      items:
                        type: string
                        enum:
                          - Q1
                          - Q2
                          - Q3
                          - Q4
                      description: >-
                        Fiscal quarter values in the format Q1, Q2, Q3, Q4.
                        Multiple values can be provided separated by commas. Use
                        this parameter to filter by specific quarters.
      responses:
        '200':
          description: >-
            Successful response. Contains the list of chunks for given query
            vector
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: Status code
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/DocumentChunkWithScore'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    DocumentChunkWithScore:
      allOf:
        - $ref: '#/components/schemas/DocumentChunk'
        - type: object
          properties:
            similarity_score:
              type: number
              description: Similarity score
    Error:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              status:
                type: string
                description: Error status
              title:
                type: string
                description: Error description
              message:
                type: string
                description: Detailed error message (optional)
    DocumentChunk:
      type: object
      properties:
        text:
          type: string
          description: The chunk's text
        metadata:
          type: object
          properties:
            chunk_num:
              type: string
              description: Identifier of the chunk in the document
        document:
          type: object
          properties:
            type:
              type: string
              description: Filing type
            published_date:
              type: string
              format: date-time
              description: Filing date
            year:
              type: string
              description: Year of the filing
            quarter:
              type: string
              enum:
                - Q1
                - Q2
                - Q3
                - Q4
              description: Quarter of the filing
            link:
              type: string
              description: URL of the document
        company:
          type: object
          properties:
            id:
              type: string
              description: Internal representation of ID
            company_name:
              type: string
              description: Company Name
            ticker:
              type: string
              description: Internal ticker of the company
            exchange_tickers:
              type: array
              items:
                $ref: '#/components/schemas/ExchangeTicker'
    ExchangeTicker:
      type: object
      properties:
        exchange:
          type: string
          enum:
            - BSE
            - NSE
          description: Exchange Name
        ticker:
          type: string
          description: Company ticker in the exchange
        id:
          type: string
          description: Company ID/Code in the exchange. Not present for NSE
        url:
          type: string
          description: Company URL in the exchange
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````