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

> Create a routing config



## OpenAPI

````yaml post /routing
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:
    post:
      tags:
        - Routing
      summary: Routing - Create
      description: Create a routing config
      operationId: Create a routing config
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RoutingConfigRequest'
        required: true
      responses:
        '200':
          description: Routing config created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoutingDictionaryRecord'
        '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: []
        - jwt_key: []
components:
  schemas:
    RoutingConfigRequest:
      type: object
      properties:
        name:
          type: string
          description: |-
            Unique name of the routing configuration.

            This identifier is used to reference the routing config internally.

            Example:
            ```json
            "default_card_routing"
            ```
          example: default_card_routing
          nullable: true
        description:
          type: string
          description: |-
            Optional human-readable description of the routing configuration.

            Example:
            ```json
            "Primary routing strategy for card payments in India"
            ```
          example: Primary routing strategy for card payments in Middle east
          nullable: true
        algorithm:
          allOf:
            - $ref: '#/components/schemas/StaticRoutingAlgorithm'
          nullable: true
        profile_id:
          type: string
          description: |-
            Profile ID associated with this routing configuration.

            Routing configs can be scoped per business profile.

            Example:
            ```json
            "profile_123"
            ```
          example: profile_123
          nullable: true
        transaction_type:
          allOf:
            - $ref: '#/components/schemas/TransactionType'
          nullable: true
    RoutingDictionaryRecord:
      type: object
      description: |-
        Metadata record representing a stored routing configuration.

        Used in routing dictionary listings.
      required:
        - id
        - profile_id
        - name
        - kind
        - description
        - created_at
        - modified_at
      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 associated with this routing configuration.

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

            Example:
            ```json
            "india_card_routing"
            ```
          example: india_card_routing
        kind:
          $ref: '#/components/schemas/RoutingAlgorithmKind'
        description:
          type: string
          description: |-
            Description of this routing configuration.

            Example:
            ```json
            "Volume split routing for domestic transactions"
            ```
          example: Volume split routing for domestic transactions
        created_at:
          type: integer
          format: int64
          description: Creation timestamp (milliseconds since epoch).
          example: 1718000000000
        modified_at:
          type: integer
          format: int64
          description: Last modification timestamp (milliseconds since epoch).
          example: 1718050000000
        algorithm_for:
          allOf:
            - $ref: '#/components/schemas/TransactionType'
          nullable: true
        decision_engine_routing_id:
          type: string
          description: |-
            Associated Decision Engine routing identifier (if applicable).

            Present when routing is linked to an external decision engine.

            Example:
            ```json
            "de_route_456"
            ```
          example: de_route_456
          nullable: true
    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
    TransactionType:
      type: string
      enum:
        - payment
        - payout
        - three_ds_authentication
    RoutingAlgorithmKind:
      type: string
      enum:
        - single
        - priority
        - volume_split
        - advanced
        - dynamic
        - three_ds_decision_rule
    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: {}
    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'
    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
    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

````