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

# Win and loss rates

> Win/loss rates by rep by funnel (deal-count and dollar-weighted). When a funnel is specified, also returns per-stage conversion rates (P(win | reached stage)) and average days to win from each stage, overall and per rep.



## OpenAPI

````yaml /api-reference/cx/swagger.json post /deals/reporting/_rates
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/reporting/_rates:
    post:
      tags:
        - deals
      summary: Win and loss rates
      description: >-
        Win/loss rates by rep by funnel (deal-count and dollar-weighted). When a
        funnel is specified, also returns per-stage conversion rates (P(win |
        reached stage)) and average days to win from each stage, overall and per
        rep.
      requestBody:
        $ref: '#/components/requestBodies/pkg_routes_deals_reporting.ReportingRequest'
      responses:
        '200':
          description: Win/loss rates
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pkg_routes_deals_reporting.RatesResponse'
        '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
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
      security:
        - ApiKeyAuth: []
components:
  requestBodies:
    pkg_routes_deals_reporting.ReportingRequest:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/pkg_routes_deals_reporting.ReportingRequest'
      description: Reporting request
      required: true
  schemas:
    pkg_routes_deals_reporting.RatesResponse:
      type: object
      properties:
        end_date:
          type: string
        reps:
          type: array
          items:
            $ref: '#/components/schemas/pkg_routes_deals_reporting.RepRateRow'
        stage_reps:
          description: per stage per rep (funnel-scoped only)
          type: array
          items:
            $ref: '#/components/schemas/pkg_routes_deals_reporting.StageRateRow'
        stages:
          description: per stage, all reps (funnel-scoped only)
          type: array
          items:
            $ref: '#/components/schemas/pkg_routes_deals_reporting.StageRateRow'
        start_date:
          type: string
    pkg_routes_deals_reporting.ReportingRequest:
      type: object
      properties:
        assignee:
          description: empty = all reps per settings
          type: array
          items:
            type: string
        bucket_unit:
          description: 'timeseries only: day | week | month (default: by range length)'
          type: string
        compare_previous:
          type: boolean
        end_date:
          type: string
        funnel:
          description: nil = all funnels
          type: string
        start_date:
          type: string
        timezone:
          type: string
    pkg_routes_deals_reporting.RepRateRow:
      type: object
      properties:
        funnel:
          type: string
        lost_count:
          type: integer
        lost_total:
          type: number
        name:
          type: string
        rep:
          type: string
        win_rate_count:
          type: number
        win_rate_value:
          type: number
        won_count:
          type: integer
        won_total:
          type: number
    pkg_routes_deals_reporting.StageRateRow:
      type: object
      properties:
        avg_days_to_win:
          type: number
        deals_closed:
          type: integer
        deals_reached:
          type: integer
        deals_won:
          type: integer
        rep:
          description: empty = all reps
          type: string
        stage:
          type: string
        stage_name:
          type: string
        win_rate:
          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.