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

> Evaluate routing rules



## OpenAPI

````yaml post /routing/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/evaluate:
    post:
      tags:
        - Routing
      summary: Routing - Evaluate
      description: Evaluate routing rules
      operationId: Evaluate routing rules
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OpenRouterDecideGatewayRequest'
        required: true
      responses:
        '200':
          description: Routing rules evaluated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DecideGatewayResponse'
        '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:
    OpenRouterDecideGatewayRequest:
      type: object
      description: Request to decide the optimal gateway for routing a payment
      required:
        - paymentInfo
        - merchantId
      properties:
        paymentInfo:
          $ref: '#/components/schemas/PaymentInfo'
        merchantId:
          type: string
          description: Profile ID of the merchant
          example: pro_aMoPnEkgCVnh2WVsFe32
        eligibleGatewayList:
          type: array
          items:
            type: string
          description: List of eligible gateways for routing consideration
          example: '["stripe:mca_123", "adyen:mca_456"]'
          nullable: true
        rankingAlgorithm:
          allOf:
            - $ref: '#/components/schemas/RankingAlgorithm'
          nullable: true
        eliminationEnabled:
          type: boolean
          description: Whether elimination logic is enabled for filtering gateways
          example: true
          nullable: true
    DecideGatewayResponse:
      type: object
      properties:
        decided_gateway:
          type: string
          description: The gateway decided by the routing engine
          example: stripe:mca1
          nullable: true
        gateway_priority_map:
          type: object
          description: Map of gateways with their priority scores
          additionalProperties:
            type: number
            format: double
          example:
            adyen:mca2: 1
            stripe:mca1: 1
          nullable: true
        filter_wise_gateways:
          type: object
          description: Gateways organized by filter criteria
          nullable: true
        priority_logic_tag:
          type: string
          description: Tag identifying the priority logic used
          nullable: true
        routing_approach:
          type: string
          description: The routing approach used for decision making
          example: SR_SELECTION_V3_ROUTING
          nullable: true
        gateway_before_evaluation:
          type: string
          description: The gateway that was evaluated before the final decision
          example: adyen:mca2
          nullable: true
        priority_logic_output:
          allOf:
            - $ref: '#/components/schemas/PriorityLogicOutput'
          nullable: true
        reset_approach:
          type: string
          description: The reset approach applied during routing
          example: NO_RESET
          nullable: true
        routing_dimension:
          type: string
          description: Dimensions used for routing decision (payment type, method, etc.)
          example: ORDER_PAYMENT, UPI, upi
          nullable: true
        routing_dimension_level:
          type: string
          description: Level at which routing dimension is evaluated
          example: PM_LEVEL
          nullable: true
        is_scheduled_outage:
          type: boolean
          description: Indicates if routing decision was affected by scheduled outage
          example: false
          nullable: true
        is_dynamic_mga_enabled:
          type: boolean
          description: Indicates if dynamic merchant gateway account is enabled
          example: false
          nullable: true
        gateway_mga_id_map:
          type: object
          description: Map of gateways to their MGA IDs
          nullable: true
    PaymentInfo:
      type: object
      description: Payment information used for routing decision-making
      required:
        - paymentId
        - amount
        - currency
        - paymentType
        - metadata
        - paymentMethodType
        - paymentMethod
        - cardIsin
      properties:
        paymentId:
          type: string
          description: Unique identifier for the payment transaction
          example: pay_12345
        amount:
          type: integer
          format: int64
          description: Payment amount in minor units
          example: '100'
        currency:
          type: string
          description: Currency code for the payment
          example: USD
        paymentType:
          type: string
          description: Type of payment transaction being processed
          example: ORDER_PAYMENT
        metadata:
          type: string
          description: Optional metadata associated with the payment
          example: metadata
        paymentMethodType:
          type: string
          description: Specific payment method type being used
          example: upi
        paymentMethod:
          type: string
          description: General payment method category
          example: upi
        cardIsin:
          type: string
          description: Card Issuer Identification Number (first 6 digits of card)
          example: '424242'
    RankingAlgorithm:
      type: string
      enum:
        - SR_BASED_ROUTING
        - PL_BASED_ROUTING
        - NTW_BASED_ROUTING
    PriorityLogicOutput:
      type: object
      properties:
        isEnforcement:
          type: boolean
          description: Whether enforcement mode is enabled
          example: false
          nullable: true
        gws:
          type: array
          items:
            type: string
          description: List of gateways returned by the priority logic
          example:
            - stripe:mca1
            - adyen:mca2
          nullable: true
        priorityLogicTag:
          type: string
          description: Tag identifying the priority logic used
          nullable: true
        gatewayReferenceIds:
          type: object
          description: Map of gateway reference IDs
          nullable: true
        primaryLogic:
          allOf:
            - $ref: '#/components/schemas/PriorityLogicData'
          nullable: true
        fallbackLogic:
          allOf:
            - $ref: '#/components/schemas/PriorityLogicData'
          nullable: true
    PriorityLogicData:
      type: object
      properties:
        name:
          type: string
          description: Name of the logic
          example: success_rate_logic
          nullable: true
        status:
          type: string
          description: Status of the logic execution
          example: success
          nullable: true
        failure_reason:
          type: string
          description: Reason for failure if the logic failed
          example: insufficient_data
          nullable: true
  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.

````