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

# Create a routing Rule

> Creates a routing rule with the given parameters



## OpenAPI

````yaml post /euclid.EuclidService/Create
openapi: 3.0.0
info:
  title: Dynamic routing - OpenAPI 3.0
  description: This the the open API 3.0 specification for the dynamic routing.
  version: 1.0.0
servers: []
security: []
paths:
  /euclid.EuclidService/Create:
    post:
      tags:
        - Static Routing
      summary: Create a routing Rule
      description: Creates a routing rule with the given parameters
      operationId: CreateRule
      parameters:
        - name: x-tenant-id
          in: header
          required: true
          schema:
            type: string
          example: public
        - name: x-profile-id
          in: header
          required: true
          schema:
            type: string
          example: pro_WX0giXQnzk2wQJjkKVBX
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
          example: dev_VLzQTxkPq3ALj2mlfiHL4mMtXca4uplOIOLaKEzmWAmNBXZjwsuv5bCLjnf0QYHm
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RoutingRule'
            example:
              name: Test Routing Rule
              algorithm:
                globals: {}
                default_selection:
                  priority:
                    connectors:
                      - stripe
                      - adyen
                      - checkout
                rules:
                  - name: Card Rule
                    routing_type: priority
                    output:
                      priority:
                        connectors:
                          - stripe
                          - adyen
                    statements:
                      - condition:
                          - lhs: payment_method
                            comparison: equal
                            value:
                              enum_variant: card
                            metadata: {}
                          - lhs: amount
                            comparison: greater_than
                            value:
                              number: 1000
                            metadata: {}
                metadata: {}
      responses:
        '200':
          description: Successful creation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateResponse'
              example:
                algorithm_id: routing_ec1ac351-7944-440f-bdc7-6a500df1116f
                name: Test Routing Rule
                created_at: '2025-04-09 8:03:44.85588'
                modified_at: '2025-04-09 8:03:44.85588'
        '400':
          description: Invalid request parameters
        '500':
          description: Internal server error
components:
  schemas:
    RoutingRule:
      type: object
      example:
        algorithm:
          globals: {}
          default_selection:
            priority:
              connectors:
                - stripe
                - adyen
                - checkout
          rules:
            - name: Card Rule
              routing_type: priority
              output:
                priority:
                  connectors:
                    - stripe
                    - adyen
              statements:
                - condition:
                    - lhs: payment_method
                      comparison: equal
                      value:
                        enum_variant: card
                      metadata: {}
                    - lhs: amount
                      comparison: greater_than
                      value:
                        number: 1000
                      metadata: {}
          metadata: {}
      properties:
        name:
          type: string
          example: Test Routing Rule
        algorithm:
          $ref: '#/components/schemas/Program'
    CreateResponse:
      type: object
      properties:
        algorithm_id:
          type: string
          description: Algorithm Id for the routing rule
          example: routing_ec1ac351-7944-440f-bdc7-6a500df1116f
        name:
          type: string
          description: name of the routing rule
          example: test routing rule
        created_at:
          type: string
          description: Timestamp for creation of routing rule
          example: '2025-04-09 8:03:44.85588'
        modified_at:
          type: string
          description: Timestamp for modification of routing rule
          example: '2025-04-09 8:03:44.85588'
    Program:
      type: object
      example:
        globals: {}
        default_selection:
          priority:
            connectors:
              - stripe
              - checkout
        rules:
          - name: High Amount Card
            routing_type: priority
            output:
              priority:
                connectors:
                  - adyen
            statements:
              - condition:
                  - lhs: payment_method
                    comparison: equal
                    value: card
                    metadata: {}
                  - lhs: amount
                    comparison: greater_than
                    value: 1000
                    metadata: {}
        metadata: {}
      properties:
        globals:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/ValueTypeList'
        default_selection:
          $ref: '#/components/schemas/Output'
        rules:
          type: array
          items:
            $ref: '#/components/schemas/Rule'
        metadata:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/MetadataValue'
    ValueTypeList:
      type: object
      example:
        values:
          - card
          - bank_transfer
      properties:
        values:
          type: array
          items:
            $ref: '#/components/schemas/ValueType'
    Output:
      type: object
      oneOf:
        - $ref: '#/components/schemas/PriorityOutput'
        - $ref: '#/components/schemas/VolumeSplitOutput'
        - $ref: '#/components/schemas/VolumeSplitPriorityOutput'
    Rule:
      type: object
      example:
        name: High Volume Transactions
        routing_type: priority
        output:
          priority:
            connectors:
              - stripe
              - adyen
        statements:
          - condition:
              - lhs: amount
                comparison: greater_than
                value: 5000
                metadata: {}
      properties:
        name:
          type: string
        routing_type:
          $ref: '#/components/schemas/RoutingType'
        output:
          $ref: '#/components/schemas/Output'
        statements:
          type: array
          items:
            $ref: '#/components/schemas/IfStatement'
    MetadataValue:
      type: object
      properties:
        key:
          type: string
        value:
          type: string
    ValueType:
      type: object
      oneOf:
        - type: integer
          format: uint64
        - type: string
        - $ref: '#/components/schemas/MetadataValue'
    PriorityOutput:
      type: object
      example:
        connectors:
          - stripe
          - adyen
      properties:
        connectors:
          type: array
          items:
            type: string
    VolumeSplitOutput:
      type: object
      properties:
        connectors:
          type: array
          items:
            $ref: '#/components/schemas/VolumeSplit'
    VolumeSplitPriorityOutput:
      type: object
      example:
        groups:
          - split: 60
            output:
              - stripe
              - adyen
          - split: 40
            output:
              - checkout
      properties:
        groups:
          type: array
          items:
            $ref: '#/components/schemas/VolumeSplitGroup'
    RoutingType:
      type: string
      enum:
        - priority
        - volume_split
        - volume_split_priority
    IfStatement:
      type: object
      example:
        condition:
          - lhs: currency
            comparison: equal
            value: USD
            metadata: {}
        nested:
          - condition:
              - lhs: amount
                comparison: greater_than
                value: 1000
                metadata: {}
      properties:
        condition:
          type: array
          items:
            $ref: '#/components/schemas/Comparison'
        nested:
          type: array
          items:
            $ref: '#/components/schemas/IfStatement'
    VolumeSplit:
      type: object
      example:
        split: 70
        output: stripe
      properties:
        split:
          type: integer
        output:
          type: string
    VolumeSplitGroup:
      type: object
      example:
        split: 50
        output:
          - adyen
          - checkout
      properties:
        split:
          type: integer
        output:
          type: array
          items:
            type: string
    Comparison:
      type: object
      example:
        lhs: payment_method
        comparison: equal
        value: card
        metadata: {}
      properties:
        lhs:
          type: string
        comparison:
          $ref: '#/components/schemas/ComparisonType'
        value:
          $ref: '#/components/schemas/ValueType'
        metadata:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/MetadataValue'
    ComparisonType:
      type: string
      enum:
        - equal
        - not_equal
        - less_than
        - less_than_equal
        - greater_than
        - greater_than_equal

````