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

# Analyze relationships

> Explain how an explicitly selected set of outcomes can pay together. Supply outcome_id or listing_id references in selection; resolve native market IDs first. The response can include pair relationships, basket overlap/gap counts and example settlement witnesses.

For example, two outcomes can be mutually exclusive even when their markets appear in different original venue events. The analysis uses published family scenarios rather than titles or price correlation. Returned scenario pins and the paying_definition state the scope of the finding; FULL_PAYOUT distinguishes full wins from fractional payouts.

Only supplied outcomes participate, and duplicate references to the same canonical outcome are deduplicated for set counts. Witness limits bound returned examples, not the scenario domain used to prove a finding. Complete-coverage requests reject missing interpretations; partial requests identify the supported subset explicitly.

See the [integration guide](/guides/relationships) for the workflow and interpretation of this response.


## OpenAPI

````yaml POST /relationships:analyze
openapi: 3.1.0
info:
  title: Rook API
  version: 0.1.0-design
  description: Markets, settlement relationships, scenarios, payouts and market data.
servers:
  - url: https://api.rook.pm/v1
    description: Proposed API origin; not an assertion these operations are callable.
security:
  - ApiKeyBearer: []
tags:
  - name: Reference data
    description: Events, unified markets and native-ID resolution.
  - name: Families and scenarios
    description: Family scope and versioned scenario columns.
  - name: Relationships and Combos
    description: Related-market discovery, selected-set inference and Combo interpretation.
  - name: Payouts and exposure
    description: Scoped per-unit payouts and stateless portfolio/candidate calculations.
  - name: Market data
    description: Current prices, history, L2 books, prints, statistics and published fees.
  - name: Fair values
    description: Future private customer estimates; not Rook forecasts.
  - name: Coverage and updates
    description: Supported capabilities and incremental semantic changes.
paths:
  /relationships:analyze:
    post:
      tags:
        - Relationships and Combos
      summary: Analyze relationships
      description: >-
        Explain how an explicitly selected set of outcomes can pay together.
        Supply outcome_id or listing_id references in selection; resolve native
        market IDs first. The response can include pair relationships, basket
        overlap/gap counts and example settlement witnesses.


        For example, two outcomes can be mutually exclusive even when their
        markets appear in different original venue events. The analysis uses
        published family scenarios rather than titles or price correlation.
        Returned scenario pins and the paying_definition state the scope of the
        finding; FULL_PAYOUT distinguishes full wins from fractional payouts.


        Only supplied outcomes participate, and duplicate references to the same
        canonical outcome are deduplicated for set counts. Witness limits bound
        returned examples, not the scenario domain used to prove a finding.
        Complete-coverage requests reject missing interpretations; partial
        requests identify the supported subset explicitly.
      operationId: analyzeRelationships
      parameters:
        - name: X-Client-Request-Id
          in: header
          required: false
          schema:
            type: string
          description: Caller correlation reference; not an idempotency guarantee.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnalyzeRelationshipsRequest'
            example:
              selection:
                - outcome_id: out_fed_dec_2026_cut_yes
                - outcome_id: out_fed_dec_2026_hold_yes
              scenario_pins:
                - family_id: fam_fed_dec_2026
                  scenario_version: '1'
              include:
                - PAIRS
                - BASKET
                - WITNESSES
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalyzeRelationshipsResponse'
              example:
                relationships:
                  - relationship_id: rel_fed_cut_hold_exclusive
                    type: EXCLUSIVITY
                    from_outcome_id: out_fed_dec_2026_cut_yes
                    to_outcome_id: out_fed_dec_2026_hold_yes
                    related_market_ids:
                      - mkt_fed_dec_2026_cut
                      - mkt_fed_dec_2026_hold
                    related_event_ids:
                      - evt_pm_900001
                      - evt_pm_900002
                    explanation: >-
                      The same Fed decision cannot both lower the policy rate
                      and leave it unchanged. The two YES outcomes never pay
                      together in these scenarios.
                    scenario_pins:
                      - family_id: fam_fed_dec_2026
                        scenario_version: '1'
                    witnesses:
                      - family_id: fam_fed_dec_2026
                        scenario_version: '1'
                        scenario_id: scn_cut
                      - family_id: fam_fed_dec_2026
                        scenario_version: '1'
                        scenario_id: scn_hold
                baskets:
                  - classification: EXCLUSIVE
                    outcome_ids:
                      - out_fed_dec_2026_cut_yes
                      - out_fed_dec_2026_hold_yes
                    selected_outcome_count: 2
                    scenario_count: 3
                    representation: CUT_HOLD_HIKE
                    paying_definition: POSITIVE_PAYOUT
                    scenario_pins:
                      - family_id: fam_fed_dec_2026
                        scenario_version: '1'
                    paying_counts:
                      none: 1
                      exactly_one: 2
                      two_or_more: 0
                    gap_witnesses:
                      - family_id: fam_fed_dec_2026
                        scenario_version: '1'
                        scenario_id: scn_hike
                    overlap_witnesses: []
                coverage:
                  complete: true
                  submitted_count: 2
                  supported_count: 2
                  items:
                    - input_reference: out_fed_dec_2026_cut_yes
                      outcome_id: out_fed_dec_2026_cut_yes
                      status: SUPPORTED
                      family_ids:
                        - fam_fed_dec_2026
                    - input_reference: out_fed_dec_2026_hold_yes
                      outcome_id: out_fed_dec_2026_hold_yes
                      status: SUPPORTED
                      family_ids:
                        - fam_fed_dec_2026
                versions:
                  market_versions:
                    - market_id: mkt_fed_dec_2026_cut
                      version: '1'
                    - market_id: mkt_fed_dec_2026_hold
                      version: '1'
                  mapping_version: '1'
                  scenario_pins:
                    - family_id: fam_fed_dec_2026
                      scenario_version: '1'
                  as_of: '2026-10-19T12:00:00Z'
          headers:
            X-Request-Id:
              description: Server request trace ID.
              schema:
                type: string
                description: Opaque text identifier. Preserve its exact value.
                minLength: 1
