Skip to content

Routing Rail

Payment routing, rules engine, and intelligent transaction routing.

The Routing Rail provides endpoints for configuring payment routing rules, optimizing transaction paths, and managing failover strategies.

/api/v1/routing
POST /api/v1/routing/route

Determine optimal route for a transaction.

Request Body:

{
"transactionType": "TRANSFER",
"amount": "50000.00",
"currency": "SAR",
"sourceCountry": "SAU",
"destinationCountry": "UAE",
"priority": "COST",
"metadata": {
"customerId": "cust_123"
}
}

Response:

{
"data": {
"routeId": "rt_abc123",
"selectedRoute": {
"provider": "SWIFT",
"corridor": "SAU_UAE",
"estimatedFee": "50.00",
"estimatedTime": "1-2 business days",
"cutoffTime": "14:00 AST"
},
"alternativeRoutes": [
{
"provider": "LOCAL_CLEARING",
"estimatedFee": "25.00",
"estimatedTime": "Same day"
}
]
}
}
POST /api/v1/routing/rules

Create a routing rule.

Request Body:

{
"name": "High Value SWIFT",
"priority": 100,
"conditions": {
"amount": { "gte": "100000.00" },
"currency": ["SAR", "AED", "USD"],
"transactionType": "TRANSFER"
},
"action": {
"route": "SWIFT",
"provider": "PROVIDER_A"
},
"active": true
}
GET /api/v1/routing/rules

List all routing rules.

PATCH /api/v1/routing/rules/:ruleId

Update a routing rule.

POST /api/v1/routing/rules/test

Test rules against a sample transaction.

Request Body:

{
"transactionType": "TRANSFER",
"amount": "150000.00",
"currency": "SAR",
"destinationCountry": "UAE"
}
GET /api/v1/routing/providers/status

Get status of routing providers.

Response:

{
"data": [
{
"provider": "SWIFT",
"status": "OPERATIONAL",
"latency": 250,
"successRate": 0.998
},
{
"provider": "LOCAL_CLEARING",
"status": "DEGRADED",
"latency": 500,
"successRate": 0.95
}
]
}
POST /api/v1/routing/failover

Configure failover rules.

Request Body:

{
"primaryRoute": "SWIFT",
"failoverRoutes": ["LOCAL_CLEARING", "CORRESPONDENT"],
"triggerConditions": {
"errorRate": 0.05,
"latency": 5000
},
"autoRecover": true
}
PriorityDescription
COSTMinimize transaction cost
SPEEDFastest delivery
RELIABILITYMost reliable route
COMPLIANCEStrictest compliance
ConditionTypeDescription
amountobjectAmount range (gte, lte)
currencyarrayAllowed currencies
sourceCountryarraySource countries
destinationCountryarrayDestination countries
transactionTypearrayTransaction types
customerIdstringSpecific customer
EventDescription
routing.route.selectedRoute selected
routing.failover.triggeredFailover activated
routing.provider.degradedProvider degraded
routing.rule.matchedRule matched