> ## 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 contract scores for an entity

> Calculates contract scores for an entity based on provided parameters and labels



## OpenAPI

````yaml post /contract_routing.ContractScoreCalculator/FetchContractScore
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:
  /contract_routing.ContractScoreCalculator/FetchContractScore:
    post:
      tags:
        - Contract Routing
      summary: Fetch contract scores for an entity
      description: >-
        Calculates contract scores for an entity based on provided parameters
        and labels
      operationId: fetchContractScore
      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/CalContractScoreRequest'
            example:
              id: merchant1
              params: card
              labels:
                - stripe
                - adyen
              config:
                constants:
                  - 0.7
                  - 0.3
                time_scale:
                  time_scale: Day
      responses:
        '200':
          description: Success rate calculated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CalContractScoreResponse'
        '400':
          description: Invalid request parameters
        '500':
          description: Internal server error
components:
  schemas:
    CalContractScoreRequest:
      type: object
      properties:
        id:
          type: string
          example: merchant1
          description: Entity identifier
        params:
          type: string
          description: Additional parameters for contract calculation
          example: card
        labels:
          type: array
          items:
            type: string
          description: Labels (processors) to calculate scores for
          example:
            - stripe
            - adyen
        config:
          $ref: '#/components/schemas/CalContractScoreConfig'
          description: Configuration for calculation
      required:
        - id
        - labels
        - config
    CalContractScoreResponse:
      type: object
      properties:
        labels_with_score:
          type: array
          items:
            $ref: '#/components/schemas/ScoreData'
          description: Contract scores for each label
    CalContractScoreConfig:
      type: object
      properties:
        constants:
          type: array
          items:
            type: number
            format: double
          description: Constants used in score calculation algorithm
          example:
            - 0.7
            - 0.3
        time_scale:
          $ref: '#/components/schemas/TimeScale'
          description: Time scale for contract calculation
      required:
        - constants
        - time_scale
    ScoreData:
      type: object
      properties:
        score:
          type: number
          format: double
          description: Contract score (higher values indicate higher priority)
          example: 0.95
        label:
          type: string
          description: Label (processor) identifier
          example: stripe
        current_count:
          type: integer
          format: uint64
          description: Current transaction count for this processor
          example: 500
      required:
        - score
        - label
        - current_count
    TimeScale:
      type: object
      properties:
        time_scale:
          type: string
          enum:
            - Day
            - Month
          description: Selected time scale for contract calculation

````