Create a Routing

Creates a routing for one (account_id, payment_method) pair. Each routing references connections by their connection_id. Make sure your connections are created and ACTIVE for the requested payment_method before you call routing.

Body

account_idstring (UUID)required

The merchant account ID this routing rule applies to.

payment_methodenumrequired

E.g., CARD, PIX, WALLET. Immutable per routing — to route a different method, create a new routing.

namestringrequired

Free-form label.

default_routeobjectrequired

The route used when no condition_sets[] matches.

Hide properties
stepsobject[]required

Each step is one provider attempt. index values are contiguous starting at 1.

Hide item
indexintegerrequired

Step ordinal.

provider_idstringrequired

Must match the provider of the connection.

connection_idUUIDrequired

Must be ACTIVE and support the payment_method.

outputobject[]

Defines how to handle each possible outcome of this step.

Hide item
statusstringrequired

The outcome status that triggers this rule (e.g., APPROVED, DECLINED, DECLINE_GROUP, TIMEOUT, INTERNAL_ERROR).

decline_typesstring[]

Required when status is DECLINE_GROUP. Specifies which decline subtypes trigger this rule (e.g., INSUFFICIENT_FUNDS, DECLINED_BY_BANK).

nextinteger

The index of the next step to execute. Omit if no fallback is needed.

condition_setsobject[]

Optional. Ordered by sort_number — first matching set wins.

Hide item
sort_numberintegerrequired

Priority of the condition set.

namestringrequired

Label for the set.

conditionsobject[]required

List of Conditions that must match.

routeobjectrequired

The steps to execute if this set matches.

Response

idstring

Unique identifier for the routing.

account_idstring

Unique identifier for the account.

payment_methodenum

The payment method this routing applies to (e.g., CARD).

namestring

Label for the routing.

default_routeobject

The default routing logic.

condition_setsobject[]

Optional conditional logic.

created_atstring

ISO 8601 timestamp.

updated_atstring

ISO 8601 timestamp.

cURL
curl -X POST 'https://api.whitelabel.com/v1/routing' \
  -H 'public-api-key: <YOUR_PUBLIC_KEY>' \
  -H 'private-secret-key: <YOUR_SECRET_KEY>' \
  -H 'Content-Type: application/json' \
  -H 'X-Idempotency-Key: <UUID>' \
  -d '{
    "account_id": "7825fc5e-e50a-4248-9ae8-5d3786afb0be",
    "payment_method": "CARD",
    "name": "Card routing — Stripe primary, Adyen fallback",
    "default_route": {
      "steps": [
        {
          "index": 1,
          "provider_id": "STRIPE",
          "connection_id": "f1a3c4d5-7b8e-4a2c-9d1e-3f4a5b6c7d8e",
          "output": [
            {
              "status": "DECLINE_GROUP",
              "decline_types": ["DECLINED_BY_BANK", "DO_NOT_HONOR"],
              "next": 2
            },
            { "status": "TIMEOUT",        "next": 2 },
            { "status": "INTERNAL_ERROR", "next": 2 }
          ]
        },
        {
          "index": 2,
          "provider_id": "ADYEN",
          "connection_id": "b2c4d5e6-1a2b-3c4d-5e6f-7a8b9c0d1e2f"
        }
      ]
    },
    "condition_sets": [
      {
        "sort_number": 1,
        "name": "Brazil — BRL 300 to 600 via Adyen",
        "description": "BR card transactions between BRL 300 and 600 go to Adyen directly",
        "conditions": [
          { "condition_type": "COUNTRY", "conditional": "EQUAL",   "values": ["BR"] },
          { "condition_type": "AMOUNT",  "conditional": "BETWEEN", "values": ["300.00", "600.00"], "currency": "BRL" }
        ],
        "route": {
          "steps": [
            { "index": 1, "provider_id": "ADYEN", "connection_id": "b2c4d5e6-..." }
          ]
        }
      }
    ]
  }'
