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

# Query Interview Graph

> Ask an ad-hoc question about a campaign's interview data.

Uses the interview graph RAG pipeline:
1. Classify query complexity
2. Retrieve relevant passages via vector search + graph traversal
3. Verify retrieval quality (coverage, provenance)
4. Synthesize a structured answer with patterns and divergences



## OpenAPI

````yaml /openapi.json post /v1/interviews/{interview_id}/graph/query
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/interviews/{interview_id}/graph/query:
    post:
      tags:
        - interview-query
      summary: Query Interview Graph
      description: |-
        Ask an ad-hoc question about a campaign's interview data.

        Uses the interview graph RAG pipeline:
        1. Classify query complexity
        2. Retrieve relevant passages via vector search + graph traversal
        3. Verify retrieval quality (coverage, provenance)
        4. Synthesize a structured answer with patterns and divergences
      operationId: query_interview_graph_v1_interviews__interview_id__graph_query_post
      parameters:
        - name: interview_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Interview Id
        - 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/InterviewQueryRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InterviewQueryResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    InterviewQueryRequest:
      properties:
        query:
          type: string
          title: Query
        anonymize:
          type: boolean
          title: Anonymize
          default: false
        top_k:
          type: integer
          title: Top K
          default: 20
        conversation_history:
          anyOf:
            - items:
                $ref: '#/components/schemas/ConversationMessage'
              type: array
            - type: 'null'
          title: Conversation History
      type: object
      required:
        - query
      title: InterviewQueryRequest
    InterviewQueryResponse:
      properties:
        answer:
          type: string
          title: Answer
        patterns:
          items:
            $ref: '#/components/schemas/PatternOut'
          type: array
          title: Patterns
        divergences:
          items:
            $ref: '#/components/schemas/DivergenceOut'
          type: array
          title: Divergences
        provenance:
          items:
            $ref: '#/components/schemas/ProvenanceLinkOut'
          type: array
          title: Provenance
        verification:
          $ref: '#/components/schemas/VerificationOut'
        query_complexity:
          type: string
          title: Query Complexity
        strategies_used:
          items:
            type: string
          type: array
          title: Strategies Used
      type: object
      required:
        - answer
        - patterns
        - divergences
        - provenance
        - verification
        - query_complexity
        - strategies_used
      title: InterviewQueryResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ConversationMessage:
      properties:
        role:
          type: string
          title: Role
        content:
          type: string
          title: Content
      type: object
      required:
        - role
        - content
      title: ConversationMessage
    PatternOut:
      properties:
        theme:
          type: string
          title: Theme
        description:
          type: string
          title: Description
        mention_count:
          type: integer
          title: Mention Count
        total_respondents:
          type: integer
          title: Total Respondents
        percentage:
          type: number
          title: Percentage
        departments_affected:
          items:
            type: string
          type: array
          title: Departments Affected
        supporting_passage_keys:
          items:
            type: string
          type: array
          title: Supporting Passage Keys
      type: object
      required:
        - theme
        - description
        - mention_count
        - total_respondents
        - percentage
        - departments_affected
        - supporting_passage_keys
      title: PatternOut
    DivergenceOut:
      properties:
        topic:
          type: string
          title: Topic
        position_a:
          type: string
          title: Position A
        sources_a:
          items:
            type: string
          type: array
          title: Sources A
        departments_a:
          items:
            type: string
          type: array
          title: Departments A
        position_b:
          type: string
          title: Position B
        sources_b:
          items:
            type: string
          type: array
          title: Sources B
        departments_b:
          items:
            type: string
          type: array
          title: Departments B
        magnitude:
          type: string
          title: Magnitude
      type: object
      required:
        - topic
        - position_a
        - sources_a
        - departments_a
        - position_b
        - sources_b
        - departments_b
        - magnitude
      title: DivergenceOut
    ProvenanceLinkOut:
      properties:
        claim:
          type: string
          title: Claim
        passages:
          items:
            $ref: '#/components/schemas/PassageOut'
          type: array
          title: Passages
      type: object
      required:
        - claim
        - passages
      title: ProvenanceLinkOut
    VerificationOut:
      properties:
        passed:
          type: boolean
          title: Passed
        department_coverage:
          type: number
          title: Department Coverage
        departments_hit:
          items:
            type: string
          type: array
          title: Departments Hit
        departments_missing:
          items:
            type: string
          type: array
          title: Departments Missing
        passage_count:
          type: integer
          title: Passage Count
        unique_contacts:
          type: integer
          title: Unique Contacts
      type: object
      required:
        - passed
        - department_coverage
        - departments_hit
        - departments_missing
        - passage_count
        - unique_contacts
      title: VerificationOut
    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
    PassageOut:
      properties:
        key:
          type: string
          title: Key
        text:
          type: string
          title: Text
        contact_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Contact Name
        department:
          anyOf:
            - type: string
            - type: 'null'
          title: Department
        job_title:
          anyOf:
            - type: string
            - type: 'null'
          title: Job Title
        seniority_level:
          anyOf:
            - type: integer
            - type: 'null'
          title: Seniority Level
        similarity_score:
          type: number
          title: Similarity Score
          default: 0
      type: object
      required:
        - key
        - text
      title: PassageOut
  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_`).'
    HTTPBearer:
      type: http
      scheme: bearer

````