components:
  schemas:
    AnalyzeRelationshipsRequest:
      type: object
      properties:
        selection:
          type: array
          items:
            $ref: '#/components/schemas/InstrumentRef'
          minItems: 1
          description: >-
            Explicit supplied outcome/listing references; resolved canonical
            outcomes are deduplicated for set statistics.
        scenario_pins:
          type: array
          items:
            $ref: '#/components/schemas/ScenarioPin'
          description: >-
            Optional explicit family/version pins; returned even when selected
            automatically.
        paying_definition:
          type: string
          enum:
            - POSITIVE_PAYOUT
            - FULL_PAYOUT
          description: >-
            POSITIVE_PAYOUT by default; FULL_PAYOUT distinguishes fractional
            settlements.
          default: POSITIVE_PAYOUT
        include:
          type: array
          items:
            type: string
            enum:
              - PAIRS
              - BASKET
              - WITNESSES
              - EVIDENCE
          description: Requested outputs; default PAIRS, BASKET and WITNESSES.
          default:
            - PAIRS
            - BASKET
            - WITNESSES
        witness_limit:
          type: integer
          minimum: 0
          default: 5
          description: >-
            Maximum example witnesses per finding; never limits the domain used
            to establish the finding.
        require_complete_coverage:
          type: boolean
          default: true
          description: >-
            True rejects incomplete selected-set scope; false explicitly labels
            analysis of the supported subset.
      required:
        - selection
      additionalProperties: false
    AnalyzeRelationshipsResponse:
      type: object
      properties:
        relationships:
          type: array
          items:
            $ref: '#/components/schemas/Relationship'
        baskets:
          type: array
          items:
            $ref: '#/components/schemas/BasketSummary'
        coverage:
          $ref: '#/components/schemas/Coverage'
        versions:
          $ref: '#/components/schemas/VersionContext'
      required:
        - relationships
        - baskets
        - coverage
        - versions
      additionalProperties: true
    InstrumentRef:
      type: object
      properties:
        outcome_id:
          type: string
          minLength: 1
          description: Rook payout-side ID. YES and NO have separate IDs.
        listing_id:
          type: string
          minLength: 1
          description: >-
            Rook ID for one outcome listing on one venue; preserves venue
            provenance.
      required: []
      additionalProperties: false
      description: Supply exactly one outcome_id or listing_id; never both.
      oneOf:
        - required:
            - outcome_id
        - required:
            - listing_id
    ScenarioPin:
      type: object
      properties:
        family_id:
          type: string
          minLength: 1
          description: >-
            Rook family ID connecting related markets across original venue
            events.
        scenario_version:
          type: string
          description: Opaque text identifier. Preserve its exact value.
          minLength: 1
      required:
        - family_id
        - scenario_version
      additionalProperties: false
    Relationship:
      type: object
      properties:
        relationship_id:
          type: string
          description: Opaque text identifier. Preserve its exact value.
          minLength: 1
        type:
          $ref: '#/components/schemas/RelationType'
        from_outcome_id:
          type: string
          description: Opaque text identifier. Preserve its exact value.
          minLength: 1
        to_outcome_id:
          type: string
          description: Opaque text identifier. Preserve its exact value.
          minLength: 1
        related_market_ids:
          type: array
          items:
            type: string
            description: Opaque text identifier. Preserve its exact value.
            minLength: 1
        related_event_ids:
          type: array
          items:
            type: string
            description: Opaque text identifier. Preserve its exact value.
            minLength: 1
        explanation:
          type: string
        scenario_pins:
          type: array
          items:
            $ref: '#/components/schemas/ScenarioPin'
        witnesses:
          type: array
          items:
            $ref: '#/components/schemas/ScenarioColumn'
        evidence:
          type: array
          items:
            $ref: '#/components/schemas/Evidence'
      required:
        - relationship_id
        - type
        - from_outcome_id
        - to_outcome_id
        - explanation
        - scenario_pins
        - witnesses
      additionalProperties: true
    BasketSummary:
      type: object
      properties:
        classification:
          type: string
          enum:
            - PARTITION
            - EXCLUSIVE
            - EXHAUSTIVE
            - OVERLAPPING
            - UNCOMPUTED
        outcome_ids:
          type: array
          items:
            type: string
            description: Opaque text identifier. Preserve its exact value.
            minLength: 1
        scenario_count:
          type: integer
          minimum: 0
        representation:
          type: string
        paying_definition:
          type: string
          enum:
            - POSITIVE_PAYOUT
            - FULL_PAYOUT
        gap_witnesses:
          type: array
          items:
            $ref: '#/components/schemas/ScenarioColumn'
        overlap_witnesses:
          type: array
          items:
            $ref: '#/components/schemas/ScenarioColumn'
        scenario_pins:
          type: array
          items:
            $ref: '#/components/schemas/ScenarioPin'
        selected_outcome_count:
          type: integer
          minimum: 0
        paying_counts:
          type: object
          properties:
            none:
              type: integer
              minimum: 0
            exactly_one:
              type: integer
              minimum: 0
            two_or_more:
              type: integer
              minimum: 0
            exact_k:
              type: array
              items:
                type: object
                properties:
                  paying_count:
                    type: integer
                    minimum: 0
                  scenario_count:
                    type: integer
                    minimum: 0
                required:
                  - paying_count
                  - scenario_count
                additionalProperties: false
          required:
            - none
            - exactly_one
            - two_or_more
          additionalProperties: false
      required:
        - classification
        - outcome_ids
        - scenario_count
        - representation
        - paying_definition
        - scenario_pins
        - selected_outcome_count
        - paying_counts
      additionalProperties: true
    Coverage:
      type: object
      properties:
        complete:
          type: boolean
        submitted_count:
          type: integer
          minimum: 0
        supported_count:
          type: integer
          minimum: 0
        items:
          type: array
          items:
            $ref: '#/components/schemas/CoverageItem'
      required:
        - complete
        - submitted_count
        - supported_count
        - items
      additionalProperties: true
    VersionContext:
      type: object
      properties:
        market_versions:
          type: array
          items:
            type: object
            properties:
              market_id:
                type: string
                minLength: 1
                description: >-
                  Rook canonical market ID; obtain it by resolving a venue and
                  native market ID.
              version:
                type: string
                description: Opaque text identifier. Preserve its exact value.
                minLength: 1
            required:
              - market_id
              - version
            additionalProperties: false
        mapping_version:
          type: string
          description: Opaque text identifier. Preserve its exact value.
          minLength: 1
        scenario_pins:
          type: array
          items:
            $ref: '#/components/schemas/ScenarioPin'
        as_of:
          type: string
          format: date-time
      required:
        - market_versions
        - scenario_pins
        - as_of
      additionalProperties: true
    RelationType:
      type: string
      enum:
        - EQUALITY
        - COMPLEMENT
        - IMPLICATION
        - EXCLUSIVITY
        - OVERLAP
    ScenarioColumn:
      oneOf:
        - $ref: '#/components/schemas/ScenarioRef'
        - $ref: '#/components/schemas/JointScenarioRef'
    Evidence:
      type: object
      properties:
        source_url:
          type: string
          format: uri
        passage:
          type: string
        captured_at:
          type: string
          format: date-time
        rule_version:
          type: string
          description: Opaque text identifier. Preserve its exact value.
          minLength: 1
      required:
        - source_url
        - rule_version
      additionalProperties: true
    CoverageItem:
      type: object
      properties:
        input_reference:
          type: string
        outcome_id:
          type: string
          minLength: 1
          description: Rook payout-side ID. YES and NO have separate IDs.
        listing_id:
          type: string
          minLength: 1
          description: >-
            Rook ID for one outcome listing on one venue; preserves venue
            provenance.
        status:
          type: string
          enum:
            - SUPPORTED
            - UNRESOLVED
            - UNSUPPORTED
            - STALE
            - CONFLICTING
        reason_code:
          type: string
        reason:
          type: string
        family_ids:
          type: array
          items:
            type: string
            description: Opaque text identifier. Preserve its exact value.
            minLength: 1
      required:
        - input_reference
        - status
      additionalProperties: true
    ScenarioRef:
      type: object
      properties:
        family_id:
          type: string
          minLength: 1
          description: >-
            Rook family ID connecting related markets across original venue
            events.
        scenario_version:
          type: string
          description: Opaque text identifier. Preserve its exact value.
          minLength: 1
        scenario_id:
          type: string
          minLength: 1
          description: Rook scenario ID within its family and published scenario version.
      required:
        - family_id
        - scenario_version
        - scenario_id
      additionalProperties: false
    JointScenarioRef:
      type: object
      properties:
        components:
          type: array
          items:
            $ref: '#/components/schemas/ScenarioRef'
          minItems: 2
      required:
        - components
      additionalProperties: false
      description: >-
        Compatible tuple of Rook family scenario references; components have
        distinct family/version scopes.
  securitySchemes:
    ApiKeyBearer:
      type: http
      scheme: bearer
      description: >-
        Proposed server-to-server API key. No client request HMAC signing scheme
        is specified.

````

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