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

# Retrieve Answer

> Get an LLM-generated answer based on vault context.

This endpoint retrieves relevant context and generates an answer using
the LLM. The response includes the answer text with source citations.

Authentication: X-API-Key header required.



## OpenAPI

````yaml /openapi.json post /v1/retrieval/answer
openapi: 3.1.0
info:
  title: Ontora API
  description: >-
    Ontora's public API. Covers interview campaigns, transcripts, synthesis
    reports, graph queries, webhooks, and workspace management. 


    **Authentication**: endpoints accept either a Clerk JWT (`Authorization:
    Bearer <token>`) or a workspace API key (`X-API-Key: ont_...`). Workspace
    keys are managed via `/v1/api-keys`.
  version: 0.1.0
servers: []
security:
  - ClerkJWT: []
  - WorkspaceApiKey: []
tags:
  - name: interviews
    description: Campaign CRUD, lifecycle, contacts, question sets.
  - name: campaign-insights
    description: Synthesis outputs — cartography, roadmap, personas, conversations.
  - name: interview-query
    description: Graph RAG query over campaign data.
  - name: interview-export
    description: Markdown / ZIP exports of transcripts and reports.
  - name: api-keys
    description: Manage workspace-scoped API keys for programmatic access.
  - name: webhook-endpoints
    description: Outbound webhook endpoints for automation.
  - name: booking
    description: Public self-scheduling endpoints for interview participants.
  - name: workspaces
    description: Workspace and membership management.
  - name: vaults
    description: Context vault management.
paths:
  /v1/retrieval/answer:
    post:
      tags:
        - retrieval
      summary: Retrieve Answer
      description: |-
        Get an LLM-generated answer based on vault context.

        This endpoint retrieves relevant context and generates an answer using
        the LLM. The response includes the answer text with source citations.

        Authentication: X-API-Key header required.
      operationId: retrieve_answer_v1_retrieval_answer_post
      parameters:
        - name: X-API-Key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Api-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RetrievalRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnswerResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    RetrievalRequest:
      properties:
        prompt:
          type: string
          title: Prompt
          description: The query/question to search for
        limit:
          type: integer
          maximum: 100
          minimum: 1
          title: Limit
          description: Maximum number of results
          default: 20
        depth:
          type: integer
          maximum: 3
          minimum: 1
          title: Depth
          description: Graph traversal depth
          default: 2
        rerank:
          type: boolean
          title: Rerank
          description: Whether to rerank results for relevance
          default: true
      type: object
      required:
        - prompt
      title: RetrievalRequest
      description: Request body for retrieval endpoints.
    AnswerResponse:
      properties:
        data:
          items:
            $ref: '#/components/schemas/RetrievalDataItem'
          type: array
          title: Data
          description: Answer with sources
      type: object
      required:
        - data
      title: AnswerResponse
      description: Response from retrieval/answer endpoint.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    RetrievalDataItem:
      properties:
        text:
          type: string
          title: Text
          description: Retrieved text content
        sources:
          items:
            $ref: '#/components/schemas/SourceInfo'
          type: array
          title: Sources
          description: Sources for this content
      type: object
      required:
        - text
      title: RetrievalDataItem
      description: Single item in retrieval response.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    SourceInfo:
      properties:
        source_id:
          type: string
          title: Source Id
          description: Document ID from the source system
        source_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Url
          description: URL to the source document
        source_data_type:
          type: string
          title: Source Data Type
          description: Type of data (File, Email, Page, etc.)
        source_integration:
          type: string
          title: Source Integration
          description: Integration name (GoogleDrive, Gmail, Notion, etc.)
      type: object
      required:
        - source_id
        - source_data_type
        - source_integration
      title: SourceInfo
      description: Source information for a retrieved chunk.
  securitySchemes:
    ClerkJWT:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Clerk-issued RS256 JWT.
    WorkspaceApiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: 'Workspace-scoped API key (prefix: `ont_`).'

````