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

# Run sales forecast

> Runs the forecast model: expected wins from deals currently in the pipeline plus wins from projected new pipeline generation, per month over the horizon, with tolerance bands and goal overlay. Assumptions can come from a saved scenario or be provided inline.



## OpenAPI

````yaml /api-reference/cx/swagger.json post /deals/forecast/_run
openapi: 3.0.0
info:
  description: CX API.
  title: CX API
  contact:
    name: API Support
    url: https://stax.ai
    email: support@stax.ai
  version: '1.0'
servers:
  - url: https://api.cx.stax.ai
security: []
paths:
  /deals/forecast/_run:
    post:
      tags:
        - deals
      summary: Run sales forecast
      description: >-
        Runs the forecast model: expected wins from deals currently in the
        pipeline plus wins from projected new pipeline generation, per month
        over the horizon, with tolerance bands and goal overlay. Assumptions can
        come from a saved scenario or be provided inline.
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/pkg_routes_deals_forecast.RunForecastRequest
        description: Forecast run request
        required: true
      responses:
        '200':
          description: Forecast result
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/pkg_routes_deals_forecast.RunForecastResponse
        '400':
          description: Bad request - invalid request body
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '403':
          description: Forbidden - deals analytics not enabled
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '404':
          description: Scenario not found
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
      security:
        - ApiKeyAuth: []
components:
  schemas:
    pkg_routes_deals_forecast.RunForecastRequest:
      type: object
      properties:
        assumptions:
          description: inline assumptions (override scenario)
          allOf:
            - $ref: >-
                #/components/schemas/stax_ai_cx_cx-api_pkg_routes_deals_reporting.ForecastAssumptions
        funnel:
          description: nil = all funnels
          type: string
        horizon_months:
          type: integer
        scenario:
          description: saved scenario to apply
          type: string
        timezone:
          type: string
    pkg_routes_deals_forecast.RunForecastResponse:
      type: object
      properties:
        deals:
          type: array
          items:
            $ref: '#/components/schemas/pkg_routes_deals_forecast.DealForecast'
        history:
          $ref: '#/components/schemas/pkg_routes_deals_forecast.ForecastBaselines'
        months:
          type: array
          items:
            $ref: '#/components/schemas/pkg_routes_deals_forecast.MonthForecast'
    stax_ai_cx_cx-api_pkg_routes_deals_reporting.ForecastAssumptions:
      type: object
      properties:
        cycle_days_fixed:
          description: >-
            Fixed sales cycle length in days; overrides VelocityMultiplier when
            set (implied multiplier = historical avg cycle / fixed)
          type: number
        pipeline_gen_monthly:
          description: Monthly $ of new pipeline generated; nil = derive from historicals
          type: number
        reps_added:
          description: >-
            Number of hypothetical reps added (each contributes the per-rep
            average pipeline generation)
          type: integer
        reps_removed:
          description: >-
            Existing reps removed from the model (their open deals and
            contribution are excluded)
          type: array
          items:
            type: string
        tolerance_pct:
          description: >-
            Tolerance band around the forecast total (0.2 = ±20%); nil = derive
            from historicals
          type: number
        velocity_multiplier:
          description: >-
            Multiplier applied to deal velocity; >1 = faster (durations divided
            by this, default 1.0)
          type: number
        win_rate_fixed:
          description: >-
            Fixed win probability (0-1) applied to all deals; overrides
            WinRateMultiplier when set
          type: number
        win_rate_multiplier:
          description: Multiplier applied to all win probabilities (default 1.0)
          type: number
    pkg_routes_deals_forecast.DealForecast:
      type: object
      properties:
        deal:
          type: string
        expected_close:
          type: string
        expected_value:
          type: number
        funnel:
          type: string
        funnel_name:
          type: string
        name:
          type: string
        owner:
          type: string
        owner_name:
          type: string
        p_win:
          type: number
        stage_index:
          description: 0-based position in the funnel, -1 if unknown
          type: integer
        stage_name:
          type: string
        value:
          type: number
    pkg_routes_deals_forecast.ForecastBaselines:
      type: object
      properties:
        avg_cycle_days:
          description: avg created-to-won days of deals won in the last 30 days
          type: number
        pipeline_gen_monthly:
          description: created $ over the last 30 days
          type: number
        win_rate:
          description: dollar-weighted win rate of deals closed in the last 30 days (0-1)
          type: number
    pkg_routes_deals_forecast.MonthForecast:
      type: object
      properties:
        goal:
          type: number
        high:
          type: number
        low:
          type: number
        month:
          type: string
        new_pipeline_wins:
          type: number
        pipeline_wins:
          type: number
        total:
          type: number
  securitySchemes:
    ApiKeyAuth:
      description: CX API key. Create one in CX under Settings → Advanced → API Keys.
      in: header
      name: x-api-key
      type: apiKey

````

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