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

# Context Search

> Search for relevant context documents from library entities, resources, and external research. Supports inline configuration for query enhancement, reranking, and reasoning generation.



## OpenAPI

````yaml post /api/v2/context
openapi: 3.0.0
info:
  version: 1.0.0
  title: Octave API
  description: API for Octave workspace management and AI-powered content generation
servers:
  - url: https://app.octavehq.com
security:
  - ApiKeyAuth: []
paths:
  /api/v2/context:
    post:
      tags:
        - Context
      summary: Context Search
      description: >-
        Search for relevant context documents from library entities, resources,
        and external research. Supports inline configuration for query
        enhancement, reranking, and reasoning generation.
      operationId: searchContext
      requestBody:
        description: Context search input with configuration
        content:
          application/json:
            schema:
              type: object
              properties:
                query:
                  type: string
                  minLength: 1
                  description: Question or task to fetch context for
                additionalContext:
                  type: object
                  nullable: true
                  properties:
                    person:
                      type: object
                      nullable: true
                      properties:
                        firstName:
                          type: string
                          nullable: true
                        lastName:
                          type: string
                          nullable: true
                        title:
                          type: string
                          nullable: true
                        email:
                          type: string
                          nullable: true
                          format: email
                        linkedInProfileUrl:
                          type: string
                          nullable: true
                          format: uri
                        crmContactId:
                          type: string
                          nullable: true
                        crmLeadId:
                          type: string
                          nullable: true
                        crmAccountId:
                          type: string
                          nullable: true
                      description: >-
                        Optional context about the person associated with the
                        query
                    company:
                      type: object
                      nullable: true
                      properties:
                        name:
                          type: string
                          nullable: true
                        domain:
                          type: string
                          nullable: true
                        linkedInProfileUrl:
                          type: string
                          nullable: true
                          format: uri
                        crmAccountId:
                          type: string
                          nullable: true
                      description: >-
                        Optional context about the company associated with the
                        query
                    details:
                      type: string
                      nullable: true
                      description: Free-form text providing additional context
                  description: Optional person/company/details to enhance search
                topK:
                  type: number
                rerank:
                  type: string
                  enum:
                    - 'off'
                    - low
                    - medium
                    - high
                    - best
                sources:
                  type: object
                  properties:
                    library:
                      type: object
                      properties:
                        enabled:
                          type: boolean
                          default: true
                      default:
                        enabled: true
                    resources:
                      type: object
                      properties:
                        enabled:
                          type: boolean
                          default: false
                      default:
                        enabled: false
                tools:
                  type: object
                  properties:
                    personProfile:
                      type: object
                      properties:
                        enabled:
                          type: boolean
                          default: false
                        returnOutput:
                          type: boolean
                          default: true
                          description: Include profile in output documents
                        guess:
                          type: boolean
                          default: false
                          description: Attempt to guess LinkedIn profile if not provided
                    companyProfile:
                      type: object
                      properties:
                        enabled:
                          type: boolean
                          default: false
                        returnOutput:
                          type: boolean
                          default: true
                          description: Include profile in output documents
                    companyResearch:
                      type: object
                      properties:
                        enabled:
                          type: boolean
                          default: false
                        returnOutput:
                          type: boolean
                          default: true
                          description: Include research in output documents
                    personResearch:
                      type: object
                      properties:
                        enabled:
                          type: boolean
                          default: false
                        returnOutput:
                          type: boolean
                          default: true
                          description: Include research in output documents
                    deepWebResearch:
                      type: object
                      properties:
                        enabled:
                          type: boolean
                          default: false
                        returnOutput:
                          type: boolean
                          default: true
                          description: Include web results in output documents
                agentTools:
                  type: object
                  properties:
                    brandVoice:
                      type: object
                      properties:
                        enabled:
                          type: boolean
                          default: false
                        brandVoiceOId:
                          type: string
                    webSearch:
                      type: object
                      properties:
                        enabled:
                          type: boolean
                          default: false
                        allowedDomains:
                          type: array
                          items:
                            type: string
                    parallelWebSearch:
                      type: object
                      properties:
                        enabled:
                          type: boolean
                          default: false
                        allowedDomains:
                          type: array
                          items:
                            type: string
                        mode:
                          type: string
                          enum:
                            - auto
                            - advanced
                          default: auto
                        customInstructions:
                          type: string
                    highEffortMode:
                      type: object
                      properties:
                        enabled:
                          type: boolean
                          default: false
                    crmActivity:
                      type: object
                      properties:
                        enabled:
                          type: boolean
                          default: false
                        mode:
                          type: string
                          enum:
                            - auto
                            - advanced
                            - analyze
                            - read
                          default: auto
                        activityTypes:
                          type: array
                          items:
                            type: string
                            enum:
                              - notes
                              - tasks
                              - calls
                              - emails
                          default:
                            - notes
                            - tasks
                            - calls
                            - emails
                        guessEmailFromLinkedIn:
                          type: boolean
                          default: true
                        leadConfig:
                          type: object
                          properties:
                            enabled:
                              type: boolean
                              default: true
                            maxActivities:
                              type: number
                              minimum: 0
                              maximum: 50
                              default: 10
                            activityLookbackDays:
                              type: number
                              minimum: 1
                              maximum: 365
                              default: 90
                            fields:
                              type: array
                              items:
                                type: string
                            additionalFields:
                              type: array
                              items:
                                type: object
                                properties:
                                  fieldName:
                                    type: string
                                    minLength: 1
                                    description: >-
                                      CRM API field name to fetch (e.g.,
                                      'Competitor__c', 'Industry',
                                      'hs_lead_status')
                                  description:
                                    type: string
                        contactConfig:
                          type: object
                          properties:
                            enabled:
                              type: boolean
                              default: true
                            maxActivities:
                              type: number
                              minimum: 0
                              maximum: 50
                              default: 10
                            activityLookbackDays:
                              type: number
                              minimum: 1
                              maximum: 365
                              default: 90
                            fields:
                              type: array
                              items:
                                type: string
                            additionalFields:
                              type: array
                              items:
                                type: object
                                properties:
                                  fieldName:
                                    type: string
                                    minLength: 1
                                    description: >-
                                      CRM API field name to fetch (e.g.,
                                      'Competitor__c', 'Industry',
                                      'hs_lead_status')
                                  description:
                                    type: string
                        accountConfig:
                          type: object
                          properties:
                            enabled:
                              type: boolean
                              default: true
                            maxActivities:
                              type: number
                              minimum: 0
                              maximum: 50
                              default: 10
                            activityLookbackDays:
                              type: number
                              minimum: 1
                              maximum: 365
                              default: 90
                            fields:
                              type: array
                              items:
                                type: string
                            additionalFields:
                              type: array
                              items:
                                type: object
                                properties:
                                  fieldName:
                                    type: string
                                    minLength: 1
                                    description: >-
                                      CRM API field name to fetch (e.g.,
                                      'Competitor__c', 'Industry',
                                      'hs_lead_status')
                                  description:
                                    type: string
                        opportunityConfig:
                          type: object
                          properties:
                            enabled:
                              type: boolean
                              default: true
                            maxActivities:
                              type: number
                              minimum: 0
                              maximum: 50
                              default: 10
                            activityLookbackDays:
                              type: number
                              minimum: 1
                              maximum: 365
                              default: 90
                            fields:
                              type: array
                              items:
                                type: string
                            additionalFields:
                              type: array
                              items:
                                type: object
                                properties:
                                  fieldName:
                                    type: string
                                    minLength: 1
                                    description: >-
                                      CRM API field name to fetch (e.g.,
                                      'Competitor__c', 'Industry',
                                      'hs_lead_status')
                                  description:
                                    type: string
                        customInstructions:
                          type: string
                    customTask:
                      type: object
                      properties:
                        enabled:
                          type: boolean
                          default: false
                        prompt:
                          type: string
                        jsonSchema:
                          type: string
                    personResearch:
                      type: object
                      properties:
                        enabled:
                          type: boolean
                          default: false
                    companyResearch:
                      type: object
                      properties:
                        enabled:
                          type: boolean
                          default: false
                reasoning:
                  type: object
                  properties:
                    perDocument:
                      type: boolean
                      default: false
                      description: Generate reasoning explanation for each document
                    overall:
                      type: boolean
                      default: false
                      description: >-
                        Generate overall summary of how documents collectively
                        help
                commonContext:
                  type: object
                  nullable: true
                  properties:
                    accountBasedMode:
                      type: boolean
                      default: false
                    entities:
                      type: object
                      properties:
                        product:
                          type: object
                          properties:
                            strategy:
                              type: string
                              enum:
                                - BEST_MATCH
                                - MANUAL
                                - NONE
                              default: BEST_MATCH
                            oIds:
                              type: array
                              items:
                                type: string
                            numItems:
                              type: number
                              default: 1
                            bestMatchMinConfidenceLevel:
                              type: string
                              enum:
                                - LOW
                                - MEDIUM
                                - HIGH
                            bestMatchFallbackMode:
                              type: string
                              enum:
                                - DONT_USE
                                - FORCE_USE
                                - EXIT_EARLY
                                - FALLBACK_TO_OID
                              default: FORCE_USE
                            fallbackOIds:
                              type: array
                              nullable: true
                              items:
                                type: string
                        service:
                          type: object
                          properties:
                            strategy:
                              type: string
                              enum:
                                - BEST_MATCH
                                - MANUAL
                                - NONE
                              default: BEST_MATCH
                            oIds:
                              type: array
                              items:
                                type: string
                            numItems:
                              type: number
                              default: 1
                            bestMatchMinConfidenceLevel:
                              type: string
                              enum:
                                - LOW
                                - MEDIUM
                                - HIGH
                            bestMatchFallbackMode:
                              type: string
                              enum:
                                - DONT_USE
                                - FORCE_USE
                                - EXIT_EARLY
                                - FALLBACK_TO_OID
                              default: FORCE_USE
                            fallbackOIds:
                              type: array
                              nullable: true
                              items:
                                type: string
                        solution:
                          type: object
                          properties:
                            strategy:
                              type: string
                              enum:
                                - BEST_MATCH
                                - MANUAL
                                - NONE
                              default: BEST_MATCH
                            oIds:
                              type: array
                              items:
                                type: string
                            numItems:
                              type: number
                              default: 1
                            bestMatchMinConfidenceLevel:
                              type: string
                              enum:
                                - LOW
                                - MEDIUM
                                - HIGH
                            bestMatchFallbackMode:
                              type: string
                              enum:
                                - DONT_USE
                                - FORCE_USE
                                - EXIT_EARLY
                                - FALLBACK_TO_OID
                              default: FORCE_USE
                            fallbackOIds:
                              type: array
                              nullable: true
                              items:
                                type: string
                        playbook:
                          type: object
                          properties:
                            strategy:
                              type: string
                              enum:
                                - BEST_MATCH
                                - MANUAL
                                - NONE
                              default: BEST_MATCH
                            oIds:
                              type: array
                              items:
                                type: string
                            numItems:
                              type: number
                              default: 1
                            bestMatchMinConfidenceLevel:
                              type: string
                              enum:
                                - LOW
                                - MEDIUM
                                - HIGH
                              default: MEDIUM
                            bestMatchFallbackMode:
                              type: string
                              enum:
                                - DONT_USE
                                - FORCE_USE
                                - EXIT_EARLY
                                - FALLBACK_TO_OID
                              default: DONT_USE
                            bestMatchAllowedPlaybookTypes:
                              type: array
                              nullable: true
                              items:
                                type: string
                                enum:
                                  - LEGACY
                                  - SECTOR
                                  - SOLUTION
                                  - MILESTONE
                                  - PRACTITIONER
                                  - COMPETITIVE
                                  - ACCOUNT
                                  - CUSTOM
                              default:
                                - SECTOR
                                - SOLUTION
                                - MILESTONE
                                - PRACTITIONER
                                - ACCOUNT
                            fallbackOIds:
                              type: array
                              nullable: true
                              items:
                                type: string
                        persona:
                          type: object
                          properties:
                            strategy:
                              type: string
                              enum:
                                - BEST_MATCH
                                - MANUAL
                                - NONE
                              default: BEST_MATCH
                            oIds:
                              type: array
                              items:
                                type: string
                            numItems:
                              type: number
                              default: 1
                            bestMatchMinConfidenceLevel:
                              type: string
                              enum:
                                - LOW
                                - MEDIUM
                                - HIGH
                        useCase:
                          type: object
                          properties:
                            strategy:
                              type: string
                              enum:
                                - BEST_MATCH
                                - MANUAL
                                - NONE
                              default: BEST_MATCH
                            oIds:
                              type: array
                              items:
                                type: string
                            numItems:
                              type: number
                              default: 1
                            bestMatchMinConfidenceLevel:
                              type: string
                              enum:
                                - LOW
                                - MEDIUM
                                - HIGH
                        referenceCustomer:
                          type: object
                          properties:
                            strategy:
                              type: string
                              enum:
                                - BEST_MATCH
                                - MANUAL
                                - NONE
                              default: BEST_MATCH
                            oIds:
                              type: array
                              items:
                                type: string
                            numItems:
                              type: number
                              default: 1
                            bestMatchMinConfidenceLevel:
                              type: string
                              enum:
                                - LOW
                                - MEDIUM
                                - HIGH
                        segment:
                          type: object
                          properties:
                            strategy:
                              type: string
                              enum:
                                - BEST_MATCH
                                - MANUAL
                                - NONE
                              default: BEST_MATCH
                            oIds:
                              type: array
                              items:
                                type: string
                            numItems:
                              type: number
                              default: 1
                            bestMatchMinConfidenceLevel:
                              type: string
                              enum:
                                - LOW
                                - MEDIUM
                                - HIGH
                        competitor:
                          type: object
                          properties:
                            strategy:
                              type: string
                              enum:
                                - BEST_MATCH
                                - MANUAL
                                - NONE
                              default: MANUAL
                            oIds:
                              type: array
                              items:
                                type: string
                            numItems:
                              type: number
                              default: 1
                            bestMatchMinConfidenceLevel:
                              type: string
                              enum:
                                - LOW
                                - MEDIUM
                                - HIGH
                        alternative:
                          type: object
                          properties:
                            strategy:
                              type: string
                              enum:
                                - BEST_MATCH
                                - MANUAL
                                - NONE
                              default: MANUAL
                            oIds:
                              type: array
                              items:
                                type: string
                            numItems:
                              type: number
                              default: 1
                            bestMatchMinConfidenceLevel:
                              type: string
                              enum:
                                - LOW
                                - MEDIUM
                                - HIGH
                        buyingTrigger:
                          type: object
                          properties:
                            strategy:
                              type: string
                              enum:
                                - BEST_MATCH
                                - MANUAL
                                - NONE
                              default: MANUAL
                            oIds:
                              type: array
                              items:
                                type: string
                            numItems:
                              type: number
                              default: 1
                            bestMatchMinConfidenceLevel:
                              type: string
                              enum:
                                - LOW
                                - MEDIUM
                                - HIGH
                        objection:
                          type: object
                          properties:
                            strategy:
                              type: string
                              enum:
                                - BEST_MATCH
                                - MANUAL
                                - NONE
                              default: MANUAL
                            oIds:
                              type: array
                              items:
                                type: string
                            numItems:
                              type: number
                              default: 1
                            bestMatchMinConfidenceLevel:
                              type: string
                              enum:
                                - LOW
                                - MEDIUM
                                - HIGH
                        proofPoint:
                          type: object
                          properties:
                            strategy:
                              type: string
                              enum:
                                - BEST_MATCH
                                - MANUAL
                                - NONE
                              default: BEST_MATCH
                            oIds:
                              type: array
                              items:
                                type: string
                            numItems:
                              type: number
                              default: 1
                            bestMatchMinConfidenceLevel:
                              type: string
                              enum:
                                - LOW
                                - MEDIUM
                                - HIGH
                        motion:
                          type: object
                          properties:
                            strategy:
                              type: string
                              enum:
                                - BEST_MATCH
                                - MANUAL
                                - NONE
                              default: BEST_MATCH
                            oIds:
                              type: array
                              items:
                                type: string
                            numItems:
                              type: number
                              default: 1
                            bestMatchMinConfidenceLevel:
                              type: string
                              enum:
                                - LOW
                                - MEDIUM
                                - HIGH
                        motionPlaybook:
                          type: object
                          properties:
                            strategy:
                              type: string
                              enum:
                                - BEST_MATCH
                                - MANUAL
                                - NONE
                              default: BEST_MATCH
                            oIds:
                              type: array
                              items:
                                type: string
                            numItems:
                              type: number
                              default: 1
                            bestMatchMinConfidenceLevel:
                              type: string
                              enum:
                                - LOW
                                - MEDIUM
                                - HIGH
                            bestMatchFallbackMode:
                              type: string
                              enum:
                                - DONT_USE
                                - FORCE_USE
                                - EXIT_EARLY
                                - FALLBACK_TO_OID
                              default: DONT_USE
                            motionType:
                              type: string
                              enum:
                                - NET_NEW
                                - UPSELL
                                - CROSS_SELL
                                - CONVERT_FREE_TO_PAID
                                - RENEW_AND_RETAIN
                                - DISPLACE_INCUMBENT
                    includeRuntimeValueProps:
                      type: boolean
                      default: false
                    context:
                      type: string
                      nullable: true
                    sources:
                      type: array
                      items:
                        type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - TEXT
                              - URL
                              - GOOGLE_DRIVE_FILE_ID
                              - GENERATIVE_NAME
                              - OID
                              - COMPANY_NAME
                              - FIELDWISE_DOCUMENT_ID
                              - RAG_DOCUMENT_ID
                              - RESOURCE
                              - REPORT
                              - REPORT_SECTION
                              - EVENT_OID_FINDINGS
                              - FINDING_OIDS
                          value:
                            type: string
                          name:
                            type: string
                            nullable: true
                          details:
                            type: string
                            nullable: true
                          useNameIfUrlFails:
                            type: boolean
                            nullable: true
                    page:
                      type: object
                      properties:
                        url:
                          type: string
                        pageType:
                          type: string
                          enum:
                            - PERSONA_DETAIL
                            - PRODUCT_DETAIL
                            - SERVICE_DETAIL
                            - SOLUTION_DETAIL
                            - PLAYBOOK_DETAIL
                            - USE_CASE_DETAIL
                            - SEGMENT_DETAIL
                            - COMPETITOR_DETAIL
                            - REFERENCE_DETAIL
                            - PROOF_POINT_DETAIL
                            - EVENT_DETAIL
                            - MOTION_ICP_DETAIL
                            - ASK_OCTAVE
                            - OTHER
                        targetEntityOId:
                          type: string
                        targetEntityName:
                          type: string
                        targetEntityType:
                          type: string
                        additionalContext:
                          type: string
                    mergeManualContext:
                      type: boolean
                      default: true
              required:
                - query
              description: Context search input with inline configuration
              example:
                query: How do you help with HIPAA compliance?
                additionalContext:
                  person:
                    firstName: John
                    lastName: Doe
                    title: CISO
                    email: john.doe@healthcare.com
                  company:
                    name: Healthcare Corp
                    domain: healthcare.com
                  details: Large healthcare provider in California
                topK: 10
                rerank: medium
                sources:
                  library:
                    enabled: true
                  resources:
                    enabled: true
                tools:
                  personProfile:
                    enabled: false
                    returnOutput: true
                    guess: false
                  companyProfile:
                    enabled: false
                    returnOutput: true
                  companyResearch:
                    enabled: false
                    returnOutput: true
                  personResearch:
                    enabled: false
                    returnOutput: true
                  deepWebResearch:
                    enabled: false
                    returnOutput: true
                agentTools:
                  crmActivity:
                    enabled: false
                reasoning:
                  perDocument: false
                  overall: false
      responses:
        '200':
          description: Context search successful
          content:
            application/json:
              schema:
                type: object
                properties:
                  _metadata:
                    $ref: '#/components/schemas/Metadata'
                  data:
                    $ref: '#/components/schemas/ContextData'
                  usage:
                    type: number
                    description: Usage count for billing/credits
                  found:
                    type: boolean
                    description: Whether the query was found
                  message:
                    type: string
                    description: Message from the context agent
                required:
                  - _metadata
                  - data
                  - usage
                  - found
                  - message
        '400':
          description: Bad request - invalid input parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  _metadata:
                    $ref: '#/components/schemas/Metadata'
                  message:
                    type: string
                required:
                  - _metadata
                  - message
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  _metadata:
                    $ref: '#/components/schemas/Metadata'
                  message:
                    type: string
                required:
                  - _metadata
                  - message
      deprecated: false
