api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-create.mdx
Use /routing/create to persist a merchant-scoped routing algorithm. Creating an algorithm does not make it active; call /routing/activate after creation.
Supported algorithm.type values:
| Type | Use case | Full example |
|---|---|---|
single | Always return one connector. | Single connector |
priority | Return connectors in the configured order. | Priority routing |
volume_split | Split decisions by percentage. | Volume split |
advanced | Evaluate AND/OR/nested conditions before returning an output. | Advanced routing |
ab_test | Split traffic between a control and variant strategy with guardrails and significance testing. | A/B testing |
Use /routing/deactivate to deactivate the currently active algorithm without deleting it, and update or delete an inactive algorithm in place.
curl --location "$BASE_URL/routing/create" \
--header "$AUTH_HEADER" \
--header "Content-Type: application/json" \
--data '{
"name": "priority rule",
"created_by": "merchant_demo",
"description": "try stripe before adyen",
"algorithm_for": "payment",
"algorithm": {
"type": "priority",
"data": [
{ "gateway_name": "stripe", "gateway_id": "mca_111" },
{ "gateway_name": "adyen", "gateway_id": "mca_112" }
]
}
}'
curl --location "$BASE_URL/routing/create" \
--header "$AUTH_HEADER" \
--header "Content-Type: application/json" \
--data '{
"name": "single connector rule",
"created_by": "merchant_demo",
"description": "always route to stripe",
"algorithm_for": "payment",
"algorithm": {
"type": "single",
"data": { "gateway_name": "stripe", "gateway_id": "mca_111" }
}
}'
curl --location "$BASE_URL/routing/create" \
--header "$AUTH_HEADER" \
--header "Content-Type: application/json" \
--data '{
"name": "volume split rule",
"created_by": "merchant_demo",
"description": "split traffic between stripe and adyen",
"algorithm_for": "payment",
"algorithm": {
"type": "volume_split",
"data": [
{
"split": 70,
"output": { "gateway_name": "stripe", "gateway_id": "mca_111" }
},
{
"split": 30,
"output": { "gateway_name": "adyen", "gateway_id": "mca_112" }
}
]
}
}'
Use advanced for conditional routing. The complete AND/OR/nested reference is in Advanced Routing Example.
curl --location "$BASE_URL/routing/create" \
--header "$AUTH_HEADER" \
--header "Content-Type: application/json" \
--data '{
"name": "advanced card rule",
"created_by": "merchant_demo",
"description": "route Visa cards to adyen first",
"algorithm_for": "payment",
"algorithm": {
"type": "advanced",
"data": {
"globals": {},
"default_selection": {
"priority": [{ "gateway_name": "stripe", "gateway_id": "mca_111" }]
},
"rules": [
{
"name": "visa_card_rule",
"routing_type": "priority",
"output": {
"priority": [
{ "gateway_name": "adyen", "gateway_id": "mca_112" },
{ "gateway_name": "stripe", "gateway_id": "mca_111" }
]
},
"statements": [
{
"condition": [
{
"lhs": "card_network",
"comparison": "equal",
"value": { "type": "enum_variant", "value": "Visa" },
"metadata": {}
}
],
"nested": null
}
]
}
],
"metadata": {}
}
}
}'
{
"rule_id": "routing_e641380c-6f24-4405-8454-5ae6cbceb7a0",
"name": "priority rule",
"created_at": "2026-04-25 11:45:03",
"modified_at": "2026-04-25 11:45:03"
}