Fetch success rate for an entity

POST /success_rate.SuccessRateCalculator/FetchSuccessRate

Fetches success rates for given labels for an entity.

cURL
curl --request POST \
  --url https://api.example.com/success_rate.SuccessRateCalculator/FetchSuccessRate \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <x-api-key>' \
  --header 'x-profile-id: <x-profile-id>' \
  --header 'x-tenant-id: <x-tenant-id>' \
  --data '
{
  "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
  }
}
'

Response example (200)

Headers

Name
Type
Required

x-tenant-id

string

required

x-profile-id

string

required

x-api-key

string

required

Body (application/json)

Properties:

  • id (string) — required Entity identifier. Example: "merchant1"

  • params (string) — required Parameters on which success rate scores have to be maintained. Example: "card"

  • labels (string[]) — required Labels for which to calculate success rates. Example:

  • config (object) See example above for available config fields:

    • min_aggregates_size

    • default_success_rate

    • specificity_level

    • exploration_percent

    • shuffle_on_tie_during_exploitation

Response (200 application/json)

  • labels_with_score (object[][]) List (nested array) of labels with their calculated success rates. Example item:

  • routing_approach (enum) Defines the routing approach based on the success rate calculation. Available options: EXPLORATION, EXPLOITATION. Example: "EXPLOITATION"

Try it — cURL request (duplicate example)

Suggest edits: https://github.com/juspay/hyperswitch/edit/main/api-reference/intelligent-router-api-reference/success-rate/fetch-success-rate-for-an-entity.mdx Raise issue: https://github.com/juspay/hyperswitch/issues/new?title=Issue%20on%20docs&body=Path:%20/intelligent-router-api-reference/success-rate/fetch-success-rate-for-an-entity