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

# Search

> LinqAlpha uses multiple data sources and retrieval methods to find the most relevant documents or information based on a query. Unlike the generate endpoint, this API only performs the search step and returns matched results without generating a response.

**How to view original documents:**
1. **Via Viewer:** `https://chat.linqalpha.com/rms/viewer?chat_message_id={chat_message_id}&citation_idx={citation_idx}`
2. **Direct Download:** If the reference contains a `document_id`, you can access the original document directly through the [presigned_url endpoint](https://docs.linqalpha.com/api-reference/basic/presigned_url).



## OpenAPI

````yaml POST /v1/search
openapi: 3.0.1
info:
  title: LinqAlpha API
  description: >-
    Linq helps finance professionals make informed decisions using
    Retrieval-Augmented Generation (RAG)-enhanced answers. By leveraging
    cutting-edge Large Language Models (LLM) and supplementary technology, Linq
    provides the most optimized responses based on your queries.
  version: 1.0.0
  license:
    name: MIT
servers:
  - url: https://api.linqalpha.com
security:
  - ApiKeyAuth: []
tags:
  - name: Search
    description: Search and generate responses
  - name: Data
    description: Data retrieval and mapping
  - name: Feedback
    description: Conversation feedback
  - name: RMS
    description: Research Management System
  - name: Source Management
    description: Source batch and file management
  - name: MCP
    description: >-
      LinqAlpha MCP — Financial data tools for AI assistants via Model Context
      Protocol
  - name: Connectors
    description: Customer Connectors — customer-owned MCP connector management
  - name: Briefing
    description: Briefing Agent — automated market briefings with scheduling and delivery
  - name: Status
    description: Sync status — check organization, document, and container sync progress
paths:
  /v1/search:
    post:
      tags:
        - Search
      summary: Search
      description: >-
        LinqAlpha uses multiple data sources and retrieval methods to find the
        most relevant documents or information based on a query. Unlike the
        generate endpoint, this API only performs the search step and returns
        matched results without generating a response.


        **How to view original documents:**

        1. **Via Viewer:**
        `https://chat.linqalpha.com/rms/viewer?chat_message_id={chat_message_id}&citation_idx={citation_idx}`

        2. **Direct Download:** If the reference contains a `document_id`, you
        can access the original document directly through the [presigned_url
        endpoint](https://docs.linqalpha.com/api-reference/basic/presigned_url).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchRequest'
            example:
              query: What are the latest news on AAPL?
              stock_ids:
                - BBG001S5N8V8
              tickers:
                - AAPL
              external_types:
                - transcript
                - filing
                - news
                - ir_slide
      responses:
        '200':
          description: Search response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
              example:
                chat_message_id: 123e4567-e89b-12d3-a456-426614174000
                search_result_count: 38
                execution_time_ms: 10355
                references:
                  - id: '12'
                    citation_idx: '12'
                    search_type: rms
                    chunk_id: 123e4567-e89b-12d3-a456-426614174000
                    text: >-
                      For fiscal year 2024, Tesla expects EBIT to grow between
                      15% and 20%...
                    text_type: paragraph
                    document_name: Tesla 10-K 2023
                    external_url: >-
                      https://www.sec.gov/ix?doc=/Archives/edgar/data/1318605/000095017024002308/tsla-20231231.htm
                    metadata:
                      source: filing
                      ticker: TSLA
                      published_at: '2024-02-14'
                    custom_metadata: null
        '400':
          description: Bad Request - Invalid request parameters or incorrect format.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorResponse'
              examples:
                invalid_upload_period:
                  summary: Invalid upload_period format
                  value:
                    error:
                      code: INVALID_REQUEST_BODY
                      message: >-
                        upload_period.start_time must be an object with year
                        (integer), month (integer 1-12), and optional day
                        (integer 1-31). Example: {"year": 2025, "month": 1,
                        "day": 1}
                    payload: null
                missing_query:
                  summary: Missing required field
                  value:
                    error:
                      code: INVALID_REQUEST_BODY
                      message: query is required and must be a string
                    payload: null
        '401':
          description: Unauthorized - Invalid authentication credentials.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorResponse'
              example:
                error:
                  code: API_KEY_MISSING
                  msg: header does not contain api key
                  message: header does not contain api key
                payload: null
        '403':
          description: Forbidden - No permission to access this resource.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorResponse'
              example:
                error:
                  code: FORBIDDEN
                  message: 'Access denied: insufficient permissions.'
                payload: null
        '404':
          description: Not Found - The requested resource does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorResponse'
              example:
                error:
                  code: NOT_FOUND
                  message: The requested resource was not found.
                payload: null
        '500':
          description: Internal Server Error - An unexpected error occurred on the server.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorResponse'
              example:
                error:
                  code: SERVER_ERROR
                  message: An unexpected error occurred on the server.
                payload: null
components:
  schemas:
    SearchRequest:
      type: object
      properties:
        query:
          type: string
          description: A search query
          example: What are the latest updates on AAPL?
        stock_ids:
          type: array
          items:
            type: string
          description: Bloomberg stock IDs (optional)
          example:
            - BBG001S5N8V8
        tickers:
          type: array
          items:
            type: string
          description: Ticker symbols (optional)
          example:
            - AAPL
        external_types:
          type: array
          items:
            type: string
          description: >-
            External document types (optional, defaults to ["transcript",
            "filing", "news", "ir_slide"])
          default:
            - transcript
            - filing
            - news
            - ir_slide
          example:
            - transcript
            - filing
            - news
            - ir_slide
        top_k:
          type: number
          description: >-
            Specifies the number of top search results to return.

            If the value exceeds 50, it will be capped at 50

            The number of returned results will be less than or equal to the
            specified top_k value.

            Results are sorted by relevancy in descending order (from highest to
            lowest).
          example: 50
        upload_period:
          type: object
          description: >-
            Filter documents by upload date range. At least one of start_time or
            end_time must be provided.
          properties:
            start_time:
              $ref: '#/components/schemas/DateFilter'
            end_time:
              $ref: '#/components/schemas/DateFilter'
          example:
            start_time:
              year: 2025
              month: 1
              day: 1
            end_time:
              year: 2026
              month: 1
              day: 17
        search_types:
          type: array
          items:
            type: string
            enum:
              - rms
              - external
              - all
          description: Types of search to perform
          example:
            - rms
            - external
        rms_types:
          type: array
          items:
            type: string
          description: >-
            Filter by RMS document type. Only applies when `search_types`
            includes `rms`.
          nullable: true
        rms_sub_types:
          type: array
          items:
            type: string
          description: Filter by RMS document subtype within `rms_types`.
          nullable: true
      required:
        - query
    SearchResponse:
      type: object
      properties:
        chat_message_id:
          type: string
          format: uuid
          description: Chat message ID
        search_result_count:
          type: number
          description: Search result count
        execution_time_ms:
          type: number
          description: Execution time in milliseconds
        references:
          type: array
          items:
            type: object
            properties:
              citation_idx:
                type: string
                description: Citation index
              chunk_id:
                type: string
                description: Chunk ID
              document_id:
                type: string
                description: Document ID
              text:
                type: string
                description: Text
              text_type:
                type: string
                description: Text type
              document_name:
                type: string
                description: Document name
              external_url:
                type: string
                description: External URL
              metadata:
                $ref: '#/components/schemas/ReferenceMetadata'
              custom_metadata:
                $ref: '#/components/schemas/CustomMetadata'
            required:
              - citation_idx
              - chunk_id
              - text
              - text_type
              - document_name
              - external_url
              - metadata
          description: References
      required:
        - chat_message_id
    ApiErrorResponse:
      type: object
      description: Standard error response wrapper
      properties:
        error:
          $ref: '#/components/schemas/ApiError'
        payload:
          description: Always null for error responses
          nullable: true
      required:
        - error
        - payload
    DateFilter:
      type: object
      description: Date filter with year, month, and optional day
      properties:
        year:
          type: integer
          description: Year (e.g., 2025)
          example: 2025
        month:
          type: integer
          description: Month (1-12)
          minimum: 1
          maximum: 12
          example: 1
        day:
          type: integer
          description: Day of month (1-31, optional)
          minimum: 1
          maximum: 31
          example: 15
      required:
        - year
        - month
    ReferenceMetadata:
      type: object
      description: Additional metadata information
      properties:
        source:
          type: string
          nullable: true
          example: news
        rms_type:
          type: string
          enum:
            - emailnotes
            - generalnotes
            - templatednotes
            - custom-data
            - structured-data
            - public_transcript
            - private_transcript
          nullable: true
        rms_sub_type:
          type: string
          nullable: true
        rms_document_type:
          type: string
          enum:
            - note
            - attachment
          nullable: true
        parent_id:
          type: string
          nullable: true
        parent_document_id:
          type: string
          nullable: true
        countries:
          type: array
          items:
            type: string
          nullable: true
        regions:
          type: array
          items:
            type: string
          nullable: true
        participants:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              organization:
                type: string
              role:
                type: string
                nullable: true
              participant_type:
                type: string
                enum:
                  - author
                  - analyst
                  - attendee
                  - mentioned
                  - others
                nullable: true
          nullable: true
        tags:
          type: array
          items:
            type: string
          nullable: true
        publisher:
          type: string
          nullable: true
        calendar_date:
          type: string
          format: date-time
          nullable: true
        creation_timestamp:
          type: string
          nullable: true
        last_contribution_timestamp:
          type: string
          nullable: true
        creator_name:
          type: string
          description: Name of the user who created the document
          nullable: true
        last_contributor_name:
          type: string
          description: Name of the user who last contributed to the document
          nullable: true
        fiscal_year:
          type: integer
          nullable: true
        fiscal_quarter:
          type: string
          nullable: true
        document_category:
          type: string
          enum:
            - internal
            - brokerage
            - expert_network
            - corporate_data
            - external
            - earnings_call
            - filing
          nullable: true
        document_subcategory:
          type: string
          enum:
            - calls
            - model
            - analysis
            - report
            - filings
            - ir_slide
            - factsheet
            - email
            - earning
            - slides
            - 10-K
            - 10-Q
            - 6-K
            - 8-K
            - DEF 14A
            - 20-F
            - annual_results
            - interim_results
            - annual_report
            - interim_report
            - offerings
            - others
          nullable: true
        document_tags:
          type: array
          items:
            type: string
          nullable: true
        sector:
          type: array
          items:
            type: string
            enum:
              - Basic Materials
              - Consumer Cyclicals
              - Consumer Staples
              - Energy
              - Financial Services
              - Healthcare
              - Industrials
              - Technology
              - Transportation
              - Telecom Services
              - Utilities
          nullable: true
        subsector:
          type: array
          items:
            type: string
            enum:
              - Agriculture
              - Chemicals
              - Metals & Mining
              - Paper & Forest
              - Steel
              - Automobiles
              - Branded Consumer Goods
              - Business Services
              - Consumer Cyclicals
              - Consumer Durables
              - Education
              - Entertainment & Leisure
              - Gaming
              - Housing
              - Lodging
              - Media
              - Restaurants & Pubs
              - Retail
              - Textile
              - Apparel & Footwear
              - Travel
              - Beverages
              - Consumer Products
              - Food
              - Tobacco
              - Clean Energy
              - Energy
              - Gas
              - Oil
              - Oil Services
              - Banks
              - Brokers & Asset Managers
              - Capital Markets
              - Diversified Financials
              - Insurance
              - Real Estate
              - Specialty Finance
              - Biotechnology
              - Healthcare Services
              - Life Sciences
              - Medical Technology
              - Pharmaceuticals
              - Aerospace & Defense
              - Capital Goods
              - Construction
              - Electrical Equipment
              - Environmental Services
              - Machinery
              - Machinery & Diversified Industrials
              - Multi-Industry
              - Packaging
              - Communications Technology
              - Hardware
              - Info Services
              - Integrated Electricals
              - Internet
              - IT Services
              - IT Supply Chain
              - Semiconductors
              - Software
              - Technology
              - Air Freight
              - Airlines
              - Airports
              - Infrastructure
              - Logistics
              - Railroads
              - Shipping
              - Trucking
              - Communication Services
              - Satellite
              - Telecom Wireless
              - Towers
              - Diversified
              - MLPs
              - Power
              - Utilities
              - Water
          nullable: true
        stock_ids:
          type: array
          items:
            type: string
          nullable: true
        tickers:
          type: array
          items:
            type: string
          nullable: true
        company_names:
          type: array
          items:
            type: string
          nullable: true
        offset:
          type: array
          nullable: true
          items:
            type: object
            properties:
              top:
                type: number
              left:
                type: number
              width:
                type: number
              height:
                type: number
              page:
                type: integer
        blocks:
          type: array
          items:
            type: integer
          nullable: true
          description: Transcript block indices for this chunk.
    CustomMetadata:
      type: object
      nullable: true
      description: >-
        User-defined metadata. This field may contain additional structured data
        based on the document type and user configuration.
      properties:
        edgar_metadata:
          type: object
          description: >-
            SEC EDGAR filing metadata. This field is only available for SEC
            filing documents and is provided upon request. Not all users will
            have access to this data. Contact support@linqalpha.com to enable
            EDGAR metadata for your organization.
          properties:
            public_url:
              type: string
              format: uri
              description: >-
                Public EDGAR URL to the source filing document on the SEC
                website
              example: >-
                https://www.sec.gov/Archives/edgar/data/1045810/000104581023000227/nvda-20231029.htm
            accession_number:
              type: string
              description: >-
                SEC accession number uniquely identifying the filing. Format:
                XXXXXXXXXX-XX-XXXXXX
              example: 0001045810-23-000227
              pattern: ^\d{10}-\d{2}-\d{6}$
            filing_values:
              type: object
              description: Additional SEC filing identifiers
              properties:
                film_number:
                  type: string
                  description: SEC film number assigned to the filing
                  example: '231428716'
                sec_file_number:
                  type: string
                  description: SEC file number for the registrant
                  example: 000-23985
          required:
            - public_url
            - accession_number
    ApiError:
      type: object
      properties:
        code:
          type: string
          description: >-
            Error code indicating the type of error. Common codes:

            - Authentication: `API_KEY_MISSING`, `INVALID_API_KEY`

            - Validation: `INVALID_REQUEST_BODY`, `ORGANIZATION_ID_MISSING`,
            `TICKERS_MISSING`, `CHAT_MESSAGE_ID_MISSING`, `DOCUMENT_ID_MISSING`

            - Service: `SEARCH_FAIL`, `TTS_FAIL`, `CREATE_CONV_FAIL`,
            `GET_STOCK_FAIL`, `CREATE_MSG_FAIL`, `ALPHA_COMP_FAIL`,
            `GET_REF_FAIL`

            - Connectors: `CONNECTOR_LIST_FAIL`, `CONNECTOR_NOT_FOUND`,
            `CONNECTOR_CREATE_FAIL`, `CONNECTOR_UPDATE_FAIL`,
            `CONNECTOR_DELETE_FAIL`, `CONNECTOR_TEST_FAIL`

            - Not Found: `NOT_FOUND`
          example: INVALID_REQUEST_BODY
        msg:
          type: string
          description: Error message (deprecated, use `message` instead)
          example: query is required and must be a string
        message:
          type: string
          description: Error message providing more details about the error
          example: query is required and must be a string
      required:
        - code
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````