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

# Get the real win rate of each stage

> For each open stage of the pipeline, the share of won deals among the deals that went through it and are closed in the pipeline now, read from the stage history. It is the number to set as the stage's `probability`. A stage no closed deal went through is left out, so a new pipeline answers an empty array. Counts only the deals the caller can see.



## OpenAPI

````yaml /api-reference/openapi.json get /v1/pipelines/{id}/stages/win-rates
openapi: 3.1.0
info:
  title: Leadstaker API
  version: 1.0.0
  description: Public REST API for Leadstaker projects.
servers:
  - url: https://n-api.leadstaker.com
    description: Production
security: []
tags:
  - name: Calls
    description: >-
      Phone calls made through the telephony app or posted from another phone
      system, with their recording, transcript and AI summary.
  - name: Chats
    description: Conversations with a contact over a connected channel.
  - name: Contacts
    description: >-
      People inside a project, holding the custom field values collected about
      them.
  - name: Deals
    description: Opportunities moving through a pipeline, each tied to a contact.
  - name: Field groups
    description: Sections that organize custom fields in the interface.
  - name: Fields
    description: >-
      Custom field definitions, both the built-in ones and the ones a project
      creates.
  - name: Leads
    description: >-
      Chatbot conversations captured in a project, with the answers given and
      where the visitor came from.
  - name: Loss reasons
    description: The catalog of reasons a deal can be marked as lost.
  - name: Messages
    description: Individual messages inside a chat, inbound and outbound.
  - name: Notes
    description: >-
      Free text attached to a contact or a deal, written by a user, an agent, or
      the system.
  - name: Pipelines
    description: >-
      Ordered sets of stages a deal travels through, each with its own won and
      lost stages.
  - name: Stages
    description: >-
      Steps inside a pipeline: the open ones a deal moves through, and the
      pipeline's own won and lost stages.
  - name: Tags
    description: Free-form labels attached to deals.
  - name: Tasks
    description: >-
      Follow-up activities with a due date, attached to a deal and assigned to a
      user.
  - name: Touchpoints
    description: >-
      Each time a lead reached the business, traced to the ad, campaign, channel
      or form that brought it.
paths:
  /v1/pipelines/{id}/stages/win-rates:
    get:
      tags:
        - Stages
      summary: Get the real win rate of each stage
      description: >-
        For each open stage of the pipeline, the share of won deals among the
        deals that went through it and are closed in the pipeline now, read from
        the stage history. It is the number to set as the stage's `probability`.
        A stage no closed deal went through is left out, so a new pipeline
        answers an empty array. Counts only the deals the caller can see.
      operationId: getPipelinesByIdStagesWinRates
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            minLength: 1
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    stageId:
                      type: string
                      minLength: 1
                    winRate:
                      type: number
                      minimum: 0
                      maximum: 1
                      description: >-
                        Of the closed deals that went through the stage, the
                        share won, from 0 to 1.
                    closedDeals:
                      type: integer
                      exclusiveMinimum: 0
                      description: How many closed deals the rate comes from.
                  required:
                    - stageId
                    - winRate
                    - closedDeals
                  additionalProperties: false
              example:
                - stageId: 670fa8b21d94cc0010e3c7a8
                  winRate: 0.42
                  closedDeals: 57
        '401':
          description: Missing or invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - apiKey: []
components:
  schemas:
    Error:
      type: object
      required:
        - errorCode
        - message
        - status
      properties:
        errorCode:
          type: string
        message:
          type: string
        status:
          type: integer
        errors:
          type: array
          items:
            type: object
            required:
              - field
              - code
              - message
            properties:
              field:
                type: string
              code:
                type: string
              message:
                type: string
              details:
                type: object
                additionalProperties: true
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key

````

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