components:
  schemas:
    Metadata:
      type: object
      properties:
        usage:
          type: number
          default: 0
          description: API usage
          example: 0
        requestId:
          type: string
          description: Request ID
          example: requestId
        message:
          type: string
          description: Message
          example: message
        timestamp:
          type: string
          description: Timestamp
          example: '2021-01-01T00:00:00.000Z'
      required:
        - requestId
        - timestamp
    ContextData:
      type: object
      properties:
        documents:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
                enum:
                  - PERSONA
                  - USE_CASE
                  - REFERENCE_CUSTOMER
                  - PROOF_POINT
                  - SEGMENT
                  - COMPETITOR
                  - ALTERNATIVE
                  - BUYING_TRIGGER
                  - OBJECTION
                  - PRODUCT
                  - SERVICE
                  - PLAYBOOK
                  - HYPOTHESIS
                  - PERSON_LINKEDIN
                  - COMPANY_WEBSITE
                  - COMPANY_RESEARCH
                  - PERSON_RESEARCH
                  - WEB_SEARCH
                  - CRM_CONTEXT
                  - GLOBAL_RESOURCE
                  - WEBSITE_RESOURCE
                description: Type/source of this context document
              id:
                type: string
                description: >-
                  Unique identifier (oId for library entities, external_id for
                  resources)
              name:
                type: string
                nullable: true
                description: Name or title of the document
              data:
                type: object
                nullable: true
                additionalProperties:
                  nullable: true
                description: Document content/details
              score:
                type: number
                nullable: true
                minimum: 0
                maximum: 10
                description: >-
                  Reranking relevance score (0-10 scale) - only present if
                  reranking was applied
              reasoning:
                type: string
                nullable: true
                description: >-
                  Explanation of why this document is relevant (if
                  reasoning.perDocument enabled)
            required:
              - type
              - id
          description: Array of context documents
        reasoning:
          type: string
          nullable: true
          description: >-
            Overall summary of how documents help answer query (if
            reasoning.overall enabled)
        _debug:
          type: object
          nullable: true
          properties:
            totalFetched:
              type: number
              description: Total documents fetched before reranking
            afterReranking:
              type: number
              description: Documents remaining after reranking
            timeTaken:
              type: number
              nullable: true
              description: Total request time in milliseconds
            sourcesUsed:
              type: object
              properties:
                library:
                  type: boolean
                resources:
                  type: boolean
                tools:
                  type: boolean
              required:
                - library
                - resources
                - tools
            tokenUsage:
              type: object
              nullable: true
              properties:
                inputTokens:
                  type: number
                  description: Input tokens consumed
                outputTokens:
                  type: number
                  description: Output tokens generated
                totalTokens:
                  type: number
                  description: Total tokens (input + output)
              required:
                - inputTokens
                - outputTokens
                - totalTokens
              description: LLM token consumption breakdown
          required:
            - totalFetched
            - afterReranking
            - sourcesUsed
          description: Admin-only debug information
      required:
        - documents
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: api_key

````