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

# Agent Response

> Answer a natural-language question from corporate disclosures, with every statement cited.

    The answer is Markdown in `content`, with citations such as `[#43c00004]`. Each citation is a key in `sourceMap`, which holds the passage, page and exact excerpt that support it, and the source document's metadata. When no relevant documents are found, `content` says so and `sourceMap` is empty.

    Use it when you need the complete answer at once, for example for data extraction or alerts. For chat interfaces, use the streaming endpoint. To answer from specific documents only, pass their IDs in `documentIds`.



## OpenAPI

````yaml POST /api/v2/rag/agent-response
openapi: 3.1.0
info:
  title: Captide REST API
  description: >-
    API for accessing financial disclosures and AI-powered financial document
    analysis.
  version: 0.3.14
servers:
  - url: https://rest-api.captide.co
    description: Prod server
security: []
paths:
  /api/v2/rag/agent-response:
    post:
      tags:
        - Retrieval Augmented Generation
      summary: Get agent response
      description: >-
        Answer a natural-language question from corporate disclosures, with
        every statement cited.

            The answer is Markdown in `content`, with citations such as `[#43c00004]`. Each citation is a key in `sourceMap`, which holds the passage, page and exact excerpt that support it, and the source document's metadata. When no relevant documents are found, `content` says so and `sourceMap` is empty.

            Use it when you need the complete answer at once, for example for data extraction or alerts. For chat interfaces, use the streaming endpoint. To answer from specific documents only, pass their IDs in `documentIds`.
      operationId: agent_response_api_v2_rag_agent_response_post
      parameters:
        - name: X-Langfuse-Trace-Id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Langfuse-Trace-Id
        - name: X-Langfuse-Parent-Span-Id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Langfuse-Parent-Span-Id
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentRequest'
        required: true
      responses:
        '200':
          description: The cited answer and its sources
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentResponse'
              examples:
                with_sources:
                  summary: Answer with sources
                  value:
                    content: >-
                      Zscaler’s net dollar retention was **115%** in Q4 FY2026
                      [#43c00004].


                      Management said NRR was “consistent each quarter this year
                      at **115%**” [#43c00004:2].
                    sourceMap:
                      '#43c00004':
                        content: >-
                          please join us at our upcoming Investor Day on October
                          6 in New York City. I want to thank our employees,
                          customers and

                          partners for their continued support. With that,
                          operator, you may now open the call for questions. …
                        pageNumber: 5
                        excerpt: 115%
                        documentMetadata:
                          id: a0dcd3e7-7985-4fbc-9c77-371b4232e242
                          title: >-
                            Zscaler, Inc. Earnings Call Transcript Q4 2026
                            (2026-09-03)
                          documentCategory: earnings-call-transcript
                          date: '2026-09-03'
                          fiscalQuarter: 4
                          fiscalYear: 2026
                          companyName: Zscaler, Inc.
                          companyTickers:
                            - ZS
                      '#43c00004:2':
                        content: >-
                          please join us at our upcoming Investor Day on October
                          6 in New York City. I want to thank our employees,
                          customers and

                          partners for their continued support. With that,
                          operator, you may now open the call for questions. …
                        pageNumber: 5
                        excerpt: 115%
                        documentMetadata:
                          id: a0dcd3e7-7985-4fbc-9c77-371b4232e242
                          title: >-
                            Zscaler, Inc. Earnings Call Transcript Q4 2026
                            (2026-09-03)
                          documentCategory: earnings-call-transcript
                          date: '2026-09-03'
                          fiscalQuarter: 4
                          fiscalYear: 2026
                          companyName: Zscaler, Inc.
                          companyTickers:
                            - ZS
                no_sources:
                  summary: No relevant documents found
                  value:
                    content: >-
                      I couldn't find any relevant documents in our database to
                      answer your query. This could be because:


                      - The company or topic you're asking about isn't covered
                      in our document collection

                      - The specific information you're looking for isn't
                      mentioned in the available documents

                      - Your query might need to be more specific or use
                      different terminology


                      Try rephrasing your question or asking about a different
                      company or topic that might be covered in our financial
                      disclosure database.
                    sourceMap: {}
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              examples:
                missing_key:
                  summary: Missing API key
                  value:
                    detail: Missing API key
                invalid_key:
                  summary: Invalid or expired API key
                  value:
                    detail: Invalid or expired API key
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '402':
          description: Not enough API credits for this request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                insufficient_credits:
                  summary: 'Insufficient credits. Required: 10 cents, Available: 4 cents'
                  value:
                    detail: >-
                      Insufficient credits. Required: 10 cents, Available: 4
                      cents
        '403':
          description: Your organization doesn't have access to this endpoint
          content:
            application/json:
              examples:
                forbidden:
                  summary: Access to this endpoint is not allowed for your organization
                  value:
                    detail: >-
                      Access to this endpoint is not allowed for your
                      organization
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: >-
            Validation error: a parameter or body field is missing, has the
            wrong type or is out of range
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
              example:
                detail:
                  - type: missing
                    loc:
                      - body
                    msg: Field required
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              examples:
                rate_limited:
                  summary: 'Rate limit exceeded: 100 requests per minute'
                  value:
                    detail: 'Rate limit exceeded: 100 requests per minute'
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              examples:
                database_error:
                  summary: Database error occurred
                  value:
                    detail: Database error occurred
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - APIKeyHeader: []
components:
  schemas:
    AgentRequest:
      properties:
        query:
          type: string
          minLength: 1
          title: Query
          description: The natural language query
        documentIds:
          anyOf:
            - type: string
            - type: 'null'
          title: Documentids
          description: >-
            Comma-separated string of document file IDs. If provided and
            non-empty, skips document and company selection and goes directly to
            retrieval.
      type: object
      required:
        - query
      title: AgentRequest
      description: Request model for agent queries.
    AgentResponse:
      properties:
        content:
          type: string
          title: Content
          description: The agent's response in markdown format
        sourceMap:
          additionalProperties:
            $ref: '#/components/schemas/Chunk'
          type: object
          title: Sourcemap
          description: >-
            Mapping of citation reference IDs to chunk metadata. Empty when no
            relevant documents are found.
      type: object
      required:
        - content
        - sourceMap
      title: AgentResponse
      description: Response model for agent queries.
    ErrorResponse:
      properties:
        detail:
          type: string
          title: Detail
      type: object
      required:
        - detail
      title: ErrorResponse
      description: Standard error response model for all API endpoints.
    ValidationErrorResponse:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationErrorItem'
          type: array
          title: Detail
      type: object
      required:
        - detail
      title: ValidationErrorResponse
      description: '422 body: every invalid field of the request.'
    Chunk:
      properties:
        content:
          type: string
          title: Content
          description: Text content of the chunk
        pageNumber:
          type: integer
          title: Pagenumber
          description: Page number in the document
        excerpt:
          anyOf:
            - type: string
            - type: 'null'
          title: Excerpt
          description: >-
            Specific part of the chunk that the agent used to answer the user's
            question. Used for source linking and highlighting. Each citation
            occurrence has its own sourceMap entry, so the same underlying chunk
            cited for different metrics yields a distinct excerpt per citation.
        documentMetadata:
          $ref: '#/components/schemas/SourceDocument'
          description: Metadata for the chunk's document
      type: object
      required:
        - content
        - pageNumber
        - documentMetadata
      title: Chunk
      description: A chunk of document content with metadata.
    ValidationErrorItem:
      properties:
        type:
          type: string
          title: Type
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Loc
        msg:
          type: string
          title: Msg
        input:
          anyOf:
            - {}
            - type: 'null'
          title: Input
        ctx:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Ctx
      type: object
      required:
        - type
        - loc
        - msg
      title: ValidationErrorItem
      description: One invalid field, as FastAPI reports it.
    SourceDocument:
      properties:
        id:
          type: string
          title: Id
          description: Document ID. Use it with `GET /api/v2/documents/{id}`.
        title:
          type: string
          title: Title
          description: Document title
        documentCategory:
          type: string
          title: Documentcategory
          description: >-
            Document categories. For detailed category descriptions, please
            refer to [this page](/coverage)
        secFormType:
          anyOf:
            - type: string
            - type: 'null'
          title: Secformtype
          description: >-
            Document SEC form type (only applicable if the document is an SEC
            filing)
        date:
          type: string
          title: Date
          description: >-
            Date of the document: the EDGAR filing date for SEC filings,
            otherwise the date the document was issued or published. When the
            document has no date of its own, the date it was published online.
        fiscalQuarter:
          anyOf:
            - type: integer
            - type: 'null'
          title: Fiscalquarter
          description: Fiscal quarter the document relates to (from 1 to 4)
        fiscalYear:
          anyOf:
            - type: integer
            - type: 'null'
          title: Fiscalyear
          description: Fiscal year the document relates to (e.g., 2024)
        companyName:
          type: string
          title: Companyname
          description: Name of the company filing the document
        companyTickers:
          items:
            type: string
          type: array
          title: Companytickers
          description: Tickers of the company filing the document
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: Metadata for the document
      type: object
      required:
        - id
        - title
        - documentCategory
        - date
        - companyName
        - companyTickers
      title: SourceDocument
      description: Source document metadata model.
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key

````

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