Routing - Evaluate

POST /routing/evaluate

Evaluate routing rules for a payment request.

Example request (cURL)

cURL
curl --request POST \
  --url https://sandbox.hyperswitch.io/routing/evaluate \
  --header 'Content-Type: application/json' \
  --header 'api-key: <api-key>' \
  --data '
{
  "paymentInfo": {
    "paymentId": "<string>",
    "amount": 123,
    "currency": "AED",
    "paymentType": "<string>",
    "paymentMethodType": "<string>",
    "paymentMethod": "card",
    "metadata": "<string>",
    "cardIsin": "<string>"
  },
  "merchantId": "<string>",
  "eligibleGatewayList": [
    "<string>"
  ],
  "rankingAlgorithm": "SR_BASED_ROUTING",
  "eliminationEnabled": true
}
'

Successful response (200)

Authorization

Header: api-key (string) — required

Use the API key created under your merchant account from the HyperSwitch dashboard. API key is used to authenticate API requests from your merchant server only. Don't expose this key on a website or embed it in a mobile application.

Request body (application/json)

  • paymentInfo (object) — required

    • paymentId: string

    • amount: number

    • currency: string (e.g., "AED")

    • paymentType: string

    • paymentMethodType: string

    • paymentMethod: string (e.g., "card")

    • metadata: string

    • cardIsin: string

  • merchantId: string — required

  • eligibleGatewayList: string[] | null

  • rankingAlgorithm: enum Available options: SR_BASED_ROUTING, PL_BASED_ROUTING, NTW_BASED_ROUTING

  • eliminationEnabled: boolean | null

Response (200 — application/json)

Routing rules evaluated successfully. Response fields:

  • decided_gateway: string | null

  • gateway_priority_map: unknown

  • filter_wise_gateways: unknown

  • priority_logic_tag: string | null

  • routing_approach: string | null

  • gateway_before_evaluation: string | null

  • priority_logic_output: object

    • isEnforcement: boolean

    • gws: string[]

    • priorityLogicTag: string

    • gatewayReferenceIds: object

    • primaryLogic: object

      • name: string

      • status: string

      • failure_reason: string

    • fallbackLogic: object

      • name: string

      • status: string

      • failure_reason: string

  • reset_approach: string | null

  • routing_dimension: string | null

  • routing_dimension_level: string | null

  • is_scheduled_outage: boolean | null

  • is_dynamic_mga_enabled: boolean | null

  • gateway_mga_id_map: unknown

  • Documentation: https://api-reference.hyperswitch.io/introduction

  • Locker API Reference: https://api-reference.hyperswitch.io/locker-api-reference/overview

  • Intelligent Router API Reference: https://api-reference.hyperswitch.io/intelligent-router-api-reference/overview

Suggest edits: https://github.com/juspay/hyperswitch/edit/main/api-reference/v1/routing/routing--evaluate.mdx Raise issue: https://github.com/juspay/hyperswitch/issues/new?title=Issue%20on%20docs&body=Path:%20/v1/routing/routing--evaluate