Bug: feat: list for dynamic routing



### Context

**The dashboard required changes**

- get api for dynamic routing is inplace
- list active Dynamic routing
- Refactor volume split response
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 956d6d6697c..5933e3d0538 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -8375,6 +8375,54 @@
         },
         "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
+          }
+        }
+      },
+      "ContractBasedRoutingConfigBody": {
+        "type": "object",
+        "properties": {
+          "constants": {
+            "type": "array",
+            "items": {
+              "type": "number",
+              "format": "double"
+            },
+            "nullable": true
+          },
+          "time_scale": {
+            "allOf": [
+              {
+                "$ref": "#/components/schemas/ContractBasedTimeScale"
+              }
+            ],
+            "nullable": true
+          }
+        }
+      },
+      "ContractBasedTimeScale": {
+        "type": "string",
+        "enum": [
+          "day",
+          "month"
+        ]
+      },
       "CountryAlpha2": {
         "type": "string",
         "enum": [
@@ -9197,6 +9245,23 @@
           "ZWL"
         ]
       },
+      "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
+          }
+        }
+      },
       "CustomerAcceptance": {
         "type": "object",
         "description": "This \"CustomerAcceptance\" object is passed during Payments-Confirm request, it enlists the type, time, and mode of acceptance properties related to an acceptance done by the customer. The customer_acceptance sub object is usually passed by the SDK or client.",
@@ -9704,6 +9769,123 @@
         },
         "additionalProperties": false
       },
+      "DecisionEngineEliminationData": {
+        "type": "object",
+        "required": [
+          "threshold"
+        ],
+        "properties": {
+          "threshold": {
+            "type": "number",
+            "format": "double"
+          }
+        }
+      },
+      "DecisionEngineGatewayWiseExtraScore": {
+        "type": "object",
+        "required": [
+          "gatewayName",
+          "gatewaySigmaFactor"
+        ],
+        "properties": {
+          "gatewayName": {
+            "type": "string"
+          },
+          "gatewaySigmaFactor": {
+            "type": "number",
+            "format": "double"
+          }
+        }
+      },
+      "DecisionEngineSRSubLevelInputConfig": {
+        "type": "object",
+        "properties": {
+          "paymentMethodType": {
+            "type": "string",
+            "nullable": true
+          },
+          "paymentMethod": {
+            "type": "string",
+            "nullable": true
+          },
+          "latencyThreshold": {
+            "type": "number",
+            "format": "double",
+            "nullable": true
+          },
+          "bucketSize": {
+            "type": "integer",
+            "format": "int32",
+            "nullable": true
+          },
+          "hedgingPercent": {
+            "type": "number",
+            "format": "double",
+            "nullable": true
+          },
+          "lowerResetFactor": {
+            "type": "number",
+            "format": "double",
+            "nullable": true
+          },
+          "upperResetFactor": {
+            "type": "number",
+            "format": "double",
+            "nullable": true
+          },
+          "gatewayExtraScore": {
+            "type": "array",
+            "items": {
+              "$ref": "#/components/schemas/DecisionEngineGatewayWiseExtraScore"
+            },
+            "nullable": true
+          }
+        }
+      },
+      "DecisionEngineSuccessRateData": {
+        "type": "object",
+        "properties": {
+          "defaultLatencyThreshold": {
+            "type": "number",
+            "format": "double",
+            "nullable": true
+          },
+          "defaultBucketSize": {
+            "type": "integer",
+            "format": "int32",
+            "nullable": true
+          },
+          "defaultHedgingPercent": {
+            "type": "number",
+            "format": "double",
+            "nullable": true
+          },
+          "defaultLowerResetFactor": {
+            "type": "number",
+            "format": "double",
+            "nullable": true
+          },
+          "defaultUpperResetFactor": {
+            "type": "number",
+            "format": "double",
+            "nullable": true
+          },
+          "defaultGatewayExtraScore": {
+            "type": "array",
+            "items": {
+              "$ref": "#/components/schemas/DecisionEngineGatewayWiseExtraScore"
+            },
+            "nullable": true
+          },
+          "subLevelInputConfig": {
+            "type": "array",
+            "items": {
+              "$ref": "#/components/schemas/DecisionEngineSRSubLevelInputConfig"
+            },
+            "nullable": true
+          }
+        }
+      },
       "DecoupledAuthenticationType": {
         "type": "string",
         "enum": [
@@ -9969,6 +10151,31 @@
           }
         }
       },
+      "DynamicRoutingAlgorithm": {
+        "oneOf": [
+          {
+            "$ref": "#/components/schemas/EliminationRoutingConfig"
+          },
+          {
+            "$ref": "#/components/schemas/SuccessBasedRoutingConfig"
+          },
+          {
+            "$ref": "#/components/schemas/ContractBasedRoutingConfig"
+          }
+        ]
+      },
+      "DynamicRoutingConfigParams": {
+        "type": "string",
+        "enum": [
+          "PaymentMethod",
+          "PaymentMethodType",
+          "AuthenticationType",
+          "Currency",
+          "Country",
+          "CardNetwork",
+          "CardBin"
+        ]
+      },
       "ElementPosition": {
         "type": "string",
         "enum": [
@@ -10024,6 +10231,51 @@
           }
         ]
       },
+      "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
+      },
+      "EliminationRoutingConfig": {
+        "type": "object",
+        "required": [
+          "decision_engine_configs"
+        ],
+        "properties": {
+          "params": {
+            "type": "array",
+            "items": {
+              "$ref": "#/components/schemas/DynamicRoutingConfigParams"
+            },
+            "nullable": true
+          },
+          "elimination_analyser_config": {
+            "allOf": [
+              {
+                "$ref": "#/components/schemas/EliminationAnalyserConfig"
+              }
+            ],
+            "nullable": true
+          },
+          "decision_engine_configs": {
+            "$ref": "#/components/schemas/DecisionEngineEliminationData"
+          }
+        },
+        "additionalProperties": false
+      },
       "EnablePaymentLinkRequest": {
         "type": "string",
         "description": "Whether payment link is requested to be enabled or not for this transaction",
@@ -12054,6 +12306,33 @@
           }
         }
       },
+      "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"
+          }
+        }
+      },
       "LinkedRoutingConfigRetrieveResponse": {
         "oneOf": [
           {
@@ -13237,7 +13516,7 @@
             "type": "string"
           },
           "algorithm": {
-            "$ref": "#/components/schemas/RoutingAlgorithm"
+            "$ref": "#/components/schemas/RoutingAlgorithmWrapper"
           },
           "created_at": {
             "type": "integer",
@@ -18787,7 +19066,7 @@
           "routing": {
             "allOf": [
               {
-                "$ref": "#/components/schemas/RoutingAlgorithm"
+                "$ref": "#/components/schemas/StaticRoutingAlgorithm"
               }
             ],
             "nullable": true
@@ -21669,92 +21948,6 @@
           "zsl"
         ]
       },
-      "RoutingAlgorithm": {
-        "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"
-              }
-            }
-          }
-        ],
-        "description": "Routing Algorithm kind",
-        "discriminator": {
-          "propertyName": "type"
-        }
-      },
       "RoutingAlgorithmId": {
         "type": "object",
         "required": [
@@ -21776,6 +21969,16 @@
           "dynamic"
         ]
       },
