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

# Run a Scenario

Gated by the **live, per-user** feature flag `deals_war_room` — `403` when disabled for the caller.

**Synchronous** (unlike the brief/competitive-intelligence generators) — creates a `pending` scenario row, runs the simulation inline against the deal's saved war-room context (building one on the fly if none exists), and updates the row to `completed` or `failed` before returning.

### Auth

Requires a CRM manage [scope](/authentication#scopes) and an active organization on the token. Any `*:manage` scope qualifies — in practice `contacts:manage`, `deals:manage`, `companies:manage`, or `activities:manage`.

### Response

`201` with the completed scenario row — same shape as [List Scenarios](/api-reference/deals/list-scenarios). `scenario_result` shape:

`{title, summary, currentState: {winProbability, coalitionStrength, riskLevel}, branches: [{id, label, probability, sentiment, winProbability, coalitionStrength, riskLevel, stakeholderShifts: [{name, fromStance, toStance, reason}], counterMove, keyRisks, subBranches: [...] (recursive, up to depth 2)}], recommendedPath, recommendedCounterMoves: [{priority, action, timing, rationale}]}`

Simulated via Anthropic when configured (falling back to a deterministic 3-branch stub scenario otherwise, or on invalid LLM JSON). Every branch's `winProbability` is clamped to within ±35 points of the deal's current `win_probability`, so a single scenario can't swing from e.g. 30% to 90%.

### Errors

| Status | Cause                                                                                                                 |
| ------ | --------------------------------------------------------------------------------------------------------------------- |
| `404`  | Deal not found.                                                                                                       |
| `500`  | Simulation failed after the scenario row was already created — the row is marked `failed` rather than left `pending`. |


## OpenAPI

````yaml POST /deals/{deal_id}/war-room/scenarios/run
openapi: 3.1.0
info:
  title: anycrm-api
  version: 0.0.1
servers: []
security: []
tags:
  - name: Customer Intelligence
    description: >-
      Company research and ICP-fit scoring — create a research run, track its
      progress, and read back scored companies as leads.
  - name: Outreach
    description: >-
      The cold-email management console — domains, mailboxes, and campaigns — as
      a thin control plane over the SalesForge stack.
  - name: AnyCard
    description: >-
      Authenticated CRUD for AnyCard, the org's digital business-card /
      lead-capture product.
  - name: AnyCard Events
    description: >-
      Event-attribution analytics for AnyCard — which captured leads converted,
      broken down by source, owner, and deal.
  - name: AnyCard Share Links
    description: >-
      Unauthenticated endpoints reached by anyone who scans a QR code or opens a
      shared AnyCard link.
  - name: AI
    description: >-
      A streaming (SSE) AI chat endpoint with account-commit actions it can take
      on the caller's behalf.
  - name: Analytics Assistant
    description: >-
      The natural-language analytics assistant — a guarded text-to-SQL loop
      (SSE) that answers ad-hoc questions over the org's CRM data as a
      least-privilege, read-only database role.
  - name: Account Readiness
    description: >-
      Account Readiness Profiles — AI-scored signals on whether an account is
      ready for outreach or expansion, computed via a Temporal workflow.
  - name: Integrations
    description: >-
      Pipedream Connect — issuing connect tokens and managing the org's
      connected third-party accounts.
  - name: Feedback
    description: >-
      User-submitted platform feedback (bug reports, feature requests) — global,
      not scoped to one organization.
  - name: Public Media
    description: >-
      Unauthenticated image reads for publicly-embeddable assets (card photos,
      inline email images) — allowlisted by key shape; everything else in the
      storage bucket stays private.
  - name: Service Health
    description: Service liveness.
paths:
  /deals/{deal_id}/war-room/scenarios/run:
    post:
      tags:
        - Deals
      summary: Run War Room Scenario
      operationId: run_war_room_scenario_deals__deal_id__war_room_scenarios_run_post
      parameters:
        - name: deal_id
          in: path
          required: true
          schema:
            type: string
            description: The deal's id.
            title: Deal Id
          description: The deal's id.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WarRoomScenarioRunBody'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    WarRoomScenarioRunBody:
      properties:
        actions:
          items:
            $ref: '#/components/schemas/WarRoomScenarioActionIn'
          type: array
          minItems: 1
          title: Actions
          description: One or more hypothesized stakeholder actions to simulate together.
        title:
          anyOf:
            - type: string
            - type: 'null'
          title: Title
          description: Scenario title; defaults to the first action's text when omitted.
      type: object
      required:
        - actions
      title: WarRoomScenarioRunBody
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    WarRoomScenarioActionIn:
      properties:
        actorContactId:
          anyOf:
            - type: string
            - type: 'null'
          title: Actorcontactid
          description: >-
            Contact id of the stakeholder taking this hypothesized action, if
            known.
        actorName:
          type: string
          minLength: 1
          title: Actorname
          description: Display name of the stakeholder taking this action.
        actorRole:
          anyOf:
            - type: string
            - type: 'null'
          title: Actorrole
          description: Stakeholder's role, for context in the simulation.
        action:
          type: string
          minLength: 1
          title: Action
          description: The hypothesized action or move to simulate.
        context:
          anyOf:
            - type: string
            - type: 'null'
          title: Context
          description: Additional free-text context for the simulation.
      type: object
      required:
        - actorName
        - action
      title: WarRoomScenarioActionIn
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````