> ## 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.

# Routing - Rule Evaluate

> Evaluate routing rules



## OpenAPI

````yaml post /routing/rule/evaluate
openapi: 3.0.3
info:
  title: Hyperswitch - API Documentation
  description: >

    ## Get started


    Hyperswitch provides a collection of APIs that enable you to process and
    manage payments.

    Our APIs accept and return JSON in the HTTP body, and return standard HTTP
    response codes.


    You can consume the APIs directly using your favorite HTTP/REST library.


    We have a testing environment referred to "sandbox", which you can setup to
    test API calls without

    affecting production data.

    Currently, our sandbox environment is live while our production environment
    is under development

    and will be available soon.

    You can sign up on our Dashboard to get API keys to access Hyperswitch API.


    ### Environment


    Use the following base URLs when making requests to the APIs:


    | Environment   |  Base URL                          |

    |---------------|------------------------------------|

    | Sandbox       | <https://sandbox.hyperswitch.io>   |

    | Production    | <https://api.hyperswitch.io>       |


    ## Authentication


    When you sign up on our [dashboard](https://app.hyperswitch.io) and create a
    merchant

    account, you are given a secret key (also referred as api-key) and a
    publishable key.

    You may authenticate all API requests with Hyperswitch server by providing
    the appropriate key in

    the request Authorization header.


    | Key             | 
    Description                                                                                 
    |

    |-----------------|-----------------------------------------------------------------------------------------------|

    | api-key         | Private key. Used to authenticate all API requests from
    your merchant server                  |

    | publishable key | Unique identifier for your account. Used to authenticate
    API requests from your app's client  |


    Never share your secret api keys. Keep them guarded and secure.
  contact:
    name: Hyperswitch Support
    url: https://hyperswitch.io
    email: support.global@juspay.io
  license:
    name: Apache-2.0
  version: 0.1.0
servers:
  - url: https://sandbox.hyperswitch.io
    description: Sandbox Environment
security: []
tags:
  - name: Merchant Account
    description: Create and manage merchant accounts
  - name: Profile
    description: Create and manage profiles
  - name: Merchant Connector Account
    description: Create and manage merchant connector accounts
  - name: Payments
    description: Create and manage one-time payments, recurring payments and mandates
  - name: Refunds
    description: Create and manage refunds for successful payments
  - name: Mandates
    description: Manage mandates
  - name: Customers
    description: Create and manage customers
  - name: Payment Methods
    description: Create and manage payment methods of customers
  - name: Disputes
    description: Manage disputes
  - name: API Key
    description: Create and manage API Keys
  - name: Payouts
    description: Create and manage payouts
  - name: payment link
    description: Create payment link
  - name: Routing
    description: Create and manage routing configurations
  - name: Event
    description: Manage events
  - name: Authentication
    description: Create and manage authentication
  - name: Subscriptions
    description: Subscription management and billing endpoints
  - name: Card Issuer
    description: Create and manage card issuers
paths:
  /routing/rule/evaluate:
    post:
      tags:
        - Routing
      summary: Routing - Rule Evaluate
      description: Evaluate routing rules
      operationId: Evaluate routing rules (alternative)
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RoutingEvaluateRequest'
        required: true
      responses:
        '200':
          description: Routing rules evaluated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoutingEvaluateResponse'
        '400':
          description: Request body is malformed
        '403':
          description: Forbidden
        '404':
          description: Resource missing
        '422':
          description: Unprocessable request
        '500':
          description: Internal server error
      security:
        - api_key: []
components:
  schemas:
    RoutingEvaluateRequest:
      type: object
      description: |-
        Request body used to evaluate routing rules.

        This API evaluates routing logic based on dynamic parameters
        like payment method, amount, country, card_bin, etc.
      required:
        - created_by
        - parameters
        - fallback_output
      properties:
        created_by:
          type: string
          description: |-
            Identifier of the user/system triggering routing evaluation.

            Example:
            ```json
            "created_by": "some_id"
            ```
          example: profile_123
        payment_id:
          type: string
          description: |-
            Payment ID for debugging and tracing routing decisions.

            Example:
            ```json
            "payment_id": "pay_abc123"
            ```
          example: pay_abc123
          nullable: true
        parameters:
          type: object
          description: >-
            Dynamic parameters used during routing evaluation.


            Each key represents a routing attribute.


            Example fields:


            - `payment_method`

            - `payment_method_type`

            - `amount`

            - `currency`

            - `authentication_type`

            - `card_bin`

            - `capture_method`

            - `business_country`

            - `billing_country`

            - `business_label`

            - `setup_future_usage`

            - `card_network`

            - `payment_type`

            - `mandate_type`

            - `mandate_acceptance_type`

            - `metadata`


            Example:

            ```json

            {

            "payment_method": { "type": "enum_variant", "value": "card" },

            "amount": { "type": "number", "value": 10 },

            "currency": { "type": "str_value", "value": "INR" },

            "authentication_type": { "type": "enum_variant", "value": "three_ds"
            },

            "card_bin": { "type": "str_value", "value": "424242" },

            "business_country": { "type": "str_value", "value": "IN" },

            "setup_future_usage": { "type": "enum_variant", "value":
            "off_session" },

            "card_network": { "type": "enum_variant", "value": "visa" },

            "metadata": {

            "type": "metadata_variant",

            "value": { "key": "key1", "value": "value1" }

            }

            }

            ```


            For the complete superset of supported routing keys,

            refer to `routing_configs.keys` in:

            https://github.com/juspay/decision-engine/blob/main/config/development.toml
        fallback_output:
          type: array
          items:
            $ref: '#/components/schemas/DeRoutableConnectorChoice'
          description: |-
            Fallback connectors used if routing rule evaluation fails.

            These connectors will be returned if no rule matches.

            Example:
            ```json
            [
            {
            "gateway_name": "stripe",
            "gateway_id": "mca_123"
            }
            ]
            ```
    RoutingEvaluateResponse:
      type: object
      description: |-
        Response returned after routing evaluation.

        Contains:
        - Routing status
        - Raw output structure (priority / volume_split)
        - Final evaluated connectors
        - Eligible connectors list
      required:
        - status
        - output
        - evaluated_output
        - eligible_connectors
      properties:
        status:
          type: string
          description: |-
            Status of routing evaluation.

            Example:
            ```json
            "success"
            ```
          example: success
        output:
          description: |-
            Raw routing output returned by routing engine.

            Possible structures:

            1. Volume Split:
            ```json
            {
            "type": "volume_split",
            "splits": [
            {
            "connector": { "gateway_name": "adyen", "gateway_id": "mca_124" },
            "split": 60
            },
            {
            "connector": { "gateway_name": "stripe", "gateway_id": "mca_123" },
            "split": 40
            }
            ]
            }
            ```

            2. Priority:
            ```json
            {
            "type": "priority",
            "connectors": [
            { "gateway_name": "stripe", "gateway_id": "mca_123" },
            { "gateway_name": "adyen", "gateway_id": "mca_124" }
            ]
            }
            ```
        evaluated_output:
          type: array
          items:
            $ref: '#/components/schemas/RoutableConnectorChoice'
          description: |-
            Final connector(s) selected after evaluation.

            Example:
            ```json
            [
            {
            "connector": "stripe",
            "merchant_connector_id": "mca_123"
            }
            ]
            ```
        eligible_connectors:
          type: array
          items:
            $ref: '#/components/schemas/RoutableConnectorChoice'
    DeRoutableConnectorChoice:
      type: object
      description: |-
        Connector representation used in API request/response.

        Represents a Merchant Connector Account.
      required:
        - gateway_name
        - gateway_id
      properties:
        gateway_name:
          $ref: '#/components/schemas/RoutableConnectors'
        gateway_id:
          type: string
          description: |-
            Merchant Connector Account ID.

            Example:
            ```json
            "mca_ExbsYfO1xFErhNtwY1PX"
            ```
          example: authipay_1705
    RoutableConnectorChoice:
      type: object
      description: Routable Connector chosen for a payment
      required:
        - connector
      properties:
        connector:
          $ref: '#/components/schemas/RoutableConnectors'
        merchant_connector_id:
          type: string
          nullable: true
    RoutableConnectors:
      type: string
      description: >-
        RoutableConnectors are the subset of Connectors that are eligible for
        payments routing
      enum:
        - authipay
        - adyenplatform
        - stripe_billing_test
        - phonypay
        - fauxpay
        - pretendpay
        - stripe_test
        - adyen_test
        - checkout_test
        - paypal_test
        - aci
        - adyen
        - affirm
        - airwallex
        - amazonpay
        - archipel
        - authorizedotnet
        - bankofamerica
        - barclaycard
        - billwerk
        - bitpay
        - bambora
        - blackhawknetwork
        - bamboraapac
        - bluesnap
        - calida
        - boku
        - braintree
        - breadpay
        - cashtocode
        - celero
        - chargebee
        - custombilling
        - checkbook
        - checkout
        - coinbase
        - coingate
        - cryptopay
        - cybersource
        - cybersourcedecisionmanager
        - datatrans
        - deutschebank
        - digitalvirgo
        - dlocal
        - dwolla
        - ebanx
        - elavon
        - envoy
        - facilitapay
        - finix
        - fiserv
        - fiservemea
        - fiservcommercehub
        - fiuu
        - flexiti
        - forte
        - getnet
        - gigadat
        - globalpay
        - globepay
        - gocardless
        - hipay
        - helcim
        - hyperpg
        - iatapay
        - imerchantsolutions
        - inespay
        - itaubank
        - jpmorgan
        - klarna
        - loonio
        - mifinity
        - mollie
        - moneris
        - multisafepay
        - nexinets
        - nexixpay
        - nmi
        - nomupay
        - noon
        - nordea
        - novalnet
        - nuvei
        - opennode
        - paybox
        - payme
        - payload
        - payone
        - paypal
        - paysafe
        - paystack
        - paytm
        - payu
        - peachpayments
        - payjustnow
        - payjustnowinstore
        - phonepe
        - placetopay
        - powertranz
        - prophetpay
        - rapyd
        - razorpay
        - recurly
        - redsys
        - revolv3
        - riskified
        - sanlam
        - santander
        - shift4
        - signifyd
        - silverflow
        - square
        - stax
        - stripe
        - stripebilling
        - tesouro
        - truelayer
        - trustly
        - trustpay
        - trustpayments
        - tokenio
        - tsys
        - volt
        - wellsfargo
        - wise
        - worldline
        - worldpay
        - worldpaymodular
        - worldpayvantiv
        - worldpayxml
        - xendit
        - zen
        - zift
        - plaid
        - zsl
        - juspaythreedsserver
        - ctp_mastercard
        - ctp_visa
        - netcetera
        - cardinal
        - threedsecureio
  securitySchemes:
    api_key:
      type: apiKey
      in: header
      name: api-key
      description: >-
        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.

````