+      "RoutingAlgorithmWrapper": {
+        "oneOf": [
+          {
+            "$ref": "#/components/schemas/StaticRoutingAlgorithm"
+          },
+          {
+            "$ref": "#/components/schemas/DynamicRoutingAlgorithm"
+          }
+        ]
+      },
       "RoutingConfigRequest": {
         "type": "object",
         "required": [
@@ -21792,7 +21995,7 @@
             "type": "string"
           },
           "algorithm": {
-            "$ref": "#/components/schemas/RoutingAlgorithm"
+            "$ref": "#/components/schemas/StaticRoutingAlgorithm"
           },
           "profile_id": {
             "type": "string"
@@ -22749,6 +22952,91 @@
         ],
         "description": "Charge specific fields for controlling the revert of funds from either platform or connected account. Check sub-fields for more details."
       },
+      "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"
+              }
+            }
+          }
+        ],
+        "discriminator": {
+          "propertyName": "type"
+        }
+      },
       "StraightThroughAlgorithm": {
         "oneOf": [
           {
@@ -22898,6 +23186,74 @@
         },
         "additionalProperties": false
       },
+      "SuccessBasedRoutingConfig": {
+        "type": "object",
+        "required": [
+          "decision_engine_configs"
+        ],
+        "properties": {
+          "params": {
+            "type": "array",
+            "items": {
+              "$ref": "#/components/schemas/DynamicRoutingConfigParams"
+            },
+            "nullable": true
+          },
+          "config": {
+            "allOf": [
+              {
+                "$ref": "#/components/schemas/SuccessBasedRoutingConfigBody"
+              }
+            ],
+            "nullable": true
+          },
+          "decision_engine_configs": {
+            "$ref": "#/components/schemas/DecisionEngineSuccessRateData"
+          }
+        },
+        "additionalProperties": false
+      },
+      "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"
+          }
+        },
+        "additionalProperties": false
+      },
+      "SuccessRateSpecificityLevel": {
+        "type": "string",
+        "enum": [
+          "merchant",
+          "global"
+        ]
+      },
       "SupportedPaymentMethod": {
         "allOf": [
           {
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index 60eca62b618..1d026a68548 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -58,7 +58,7 @@ pub struct MerchantAccountCreate {
 
     /// The routing algorithm to be  used for routing payouts to desired connectors
     #[cfg(feature = "payouts")]
-    #[schema(value_type = Option<RoutingAlgorithm>,example = json!({"type": "single", "data": "wise"}))]
+    #[schema(value_type = Option<StaticRoutingAlgorithm>,example = json!({"type": "single", "data": "wise"}))]
     pub payout_routing_algorithm: Option<serde_json::Value>,
 
     /// A boolean value to indicate if the merchant is a sub-merchant under a master or a parent merchant. By default, its value is false.
@@ -165,8 +165,9 @@ impl MerchantAccountCreate {
     pub fn parse_routing_algorithm(&self) -> CustomResult<(), errors::ParsingError> {
         match self.routing_algorithm {
             Some(ref routing_algorithm) => {
-                let _: routing::RoutingAlgorithm =
-                    routing_algorithm.clone().parse_value("RoutingAlgorithm")?;
+                let _: routing::StaticRoutingAlgorithm = routing_algorithm
+                    .clone()
+                    .parse_value("StaticRoutingAlgorithm")?;
                 Ok(())
             }
             None => Ok(()),
@@ -325,7 +326,7 @@ pub struct MerchantAccountUpdate {
 
     /// The routing algorithm to be used to process the incoming request from merchant to outgoing payment processor or payment method. The default is 'Custom'
     #[cfg(feature = "payouts")]
-    #[schema(value_type = Option<RoutingAlgorithm>,example = json!({"type": "single", "data": "wise"}))]
+    #[schema(value_type = Option<StaticRoutingAlgorithm>,example = json!({"type": "single", "data": "wise"}))]
     pub payout_routing_algorithm: Option<serde_json::Value>,
 
     /// A boolean value to indicate if the merchant is a sub-merchant under a master or a parent merchant. By default, its value is false.
@@ -425,8 +426,9 @@ impl MerchantAccountUpdate {
     pub fn parse_routing_algorithm(&self) -> CustomResult<(), errors::ParsingError> {
         match self.routing_algorithm {
             Some(ref routing_algorithm) => {
-                let _: routing::RoutingAlgorithm =
-                    routing_algorithm.clone().parse_value("RoutingAlgorithm")?;
+                let _: routing::StaticRoutingAlgorithm = routing_algorithm
+                    .clone()
+                    .parse_value("StaticRoutingAlgorithm")?;
                 Ok(())
             }
             None => Ok(()),
@@ -517,7 +519,7 @@ pub struct MerchantAccountResponse {
 
     /// The routing algorithm to be used to process the incoming request from merchant to outgoing payment processor or payment method. The default is 'Custom'
     #[cfg(feature = "payouts")]
-    #[schema(value_type = Option<RoutingAlgorithm>,example = json!({"type": "single", "data": "wise"}))]
+    #[schema(value_type = Option<StaticRoutingAlgorithm>,example = json!({"type": "single", "data": "wise"}))]
     pub payout_routing_algorithm: Option<serde_json::Value>,
 
     /// A boolean value to indicate if the merchant is a sub-merchant under a master or a parent merchant. By default, its value is false.
@@ -545,7 +547,7 @@ pub struct MerchantAccountResponse {
     pub primary_business_details: Vec<PrimaryBusinessDetails>,
 
     /// The frm routing algorithm to be used to process the incoming request from merchant to outgoing payment FRM.
-    #[schema(value_type = Option<RoutingAlgorithm>, max_length = 255, example = r#"{"type": "single", "data": "stripe" }"#)]
+    #[schema(value_type = Option<StaticRoutingAlgorithm>, max_length = 255, example = r#"{"type": "single", "data": "stripe" }"#)]
     pub frm_routing_algorithm: Option<serde_json::Value>,
 
     /// The organization id merchant is associated with
@@ -1897,7 +1899,7 @@ pub struct ProfileCreate {
 
     /// The routing algorithm to be used to process the incoming request from merchant to outgoing payment processor or payment method. The default is 'Custom'
     #[cfg(feature = "payouts")]
-    #[schema(value_type = Option<RoutingAlgorithm>,example = json!({"type": "single", "data": "wise"}))]
+    #[schema(value_type = Option<StaticRoutingAlgorithm>,example = json!({"type": "single", "data": "wise"}))]
     pub payout_routing_algorithm: Option<serde_json::Value>,
 
     /// Verified Apple Pay domains for a particular profile
@@ -2199,7 +2201,7 @@ pub struct ProfileResponse {
 
     /// The routing algorithm to be used to process the incoming request from merchant to outgoing payment processor or payment method. The default is 'Custom'
     #[cfg(feature = "payouts")]
-    #[schema(value_type = Option<RoutingAlgorithm>,example = json!({"type": "single", "data": "wise"}))]
+    #[schema(value_type = Option<StaticRoutingAlgorithm>,example = json!({"type": "single", "data": "wise"}))]
     pub payout_routing_algorithm: Option<serde_json::Value>,
 
     /// Verified Apple Pay domains for a particular profile
@@ -2504,7 +2506,7 @@ pub struct ProfileUpdate {
 
     /// The routing algorithm to be used to process the incoming request from merchant to outgoing payment processor or payment method. The default is 'Custom'
     #[cfg(feature = "payouts")]
-    #[schema(value_type = Option<RoutingAlgorithm>,example = json!({"type": "single", "data": "wise"}))]
+    #[schema(value_type = Option<StaticRoutingAlgorithm>,example = json!({"type": "single", "data": "wise"}))]
     pub payout_routing_algorithm: Option<serde_json::Value>,
 
     /// Verified Apple Pay domains for a particular profile
diff --git a/crates/api_models/src/events/routing.rs b/crates/api_models/src/events/routing.rs
index c9fa118f596..750bfde2710 100644
--- a/crates/api_models/src/events/routing.rs
+++ b/crates/api_models/src/events/routing.rs
@@ -6,9 +6,9 @@ use crate::routing::{
     LinkedRoutingConfigRetrieveResponse, MerchantRoutingAlgorithm, ProfileDefaultRoutingConfig,
     RoutingAlgorithmId, RoutingConfigRequest, RoutingDictionaryRecord, RoutingKind,
     RoutingLinkWrapper, RoutingPayloadWrapper, RoutingRetrieveLinkQuery,
-    RoutingRetrieveLinkQueryWrapper, RoutingRetrieveQuery, RoutingVolumeSplitWrapper,
-    SuccessBasedRoutingConfig, SuccessBasedRoutingPayloadWrapper, ToggleDynamicRoutingQuery,
-    ToggleDynamicRoutingWrapper,
+    RoutingRetrieveLinkQueryWrapper, RoutingRetrieveQuery, RoutingVolumeSplit,
+    RoutingVolumeSplitWrapper, SuccessBasedRoutingConfig, SuccessBasedRoutingPayloadWrapper,
+    ToggleDynamicRoutingQuery, ToggleDynamicRoutingWrapper,
 };
 
 impl ApiEventMetric for RoutingKind {
@@ -134,3 +134,9 @@ impl ApiEventMetric for RoutingVolumeSplitWrapper {
         Some(ApiEventsType::Routing)
     }
 }
+
+impl ApiEventMetric for RoutingVolumeSplit {
+    fn get_api_event_type(&self) -> Option<ApiEventsType> {
+        Some(ApiEventsType::Routing)
+    }
+}
diff --git a/crates/api_models/src/payouts.rs b/crates/api_models/src/payouts.rs
index 4c8a73b75a8..cf07fd9e109 100644
--- a/crates/api_models/src/payouts.rs
+++ b/crates/api_models/src/payouts.rs
@@ -58,7 +58,7 @@ pub struct PayoutCreateRequest {
     pub currency: Option<api_enums::Currency>,
 
     /// Specifies routing algorithm for selecting a connector
-    #[schema(value_type = Option<RoutingAlgorithm>, example = json!({
+    #[schema(value_type = Option<StaticRoutingAlgorithm>, example = json!({
         "type": "single",
         "data": "adyen"
     }))]
diff --git a/crates/api_models/src/routing.rs b/crates/api_models/src/routing.rs
index 12075935cd4..a15b135ac1f 100644
--- a/crates/api_models/src/routing.rs
+++ b/crates/api_models/src/routing.rs
@@ -49,7 +49,7 @@ impl ConnectorSelection {
 pub struct RoutingConfigRequest {
     pub name: String,
     pub description: String,
-    pub algorithm: RoutingAlgorithm,
+    pub algorithm: StaticRoutingAlgorithm,
     #[schema(value_type = String)]
     pub profile_id: common_utils::id_type::ProfileId,
 }
@@ -59,7 +59,7 @@ pub struct RoutingConfigRequest {
 pub struct RoutingConfigRequest {
     pub name: Option<String>,
     pub description: Option<String>,
-    pub algorithm: Option<RoutingAlgorithm>,
+    pub algorithm: Option<StaticRoutingAlgorithm>,
     #[schema(value_type = Option<String>)]
     pub profile_id: Option<common_utils::id_type::ProfileId>,
 }
@@ -96,7 +96,7 @@ pub struct RoutingRetrieveResponse {
 #[derive(Debug, serde::Serialize, ToSchema)]
 #[serde(untagged)]
 pub enum LinkedRoutingConfigRetrieveResponse {
-    MerchantAccountBased(RoutingRetrieveResponse),
+    MerchantAccountBased(Box<RoutingRetrieveResponse>),
     ProfileBased(Vec<RoutingDictionaryRecord>),
 }
 
@@ -109,7 +109,7 @@ pub struct MerchantRoutingAlgorithm {
     pub profile_id: common_utils::id_type::ProfileId,
     pub name: String,
     pub description: String,
-    pub algorithm: RoutingAlgorithm,
+    pub algorithm: RoutingAlgorithmWrapper,
     pub created_at: i64,
     pub modified_at: i64,
     pub algorithm_for: TransactionType,
@@ -301,6 +301,20 @@ pub struct RoutingPayloadWrapper {
     pub updated_config: Vec<RoutableConnectorChoice>,
     pub profile_id: common_utils::id_type::ProfileId,
 }
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
+#[serde(untagged)]
+pub enum RoutingAlgorithmWrapper {
+    Static(StaticRoutingAlgorithm),
+    Dynamic(DynamicRoutingAlgorithm),
+}
+
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
+#[serde(untagged)]
+pub enum DynamicRoutingAlgorithm {
+    EliminationBasedAlgorithm(EliminationRoutingConfig),
+    SuccessBasedAlgorithm(SuccessBasedRoutingConfig),
+    ContractBasedAlgorithm(ContractBasedRoutingConfig),
+}
 
 #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
 #[serde(
@@ -309,8 +323,7 @@ pub struct RoutingPayloadWrapper {
     rename_all = "snake_case",
     try_from = "RoutingAlgorithmSerde"
 )]
-/// Routing Algorithm kind
-pub enum RoutingAlgorithm {
+pub enum StaticRoutingAlgorithm {
     Single(Box<RoutableConnectorChoice>),
     Priority(Vec<RoutableConnectorChoice>),
     VolumeSplit(Vec<ConnectorVolumeSplit>),
@@ -318,7 +331,7 @@ pub enum RoutingAlgorithm {
     Advanced(ast::Program<ConnectorSelection>),
 }
 
-#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
 #[serde(tag = "type", content = "data", rename_all = "snake_case")]
 pub enum RoutingAlgorithmSerde {
     Single(Box<RoutableConnectorChoice>),
@@ -327,7 +340,7 @@ pub enum RoutingAlgorithmSerde {
     Advanced(ast::Program<ConnectorSelection>),
 }
 
-impl TryFrom<RoutingAlgorithmSerde> for RoutingAlgorithm {
+impl TryFrom<RoutingAlgorithmSerde> for StaticRoutingAlgorithm {
     type Error = error_stack::Report<ParsingError>;
 
     fn try_from(value: RoutingAlgorithmSerde) -> Result<Self, Self::Error> {
@@ -434,7 +447,7 @@ impl From<StraightThroughAlgorithm> for StraightThroughAlgorithmSerde {
     }
 }
 
-impl From<StraightThroughAlgorithm> for RoutingAlgorithm {
+impl From<StraightThroughAlgorithm> for StaticRoutingAlgorithm {
     fn from(value: StraightThroughAlgorithm) -> Self {
         match value {
             StraightThroughAlgorithm::Single(conn) => Self::Single(conn),
@@ -444,7 +457,7 @@ impl From<StraightThroughAlgorithm> for RoutingAlgorithm {
     }
 }
 
-impl RoutingAlgorithm {
+impl StaticRoutingAlgorithm {
     pub fn get_kind(&self) -> RoutingAlgorithmKind {
         match self {
             Self::Single(_) => RoutingAlgorithmKind::Single,
@@ -845,6 +858,7 @@ pub struct ToggleDynamicRoutingPath {
 }
 
 #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, ToSchema)]
+#[serde(deny_unknown_fields)]
 pub struct EliminationRoutingConfig {
     pub params: Option<Vec<DynamicRoutingConfigParams>>,
     pub elimination_analyser_config: Option<EliminationAnalyserConfig>,
@@ -853,6 +867,7 @@ pub struct EliminationRoutingConfig {
 }
 
 #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Copy, ToSchema)]
+#[serde(deny_unknown_fields)]
 pub struct EliminationAnalyserConfig {
     pub bucket_size: Option<u64>,
     pub bucket_leak_interval_in_secs: Option<u64>,
@@ -924,6 +939,7 @@ impl EliminationRoutingConfig {
 }
 
 #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, ToSchema)]
+#[serde(deny_unknown_fields)]
 pub struct SuccessBasedRoutingConfig {
     pub params: Option<Vec<DynamicRoutingConfigParams>>,
     pub config: Option<SuccessBasedRoutingConfigBody>,
@@ -950,7 +966,9 @@ impl Default for SuccessBasedRoutingConfig {
     }
 }
 
-#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, ToSchema, strum::Display)]
+#[derive(
+    serde::Serialize, serde::Deserialize, Debug, Clone, ToSchema, PartialEq, strum::Display,
+)]
 pub enum DynamicRoutingConfigParams {
     PaymentMethod,
     PaymentMethodType,
@@ -962,6 +980,7 @@ pub enum DynamicRoutingConfigParams {
 }
 
 #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, ToSchema)]
+#[serde(deny_unknown_fields)]
 pub struct SuccessBasedRoutingConfigBody {
     pub min_aggregates_size: Option<u32>,
     pub default_success_rate: Option<f64>,
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index b042d2bdbd6..ffba56ac6bc 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -658,7 +658,12 @@ Never share your secret api keys. Keep them guarded and secure.
         api_models::routing::MerchantRoutingAlgorithm,
         api_models::routing::RoutingAlgorithmKind,
         api_models::routing::RoutingDictionary,
-        api_models::routing::RoutingAlgorithm,
+        api_models::routing::RoutingAlgorithmWrapper,
+        api_models::routing::EliminationRoutingConfig,
+        api_models::open_router::DecisionEngineEliminationData,
+        api_models::routing::EliminationAnalyserConfig,
+        api_models::routing::DynamicRoutingAlgorithm,
+        api_models::routing::StaticRoutingAlgorithm,
         api_models::routing::StraightThroughAlgorithm,
         api_models::routing::ConnectorVolumeSplit,
         api_models::routing::ConnectorSelection,
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index 9b8387389fe..f5632e9c3c9 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -644,7 +644,25 @@ Never share your secret api keys. Keep them guarded and secure.
         api_models::routing::MerchantRoutingAlgorithm,
         api_models::routing::RoutingAlgorithmKind,
         api_models::routing::RoutingDictionary,
-        api_models::routing::RoutingAlgorithm,
+        api_models::routing::DynamicRoutingConfigParams,
+        api_models::routing::SuccessBasedRoutingConfig,
+        api_models::routing::SuccessRateSpecificityLevel,
+        api_models::routing::CurrentBlockThreshold,
+        api_models::open_router::DecisionEngineSuccessRateData,
+        api_models::routing::ContractBasedTimeScale,
+        api_models::routing::LabelInformation,
+        api_models::routing::ContractBasedRoutingConfig,
+        api_models::routing::ContractBasedRoutingConfigBody,
+        api_models::open_router::DecisionEngineGatewayWiseExtraScore,
+        api_models::open_router::DecisionEngineSRSubLevelInputConfig,
+        api_models::open_router::DecisionEngineEliminationData,
+        api_models::routing::SuccessBasedRoutingConfigBody,
+        api_models::routing::RoutingAlgorithmWrapper,
+        api_models::routing::EliminationRoutingConfig,
+        api_models::open_router::DecisionEngineEliminationData,
+        api_models::routing::EliminationAnalyserConfig,
+        api_models::routing::DynamicRoutingAlgorithm,
+        api_models::routing::StaticRoutingAlgorithm,
         api_models::routing::StraightThroughAlgorithm,
         api_models::routing::ConnectorVolumeSplit,
         api_models::routing::ConnectorSelection,
diff --git a/crates/router/src/compatibility/stripe/payment_intents/types.rs b/crates/router/src/compatibility/stripe/payment_intents/types.rs
index ee5fb184257..c153c88e0ec 100644
--- a/crates/router/src/compatibility/stripe/payment_intents/types.rs
+++ b/crates/router/src/compatibility/stripe/payment_intents/types.rs
@@ -287,7 +287,7 @@ impl TryFrom<StripePaymentIntentRequest> for payments::PaymentsRequest {
 
         let routing = routable_connector
             .map(|connector| {
-                api_models::routing::RoutingAlgorithm::Single(Box::new(
+                api_models::routing::StaticRoutingAlgorithm::Single(Box::new(
                     api_models::routing::RoutableConnectorChoice {
                         choice_kind: api_models::routing::RoutableChoiceKind::FullStruct,
                         connector,
diff --git a/crates/router/src/compatibility/stripe/setup_intents/types.rs b/crates/router/src/compatibility/stripe/setup_intents/types.rs
index 77db75e2188..90098f1c308 100644
--- a/crates/router/src/compatibility/stripe/setup_intents/types.rs
+++ b/crates/router/src/compatibility/stripe/setup_intents/types.rs
@@ -183,7 +183,7 @@ impl TryFrom<StripeSetupIntentRequest> for payments::PaymentsRequest {
 
         let routing = routable_connector
             .map(|connector| {
-                api_models::routing::RoutingAlgorithm::Single(Box::new(
+                api_models::routing::StaticRoutingAlgorithm::Single(Box::new(
                     api_models::routing::RoutableConnectorChoice {
                         choice_kind: api_models::routing::RoutableChoiceKind::FullStruct,
                         connector,
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 14f2e439f50..c8f53cd07a6 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -3801,7 +3801,7 @@ impl ProfileCreateBridge for api::ProfileCreate {
         }
 
         if let Some(ref routing_algorithm) = self.routing_algorithm {
-            let _: api_models::routing::RoutingAlgorithm = routing_algorithm
+            let _: api_models::routing::StaticRoutingAlgorithm = routing_algorithm
                 .clone()
                 .parse_value("RoutingAlgorithm")
                 .change_context(errors::ApiErrorResponse::InvalidDataValue {
@@ -4300,7 +4300,7 @@ impl ProfileUpdateBridge for api::ProfileUpdate {
         let webhook_details = self.webhook_details.map(ForeignInto::foreign_into);
 
         if let Some(ref routing_algorithm) = self.routing_algorithm {
-            let _: api_models::routing::RoutingAlgorithm = routing_algorithm
+            let _: api_models::routing::StaticRoutingAlgorithm = routing_algorithm
                 .clone()
                 .parse_value("RoutingAlgorithm")
                 .change_context(errors::ApiErrorResponse::InvalidDataValue {
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 4c3894d5d37..7a3727aa563 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -6240,7 +6240,7 @@ where
     F: Send + Clone,
     D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
 {
-    let _: api_models::routing::RoutingAlgorithm = request_straight_through
+    let _: api_models::routing::StaticRoutingAlgorithm = request_straight_through
         .clone()
         .parse_value("RoutingAlgorithm")
         .attach_printable("Invalid straight through routing rules format")?;
diff --git a/crates/router/src/core/payments/routing.rs b/crates/router/src/core/payments/routing.rs
index 2b851c192b0..b4ac7d4421d 100644
--- a/crates/router/src/core/payments/routing.rs
+++ b/crates/router/src/core/payments/routing.rs
@@ -577,15 +577,15 @@ fn execute_dsl_and_get_connector_v1(
     backend_input: dsl_inputs::BackendInput,
     interpreter: &backend::VirInterpreterBackend<ConnectorSelection>,
 ) -> RoutingResult<Vec<routing_types::RoutableConnectorChoice>> {
-    let routing_output: routing_types::RoutingAlgorithm = interpreter
+    let routing_output: routing_types::StaticRoutingAlgorithm = interpreter
         .execute(backend_input)
         .map(|out| out.connector_selection.foreign_into())
         .change_context(errors::RoutingError::DslExecutionError)?;
 
     Ok(match routing_output {
-        routing_types::RoutingAlgorithm::Priority(plist) => plist,
+        routing_types::StaticRoutingAlgorithm::Priority(plist) => plist,
 
-        routing_types::RoutingAlgorithm::VolumeSplit(splits) => perform_volume_split(splits)
+        routing_types::StaticRoutingAlgorithm::VolumeSplit(splits) => perform_volume_split(splits)
             .change_context(errors::RoutingError::DslFinalConnectorSelectionFailed)?,
 
         _ => Err(errors::RoutingError::DslIncorrectSelectionAlgorithm)
@@ -605,7 +605,7 @@ pub async fn refresh_routing_cache_v1(
             .find_routing_algorithm_by_profile_id_algorithm_id(profile_id, algorithm_id)
             .await
             .change_context(errors::RoutingError::DslMissingInDb)?;
-        let algorithm: routing_types::RoutingAlgorithm = algorithm
+        let algorithm: routing_types::StaticRoutingAlgorithm = algorithm
             .algorithm_data
             .parse_value("RoutingAlgorithm")
             .change_context(errors::RoutingError::DslParsingError)?;
@@ -613,12 +613,12 @@ pub async fn refresh_routing_cache_v1(
     };
 
     let cached_algorithm = match algorithm {
-        routing_types::RoutingAlgorithm::Single(conn) => CachedAlgorithm::Single(conn),
-        routing_types::RoutingAlgorithm::Priority(plist) => CachedAlgorithm::Priority(plist),
-        routing_types::RoutingAlgorithm::VolumeSplit(splits) => {
+        routing_types::StaticRoutingAlgorithm::Single(conn) => CachedAlgorithm::Single(conn),
+        routing_types::StaticRoutingAlgorithm::Priority(plist) => CachedAlgorithm::Priority(plist),
+        routing_types::StaticRoutingAlgorithm::VolumeSplit(splits) => {
             CachedAlgorithm::VolumeSplit(splits)
         }
-        routing_types::RoutingAlgorithm::Advanced(program) => {
+        routing_types::StaticRoutingAlgorithm::Advanced(program) => {
             let interpreter = backend::VirInterpreterBackend::with_program(program)
                 .change_context(errors::RoutingError::DslBackendInitError)
                 .attach_printable("Error initializing DSL interpreter backend")?;
diff --git a/crates/router/src/core/routing.rs b/crates/router/src/core/routing.rs
index 893c66af24c..df6189ea424 100644
--- a/crates/router/src/core/routing.rs
+++ b/crates/router/src/core/routing.rs
@@ -275,7 +275,7 @@ pub async fn create_routing_algorithm_under_profile(
     request: routing_types::RoutingConfigRequest,
     transaction_type: enums::TransactionType,
 ) -> RouterResponse<routing_types::RoutingDictionaryRecord> {
-    use api_models::routing::RoutingAlgorithm as EuclidAlgorithm;
+    use api_models::routing::StaticRoutingAlgorithm as EuclidAlgorithm;
 
     use crate::services::logger;
 
@@ -1174,16 +1174,20 @@ pub async fn retrieve_linked_routing_config(
     transaction_type: &enums::TransactionType,
 ) -> RouterResponse<routing_types::LinkedRoutingConfigRetrieveResponse> {
     metrics::ROUTING_RETRIEVE_LINK_CONFIG.add(1, &[]);
+
     let db = state.store.as_ref();
     let key_manager_state = &(&state).into();
+    let merchant_key_store = merchant_context.get_merchant_key_store();
+    let merchant_id = merchant_context.get_merchant_account().get_id();
 
+    // Get business profiles
     let business_profiles = if let Some(profile_id) = query_params.profile_id {
         core_utils::validate_and_get_business_profile(
             db,
             key_manager_state,
-            merchant_context.get_merchant_key_store(),
+            merchant_key_store,
             Some(&profile_id),
-            merchant_context.get_merchant_account().get_id(),
+            merchant_id,
         )
         .await?
         .map(|profile| vec![profile])
@@ -1193,28 +1197,25 @@ pub async fn retrieve_linked_routing_config(
         })?
     } else {
         let business_profile = db
-            .list_profile_by_merchant_id(
-                key_manager_state,
-                merchant_context.get_merchant_key_store(),
-                merchant_context.get_merchant_account().get_id(),
-            )
+            .list_profile_by_merchant_id(key_manager_state, merchant_key_store, merchant_id)
             .await
             .to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)?;
         core_utils::filter_objects_based_on_profile_id_list(
             authentication_profile_id.map(|profile_id| vec![profile_id]),
-            business_profile.clone(),
+            business_profile,
         )
     };
 
     let mut active_algorithms = Vec::new();
 
     for business_profile in business_profiles {
-        let profile_id = business_profile.get_id().to_owned();
+        let profile_id = business_profile.get_id();
 
+        // Handle static routing algorithm
         let routing_ref: routing_types::RoutingAlgorithmRef = match transaction_type {
-            enums::TransactionType::Payment => business_profile.routing_algorithm,
+            enums::TransactionType::Payment => &business_profile.routing_algorithm,
             #[cfg(feature = "payouts")]
-            enums::TransactionType::Payout => business_profile.payout_routing_algorithm,
+            enums::TransactionType::Payout => &business_profile.payout_routing_algorithm,
         }
         .clone()
         .map(|val| val.parse_value("RoutingAlgorithmRef"))
@@ -1227,11 +1228,53 @@ pub async fn retrieve_linked_routing_config(
             let record = db
                 .find_routing_algorithm_metadata_by_algorithm_id_profile_id(
                     &algorithm_id,
-                    &profile_id,
+                    profile_id,
                 )
                 .await
                 .to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)?;
+            active_algorithms.push(record.foreign_into());
+        }
+
+        // Handle dynamic routing algorithms
+        let dynamic_routing_ref: routing_types::DynamicRoutingAlgorithmRef = business_profile
+            .dynamic_routing_algorithm
+            .clone()
+            .map(|val| val.parse_value("DynamicRoutingAlgorithmRef"))
+            .transpose()
+            .change_context(errors::ApiErrorResponse::InternalServerError)
+            .attach_printable(
+                "unable to deserialize dynamic routing algorithm ref from business profile",
+            )?
+            .unwrap_or_default();
 
+        // Collect all dynamic algorithm IDs
+        let mut dynamic_algorithm_ids = Vec::new();
+
+        if let Some(sba) = &dynamic_routing_ref.success_based_algorithm {
+            if let Some(id) = &sba.algorithm_id_with_timestamp.algorithm_id {
+                dynamic_algorithm_ids.push(id.clone());
+            }
+        }
+        if let Some(era) = &dynamic_routing_ref.elimination_routing_algorithm {
+            if let Some(id) = &era.algorithm_id_with_timestamp.algorithm_id {
+                dynamic_algorithm_ids.push(id.clone());
+            }
+        }
+        if let Some(cbr) = &dynamic_routing_ref.contract_based_routing {
+            if let Some(id) = &cbr.algorithm_id_with_timestamp.algorithm_id {
+                dynamic_algorithm_ids.push(id.clone());
+            }
+        }
+
+        // Fetch all dynamic algorithms
+        for algorithm_id in dynamic_algorithm_ids {
+            let record = db
+                .find_routing_algorithm_metadata_by_algorithm_id_profile_id(
+                    &algorithm_id,
+                    profile_id,
+                )
+                .await
+                .to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)?;
             active_algorithms.push(record.foreign_into());
         }
     }
@@ -1456,7 +1499,7 @@ pub async fn configure_dynamic_routing_volume_split(
     merchant_context: domain::MerchantContext,
     profile_id: common_utils::id_type::ProfileId,
     routing_info: routing::RoutingVolumeSplit,
-) -> RouterResponse<()> {
+) -> RouterResponse<routing::RoutingVolumeSplit> {
     metrics::ROUTING_CREATE_REQUEST_RECEIVED.add(
         1,
         router_env::metric_attributes!(("profile_id", profile_id.clone())),
@@ -1508,7 +1551,7 @@ pub async fn configure_dynamic_routing_volume_split(
     )
     .await?;
 
-    Ok(service_api::ApplicationResponse::StatusOk)
+    Ok(service_api::ApplicationResponse::Json(routing_info))
 }
 
 #[cfg(all(feature = "v1", feature = "dynamic_routing"))]
diff --git a/crates/router/src/core/routing/helpers.rs b/crates/router/src/core/routing/helpers.rs
index 89d0cb7bfe3..a29f25331ec 100644
--- a/crates/router/src/core/routing/helpers.rs
+++ b/crates/router/src/core/routing/helpers.rs
@@ -312,7 +312,7 @@ pub async fn update_business_profile_active_dynamic_algorithm_ref(
 pub struct RoutingAlgorithmHelpers<'h> {
     pub name_mca_id_set: ConnectNameAndMCAIdForProfile<'h>,
     pub name_set: ConnectNameForProfile<'h>,
-    pub routing_algorithm: &'h routing_types::RoutingAlgorithm,
+    pub routing_algorithm: &'h routing_types::StaticRoutingAlgorithm,
 }
 
 #[cfg(feature = "v1")]
@@ -410,23 +410,23 @@ impl RoutingAlgorithmHelpers<'_> {
 
     pub fn validate_connectors_in_routing_config(&self) -> RouterResult<()> {
         match self.routing_algorithm {
-            routing_types::RoutingAlgorithm::Single(choice) => {
+            routing_types::StaticRoutingAlgorithm::Single(choice) => {
                 self.connector_choice(choice)?;
             }
 
-            routing_types::RoutingAlgorithm::Priority(list) => {
+            routing_types::StaticRoutingAlgorithm::Priority(list) => {
                 for choice in list {
                     self.connector_choice(choice)?;
                 }
             }
 
-            routing_types::RoutingAlgorithm::VolumeSplit(splits) => {
+            routing_types::StaticRoutingAlgorithm::VolumeSplit(splits) => {
                 for split in splits {
                     self.connector_choice(&split.connector)?;
                 }
             }
 
-            routing_types::RoutingAlgorithm::Advanced(program) => {
+            routing_types::StaticRoutingAlgorithm::Advanced(program) => {
                 let check_connector_selection =
                     |selection: &routing_types::ConnectorSelection| -> RouterResult<()> {
                         match selection {
@@ -464,7 +464,7 @@ pub async fn validate_connectors_in_routing_config(
     key_store: &domain::MerchantKeyStore,
     merchant_id: &id_type::MerchantId,
     profile_id: &id_type::ProfileId,
-    routing_algorithm: &routing_types::RoutingAlgorithm,
+    routing_algorithm: &routing_types::StaticRoutingAlgorithm,
 ) -> RouterResult<()> {
     let all_mcas = state
         .store
@@ -518,23 +518,23 @@ pub async fn validate_connectors_in_routing_config(
     };
 
     match routing_algorithm {
-        routing_types::RoutingAlgorithm::Single(choice) => {
+        routing_types::StaticRoutingAlgorithm::Single(choice) => {
             connector_choice(choice)?;
         }
 
-        routing_types::RoutingAlgorithm::Priority(list) => {
+        routing_types::StaticRoutingAlgorithm::Priority(list) => {
             for choice in list {
                 connector_choice(choice)?;
             }
         }
 
-        routing_types::RoutingAlgorithm::VolumeSplit(splits) => {
+        routing_types::StaticRoutingAlgorithm::VolumeSplit(splits) => {
             for split in splits {
                 connector_choice(&split.connector)?;
             }
         }
 
-        routing_types::RoutingAlgorithm::Advanced(program) => {
+        routing_types::StaticRoutingAlgorithm::Advanced(program) => {
             let check_connector_selection =
                 |selection: &routing_types::ConnectorSelection| -> RouterResult<()> {
                     match selection {
diff --git a/crates/router/src/core/routing/transformers.rs b/crates/router/src/core/routing/transformers.rs
index ebf521c4604..4face887995 100644
--- a/crates/router/src/core/routing/transformers.rs
+++ b/crates/router/src/core/routing/transformers.rs
@@ -1,6 +1,6 @@
 use api_models::routing::{
-    MerchantRoutingAlgorithm, RoutingAlgorithm as Algorithm, RoutingAlgorithmKind,
-    RoutingDictionaryRecord,
+    DynamicRoutingAlgorithm, MerchantRoutingAlgorithm, RoutingAlgorithmKind,
+    RoutingAlgorithmWrapper, RoutingDictionaryRecord,
 };
 #[cfg(feature = "v1")]
 use api_models::{
@@ -59,15 +59,23 @@ impl ForeignTryFrom<RoutingAlgorithm> for MerchantRoutingAlgorithm {
     type Error = error_stack::Report<errors::ParsingError>;
 
     fn foreign_try_from(value: RoutingAlgorithm) -> Result<Self, Self::Error> {
+        let algorithm: RoutingAlgorithmWrapper = match value.kind {
+            diesel_models::enums::RoutingAlgorithmKind::Dynamic => value
+                .algorithm_data
+                .parse_value::<DynamicRoutingAlgorithm>("RoutingAlgorithmDynamic")
+                .map(RoutingAlgorithmWrapper::Dynamic)?,
+            _ => value
+                .algorithm_data
+                .parse_value::<api_models::routing::StaticRoutingAlgorithm>("RoutingAlgorithm")
+                .map(RoutingAlgorithmWrapper::Static)?,
+        };
+
         Ok(Self {
             id: value.algorithm_id,
             name: value.name,
-
             profile_id: value.profile_id,
             description: value.description.unwrap_or_default(),
-            algorithm: value
-                .algorithm_data
-                .parse_value::<Algorithm>("RoutingAlgorithm")?,
+            algorithm,
             created_at: value.created_at.assume_utc().unix_timestamp(),
             modified_at: value.modified_at.assume_utc().unix_timestamp(),
             algorithm_for: value.algorithm_for,
diff --git a/crates/router/src/types/api/routing.rs b/crates/router/src/types/api/routing.rs
index d201f57eb92..ac7337d923b 100644
--- a/crates/router/src/types/api/routing.rs
+++ b/crates/router/src/types/api/routing.rs
@@ -1,9 +1,9 @@
 pub use api_models::{
     enums as api_enums,
     routing::{
-        ConnectorVolumeSplit, RoutableChoiceKind, RoutableConnectorChoice, RoutingAlgorithm,
-        RoutingAlgorithmKind, RoutingAlgorithmRef, RoutingConfigRequest, RoutingDictionary,
-        RoutingDictionaryRecord, StraightThroughAlgorithm,
+        ConnectorVolumeSplit, RoutableChoiceKind, RoutableConnectorChoice, RoutingAlgorithmKind,
+        RoutingAlgorithmRef, RoutingConfigRequest, RoutingDictionary, RoutingDictionaryRecord,
+        StaticRoutingAlgorithm, StraightThroughAlgorithm,
     },
 };
 
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 911cacf604e..ea4c98c31f1 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -1820,7 +1820,7 @@ impl From<domain::Address> for payments::AddressDetails {
     }
 }
 
-impl ForeignFrom<ConnectorSelection> for routing_types::RoutingAlgorithm {
+impl ForeignFrom<ConnectorSelection> for routing_types::StaticRoutingAlgorithm {
     fn foreign_from(value: ConnectorSelection) -> Self {
         match value {
             ConnectorSelection::Priority(connectors) => Self::Priority(connectors),

## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description

This PR introduces support for listing both static and dynamic routing algorithms under a unified API interface. To accomplish this, it refactors how routing algorithms are represented and parsed, introducing clear separation between `StaticRoutingAlgorithm` and `DynamicRoutingAlgorithm`. The new enum `RoutingAlgorithmWrapper` is used to encapsulate both types. 

Dynamic routing strategies like `EliminationBasedAlgorithm`, `SuccessBasedAlgorithm`, and `ContractBasedAlgorithm` are now modeled and tracked similarly to static rules, allowing for consistent listing and configuration.

## Outcomes

- Enables unified listing of static and dynamic routing algorithms linked to a business profile.
- Enhances the routing engine’s flexibility to support multiple dynamic strategies (e.g., success-based, elimination-based).
- Provides type-safe and structured handling of dynamic routing configurations.
- Prepares the system for future expansion (e.g., integration of new algorithm types).
- Improves API and database alignment by enabling dynamic routing references per profile.

## Diff Hunk Explanation

### `api_models/src/routing.rs`
- Added `StaticRoutingAlgorithm`, `DynamicRoutingAlgorithm`, and `RoutingAlgorithmWrapper` enums to distinguish algorithm types.
- Updated various structs to use `StaticRoutingAlgorithm` instead of the generic `RoutingAlgorithm`.
- Introduced serde wrappers with `#[serde(untagged)]` for backward-compatible JSON parsing.

### `api_models/src/events/routing.rs`
- Registered new types like `RoutingVolumeSplit` for event logging via `ApiEventMetric`.

### `router/src/core/routing.rs`
- In `retrieve_linked_routing_config`, extended logic to resolve dynamic routing references and list their metadata.
- Dynamic algorithms from the profile are resolved and listed alongside static algorithms.

### `router/src/core/routing/helpers.rs`
- Updated connector validation to work with `StaticRoutingAlgorithm`.
- Added support to validate connectors within dynamic strategies indirectly via wrapper types.

### `router/src/core/payments/routing.rs`
- Adjusted runtime routing execution to handle `StaticRoutingAlgorithm`.
- Ensured routing output from interpreters is correctly matched and handled.

### `transformers.rs`, `admin.rs`, `payments.rs`, and `stripe/types.rs`
- Refactored references and conversions to use the newly introduced `StaticRoutingAlgorithm`.


### Additional Changes

- [x] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables

<!--
Provide links to the files with corresponding changes.

Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->


## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.

If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->


## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->

### Curls for testing the flows:
1. Create a static rule:
```
curl --location 'http://127.0.0.1:8080/routing' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_IpYFqCd4DHf7x4ER1GBQrW0mHOZzam3pYyuP2tSRb6q7qvTw7jvEjF7UzjwFPXWu' \
--data '
{
    "name": "Priority rule with fallback",
    "description": "It is my ADVANCED config",
    "profile_id": "pro_INSNcGnV7dSldWXpW1GE",
    "algorithm": {
        "type": "advanced", 
        "data": {
            "defaultSelection": {
                "type": "priority",
                "data": [
                    {
                        "connector": "stripe",
                        "merchant_connector_id": "mca_gtMC3BG1m6YTX0j8hwUU"
                    }
                ]
            },
            "rules": [
                {
                    "name": "cybersource first",
                    "connectorSelection": {
                        "type": "priority",
                        "data": [
                            {
                                "connector": "stripe",
                                "merchant_connector_id": "mca_gtMC3BG1m6YTX0j8hwUU"
                            }
                        ]
                    },
                    "statements": [
                        {
                            "condition": [
                                {
                                    "lhs": "billing_country",
                                    "comparison": "equal",
                                    "value": {
                                        "type": "enum_variant",
                                        "value": "Netherlands"
                                    },
                                    "metadata": {}
                                },
                                {
                                "lhs": "amount",
                                "comparison": "greater_than",
                                "value": {
                                    "type": "number",
                                    "value": 1000
                                },
                                "metadata": {}
                            }
                            ],
                            "nested": null
                        }
                    ]
                }
            ],
            "metadata": {}
        }
    }
}
'
```

2. Retrive the rule using id
```
curl --location 'http://127.0.0.1:8080/routing/routing_v2x2BWS0Rf3QKsyc8GUU' \
--header 'api-key: dev_IpYFqCd4DHf7x4ER1GBQrW0mHOZzam3pYyuP2tSRb6q7qvTw7jvEjF7UzjwFPXWu'
```
Response
```
{
    "id": "routing_v2x2BWS0Rf3QKsyc8GUU",
    "profile_id": "pro_INSNcGnV7dSldWXpW1GE",
    "name": "Priority rule with fallback",
    "description": "It is my ADVANCED config",
    "algorithm": {
        "type": "advanced",
        "data": {
            "defaultSelection": {
                "type": "priority",
                "data": [
                    {
                        "connector": "stripe",
                        "merchant_connector_id": "mca_gtMC3BG1m6YTX0j8hwUU"
                    }
                ]
            },
            "rules": [
                {
                    "name": "cybersource first",
                    "connectorSelection": {
                        "type": "priority",
                        "data": [
                            {
                                "connector": "stripe",
                                "merchant_connector_id": "mca_gtMC3BG1m6YTX0j8hwUU"
                            }
                        ]
                    },
                    "statements": [
                        {
                            "condition": [
                                {
                                    "lhs": "billing_country",
                                    "comparison": "equal",
                                    "value": {
                                        "type": "enum_variant",
                                        "value": "Netherlands"
                                    },
                                    "metadata": {}
                                },
                                {
                                    "lhs": "amount",
                                    "comparison": "greater_than",
                                    "value": {
                                        "type": "number",
                                        "value": 1000
                                    },
                                    "metadata": {}
                                }
                            ],
                            "nested": null
                        }
                    ]
                }
            ],
            "metadata": {}
        }
    },
    "created_at": 1747996597,
    "modified_at": 1747996597,
    "algorithm_for": "payment"
}
```

3. Toggle SR routing
```
curl --location --request POST 'http://localhost:8080/account/merchant_1747967454/business_profile/pro_INSNcGnV7dSldWXpW1GE/dynamic_routing/success_based/toggle?enable=dynamic_connector_selection' \
--header 'api-key: dev_IpYFqCd4DHf7x4ER1GBQrW0mHOZzam3pYyuP2tSRb6q7qvTw7jvEjF7UzjwFPXWu'
```

4. Retrieve it using the routing id:
```
curl --location 'http://127.0.0.1:8080/routing/routing_XP894HcdwYPJqCQjQqJV' \
--header 'api-key: dev_IpYFqCd4DHf7x4ER1GBQrW0mHOZzam3pYyuP2tSRb6q7qvTw7jvEjF7UzjwFPXWu'
```
Response:
```
{
    "id": "routing_XP894HcdwYPJqCQjQqJV",
    "profile_id": "pro_INSNcGnV7dSldWXpW1GE",
    "name": "Success rate based dynamic routing algorithm",
    "description": "",
    "algorithm": {
        "params": [
            "PaymentMethod"
        ],
        "config": {
            "min_aggregates_size": 2,
            "default_success_rate": 100.0,
            "max_aggregates_size": 3,
            "current_block_threshold": {
                "duration_in_mins": 5,
                "max_total_count": 2
            },
            "specificity_level": "merchant"
        }
    },
    "created_at": 1747967494,
    "modified_at": 1747967494,
    "algorithm_for": "payment"
}
```

5. Toggle elimination routing
```
curl --location --request POST 'http://localhost:8080/account/merchant_1747967454/business_profile/pro_INSNcGnV7dSldWXpW1GE/dynamic_routing/elimination/toggle?enable=dynamic_connector_selection' \
--header 'api-key: dev_IpYFqCd4DHf7x4ER1GBQrW0mHOZzam3pYyuP2tSRb6q7qvTw7jvEjF7UzjwFPXWu'
```
6. Retrieve it using the routing id:
```
curl --location 'http://127.0.0.1:8080/routing/routing_XP894HcdwYPJqCQjQqJV' \
--header 'api-key: dev_IpYFqCd4DHf7x4ER1GBQrW0mHOZzam3pYyuP2tSRb6q7qvTw7jvEjF7UzjwFPXWu'
```
Response:
```
{
    "id": "routing_ZlQZoyVildA7HusIfehn",
    "profile_id": "pro_INSNcGnV7dSldWXpW1GE",
    "name": "Elimination based dynamic routing algorithm",
    "description": "",
    "algorithm": {
        "params": [
            "PaymentMethod"
        ],
        "elimination_analyser_config": {
            "bucket_size": 5,
            "bucket_leak_interval_in_secs": 60
        }
    },
    "created_at": 1747968281,
    "modified_at": 1747968281,
    "algorithm_for": "payment"
}
```
5. Toggle contract based routing
```
curl --location 'http://localhost:8080/account/merchant_1747967454/business_profile/pro_INSNcGnV7dSldWXpW1GE/dynamic_routing/contracts/toggle?enable=dynamic_connector_selection' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_IpYFqCd4DHf7x4ER1GBQrW0mHOZzam3pYyuP2tSRb6q7qvTw7jvEjF7UzjwFPXWu' \
--data '
{
    "config": null,
    "label_info": null
}'
```
6. Retrieve it using the routing id:
```
curl --location 'http://127.0.0.1:8080/routing/routing_XP894HcdwYPJqCQjQqJV' \
--header 'api-key: dev_IpYFqCd4DHf7x4ER1GBQrW0mHOZzam3pYyuP2tSRb6q7qvTw7jvEjF7UzjwFPXWu'
```
Response:
```
{
    "id": "routing_C13lGF4NR613rAyuUsuZ",
    "profile_id": "pro_INSNcGnV7dSldWXpW1GE",
    "name": "Contract based dynamic routing algorithm",
    "description": "",
    "algorithm": {
        "config": null,
        "label_info": null
    },
    "created_at": 1747998023,
    "modified_at": 1747998023,
    "algorithm_for": "payment"
}
```


7. Volume between routing types
```
curl --location --request POST 'http://localhost:8080/account/merchant_1747967454/business_profile/pro_INSNcGnV7dSldWXpW1GE/dynamic_routing/set_volume_split?split=100' \
--header 'api-key: dev_IpYFqCd4DHf7x4ER1GBQrW0mHOZzam3pYyuP2tSRb6q7qvTw7jvEjF7UzjwFPXWu'
```
Response
```
{
    "routing_type": "dynamic",
    "split": 100
}
```
8. List active configs
toggle SR, toggle ER
create a static rule and activate it
```
curl --location 'http://localhost:8080/routing/active' \
--header 'api-key: dev_IpYFqCd4DHf7x4ER1GBQrW0mHOZzam3pYyuP2tSRb6q7qvTw7jvEjF7UzjwFPXWu'
```

Response
3 values should come
```
[
    {
        "id": "routing_j9omIKybJb6jw2PIwFhQ",
        "profile_id": "pro_INSNcGnV7dSldWXpW1GE",
        "name": "Priority rule with fallback",
        "kind": "advanced",
        "description": "It is my ADVANCED config",
        "created_at": 1748005058,
        "modified_at": 1748005058,
        "algorithm_for": "payment",
        "decision_engine_routing_id": null
    },
    {
        "id": "routing_ZlQZoyVildA7HusIfehn",
        "profile_id": "pro_INSNcGnV7dSldWXpW1GE",
        "name": "Elimination based dynamic routing algorithm",
        "kind": "dynamic",
        "description": "",
        "created_at": 1747968281,
        "modified_at": 1747968281,
        "algorithm_for": "payment",
        "decision_engine_routing_id": null
    },
    {
        "id": "routing_4E6HvDyeOUJKs3ncGDk7",
        "profile_id": "pro_INSNcGnV7dSldWXpW1GE",
        "name": "Contract based dynamic routing algorithm",
        "kind": "dynamic",
        "description": "",
        "created_at": 1748005049,
        "modified_at": 1748005049,
        "algorithm_for": "payment",
        "decision_engine_routing_id": null
    }
]
```

## Checklist
<!-- Put an `x` in the boxes that apply -->

- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
