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

> Retrieve a routing algorithm



## OpenAPI

````yaml get /routing/{routing_algorithm_id}
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/{routing_algorithm_id}:
    get:
      tags:
        - Routing
      summary: Routing - Retrieve
      description: Retrieve a routing algorithm
      operationId: Retrieve a routing config
      parameters:
        - name: routing_algorithm_id
          in: path
          description: The unique identifier for a config
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successfully fetched routing config
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantRoutingAlgorithm'
        '403':
          description: Forbidden
        '404':
          description: Resource missing
        '500':
          description: Internal server error
      security:
        - api_key: []
        - jwt_key: []
components:
  schemas:
    MerchantRoutingAlgorithm:
      type: object
      description: |-
        Routing algorithm configuration created for a merchant.

        Represents a fully defined routing strategy scoped to a profile
        and transaction type.
      required:
        - id
        - profile_id
        - name
        - description
        - algorithm
        - created_at
        - modified_at
        - algorithm_for
      properties:
        id:
          type: string
          description: |-
            Unique identifier of the routing configuration.

            Example:
            ```json
            "routing_abc123"
            ```
          example: routing_abc123
        profile_id:
          type: string
          description: |-
            Profile ID to which this routing configuration belongs.

            Example:
            ```json
            "profile_123"
            ```
          example: profile_123
        name:
          type: string
          description: |-
            Human-readable name of the routing configuration.

            Example:
            ```json
            "default_card_routing"
            ```
          example: default_card_routing
        description:
          type: string
          description: |-
            Description explaining the purpose of this routing configuration.

            Example:
            ```json
            "Primary routing strategy for card payments"
            ```
          example: Primary routing strategy for card payments
        algorithm:
          $ref: '#/components/schemas/RoutingAlgorithmWrapper'
        created_at:
          type: integer
          format: int64
          description: |-
            Timestamp (in milliseconds since epoch) when the routing
            configuration was created.

            Example:
            ```json
            1718000000000
            ```
          example: 1718000000000
        modified_at:
          type: integer
          format: int64
          description: |-
            Timestamp (in milliseconds since epoch) when the routing
            configuration was last modified.

            Example:
            ```json
            1718050000000
            ```
          example: 1718050000000
        algorithm_for:
          $ref: '#/components/schemas/TransactionType'
    RoutingAlgorithmWrapper:
      oneOf:
        - $ref: '#/components/schemas/StaticRoutingAlgorithm'
        - $ref: '#/components/schemas/DynamicRoutingAlgorithm'
    TransactionType:
      type: string
      enum:
        - payment
        - payout
        - three_ds_authentication
    StaticRoutingAlgorithm:
      oneOf:
        - type: object
          required:
            - type
            - data
          properties:
            type:
              type: string
              enum:
                - single
            data:
              $ref: '#/components/schemas/RoutableConnectorChoice'
        - type: object
          required:
            - type
            - data
          properties:
            type:
              type: string
              enum:
                - priority
            data:
              type: array
              items:
                $ref: '#/components/schemas/RoutableConnectorChoice'
        - type: object
          required:
            - type
            - data
          properties:
            type:
              type: string
              enum:
                - volume_split
            data:
              type: array
              items:
                $ref: '#/components/schemas/ConnectorVolumeSplit'
        - type: object
          required:
            - type
            - data
          properties:
            type:
              type: string
              enum:
                - advanced
            data:
              $ref: '#/components/schemas/ProgramConnectorSelection'
        - type: object
          required:
            - type
            - data
          properties:
            type:
              type: string
              enum:
                - three_ds_decision_rule
            data:
              $ref: '#/components/schemas/ProgramThreeDsDecisionRule'
      discriminator:
        propertyName: type
    DynamicRoutingAlgorithm:
      oneOf:
        - $ref: '#/components/schemas/EliminationRoutingConfig'
        - $ref: '#/components/schemas/SuccessBasedRoutingConfig'
        - $ref: '#/components/schemas/ContractBasedRoutingConfig'
    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
    ConnectorVolumeSplit:
      type: object
      required:
        - connector
        - split
      properties:
        connector:
          $ref: '#/components/schemas/RoutableConnectorChoice'
        split:
          type: integer
          format: int32
          minimum: 0
    ProgramConnectorSelection:
      type: object
      description: |-
        The program, having a default connector selection and
        a bunch of rules. Also can hold arbitrary metadata.
      required:
        - defaultSelection
        - rules
        - metadata
      properties:
        defaultSelection:
          $ref: '#/components/schemas/ConnectorSelection'
        rules:
          $ref: '#/components/schemas/RuleConnectorSelection'
        metadata:
          type: object
          additionalProperties: {}
    ProgramThreeDsDecisionRule:
      type: object
      required:
        - defaultSelection
        - rules
        - metadata
      properties:
        defaultSelection:
          $ref: '#/components/schemas/ThreeDSDecisionRule'
        rules:
          $ref: '#/components/schemas/RuleThreeDsDecisionRule'
        metadata:
          type: object
          additionalProperties: {}
    EliminationRoutingConfig:
      type: object
      required:
        - decision_engine_configs
      properties:
        params:
          type: array
          items:
            $ref: '#/components/schemas/DynamicRoutingConfigParams'
          deprecated: true
          nullable: true
        elimination_analyser_config:
          allOf:
            - $ref: '#/components/schemas/EliminationAnalyserConfig'
          nullable: true
        decision_engine_configs:
          $ref: '#/components/schemas/DecisionEngineEliminationData'
      additionalProperties: false
    SuccessBasedRoutingConfig:
      type: object
      required:
        - decision_engine_configs
      properties:
        params:
          type: array
          items:
            $ref: '#/components/schemas/DynamicRoutingConfigParams'
          deprecated: true
          nullable: true
        config:
          allOf:
            - $ref: '#/components/schemas/SuccessBasedRoutingConfigBody'
          nullable: true
        decision_engine_configs:
          $ref: '#/components/schemas/DecisionEngineSuccessRateData'
      additionalProperties: false
    ContractBasedRoutingConfig:
      type: object
      properties:
        config:
          allOf:
            - $ref: '#/components/schemas/ContractBasedRoutingConfigBody'
          nullable: true
        label_info:
          type: array
          items:
            $ref: '#/components/schemas/LabelInformation'
          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
    ConnectorSelection:
      oneOf:
        - type: object
          required:
            - type
            - data
          properties:
            type:
              type: string
              enum:
                - priority
            data:
              type: array
              items:
                $ref: '#/components/schemas/RoutableConnectorChoice'
        - type: object
          required:
            - type
            - data
          properties:
            type:
              type: string
              enum:
                - volume_split
            data:
              type: array
              items:
                $ref: '#/components/schemas/ConnectorVolumeSplit'
      discriminator:
        propertyName: type
    RuleConnectorSelection:
      type: object
      description: |-
        Represents a rule

        ```text
        rule_name: [stripe, adyen, checkout]
        {
        payment.method = card {
        payment.method.cardtype = (credit, debit) {
        payment.method.network = (amex, rupay, diners)
        }

        payment.method.cardtype = credit
        }
        }
        ```
      required:
        - name
        - connectorSelection
        - statements
      properties:
        name:
          type: string
        connectorSelection:
          $ref: '#/components/schemas/ConnectorSelection'
        statements:
          type: array
          items:
            $ref: '#/components/schemas/IfStatement'
    ThreeDSDecisionRule:
      type: object
      description: >-
        Struct representing the output configuration for the 3DS Decision Rule
        Engine.
      required:
        - decision
      properties:
        decision:
          $ref: '#/components/schemas/ThreeDSDecision'
    RuleThreeDsDecisionRule:
      type: object
      required:
        - name
        - connectorSelection
        - statements
      properties:
        name:
          type: string
        connectorSelection:
          $ref: '#/components/schemas/ThreeDSDecision'
        statements:
          type: array
          items:
            $ref: '#/components/schemas/IfStatement'
    DynamicRoutingConfigParams:
      type: string
      enum:
        - PaymentMethod
        - PaymentMethodType
        - AuthenticationType
        - Currency
        - Country
        - CardNetwork
        - CardBin
    EliminationAnalyserConfig:
      type: object
      properties:
        bucket_size:
          type: integer
          format: int64
          nullable: true
          minimum: 0
        bucket_leak_interval_in_secs:
          type: integer
          format: int64
          nullable: true
          minimum: 0
      additionalProperties: false
    DecisionEngineEliminationData:
      type: object
      required:
        - threshold
      properties:
        threshold:
          type: number
          format: double
          description: Threshold for elimination logic in gateway selection
          example: 0.3
    SuccessBasedRoutingConfigBody:
      type: object
      properties:
        min_aggregates_size:
          type: integer
          format: int32
          nullable: true
          minimum: 0
        default_success_rate:
          type: number
          format: double
          nullable: true
        max_aggregates_size:
          type: integer
          format: int32
          nullable: true
          minimum: 0
        current_block_threshold:
          allOf:
            - $ref: '#/components/schemas/CurrentBlockThreshold'
          nullable: true
        specificity_level:
          $ref: '#/components/schemas/SuccessRateSpecificityLevel'
        exploration_percent:
          type: number
          format: double
          nullable: true
        shuffle_on_tie_during_exploitation:
          type: boolean
          nullable: true
    DecisionEngineSuccessRateData:
      type: object
      description: Configuration for Decision Engine success rate based routing
      properties:
        defaultLatencyThreshold:
          type: number
          format: double
          description: Default latency threshold in percentile for gateway selection
          example: 90
          nullable: true
        defaultBucketSize:
          type: integer
          format: int32
          description: >-
            Default number of transactions to consider for success rate
            calculation
          example: 100
          nullable: true
        defaultHedgingPercent:
          type: number
          format: double
          description: Default percentage of traffic to route for exploration/hedging
          example: 5
          nullable: true
        defaultLowerResetFactor:
          type: number
          format: double
          description: Lower reset factor for adjusting gateway scores
          example: 0.5
          nullable: true
        defaultUpperResetFactor:
          type: number
          format: double
          description: Upper reset factor for adjusting gateway scores
          example: 1.5
          nullable: true
        defaultGatewayExtraScore:
          type: array
          items:
            $ref: '#/components/schemas/DecisionEngineGatewayWiseExtraScore'
          description: Gateway-specific extra scoring factors
          nullable: true
        subLevelInputConfig:
          type: array
          items:
            $ref: '#/components/schemas/DecisionEngineSRSubLevelInputConfig'
          description: Payment method level specific configurations
          nullable: true
    ContractBasedRoutingConfigBody:
      type: object
      properties:
        constants:
          type: array
          items:
            type: number
            format: double
          nullable: true
        time_scale:
          allOf:
            - $ref: '#/components/schemas/ContractBasedTimeScale'
          nullable: true
    LabelInformation:
      type: object
      required:
        - label
        - target_count
        - target_time
        - mca_id
      properties:
        label:
          type: string
        target_count:
          type: integer
          format: int64
          minimum: 0
        target_time:
          type: integer
          format: int64
          minimum: 0
        mca_id:
          type: string
    IfStatement:
      type: object
      description: >-
        Represents an IF statement with conditions and optional nested IF
        statements


        ```text

        payment.method = card {

        payment.method.cardtype = (credit, debit) {

        payment.method.network = (amex, rupay, diners)

        }

        }

        ```
      required:
        - condition
      properties:
        condition:
          type: array
          items:
            $ref: '#/components/schemas/Comparison'
        nested:
          type: array
          items:
            $ref: '#/components/schemas/IfStatement'
          nullable: true
    ThreeDSDecision:
      type: string
      description: Enum representing the possible outcomes of the 3DS Decision Rule Engine.
      enum:
        - no_three_ds
        - challenge_requested
        - challenge_preferred
        - three_ds_exemption_requested_tra
        - three_ds_exemption_requested_low_value
        - issuer_three_ds_exemption_requested
    CurrentBlockThreshold:
      type: object
      properties:
        duration_in_mins:
          type: integer
          format: int64
          nullable: true
          minimum: 0
        max_total_count:
          type: integer
          format: int64
          nullable: true
          minimum: 0
    SuccessRateSpecificityLevel:
      type: string
      enum:
        - merchant
        - global
    DecisionEngineGatewayWiseExtraScore:
      type: object
      required:
        - gatewayName
        - gatewaySigmaFactor
      properties:
        gatewayName:
          type: string
        gatewaySigmaFactor:
          type: number
          format: double
    DecisionEngineSRSubLevelInputConfig:
      type: object
      description: Payment method level configuration for success rate based routing
      properties:
        paymentMethodType:
          type: string
          description: Payment method type (e.g., "card", "wallet")
          example: card
          nullable: true
        paymentMethod:
          type: string
          description: Specific payment method (e.g., "credit", "debit")
          example: credit
          nullable: true
        latencyThreshold:
          type: number
          format: double
          description: Latency threshold in percentile for this payment method
          example: 90
          nullable: true
        bucketSize:
          type: integer
          format: int32
          description: Number of transactions to consider for this payment method
          example: 100
          nullable: true
        hedgingPercent:
          type: number
          format: double
          description: >-
            Percentage of traffic to route for exploration for this payment
            method
          example: 5
          nullable: true
        lowerResetFactor:
          type: number
          format: double
          description: Lower reset factor for this payment method
          example: 0.5
          nullable: true
        upperResetFactor:
          type: number
          format: double
          description: Upper reset factor for this payment method
          example: 1.5
          nullable: true
        gatewayExtraScore:
          type: array
          items:
            $ref: '#/components/schemas/DecisionEngineGatewayWiseExtraScore'
          description: Gateway-specific extra scoring factors for this payment method
          nullable: true
    ContractBasedTimeScale:
      type: string
      enum:
        - day
        - month
    Comparison:
      type: object
      description: Represents a single comparison condition.
      required:
        - lhs
        - comparison
        - value
        - metadata
      properties:
        lhs:
          type: string
          description: >-
            The left hand side which will always be a domain input identifier
            like "payment.method.cardtype"
        comparison:
          $ref: '#/components/schemas/ComparisonType'
        value:
          $ref: '#/components/schemas/ValueType'
        metadata:
          type: object
          description: >-
            Additional metadata that the Static Analyzer and Backend does not
            touch.

            This can be used to store useful information for the frontend and is
            required for communication

            between the static analyzer and the frontend.
          additionalProperties: {}
    ComparisonType:
      type: string
      description: Conditional comparison type
      enum:
        - equal
        - not_equal
        - less_than
        - less_than_equal
        - greater_than
        - greater_than_equal
    ValueType:
      oneOf:
        - type: object
          required:
            - type
            - value
          properties:
            type:
              type: string
              enum:
                - number
            value:
              type: integer
              format: int64
              description: Represents a number literal
              minimum: 0
        - type: object
          required:
            - type
            - value
          properties:
            type:
              type: string
              enum:
                - enum_variant
            value:
              type: string
              description: Represents an enum variant
        - type: object
          required:
            - type
            - value
          properties:
            type:
              type: string
              enum:
                - metadata_variant
            value:
              $ref: '#/components/schemas/MetadataValue'
        - type: object
          required:
            - type
            - value
          properties:
            type:
              type: string
              enum:
                - str_value
            value:
              type: string
              description: Represents a arbitrary String value
        - type: object
          required:
            - type
            - value
          properties:
            type:
              type: string
              enum:
                - global_ref
            value:
              type: string
              description: >-
                Represents a global reference, which is a reference to a global
                variable
        - type: object
          required:
            - type
            - value
          properties:
            type:
              type: string
              enum:
                - number_array
            value:
              type: array
              items:
                type: integer
                format: int64
                minimum: 0
              description: |-
                Represents an array of numbers. This is basically used for
                "one of the given numbers" operations
                eg: payment.method.amount = (1, 2, 3)
        - type: object
          required:
            - type
            - value
          properties:
            type:
              type: string
              enum:
                - enum_variant_array
            value:
              type: array
              items:
                type: string
              description: |-
                Similar to NumberArray but for enum variants
                eg: payment.method.cardtype = (debit, credit)
        - type: object
          required:
            - type
            - value
          properties:
            type:
              type: string
              enum:
                - number_comparison_array
            value:
              type: array
              items:
                $ref: '#/components/schemas/NumberComparison'
              description: |-
                Like a number array but can include comparisons. Useful for
                conditions like "500 < amount < 1000"
                eg: payment.amount = (> 500, < 1000)
      description: Represents a value in the DSL
      discriminator:
        propertyName: type
    MetadataValue:
      type: object
      required:
        - key
        - value
      properties:
        key:
          type: string
        value:
          type: string
    NumberComparison:
      type: object
      description: Represents a number comparison for "NumberComparisonArrayValue"
      required:
        - comparisonType
        - number
      properties:
        comparisonType:
          $ref: '#/components/schemas/ComparisonType'
        number:
          $ref: '#/components/schemas/MinorUnit'
    MinorUnit:
      type: integer
      format: int64
      description: This Unit struct represents MinorUnit in which core amount works
  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.
    jwt_key:
      type: http
      scheme: bearer
      bearerFormat: JWT

````