Create a routing Rule

Create a routing rule in the Intelligent Router.

Endpoint: POST / euclid.EuclidService / Create

Try it: https://api.example.com/euclid.EuclidService/Create

cURL
curl --request POST \
  --url https://api.example.com/euclid.EuclidService/Create \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <x-api-key>' \
  --header 'x-profile-id: <x-profile-id>' \
  --header 'x-tenant-id: <x-tenant-id>' \
  --data '
{
  "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": {}
  }
}
'

Response (200)


Headers (required)

  • x-tenant-id — string

  • x-profile-id — string

  • x-api-key — string

  • Content-Type: application/json


Body (application/json)

Example:


Response fields

  • algorithm_id — string Algorithm Id for the routing rule. Example: "routing_ec1ac351-7944-440f-bdc7-6a500df1116f"

  • name — string Name of the routing rule. Example: "test routing rule"

  • created_at — string Timestamp for creation of routing rule. Example: "2025-04-09 8:03:44.85588"

  • modified_at — string Timestamp for modification of routing rule. Example: "2025-04-09 8:03:44.85588"


Suggest edits: https://github.com/juspay/hyperswitch/edit/main/api-reference/intelligent-router-api-reference/static-routing/create-a-routing-rule.mdx Raise issue: https://github.com/juspay/hyperswitch/issues/new?title=Issue%20on%20docs&body=Path:%20/intelligent-router-api-reference/static-routing/create-a-routing-rule