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

# Backtest Custom Extractor

> Run a saved extractor (extractorOId) or an inline draft against real, already-ingested events WITHOUT persisting any findings. Select events explicitly (eventOIds) or with activity-feed-style filters (most recent matches first); omit both to use the extractor's own configured selection. Every tested event is a real, credit-charged LLM call — capped at 10 per run. Object-mode findings return their schema-validated structuredValue. Requires the custom-extractors entitlement.



## OpenAPI

````yaml post /api/v2/custom-extractor/backtest
openapi: 3.0.0
info:
  version: 5.4.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/custom-extractor/backtest:
    post:
      tags:
        - Custom Extractors
      summary: Backtest Custom Extractor
      description: >-
        Run a saved extractor (extractorOId) or an inline draft against real,
        already-ingested events WITHOUT persisting any findings. Select events
        explicitly (eventOIds) or with activity-feed-style filters (most recent
        matches first); omit both to use the extractor's own configured
        selection. Every tested event is a real, credit-charged LLM call —
        capped at 10 per run. Object-mode findings return their schema-validated
        structuredValue. Requires the custom-extractors entitlement.
      operationId: backtestCustomExtractor
      requestBody:
        description: Extractor reference (or draft) plus the event selection
        content:
          application/json:
            schema:
              type: object
              properties:
                extractorOId:
                  type: string
                  nullable: true
                draft:
                  type: object
                  nullable: true
                  properties:
                    name:
                      type: string
                      minLength: 1
                      maxLength: 255
                    description:
                      type: string
                      nullable: true
                      maxLength: 2000
                    prompt:
                      type: string
                      minLength: 1
                      maxLength: 20000
                    authoringInput:
                      type: string
                      nullable: true
                      maxLength: 4000
                      description: >-
                        The plain-language ask the AI authoring assist drafted
                        the prompt from, kept for provenance. Omit (or null)
                        when the prompt was hand-written. Changing it alone does
                        not bump promptVersion.
                    eventTypes:
                      type: array
                      items:
                        type: string
                        enum:
                          - EMAIL_SENT
                          - EMAIL_REPLY_RECEIVED
                          - CALL_TRANSCRIPT
                          - DEAL_WON
                          - DEAL_LOST
                          - OPPORTUNITY_CREATED
                          - MEETING_BOOKED
                          - RESOURCE_INDEXED
                          - RESOURCE_REINDEXED
                          - PROJECT_UPDATE
                          - TASK_COMPLETED
                          - ENTITY_CREATED
                          - ENTITY_UPDATED
                          - SOCIAL_MESSAGE_SENT
                          - SOCIAL_MESSAGE_RECEIVED
                          - SOCIAL_CONNECTION_SENT
                          - SOCIAL_CONNECTION_ACCEPTED
                          - AD_SET_PUBLISHED
                          - AD_PERFORMANCE_SNAPSHOT
                          - BULK_IMPORT_SUMMARY
                          - PROCESSING_NOT_APPLICABLE
                          - PROVIDER_EVENT_TYPE_UNKNOWN
                          - UNKNOWN
                      minItems: 1
                      description: Event types this extractor runs on
                    eventFilters:
                      type: object
                      nullable: true
                      properties:
                        match:
                          type: object
                          properties:
                            entityMatchAll:
                              type: boolean
                              description: >-
                                Require every selected library entity, including
                                entities of the same category
                            eventOIds:
                              type: array
                              items:
                                type: string
                              description: Filter to these event oIds only
                            opportunityIds:
                              type: array
                              items:
                                type: string
                              description: >-
                                Filter to events linked to these opportunities.
                                Accepts Octave opportunity oIds (crmo_*) or the
                                CRM's own deal ids (Salesforce Id, HubSpot
                                object id, Attio record UUID) interchangeably
                            eventCategories:
                              type: array
                              items:
                                type: string
                                enum:
                                  - EMAIL
                                  - CALL
                                  - CRM
                                  - RESOURCE
                                  - REVISION
                                  - SOCIAL
                                  - ADS
                                  - PRODUCT
                                  - UNKNOWN
                              description: Filter by event categories (CALL, EMAIL, CRM)
                            eventTypes:
                              type: array
                              items:
                                type: string
                                enum:
                                  - EMAIL_SENT
                                  - EMAIL_REPLY_RECEIVED
                                  - CALL_TRANSCRIPT
                                  - DEAL_WON
                                  - DEAL_LOST
                                  - OPPORTUNITY_CREATED
                                  - MEETING_BOOKED
                                  - RESOURCE_INDEXED
                                  - RESOURCE_REINDEXED
                                  - PROJECT_UPDATE
                                  - TASK_COMPLETED
                                  - ENTITY_CREATED
                                  - ENTITY_UPDATED
                                  - SOCIAL_MESSAGE_SENT
                                  - SOCIAL_MESSAGE_RECEIVED
                                  - SOCIAL_CONNECTION_SENT
                                  - SOCIAL_CONNECTION_ACCEPTED
                                  - AD_SET_PUBLISHED
                                  - AD_PERFORMANCE_SNAPSHOT
                                  - BULK_IMPORT_SUMMARY
                                  - PROCESSING_NOT_APPLICABLE
                                  - PROVIDER_EVENT_TYPE_UNKNOWN
                                  - UNKNOWN
                              description: >-
                                Filter by specific event types (CALL_TRANSCRIPT,
                                EMAIL_SENT, DEAL_WON, etc.)
                            sentiments:
                              type: array
                              items:
                                type: string
                                enum:
                                  - POSITIVE
                                  - NEUTRAL
                                  - NEGATIVE
                                  - UNKNOWN
                              description: >-
                                Filter by sentiment (POSITIVE, NEGATIVE,
                                NEUTRAL, MIXED)
                            contactEmails:
                              type: array
                              items:
                                type: string
                              description: Filter by participant email addresses
                            companyDomains:
                              type: array
                              items:
                                type: string
                              description: Filter by company domains
                            outcomeFilters:
                              type: array
                              items:
                                type: string
                                enum:
                                  - OPEN
                                  - WON
                                  - LOST
                                  - POSITIVE_REPLY
                                  - NEUTRAL_REPLY
                                  - NEGATIVE_REPLY
                              description: >-
                                Filter by outcome (OPEN, WON, LOST,
                                POSITIVE_REPLY, NEUTRAL_REPLY, NEGATIVE_REPLY)
                            opportunityStatuses:
                              type: array
                              items:
                                type: string
                                enum:
                                  - OPEN
                                  - WON
                                  - LOST
                              description: >-
                                Filter to events linked to deals with this
                                status (OPEN, WON, LOST)
                            dealMotions:
                              type: array
                              items:
                                type: string
                                enum:
                                  - NET_NEW
                                  - UPSELL
                                  - CROSS_SELL
                                  - RENEW_AND_RETAIN
                                  - CONVERT_FREE_TO_PAID
                                  - DISPLACE_INCUMBENT
                                  - SERVICES
                                  - PARTNER
                                  - NON_COMMERCIAL
                              description: >-
                                Filter to events linked to deals whose CRM deal
                                type maps to these motions (NET_NEW, UPSELL,
                                CROSS_SELL, RENEW_AND_RETAIN,
                                CONVERT_FREE_TO_PAID, DISPLACE_INCUMBENT,
                                SERVICES, PARTNER, NON_COMMERCIAL)
                            dealTypes:
                              type: array
                              items:
                                type: string
                              description: >-
                                Filter to events linked to deals with these raw
                                CRM deal-type labels (Salesforce Type, HubSpot
                                dealtype), case-insensitive
                            dealStages:
                              type: array
                              items:
                                type: string
                              description: >-
                                Filter to events linked to deals currently in
                                these CRM stages, by stage label or stage id,
                                case-insensitive
                            dealStagesAtEvent:
                              type: array
                              items:
                                type: string
                              description: >-
                                Filter to events whose linked deal was in one of
                                these CRM stages WHEN THE EVENT HAPPENED (by
                                stage label, case-insensitive), from the deal's
                                stage history — unlike dealStages, which reads
                                the deal's stage today. Use it for 'what came up
                                on calls during Discovery'. An event whose deal
                                has no recorded stage at that time does not
                                match.
                            pipelinePhases:
                              type: array
                              items:
                                type: string
                                enum:
                                  - prospecting
                                  - discovery
                                  - evaluation
                                  - negotiation
                                  - commitment
                                  - closed_won
                                  - closed_lost
                              description: >-
                                Filter to events linked to deals whose stage
                                maps to these pipeline phases (prospecting,
                                discovery, evaluation, negotiation, commitment,
                                closed_won, closed_lost)
                            crmPipelines:
                              type: array
                              items:
                                type: string
                              description: >-
                                Filter to events linked to deals in these CRM
                                pipelines, by pipeline id or name
                                (case-insensitive name)
                            minStalledDays:
                              type: number
                              description: >-
                                Filter to events linked to an OPEN deal that has
                                sat in its current stage at least this many days
                            minDealAmount:
                              type: number
                              description: Minimum deal amount filter
                            maxDealAmount:
                              type: number
                              description: Maximum deal amount filter
                            offerings:
                              type: array
                              items:
                                type: string
                              description: Filter by offering oIds
                            personas:
                              type: array
                              items:
                                type: string
                              description: >-
                                Filter by persona oIds (events must match these
                                personas)
                            segments:
                              type: array
                              items:
                                type: string
                              description: Filter by segment oIds
                            tags:
                              type: array
                              items:
                                type: string
                              description: >-
                                Filter by reporting tag oIds (from any tag
                                group, on any library entity type). Resolved to
                                the entities carrying those tags; multiple tags
                                are OR'd.
                            useCases:
                              type: array
                              items:
                                type: string
                              description: Filter by use case oIds
                            references:
                              type: array
                              items:
                                type: string
                              description: Filter by reference customer oIds
                            competitors:
                              type: array
                              items:
                                type: string
                              description: Filter by competitor oIds
                            alternatives:
                              type: array
                              items:
                                type: string
                              description: Filter by alternative oIds
                            buyingTriggers:
                              type: array
                              items:
                                type: string
                              description: Filter by buying trigger oIds
                            coreFeatures:
                              type: array
                              items:
                                type: string
                              description: Filter by core feature oIds
                            objections:
                              type: array
                              items:
                                type: string
                              description: Filter by objection oIds
                            proofPoints:
                              type: array
                              items:
                                type: string
                              description: Filter by proof point oIds
                            motionTypes:
                              type: array
                              items:
                                type: string
                                enum:
                                  - NET_NEW
                                  - UPSELL
                                  - CROSS_SELL
                                  - CONVERT_FREE_TO_PAID
                                  - RENEW_AND_RETAIN
                                  - DISPLACE_INCUMBENT
                              description: Filter by motion type (NET_NEW, UPSELL)
                            customerScope:
                              type: string
                              enum:
                                - ALL
                                - NEW_CUSTOMERS
                                - EXISTING_CUSTOMERS
                              description: >-
                                Customer-scope view (NEW_CUSTOMERS /
                                EXISTING_CUSTOMERS); ALL or absent applies no
                                filter
                            callPurposes:
                              type: array
                              items:
                                type: string
                                enum:
                                  - DISCOVERY
                                  - DEMO
                                  - TECHNICAL_EVALUATION
                                  - WORKING_SESSION
                                  - NEGOTIATION_PRICING
                                  - ONBOARDING
                                  - CHECK_IN_SUCCESS
                                  - QBR_RENEWAL
                                  - EXPANSION_UPSELL
                                  - ESCALATION_CHURN_RISK
                                  - SUPPORT
                                  - INTERNAL_SYNC
                                  - OTHER
                              description: >-
                                Filter calls by classified purpose (DISCOVERY,
                                DEMO, TECHNICAL_EVALUATION, WORKING_SESSION,
                                NEGOTIATION_PRICING, ONBOARDING,
                                CHECK_IN_SUCCESS, QBR_RENEWAL, EXPANSION_UPSELL,
                                ESCALATION_CHURN_RISK, SUPPORT, INTERNAL_SYNC,
                                OTHER)
                            unmatchedOnly:
                              type: boolean
                              description: >-
                                When true, only return events that have findings
                                with no library entity matches
                          description: Filters to INCLUDE events matching these criteria
                        exclude:
                          type: object
                          properties:
                            eventCategories:
                              type: array
                              items:
                                type: string
                                enum:
                                  - EMAIL
                                  - CALL
                                  - CRM
                                  - RESOURCE
                                  - REVISION
                                  - SOCIAL
                                  - ADS
                                  - PRODUCT
                                  - UNKNOWN
                              description: Filter by event categories (CALL, EMAIL, CRM)
                            eventTypes:
                              type: array
                              items:
                                type: string
                                enum:
                                  - EMAIL_SENT
                                  - EMAIL_REPLY_RECEIVED
                                  - CALL_TRANSCRIPT
                                  - DEAL_WON
                                  - DEAL_LOST
                                  - OPPORTUNITY_CREATED
                                  - MEETING_BOOKED
                                  - RESOURCE_INDEXED
                                  - RESOURCE_REINDEXED
                                  - PROJECT_UPDATE
                                  - TASK_COMPLETED
                                  - ENTITY_CREATED
                                  - ENTITY_UPDATED
                                  - SOCIAL_MESSAGE_SENT
                                  - SOCIAL_MESSAGE_RECEIVED
                                  - SOCIAL_CONNECTION_SENT
                                  - SOCIAL_CONNECTION_ACCEPTED
                                  - AD_SET_PUBLISHED
                                  - AD_PERFORMANCE_SNAPSHOT
                                  - BULK_IMPORT_SUMMARY
                                  - PROCESSING_NOT_APPLICABLE
                                  - PROVIDER_EVENT_TYPE_UNKNOWN
                                  - UNKNOWN
                              description: >-
                                Filter by specific event types (CALL_TRANSCRIPT,
                                EMAIL_SENT, DEAL_WON, etc.)
                            sentiments:
                              type: array
                              items:
                                type: string
                                enum:
                                  - POSITIVE
                                  - NEUTRAL
                                  - NEGATIVE
                                  - UNKNOWN
                              description: >-
                                Filter by sentiment (POSITIVE, NEGATIVE,
                                NEUTRAL, MIXED)
                            contactEmails:
                              type: array
                              items:
                                type: string
                              description: Filter by participant email addresses
                            companyDomains:
                              type: array
                              items:
                                type: string
                              description: Filter by company domains
                            outcomeFilters:
                              type: array
                              items:
                                type: string
                                enum:
                                  - OPEN
                                  - WON
                                  - LOST
                                  - POSITIVE_REPLY
                                  - NEUTRAL_REPLY
                                  - NEGATIVE_REPLY
                              description: >-
                                Exclude by outcome (OPEN, WON, LOST,
                                POSITIVE_REPLY, NEUTRAL_REPLY, NEGATIVE_REPLY)
                            opportunityStatuses:
                              type: array
                              items:
                                type: string
                                enum:
                                  - OPEN
                                  - WON
                                  - LOST
                              description: Exclude by opportunity status (OPEN, WON, LOST)
                            minDealAmount:
                              type: number
                              description: Minimum deal amount filter
                            maxDealAmount:
                              type: number
                              description: Maximum deal amount filter
                            offerings:
                              type: array
                              items:
                                type: string
                              description: Exclude events matching these offering oIds
                            personas:
                              type: array
                              items:
                                type: string
                              description: Exclude events matching these persona oIds
                            segments:
                              type: array
                              items:
                                type: string
                              description: Exclude events matching these segment oIds
                            tags:
                              type: array
                              items:
                                type: string
                              description: >-
                                Exclude events matching any library entity that
                                carries these reporting tag oIds (any tag group;
                                OR'd).
                            useCases:
                              type: array
                              items:
                                type: string
                              description: Exclude events matching these use case oIds
                            references:
                              type: array
                              items:
                                type: string
                              description: >-
                                Exclude events matching these reference customer
                                oIds
                            competitors:
                              type: array
                              items:
                                type: string
                              description: Exclude events matching these competitor oIds
                            alternatives:
                              type: array
                              items:
                                type: string
                              description: Exclude events matching these alternative oIds
                            buyingTriggers:
                              type: array
                              items:
                                type: string
                              description: >-
                                Exclude events matching these buying trigger
                                oIds
                            coreFeatures:
                              type: array
                              items:
                                type: string
                              description: Exclude events matching these core feature oIds
                            objections:
                              type: array
                              items:
                                type: string
                              description: Exclude events matching these objection oIds
                            proofPoints:
                              type: array
                              items:
                                type: string
                              description: Exclude events matching these proof point oIds
                            motionTypes:
                              type: array
                              items:
                                type: string
                                enum:
                                  - NET_NEW
                                  - UPSELL
                                  - CROSS_SELL
                                  - CONVERT_FREE_TO_PAID
                                  - RENEW_AND_RETAIN
                                  - DISPLACE_INCUMBENT
                              description: >-
                                Exclude events matching these motion types
                                (NET_NEW, UPSELL)
                            callPurposes:
                              type: array
                              items:
                                type: string
                                enum:
                                  - DISCOVERY
                                  - DEMO
                                  - TECHNICAL_EVALUATION
                                  - WORKING_SESSION
                                  - NEGOTIATION_PRICING
                                  - ONBOARDING
                                  - CHECK_IN_SUCCESS
                                  - QBR_RENEWAL
                                  - EXPANSION_UPSELL
                                  - ESCALATION_CHURN_RISK
                                  - SUPPORT
                                  - INTERNAL_SYNC
                                  - OTHER
                              description: >-
                                Exclude calls with these classified purposes
                                (e.g. SUPPORT, INTERNAL_SYNC)
                            dealMotions:
                              type: array
                              items:
                                type: string
                                enum:
                                  - NET_NEW
                                  - UPSELL
                                  - CROSS_SELL
                                  - RENEW_AND_RETAIN
                                  - CONVERT_FREE_TO_PAID
                                  - DISPLACE_INCUMBENT
                                  - SERVICES
                                  - PARTNER
                                  - NON_COMMERCIAL
                              description: >-
                                Exclude events linked to deals whose CRM deal
                                type maps to these motions
                            dealTypes:
                              type: array
                              items:
                                type: string
                              description: >-
                                Exclude events linked to deals with these raw
                                CRM deal-type labels, case-insensitive
                            dealStages:
                              type: array
                              items:
                                type: string
                              description: >-
                                Exclude events linked to deals currently in
                                these CRM stages, by stage label or stage id,
                                case-insensitive
                            pipelinePhases:
                              type: array
                              items:
                                type: string
                                enum:
                                  - prospecting
                                  - discovery
                                  - evaluation
                                  - negotiation
                                  - commitment
                                  - closed_won
                                  - closed_lost
                              description: >-
                                Exclude events linked to deals whose stage maps
                                to these pipeline phases
                          description: Filters to EXCLUDE events matching these criteria
                      description: >-
                        Optional additional event filters (event-log filter
                        shape). Library-entity filters hold the extractor until
                        entity matching has run, then gate it there as well as
                        in backfills.
                    modelTier:
                      type: string
                      enum:
                        - NOTE
                        - PULSE
                        - ECHO
                        - HARMONY
                        - CHORUS
                        - SYMPHONY
                    outputMode:
                      type: string
                      enum:
                        - freeform
                        - boolean
                        - number
                        - enum_single
                        - enum_multi
                        - object
                      default: freeform
                      description: >-
                        Output shape: freeform snippets, structured fields, or a
                        per-event verdict (boolean / number / single or multi
                        choice)
                    classes:
                      type: array
                      nullable: true
                      items:
                        type: object
                        properties:
                          value:
                            type: string
                            minLength: 1
                            maxLength: 64
                            pattern: ^[a-z0-9][a-z0-9_-]*$
                          label:
                            type: string
                            nullable: true
                            maxLength: 120
                          description:
                            type: string
                            nullable: true
                            maxLength: 500
                        required:
                          - value
                      maxItems: 25
                      description: >-
                        Choice-mode classes (enum_single / enum_multi); >= 2
                        required
                    numberConfig:
                      type: object
                      nullable: true
                      properties:
                        unit:
                          type: string
                          nullable: true
                          maxLength: 32
                        min:
                          type: number
                          nullable: true
                        max:
                          type: number
                          nullable: true
                      description: NUMBER-mode unit and optional min/max bounds
                    jsonSchema:
                      type: object
                      nullable: true
                      additionalProperties:
                        nullable: true
                      description: OBJECT-mode JSON Schema for the structured value
                    resultCardinality:
                      type: string
                      enum:
                        - single
                        - repeated
                      default: single
                      description: >-
                        OBJECT mode only: one record for the whole event, or one
                        record per matching occurrence
                    perspective:
                      type: string
                      enum:
                        - INTERNAL
                        - EXTERNAL
                        - ANY
                      default: EXTERNAL
                      description: >-
                        Whose contributions to mine: INTERNAL (our team),
                        EXTERNAL (prospect), or ANY. Defaults to EXTERNAL —
                        nearly all GTM intelligence is about what the buyer
                        said, and an unstated preference is a preference for the
                        buyer's voice.
                    fieldTargets:
                      type: array
                      items:
                        type: object
                        properties:
                          table:
                            type: string
                            enum:
                              - persona
                              - product
                              - service
                              - solution
                              - use_case
                              - playbook
                              - proof_point
                              - competitor
                              - alternative
                              - buying_trigger
                              - core_feature
                              - objection
                              - reference
                              - hypothesis
                              - segment
                              - skill
                          entityOId:
                            type: string
                            minLength: 1
                          field:
                            type: string
                            minLength: 1
                            maxLength: 120
                        required:
                          - table
                          - entityOId
                          - field
                      default: []
                      description: >-
                        Optional (entity, field) refinement targets — findings
                        are pinned to these entities as evidence for the named
                        field
                    status:
                      type: string
                      enum:
                        - DRAFT
                        - ACTIVE
                      default: ACTIVE
                      description: >-
                        Initial lifecycle status. ACTIVE (default) extracts from
                        new matching events as they arrive; DRAFT holds the
                        extractor for review until explicitly activated.
                    associatedLibraryTables:
                      type: array
                      items:
                        type: string
                        enum:
                          - persona
                          - product
                          - service
                          - solution
                          - use_case
                          - playbook
                          - proof_point
                          - competitor
                          - alternative
                          - buying_trigger
                          - core_feature
                          - objection
                          - reference
                          - hypothesis
                          - segment
                          - skill
                      default: []
                  required:
                    - name
                    - prompt
                    - eventTypes
                    - modelTier
                eventOIds:
                  type: array
                  nullable: true
                  items:
                    type: string
                    minLength: 1
                  maxItems: 10
                filters:
                  type: object
                  nullable: true
                  properties:
                    match:
                      type: object
                      properties:
                        entityMatchAll:
                          type: boolean
                          description: >-
                            Require every selected library entity, including
                            entities of the same category
                        eventOIds:
                          type: array
                          items:
                            type: string
                          description: Filter to these event oIds only
                        opportunityIds:
                          type: array
                          items:
                            type: string
                          description: >-
                            Filter to events linked to these opportunities.
                            Accepts Octave opportunity oIds (crmo_*) or the
                            CRM's own deal ids (Salesforce Id, HubSpot object
                            id, Attio record UUID) interchangeably
                        eventCategories:
                          type: array
                          items:
                            type: string
                            enum:
                              - EMAIL
                              - CALL
                              - CRM
                              - RESOURCE
                              - REVISION
                              - SOCIAL
                              - ADS
                              - PRODUCT
                              - UNKNOWN
                          description: Filter by event categories (CALL, EMAIL, CRM)
                        eventTypes:
                          type: array
                          items:
                            type: string
                            enum:
                              - EMAIL_SENT
                              - EMAIL_REPLY_RECEIVED
                              - CALL_TRANSCRIPT
                              - DEAL_WON
                              - DEAL_LOST
                              - OPPORTUNITY_CREATED
                              - MEETING_BOOKED
                              - RESOURCE_INDEXED
                              - RESOURCE_REINDEXED
                              - PROJECT_UPDATE
                              - TASK_COMPLETED
                              - ENTITY_CREATED
                              - ENTITY_UPDATED
                              - SOCIAL_MESSAGE_SENT
                              - SOCIAL_MESSAGE_RECEIVED
                              - SOCIAL_CONNECTION_SENT
                              - SOCIAL_CONNECTION_ACCEPTED
                              - AD_SET_PUBLISHED
                              - AD_PERFORMANCE_SNAPSHOT
                              - BULK_IMPORT_SUMMARY
                              - PROCESSING_NOT_APPLICABLE
                              - PROVIDER_EVENT_TYPE_UNKNOWN
                              - UNKNOWN
                          description: >-
                            Filter by specific event types (CALL_TRANSCRIPT,
                            EMAIL_SENT, DEAL_WON, etc.)
                        sentiments:
                          type: array
                          items:
                            type: string
                            enum:
                              - POSITIVE
                              - NEUTRAL
                              - NEGATIVE
                              - UNKNOWN
                          description: >-
                            Filter by sentiment (POSITIVE, NEGATIVE, NEUTRAL,
                            MIXED)
                        contactEmails:
                          type: array
                          items:
                            type: string
                          description: Filter by participant email addresses
                        companyDomains:
                          type: array
                          items:
                            type: string
                          description: Filter by company domains
                        outcomeFilters:
                          type: array
                          items:
                            type: string
                            enum:
                              - OPEN
                              - WON
                              - LOST
                              - POSITIVE_REPLY
                              - NEUTRAL_REPLY
                              - NEGATIVE_REPLY
                          description: >-
                            Filter by outcome (OPEN, WON, LOST, POSITIVE_REPLY,
                            NEUTRAL_REPLY, NEGATIVE_REPLY)
                        opportunityStatuses:
                          type: array
                          items:
                            type: string
                            enum:
                              - OPEN
                              - WON
                              - LOST
                          description: >-
                            Filter to events linked to deals with this status
                            (OPEN, WON, LOST)
                        dealMotions:
                          type: array
                          items:
                            type: string
                            enum:
                              - NET_NEW
                              - UPSELL
                              - CROSS_SELL
                              - RENEW_AND_RETAIN
                              - CONVERT_FREE_TO_PAID
                              - DISPLACE_INCUMBENT
                              - SERVICES
                              - PARTNER
                              - NON_COMMERCIAL
                          description: >-
                            Filter to events linked to deals whose CRM deal type
                            maps to these motions (NET_NEW, UPSELL, CROSS_SELL,
                            RENEW_AND_RETAIN, CONVERT_FREE_TO_PAID,
                            DISPLACE_INCUMBENT, SERVICES, PARTNER,
                            NON_COMMERCIAL)
                        dealTypes:
                          type: array
                          items:
                            type: string
                          description: >-
                            Filter to events linked to deals with these raw CRM
                            deal-type labels (Salesforce Type, HubSpot
                            dealtype), case-insensitive
                        dealStages:
                          type: array
                          items:
                            type: string
                          description: >-
                            Filter to events linked to deals currently in these
                            CRM stages, by stage label or stage id,
                            case-insensitive
                        dealStagesAtEvent:
                          type: array
                          items:
                            type: string
                          description: >-
                            Filter to events whose linked deal was in one of
                            these CRM stages WHEN THE EVENT HAPPENED (by stage
                            label, case-insensitive), from the deal's stage
                            history — unlike dealStages, which reads the deal's
                            stage today. Use it for 'what came up on calls
                            during Discovery'. An event whose deal has no
                            recorded stage at that time does not match.
                        pipelinePhases:
                          type: array
                          items:
                            type: string
                            enum:
                              - prospecting
                              - discovery
                              - evaluation
                              - negotiation
                              - commitment
                              - closed_won
                              - closed_lost
                          description: >-
                            Filter to events linked to deals whose stage maps to
                            these pipeline phases (prospecting, discovery,
                            evaluation, negotiation, commitment, closed_won,
                            closed_lost)
                        crmPipelines:
                          type: array
                          items:
                            type: string
                          description: >-
                            Filter to events linked to deals in these CRM
                            pipelines, by pipeline id or name (case-insensitive
                            name)
                        minStalledDays:
                          type: number
                          description: >-
                            Filter to events linked to an OPEN deal that has sat
                            in its current stage at least this many days
                        minDealAmount:
                          type: number
                          description: Minimum deal amount filter
                        maxDealAmount:
                          type: number
                          description: Maximum deal amount filter
                        offerings:
                          type: array
                          items:
                            type: string
                          description: Filter by offering oIds
                        personas:
                          type: array
                          items:
                            type: string
                          description: >-
                            Filter by persona oIds (events must match these
                            personas)
                        segments:
                          type: array
                          items:
                            type: string
                          description: Filter by segment oIds
                        tags:
                          type: array
                          items:
                            type: string
                          description: >-
                            Filter by reporting tag oIds (from any tag group, on
                            any library entity type). Resolved to the entities
                            carrying those tags; multiple tags are OR'd.
                        useCases:
                          type: array
                          items:
                            type: string
                          description: Filter by use case oIds
                        references:
                          type: array
                          items:
                            type: string
                          description: Filter by reference customer oIds
                        competitors:
                          type: array
                          items:
                            type: string
                          description: Filter by competitor oIds
                        alternatives:
                          type: array
                          items:
                            type: string
                          description: Filter by alternative oIds
                        buyingTriggers:
                          type: array
                          items:
                            type: string
                          description: Filter by buying trigger oIds
                        coreFeatures:
                          type: array
                          items:
                            type: string
                          description: Filter by core feature oIds
                        objections:
                          type: array
                          items:
                            type: string
                          description: Filter by objection oIds
                        proofPoints:
                          type: array
                          items:
                            type: string
                          description: Filter by proof point oIds
                        motionTypes:
                          type: array
                          items:
                            type: string
                            enum:
                              - NET_NEW
                              - UPSELL
                              - CROSS_SELL
                              - CONVERT_FREE_TO_PAID
                              - RENEW_AND_RETAIN
                              - DISPLACE_INCUMBENT
                          description: Filter by motion type (NET_NEW, UPSELL)
                        customerScope:
                          type: string
                          enum:
                            - ALL
                            - NEW_CUSTOMERS
                            - EXISTING_CUSTOMERS
                          description: >-
                            Customer-scope view (NEW_CUSTOMERS /
                            EXISTING_CUSTOMERS); ALL or absent applies no filter
                        callPurposes:
                          type: array
                          items:
                            type: string
                            enum:
                              - DISCOVERY
                              - DEMO
                              - TECHNICAL_EVALUATION
                              - WORKING_SESSION
                              - NEGOTIATION_PRICING
                              - ONBOARDING
                              - CHECK_IN_SUCCESS
                              - QBR_RENEWAL
                              - EXPANSION_UPSELL
                              - ESCALATION_CHURN_RISK
                              - SUPPORT
                              - INTERNAL_SYNC
                              - OTHER
                          description: >-
                            Filter calls by classified purpose (DISCOVERY, DEMO,
                            TECHNICAL_EVALUATION, WORKING_SESSION,
                            NEGOTIATION_PRICING, ONBOARDING, CHECK_IN_SUCCESS,
                            QBR_RENEWAL, EXPANSION_UPSELL,
                            ESCALATION_CHURN_RISK, SUPPORT, INTERNAL_SYNC,
                            OTHER)
                        unmatchedOnly:
                          type: boolean
                          description: >-
                            When true, only return events that have findings
                            with no library entity matches
                      description: Filters to INCLUDE events matching these criteria
                    exclude:
                      type: object
                      properties:
                        eventCategories:
                          type: array
                          items:
                            type: string
                            enum:
                              - EMAIL
                              - CALL
                              - CRM
                              - RESOURCE
                              - REVISION
                              - SOCIAL
                              - ADS
                              - PRODUCT
                              - UNKNOWN
                          description: Filter by event categories (CALL, EMAIL, CRM)
                        eventTypes:
                          type: array
                          items:
                            type: string
                            enum:
                              - EMAIL_SENT
                              - EMAIL_REPLY_RECEIVED
                              - CALL_TRANSCRIPT
                              - DEAL_WON
                              - DEAL_LOST
                              - OPPORTUNITY_CREATED
                              - MEETING_BOOKED
                              - RESOURCE_INDEXED
                              - RESOURCE_REINDEXED
                              - PROJECT_UPDATE
                              - TASK_COMPLETED
                              - ENTITY_CREATED
                              - ENTITY_UPDATED
                              - SOCIAL_MESSAGE_SENT
                              - SOCIAL_MESSAGE_RECEIVED
                              - SOCIAL_CONNECTION_SENT
                              - SOCIAL_CONNECTION_ACCEPTED
                              - AD_SET_PUBLISHED
                              - AD_PERFORMANCE_SNAPSHOT
                              - BULK_IMPORT_SUMMARY
                              - PROCESSING_NOT_APPLICABLE
                              - PROVIDER_EVENT_TYPE_UNKNOWN
                              - UNKNOWN
                          description: >-
                            Filter by specific event types (CALL_TRANSCRIPT,
                            EMAIL_SENT, DEAL_WON, etc.)
                        sentiments:
                          type: array
                          items:
                            type: string
                            enum:
                              - POSITIVE
                              - NEUTRAL
                              - NEGATIVE
                              - UNKNOWN
                          description: >-
                            Filter by sentiment (POSITIVE, NEGATIVE, NEUTRAL,
                            MIXED)
                        contactEmails:
                          type: array
                          items:
                            type: string
                          description: Filter by participant email addresses
                        companyDomains:
                          type: array
                          items:
                            type: string
                          description: Filter by company domains
                        outcomeFilters:
                          type: array
                          items:
                            type: string
                            enum:
                              - OPEN
                              - WON
                              - LOST
                              - POSITIVE_REPLY
                              - NEUTRAL_REPLY
                              - NEGATIVE_REPLY
                          description: >-
                            Exclude by outcome (OPEN, WON, LOST, POSITIVE_REPLY,
                            NEUTRAL_REPLY, NEGATIVE_REPLY)
                        opportunityStatuses:
                          type: array
                          items:
                            type: string
                            enum:
                              - OPEN
                              - WON
                              - LOST
                          description: Exclude by opportunity status (OPEN, WON, LOST)
                        minDealAmount:
                          type: number
                          description: Minimum deal amount filter
                        maxDealAmount:
                          type: number
                          description: Maximum deal amount filter
                        offerings:
                          type: array
                          items:
                            type: string
                          description: Exclude events matching these offering oIds
                        personas:
                          type: array
                          items:
                            type: string
                          description: Exclude events matching these persona oIds
                        segments:
                          type: array
                          items:
                            type: string
                          description: Exclude events matching these segment oIds
                        tags:
                          type: array
                          items:
                            type: string
                          description: >-
                            Exclude events matching any library entity that
                            carries these reporting tag oIds (any tag group;
                            OR'd).
                        useCases:
                          type: array
                          items:
                            type: string
                          description: Exclude events matching these use case oIds
                        references:
                          type: array
                          items:
                            type: string
                          description: >-
                            Exclude events matching these reference customer
                            oIds
                        competitors:
                          type: array
                          items:
                            type: string
                          description: Exclude events matching these competitor oIds
                        alternatives:
                          type: array
                          items:
                            type: string
                          description: Exclude events matching these alternative oIds
                        buyingTriggers:
                          type: array
                          items:
                            type: string
                          description: Exclude events matching these buying trigger oIds
                        coreFeatures:
                          type: array
                          items:
                            type: string
                          description: Exclude events matching these core feature oIds
                        objections:
                          type: array
                          items:
                            type: string
                          description: Exclude events matching these objection oIds
                        proofPoints:
                          type: array
                          items:
                            type: string
                          description: Exclude events matching these proof point oIds
                        motionTypes:
                          type: array
                          items:
                            type: string
                            enum:
                              - NET_NEW
                              - UPSELL
                              - CROSS_SELL
                              - CONVERT_FREE_TO_PAID
                              - RENEW_AND_RETAIN
                              - DISPLACE_INCUMBENT
                          description: >-
                            Exclude events matching these motion types (NET_NEW,
                            UPSELL)
                        callPurposes:
                          type: array
                          items:
                            type: string
                            enum:
                              - DISCOVERY
                              - DEMO
                              - TECHNICAL_EVALUATION
                              - WORKING_SESSION
                              - NEGOTIATION_PRICING
                              - ONBOARDING
                              - CHECK_IN_SUCCESS
                              - QBR_RENEWAL
                              - EXPANSION_UPSELL
                              - ESCALATION_CHURN_RISK
                              - SUPPORT
                              - INTERNAL_SYNC
                              - OTHER
                          description: >-
                            Exclude calls with these classified purposes (e.g.
                            SUPPORT, INTERNAL_SYNC)
                        dealMotions:
                          type: array
                          items:
                            type: string
                            enum:
                              - NET_NEW
                              - UPSELL
                              - CROSS_SELL
                              - RENEW_AND_RETAIN
                              - CONVERT_FREE_TO_PAID
                              - DISPLACE_INCUMBENT
                              - SERVICES
                              - PARTNER
                              - NON_COMMERCIAL
                          description: >-
                            Exclude events linked to deals whose CRM deal type
                            maps to these motions
                        dealTypes:
                          type: array
                          items:
                            type: string
                          description: >-
                            Exclude events linked to deals with these raw CRM
                            deal-type labels, case-insensitive
                        dealStages:
                          type: array
                          items:
                            type: string
                          description: >-
                            Exclude events linked to deals currently in these
                            CRM stages, by stage label or stage id,
                            case-insensitive
                        pipelinePhases:
                          type: array
                          items:
                            type: string
                            enum:
                              - prospecting
                              - discovery
                              - evaluation
                              - negotiation
                              - commitment
                              - closed_won
                              - closed_lost
                          description: >-
                            Exclude events linked to deals whose stage maps to
                            these pipeline phases
                      description: Filters to EXCLUDE events matching these criteria
                windowStart:
                  type: string
                  nullable: true
                  format: date-time
                  description: >-
                    Inclusive event-time start for filter-based selection;
                    ignored when eventOIds are supplied
                windowEnd:
                  type: string
                  nullable: true
                  format: date-time
                  description: >-
                    Inclusive event-time end for filter-based selection; ignored
                    when eventOIds are supplied
                limit:
                  type: integer
                  minimum: 1
                  maximum: 10
                  default: 5
                modelTierOverride:
                  type: string
                  nullable: true
                  enum:
                    - NOTE
                    - PULSE
                    - ECHO
                    - HARMONY
                    - CHORUS
                    - SYMPHONY
                    - null
      responses:
        '200':
          description: Per-event findings preview with credits charged
          content:
            application/json:
              schema:
                type: object
                properties:
                  _metadata:
                    $ref: '#/components/schemas/Metadata'
                  data:
                    $ref: '#/components/schemas/CustomExtractorBacktestResult'
                required:
                  - _metadata
        '400':
          description: Bad request
          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
          example: 0
          description: API usage
        requestId:
          type: string
          example: requestId
          description: Request ID
        message:
          type: string
          example: message
          description: Message
        timestamp:
          type: string
          example: '2021-01-01T00:00:00.000Z'
          description: Timestamp
      required:
        - requestId
        - timestamp
    CustomExtractorBacktestResult:
      type: object
      nullable: true
      properties:
        extractorName:
          type: string
        promptVersion:
          type: integer
          minimum: 0
        modelTier:
          type: string
          enum:
            - NOTE
            - PULSE
            - ECHO
            - HARMONY
            - CHORUS
            - SYMPHONY
        eventsMatchingSelection:
          type: number
        eventsTested:
          type: number
        totalCreditsCharged:
          type: number
        results:
          type: array
          items:
            type: object
            properties:
              eventOId:
                type: string
              eventType:
                type: string
                enum:
                  - EMAIL_SENT
                  - EMAIL_REPLY_RECEIVED
                  - CALL_TRANSCRIPT
                  - DEAL_WON
                  - DEAL_LOST
                  - OPPORTUNITY_CREATED
                  - MEETING_BOOKED
                  - RESOURCE_INDEXED
                  - RESOURCE_REINDEXED
                  - PROJECT_UPDATE
                  - TASK_COMPLETED
                  - ENTITY_CREATED
                  - ENTITY_UPDATED
                  - SOCIAL_MESSAGE_SENT
                  - SOCIAL_MESSAGE_RECEIVED
                  - SOCIAL_CONNECTION_SENT
                  - SOCIAL_CONNECTION_ACCEPTED
                  - AD_SET_PUBLISHED
                  - AD_PERFORMANCE_SNAPSHOT
                  - BULK_IMPORT_SUMMARY
                  - PROCESSING_NOT_APPLICABLE
                  - PROVIDER_EVENT_TYPE_UNKNOWN
                  - UNKNOWN
              eventTimestamp:
                type: string
                nullable: true
                format: date-time
              subjectLine:
                type: string
                nullable: true
              companyName:
                type: string
                nullable: true
              companyLogo:
                type: string
                nullable: true
              model:
                type: string
                nullable: true
              findings:
                type: array
                items:
                  type: object
                  properties:
                    snippetText:
                      type: string
                    quote:
                      type: string
                      nullable: true
                    speaker:
                      type: string
                      nullable: true
                    reasoning:
                      type: string
                      nullable: true
                    classification:
                      type: object
                      nullable: true
                      properties:
                        mode:
                          type: string
                          enum:
                            - freeform
                            - boolean
                            - number
                            - enum_single
                            - enum_multi
                            - object
                        value:
                          type: string
                          nullable: true
                        values:
                          type: array
                          nullable: true
                          items:
                            type: string
                        numericValue:
                          type: number
                          nullable: true
                        unit:
                          type: string
                          nullable: true
                        confidence:
                          type: string
                          enum:
                            - LOW
                            - MEDIUM
                            - HIGH
                      required:
                        - mode
                        - confidence
                    structuredValue:
                      type: object
                      nullable: true
                      additionalProperties:
                        nullable: true
                    libraryMatches:
                      type: array
                      nullable: true
                      items:
                        type: object
                        properties:
                          table:
                            type: string
                            enum:
                              - persona
                              - product
                              - service
                              - solution
                              - use_case
                              - playbook
                              - proof_point
                              - competitor
                              - alternative
                              - buying_trigger
                              - core_feature
                              - objection
                              - reference
                              - hypothesis
                              - segment
                              - skill
                          oId:
                            type: string
                          name:
                            type: string
                            nullable: true
                        required:
                          - table
                          - oId
                    libraryMatchDiagnostics:
                      type: array
                      nullable: true
                      items:
                        type: object
                        properties:
                          table:
                            type: string
                            enum:
                              - persona
                              - product
                              - service
                              - solution
                              - use_case
                              - playbook
                              - proof_point
                              - competitor
                              - alternative
                              - buying_trigger
                              - core_feature
                              - objection
                              - reference
                              - hypothesis
                              - segment
                              - skill
                          status:
                            type: string
                            enum:
                              - MATCHED
                              - REJECTED
                              - SKIPPED
                              - ERROR
                          source:
                            type: string
                            enum:
                              - SEMANTIC
                              - SPEAKER_ATTRIBUTION
                          matchConfidence:
                            type: string
                            nullable: true
                            enum:
                              - LOW
                              - MEDIUM
                              - HIGH
                              - null
                          matchAnalysis:
                            type: string
                            nullable: true
                          candidateOId:
                            type: string
                            nullable: true
                          candidateName:
                            type: string
                            nullable: true
                        required:
                          - table
                          - status
                          - source
                  required:
                    - snippetText
              creditsCharged:
                type: number
              error:
                type: string
                nullable: true
              warning:
                type: string
                nullable: true
              executionTimeMs:
                type: number
            required:
              - eventOId
              - eventType
              - eventTimestamp
              - findings
              - creditsCharged
              - executionTimeMs
      required:
        - extractorName
        - promptVersion
        - modelTier
        - eventsMatchingSelection
        - eventsTested
        - totalCreditsCharged
        - results
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: api_key

````