> ## Documentation Index
> Fetch the complete documentation index at: https://api-reference.hyperswitch.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Fetch success rate for an entity

> Calculates success rate for an entity based on provided parameters and labels



## OpenAPI

````yaml post /success_rate.SuccessRateCalculator/FetchSuccessRate
openapi: 3.0.0
info:
  title: Dynamic routing - OpenAPI 3.0
  description: This the the open API 3.0 specification for the dynamic routing.
  version: 1.0.0
servers: []
security: []
paths:
  /success_rate.SuccessRateCalculator/FetchSuccessRate:
    post:
      tags:
        - Success Rate
      summary: Fetch success rate for an entity
      description: >-
        Calculates success rate for an entity based on provided parameters and
        labels
      operationId: fetchSuccessRate
      parameters:
        - name: x-tenant-id
          in: header
          required: true
          schema:
            type: string
          example: public
        - name: x-profile-id
          in: header
          required: true
          schema:
            type: string
          example: pro_WX0giXQnzk2wQJjkKVBX
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
          example: dev_VLzQTxkPq3ALj2mlfiHL4mMtXca4uplOIOLaKEzmWAmNBXZjwsuv5bCLjnf0QYHm
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CalSuccessRateRequest'
            example:
              id: merchant1
              params: card
              labels:
                - stripe
                - adyen
              config:
                min_aggregates_size: 5
                default_success_rate: 0.95
                specificity_level: ENTITY
                exploration_percent: 20
                shuffle_on_tie_during_exploitation: true
      responses:
        '200':
          description: Success rate calculated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CalSuccessRateResponse'
        '400':
          description: Invalid request parameters
        '500':
          description: Internal server error
components:
  schemas:
    CalSuccessRateRequest:
      type: object
      properties:
        id:
          type: string
          example: merchant1
          description: Entity identifier
        params:
          type: string
          example: card
          description: Parameters on which success rate scores has to be maintained
        labels:
          type: array
          example:
            - stripe
            - adyen
          items:
            type: string
          description: Labels for which to calculate success rates
        config:
          $ref: '#/components/schemas/CalSuccessRateConfig'
      required:
        - id
        - params
        - labels
    CalSuccessRateResponse:
      type: object
      properties:
        labels_with_score:
          type: array
          items:
            $ref: '#/components/schemas/LabelWithScore'
          description: List of labels with their calculated success rates
        routing_approach:
          $ref: '#/components/schemas/RoutingApproach'
    CalSuccessRateConfig:
      type: object
      required:
        - min_aggregates_size
        - default_success_rate
      properties:
        min_aggregates_size:
          type: integer
          format: uint32
          example: 10
        default_success_rate:
          type: number
          format: double
          example: 0.95
        specificity_level:
          $ref: '#/components/schemas/SuccessRateSpecificityLevel'
    LabelWithScore:
      type: array
      items:
        $ref: '#/components/schemas/LabelWithScoreList'
      example:
        - score: 100
          label: stripe
        - score: 98.5
          label: adyen
    RoutingApproach:
      type: string
      description: |
        Defines the routing approach based on the success rate calculation.
      enum:
        - EXPLORATION
        - EXPLOITATION
      example: EXPLOITATION
    SuccessRateSpecificityLevel:
      type: string
      description: >
        Defines the specificity level to be used for calculating the success
        rate.
      enum:
        - ENTITY
        - GLOBAL
      example: ENTITY
    LabelWithScoreList:
      type: object
      properties:
        score:
          type: number
          format: double
          example: 100
          description: Calculated success rate score
        label:
          type: string
          example: stripe
          description: Label identifier
      required:
        - score
        - label

````