201 Created
{
  "id": "r_8f2c1d3e-4b5a-6c7d-8e9f-0a1b2c3d4e5f",
  "account_id": "acc-uuid",
  "payment_method": "CARD",
  "name": "Card routing — Stripe primary, Adyen fallback",
  "default_route": {
    "steps": [
      {
        "index": 1,
        "provider_id": "STRIPE",
        "connection_id": "f1a3c4d5-7b8e-4a2c-9d1e-3f4a5b6c7d8e",
        "output": [
          { "status": "DECLINE_GROUP", "next": 2 },
          { "status": "TIMEOUT",        "next": 2 }
        ]
      },
      { "index": 2, "provider_id": "ADYEN", "connection_id": "b2c4d5e6-..." }
    ]
  },
  "condition_sets": [
    {
      "sort_number": 1,
      "name": "Brazil — BRL 300 to 600 via Adyen",
      "conditions": [
        { "condition_type": "COUNTRY", "conditional": "EQUAL", "values": ["BR"] }
      ],
      "route": { "steps": ["..."] }
    }
  ],
  "created_at": "2026-05-12T14:30:00Z",
  "updated_at": "2026-05-12T14:30:00Z"
}
400 — Non-contiguous Index
{
  "code": "ROUTING_VALIDATION_FAILED",
  "messages": ["default_route.steps[].index must be contiguous starting at 1"]
}
409 — Already Exists
{
  "code": "ROUTING_ALREADY_EXISTS",
  "messages": ["A routing already exists for account 'acc-uuid' and payment_method 'CARD'"]
}

Errors

HTTPcode
400ROUTING_VALIDATION_FAILED
Schema or rule violation. messages names the offending field/path.
400ROUTING_PROVIDER_NOT_AVAILABLE
A step references a (provider_id, connection_id) not active for the account on this payment_method.
409ROUTING_ALREADY_EXISTS
A routing already exists for this (account, payment_method). Use PATCH to update it.
401NOT_AUTHENTICATED
Missing public-api-key or private-secret-key header.
401INVALID_CREDENTIALS
Wrong key pair, or a Dashboard Customized API key was used. Use an account key or organization key instead.
POST/routing

Creates a routing for one (account_id, payment_method) pair.

Header Parameters

X-Idempotency-Keystringrequired

Body application/json

account_idstring<uuid>required
payment_methodstringrequired
namestringrequired
default_routeobjectrequired
Show default_route properties
stepsobject[]required
Show steps properties
indexintegerrequired
provider_idstringrequired
connection_idstring<uuid>required

Response

Created

idstring
account_idstring
payment_methodstring
namestring
default_routeobject
Show default_route properties
stepsobject[]
Show steps properties
indexinteger
provider_idstring
connection_idstring
condition_setsobject[]
Show condition_sets properties
sort_numberinteger
namestring
conditionsobject[]
routeobject
created_atstring<date-time>
updated_atstring<date-time>
warningsstring[]

Bad Request

codestring
messagesstring[]

Unauthorized

codestring
messagesstring[]

Conflict

codestring
messagesstring[]
Request
curl -X POST "https://api-sandbox.whitelabel.com/v1/routing" \
  -H "Content-Type: application/json" \
  -H "X-Idempotency-Key: <X-Idempotency-Key>" \
  -H "PUBLIC-API-KEY: <PUBLIC-API-KEY>" \
  -H "PRIVATE-SECRET-KEY: <PRIVATE-SECRET-KEY>" \
  -d '{
  "account_id": "7825fc5e-e50a-4248-9ae8-5d3786afb0be",
  "payment_method": "CARD",
  "name": "Card routing",
  "default_route": {
    "steps": [
      {
        "index": 1,
        "provider_id": "STRIPE",
        "connection_id": "f1a3c4d5-7b8e-4a2c-9d1e-3f4a5b6c7d8e"
      }
    ]
  }
}'
Response
{
  "id": "r_8f2c1d3e-4b5a-6c7d-8e9f-0a1b2c3d4e5f",
  "account_id": "acc-uuid",
  "payment_method": "CARD",
  "name": "Card routing",
  "default_route": {
    "steps": [
      {
        "index": 1,
        "provider_id": "STRIPE",
        "connection_id": "f1a3c4d5-..."
      }
    ]
  },
  "condition_sets": [
    {
      "sort_number": 1,
      "name": "High Value US",
      "conditions": [
        {}
      ],
      "route": {}
    }
  ],
  "created_at": "2026-05-12T14:30:00Z",
  "updated_at": "2026-05-12T14:30:00Z",
  "warnings": [
    "MONITOR_REDISTRIBUTION_DEFERRED"
  ]
}