> ## 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.

# References

> Retrieves evidence references for a specific chat message. Each reference corresponds to an exact chunk used in the final answer generated by the LinqAlpha engine. These chunks represent the precise portions of documents (e.g., filings, transcripts, or news) that were retrieved and cited by the model to construct the final response..

**How to find chat_message_id:**
Look for the event with `event_name` set to `search_results` in the Chat API response data. For detailed instructions, see [search_results event response](https://docs.linqalpha.com/api-reference/basic/chat_v2#option-6).

**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 GET /v1/references
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/references:
    get:
      tags:
        - Data
      summary: References
      description: >-
        Retrieves evidence references for a specific chat message. Each
        reference corresponds to an exact chunk used in the final answer
        generated by the LinqAlpha engine. These chunks represent the precise
        portions of documents (e.g., filings, transcripts, or news) that were
        retrieved and cited by the model to construct the final response..


        **How to find chat_message_id:**

        Look for the event with `event_name` set to `search_results` in the Chat
        API response data. For detailed instructions, see [search_results event
        response](https://docs.linqalpha.com/api-reference/basic/chat_v2#option-6).


        **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).
      parameters:
        - name: chat_message_id
          in: query
          description: Chat message ID
          required: true
          schema:
            type: string
          example: 123e4567-e89b-12d3-a456-426614174000
      responses:
        '200':
          description: References response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReferencesResponse'
              example:
                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_id: 123e4567-e89b-12d3-a456-426614174000
                    document_name: Tesla 10-K 2023
                    s3_file_key: tesla/filings/2023/10k.pdf
                    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'
              example:
                error:
                  code: CHAT_MESSAGE_ID_MISSING
                  msg: chat_message_id is required
                  message: chat_message_id is required
                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:
    ReferencesResponse:
      type: object
      properties:
        references:
          type: array
          items:
            $ref: '#/components/schemas/RMSReference'
          description: References
      required:
        - references
    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
    RMSReference:
      type: object
      properties:
        id:
          type: string
          description: Reference citation index (will be deprecated in the future)
          example: 123e4567-e89b-12d3-a456-426614174000
        citation_idx:
          type: string
          description: Reference citation index
          example: 123e4567-e89b-12d3-a456-426614174000
        search_type:
          type: string
          enum:
            - rms
            - external
          description: Type of search used
          example: rms
        chunk_id:
          type: string
          format: uuid
          description: ID of the chunk this reference belongs to
        text:
          type: string
          description: >-
            Exact text content of the matching chunk retrieved during search and
            used in the final answer. This is the precise segment of the source
            document that the model cited as evidence.
        text_type:
          type: string
          enum:
            - paragraph
            - table
            - image
            - news
          description: Type of text content
        document_id:
          type: string
          format: uuid
          description: Document ID that this reference points to
        document_name:
          type: string
          description: Human-readable document name
        s3_file_key:
          type: string
          description: S3 file path for the document
        external_url:
          type: string
          description: External S3 URL to access the document
        metadata:
          $ref: '#/components/schemas/ReferenceMetadata'
        custom_metadata:
          $ref: '#/components/schemas/CustomMetadata'
      required:
        - id
        - citation_idx
        - search_type
        - chunk_id
        - text
        - text_type
        - document_name
        - external_url
        - metadata
    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
    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
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````