curl --request POST \
--url https://sandbox.hyperswitch.io/routing/rule/evaluate \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--data '
{
"created_by": "profile_123",
"parameters": {},
"fallback_output": [
{
"gateway_id": "authipay_1705"
}
],
"payment_id": "pay_abc123"
}
'import requests
url = "https://sandbox.hyperswitch.io/routing/rule/evaluate"
payload = {
"created_by": "profile_123",
"parameters": {},
"fallback_output": [{ "gateway_id": "authipay_1705" }],
"payment_id": "pay_abc123"
}
headers = {
"api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
created_by: 'profile_123',
parameters: {},
fallback_output: [{gateway_id: 'authipay_1705'}],
payment_id: 'pay_abc123'
})
};
fetch('https://sandbox.hyperswitch.io/routing/rule/evaluate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.hyperswitch.io/routing/rule/evaluate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'created_by' => 'profile_123',
'parameters' => [
],
'fallback_output' => [
[
'gateway_id' => 'authipay_1705'
]
],
'payment_id' => 'pay_abc123'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.hyperswitch.io/routing/rule/evaluate"
payload := strings.NewReader("{\n \"created_by\": \"profile_123\",\n \"parameters\": {},\n \"fallback_output\": [\n {\n \"gateway_id\": \"authipay_1705\"\n }\n ],\n \"payment_id\": \"pay_abc123\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.hyperswitch.io/routing/rule/evaluate")
.header("api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"created_by\": \"profile_123\",\n \"parameters\": {},\n \"fallback_output\": [\n {\n \"gateway_id\": \"authipay_1705\"\n }\n ],\n \"payment_id\": \"pay_abc123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.hyperswitch.io/routing/rule/evaluate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"created_by\": \"profile_123\",\n \"parameters\": {},\n \"fallback_output\": [\n {\n \"gateway_id\": \"authipay_1705\"\n }\n ],\n \"payment_id\": \"pay_abc123\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"output": "<unknown>",
"evaluated_output": [
{
"connector": "absa_sanlam",
"merchant_connector_id": "<string>"
}
],
"eligible_connectors": [
{
"connector": "absa_sanlam",
"merchant_connector_id": "<string>"
}
]
}Routing - Rule Evaluate
Evaluate routing rules
curl --request POST \
--url https://sandbox.hyperswitch.io/routing/rule/evaluate \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--data '
{
"created_by": "profile_123",
"parameters": {},
"fallback_output": [
{
"gateway_id": "authipay_1705"
}
],
"payment_id": "pay_abc123"
}
'import requests
url = "https://sandbox.hyperswitch.io/routing/rule/evaluate"
payload = {
"created_by": "profile_123",
"parameters": {},
"fallback_output": [{ "gateway_id": "authipay_1705" }],
"payment_id": "pay_abc123"
}
headers = {
"api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
created_by: 'profile_123',
parameters: {},
fallback_output: [{gateway_id: 'authipay_1705'}],
payment_id: 'pay_abc123'
})
};
fetch('https://sandbox.hyperswitch.io/routing/rule/evaluate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.hyperswitch.io/routing/rule/evaluate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'created_by' => 'profile_123',
'parameters' => [
],
'fallback_output' => [
[
'gateway_id' => 'authipay_1705'
]
],
'payment_id' => 'pay_abc123'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.hyperswitch.io/routing/rule/evaluate"
payload := strings.NewReader("{\n \"created_by\": \"profile_123\",\n \"parameters\": {},\n \"fallback_output\": [\n {\n \"gateway_id\": \"authipay_1705\"\n }\n ],\n \"payment_id\": \"pay_abc123\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.hyperswitch.io/routing/rule/evaluate")
.header("api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"created_by\": \"profile_123\",\n \"parameters\": {},\n \"fallback_output\": [\n {\n \"gateway_id\": \"authipay_1705\"\n }\n ],\n \"payment_id\": \"pay_abc123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.hyperswitch.io/routing/rule/evaluate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"created_by\": \"profile_123\",\n \"parameters\": {},\n \"fallback_output\": [\n {\n \"gateway_id\": \"authipay_1705\"\n }\n ],\n \"payment_id\": \"pay_abc123\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"output": "<unknown>",
"evaluated_output": [
{
"connector": "absa_sanlam",
"merchant_connector_id": "<string>"
}
],
"eligible_connectors": [
{
"connector": "absa_sanlam",
"merchant_connector_id": "<string>"
}
]
}Authorizations
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.
Body
Request body used to evaluate routing rules.
This API evaluates routing logic based on dynamic parameters like payment method, amount, country, card_bin, etc.
Identifier of the user/system triggering routing evaluation.
Example:
"created_by": "some_id"
"profile_123"
Dynamic parameters used during routing evaluation.
Each key represents a routing attribute.
Example fields:
payment_methodpayment_method_typeamountcurrencyauthentication_typecard_bincapture_methodbusiness_countrybilling_countrybusiness_labelsetup_future_usagecard_networkpayment_typemandate_typemandate_acceptance_typemetadata
Example:
{
"payment_method": { "type": "enum_variant", "value": "card" },
"amount": { "type": "number", "value": 10 },
"currency": { "type": "str_value", "value": "INR" },
"authentication_type": { "type": "enum_variant", "value": "three_ds" },
"card_bin": { "type": "str_value", "value": "424242" },
"business_country": { "type": "str_value", "value": "IN" },
"setup_future_usage": { "type": "enum_variant", "value": "off_session" },
"card_network": { "type": "enum_variant", "value": "visa" },
"metadata": {
"type": "metadata_variant",
"value": { "key": "key1", "value": "value1" }
}
}
For the complete superset of supported routing keys,
refer to routing_configs.keys in:
https://github.com/juspay/decision-engine/blob/main/config/development.toml
Fallback connectors used if routing rule evaluation fails.
These connectors will be returned if no rule matches.
Example:
[
{
"gateway_name": "stripe",
"gateway_id": "mca_123"
}
]
Show child attributes
Show child attributes
Payment ID for debugging and tracing routing decisions.
Example:
"payment_id": "pay_abc123"
"pay_abc123"
Response
Routing rules evaluated successfully
Response returned after routing evaluation.
Contains:
- Routing status
- Raw output structure (priority / volume_split)
- Final evaluated connectors
- Eligible connectors list
Status of routing evaluation.
Example:
"success"
"success"
Raw routing output returned by routing engine.
Possible structures:
- Volume Split:
{
"type": "volume_split",
"splits": [
{
"connector": { "gateway_name": "adyen", "gateway_id": "mca_124" },
"split": 60
},
{
"connector": { "gateway_name": "stripe", "gateway_id": "mca_123" },
"split": 40
}
]
}
- Priority:
{
"type": "priority",
"connectors": [
{ "gateway_name": "stripe", "gateway_id": "mca_123" },
{ "gateway_name": "adyen", "gateway_id": "mca_124" }
]
}
Final connector(s) selected after evaluation.
Example:
[
{
"connector": "stripe",
"merchant_connector_id": "mca_123"
}
]
Show child attributes
Show child attributes
Show child attributes
Show child attributes