Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

docs: add api-refs for decision engine with multi-objective routing (#13425)

Gaurav Rawat34e71c3e4391
diff --git a/api-reference/decision-engine-api-reference/analytics.mdx b/api-reference/decision-engine-api-reference/analytics.mdx
new file mode 100644
index 0000000000..eb5d8ac754
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/analytics.mdx
@@ -0,0 +1,96 @@
+---
+title: "Analytics"
+description: "Routing metrics, score snapshots, and operational summaries"
+---
+
+## What It Shows
+
+Analytics is the operator-facing view for understanding how routing is behaving in practice.
+
+The page is split into these sections:
+
+- Overview
+- Gateway Scoring
+- Decisions
+- Routing Stats
+- Logs / Summaries
+
+For single-payment inspection, use the separate Payment Audit surface documented in [`payment-audit`](/decision-engine-api-reference/payment-audit).
+
+## Data Sources
+
+The current implementation uses these sources:
+
+- Redis for live SR and latency snapshots
+- Prometheus for live counters and error-rate tiles
+- ClickHouse as the analytics event store and analytics query backend
+
+## Scope
+
+Analytics is always merchant-scoped by the authenticated identity:
+
+- Bearer JWT requests derive the merchant from the token claims
+- API-key requests derive the merchant from the key binding
+
+There is no all-merchants analytics mode. The analytics routes no longer accept `scope` or
+`merchant_id` query params, and changing the merchant selector in the top bar does not widen the
+backend query scope.
+
+Connector success-rate history is sourced from stored `score_snapshot` analytics events, not directly from Redis. Redis remains the live source for current score state. The connector SR chart can be narrowed by:
+
+- `payment_method_type`
+- `payment_method`
+- connector
+
+## Generating Demo Traffic
+
+To populate Analytics and Decision Audit with real traffic, use the routing traffic generator.
+
+Generate traffic for `merchant_space`:
+
+```bash
+bash scripts/generate-routing-traffic.sh
+```
+
+What the script does:
+
+- creates or reuses `merchant_space`
+- enables success-rate routing for that merchant through the real `/rule/create` or `/rule/update` flow
+- sends `100` real `POST /decide-gateway` requests with mixed payment-method combinations
+- follows each decision with `POST /update-gateway-score` using a mix of successful and failed outcomes
+- creates and activates a priority-based routing rule through `/routing/create` and `/routing/activate`
+- sends rule-based `POST /routing/evaluate` traffic so the rule-evaluation analytics path is populated
+
+Useful overrides:
+
+```bash
+MERCHANT_ID=merchant_space TOTAL_PAYMENTS=100 bash scripts/generate-routing-traffic.sh
+RULE_EVALUATIONS=40 bash scripts/generate-routing-traffic.sh
+CONNECTORS_CSV=stripe,adyen,checkout,paypal bash scripts/generate-routing-traffic.sh
+```
+
+After the script finishes, sign in as `merchant_space` and open `/dashboard/analytics` or
+`/dashboard/audit`. Analytics reads will resolve the merchant from your authenticated session.
+
+## ClickHouse Setup
+
+ClickHouse is part of the standard local runtime stacks. To bring up only ClickHouse and its schema init job:
+
+```bash
+COMPOSE_PROFILES= docker compose --profile analytics-clickhouse up -d
+```
+
+## Related Files
+
+- `website/src/components/pages/AnalyticsPage.tsx`
+- `website/src/components/layout/Sidebar.tsx`
+- `src/routes/analytics.rs`
+- `src/analytics/`
+- `clickhouse/scripts/`
+- `src/metrics.rs`
+
+## Related Docs
+
+- [Payment Audit](/decision-engine-api-reference/payment-audit) — single-payment timeline lookups.
+- [ClickHouse Analytics](/decision-engine-api-reference/clickhouse-analytics) — the underlying ingestion pipeline and schema.
+- [Dashboard](/decision-engine-api-reference/dashboard-guide) — where these views are surfaced.
diff --git a/api-reference/decision-engine-api-reference/api-reference.md b/api-reference/decision-engine-api-reference/api-reference.md
new file mode 100644
index 0000000000..e0ae64859d
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference.md
@@ -0,0 +1,107 @@
+---
+title: "API Reference"
+description: "Schema-backed reference for every Decision Engine endpoint, with request/response models and an interactive playground."
+---
+
+# API Reference
+
+This is the schema-backed reference for every Decision Engine endpoint. Each page below shows the full request and response model and includes an interactive playground, generated from the OpenAPI contract.
+
+Looking for copy-paste examples and end-to-end flows instead? Start with the [API Guide](/decision-engine-api-reference/api-reference/guides/api-ref).
+
+## Two ways to read the API
+
+| Surface | Best for |
+| --- | --- |
+| [API Guide](/decision-engine-api-reference/api-reference/guides/api-ref) | Task-oriented `curl` examples, complete flows, and request variants. |
+| API Reference (this section) | Exact request/response schemas and an interactive playground, one page per endpoint. |
+
+For advanced rule examples — AND, OR, nested AND+OR, `volume_split_priority`, enum arrays, and number-array matching — see the [Advanced Routing Example](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-advanced-example). For the exact `POST /routing/create` schema, use [Create Routing Rule](/decision-engine-api-reference/api-reference/endpoint/routing-rules/createRoutingRule).
+
+## Access classes
+
+| Class | Routes | Authentication |
+| --- | --- | --- |
+| Public | `GET /health`, `GET /health/ready`, `GET /health/diagnostics`, `POST /auth/signup`, `POST /auth/login` | None |
+| Admin bootstrap | `POST /merchant-account/create` | Admin secret |
+| Protected | All routing, decision, score update, rule config, API key, merchant read/delete, analytics, audit, config, and authenticated auth routes | `Authorization: Bearer <jwt_token>` or `x-api-key: <api_key>` |
+| Sandbox | Any Decision Engine route served through `https://sandbox.hyperswitch.io` | Same auth rules plus `x-feature: decision-engine` |
+
+## Endpoint Families
+
+### Health
+
+- [Health Check](/decision-engine-api-reference/api-reference/endpoint/health/healthCheck)
+- [Health Ready](/decision-engine-api-reference/api-reference/endpoint/health/healthReady)
+- [Health Diagnostics](/decision-engine-api-reference/api-reference/endpoint/health/healthDiagnostics)
+
+### Auth And Onboarding
+
+- [Signup](/decision-engine-api-reference/api-reference/endpoint/auth/signup)
+- [Login](/decision-engine-api-reference/api-reference/endpoint/auth/login)
+- [Logout](/decision-engine-api-reference/api-reference/endpoint/auth/logout)
+- [Current User](/decision-engine-api-reference/api-reference/endpoint/auth/me)
+- [List User Merchants](/decision-engine-api-reference/api-reference/endpoint/auth/listUserMerchants)
+- [Switch Merchant](/decision-engine-api-reference/api-reference/endpoint/auth/switchMerchant)
+- [Onboard Merchant](/decision-engine-api-reference/api-reference/endpoint/auth/onboardMerchant)
+
+### API Keys
+
+- [Create API Key](/decision-engine-api-reference/api-reference/endpoint/auth/createApiKey)
+- [List API Keys](/decision-engine-api-reference/api-reference/endpoint/auth/listApiKeys)
+- [Revoke API Key](/decision-engine-api-reference/api-reference/endpoint/auth/revokeApiKey)
+
+### Merchant Account
+
+- [Create Merchant](/decision-engine-api-reference/api-reference/endpoint/merchant-account/createMerchant)
+- [Get Merchant](/decision-engine-api-reference/api-reference/endpoint/merchant-account/getMerchant)
+- [Delete Merchant](/decision-engine-api-reference/api-reference/endpoint/merchant-account/deleteMerchant)
+- [Get Merchant Debit Routing](/decision-engine-api-reference/api-reference/endpoint/merchant-account/getMerchantDebitRouting)
+- [Update Merchant Debit Routing](/decision-engine-api-reference/api-reference/endpoint/merchant-account/updateMerchantDebitRouting)
+
+### Gateway Decision
+
+- [Decide Gateway](/decision-engine-api-reference/api-reference/endpoint/gateway-decision/decideGateway)
+- [Legacy Decision Gateway](/decision-engine-api-reference/api-reference/endpoint/compatibility/legacyDecisionGateway)
+- [Update Gateway Score](/decision-engine-api-reference/api-reference/endpoint/score-feedback/updateGatewayScore)
+- [Legacy Update Score](/decision-engine-api-reference/api-reference/endpoint/compatibility/legacyUpdateScore)
+
+### Routing Rules
+
+- [Create Routing Rule](/decision-engine-api-reference/api-reference/endpoint/routing-rules/createRoutingRule)
+- [Activate Routing Rule](/decision-engine-api-reference/api-reference/endpoint/routing-rules/activateRoutingRule)
+- [Deactivate Routing Rule](/decision-engine-api-reference/api-reference/endpoint/routing-rules/deactivateRoutingRule)
+- [List Routing Rules](/decision-engine-api-reference/api-reference/endpoint/routing-rules/listRoutingRules)
+- [Get Active Routing Rule](/decision-engine-api-reference/api-reference/endpoint/routing-rules/getActiveRoutingRule)
+- [Evaluate Routing Rule](/decision-engine-api-reference/api-reference/endpoint/routing-rules/evaluateRoutingRule)
+- [Hybrid Routing](/decision-engine-api-reference/api-reference/endpoint/routing-rules/hybridRouting)
+
+### Rule Configuration
+
+- [Create Rule Config](/decision-engine-api-reference/api-reference/endpoint/rule-configuration/createRuleConfig)
+- [Get Rule Config](/decision-engine-api-reference/api-reference/endpoint/rule-configuration/getRuleConfig)
+- [Update Rule Config](/decision-engine-api-reference/api-reference/endpoint/rule-configuration/updateRuleConfig)
+- [Delete Rule Config](/decision-engine-api-reference/api-reference/endpoint/rule-configuration/deleteRuleConfig)
+
+### Config
+
+- [Get Routing Config](/decision-engine-api-reference/api-reference/endpoint/compatibility/getRoutingConfig)
+- [Configure SR Dimensions](/decision-engine-api-reference/api-reference/endpoint/compatibility/configSrDimension)
+
+### Analytics
+
+- [Overview](/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsOverview)
+- [Gateway Scores](/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsGatewayScores)
+- [Decisions](/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsDecisions)
+- [Routing Stats](/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsRoutingStats)
+- [Log Summaries](/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsLogSummaries)
+- [Payment Audit](/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsPaymentAudit)
+- [Preview Trace](/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsPreviewTrace)
+- [Cost Savings](/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsCostSavings)
+- [Routing Events](/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsRoutingEvents)
+- [A/B Test Experiment Results](/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsExperimentResults)
+- [A/B Test Experiment Transactions](/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsExperimentTransactions)
+
+## Curl Examples
+
+For local and sandbox smoke-test examples, use [API Examples](/decision-engine-api-reference/api-reference/guides/api-ref).
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsCostSavings.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsCostSavings.mdx
new file mode 100644
index 0000000000..3023143195
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsCostSavings.mdx
@@ -0,0 +1,5 @@
+---
+title: "Cost Savings"
+description: "ClickHouse-backed cost savings read endpoint."
+openapi: "decision_engine_openapi-specs.json GET /analytics/cost-savings"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsDecisions.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsDecisions.mdx
new file mode 100644
index 0000000000..7a9b511b8f
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsDecisions.mdx
@@ -0,0 +1,5 @@
+---
+title: "Analytics Decisions"
+description: "ClickHouse-backed decisions read endpoint."
+openapi: "decision_engine_openapi-specs.json GET /analytics/decisions"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsExperimentResults.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsExperimentResults.mdx
new file mode 100644
index 0000000000..a1f294f9c2
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsExperimentResults.mdx
@@ -0,0 +1,5 @@
+---
+title: "A/B Test Experiment Results"
+description: "ClickHouse-backed A/B test experiment results read endpoint."
+openapi: "decision_engine_openapi-specs.json GET /analytics/experiment/{experiment_id}/results"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsExperimentTransactions.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsExperimentTransactions.mdx
new file mode 100644
index 0000000000..977f91e344
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsExperimentTransactions.mdx
@@ -0,0 +1,5 @@
+---
+title: "A/B Test Experiment Transactions"
+description: "ClickHouse-backed A/B test experiment transaction log read endpoint."
+openapi: "decision_engine_openapi-specs.json GET /analytics/experiment/{experiment_id}/transactions"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsGatewayScores.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsGatewayScores.mdx
new file mode 100644
index 0000000000..916b1574c7
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsGatewayScores.mdx
@@ -0,0 +1,5 @@
+---
+title: "Analytics Gateway Scores"
+description: "ClickHouse-backed gateway scores read endpoint."
+openapi: "decision_engine_openapi-specs.json GET /analytics/gateway-scores"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsLogSummaries.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsLogSummaries.mdx
new file mode 100644
index 0000000000..59f9977420
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsLogSummaries.mdx
@@ -0,0 +1,5 @@
+---
+title: "Analytics Log Summaries"
+description: "ClickHouse-backed log summaries read endpoint."
+openapi: "decision_engine_openapi-specs.json GET /analytics/log-summaries"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsOverview.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsOverview.mdx
new file mode 100644
index 0000000000..c14fdb6e6a
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsOverview.mdx
@@ -0,0 +1,5 @@
+---
+title: "Analytics Overview"
+description: "ClickHouse-backed overview read endpoint."
+openapi: "decision_engine_openapi-specs.json GET /analytics/overview"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsPaymentAudit.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsPaymentAudit.mdx
new file mode 100644
index 0000000000..404fd1f376
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsPaymentAudit.mdx
@@ -0,0 +1,5 @@
+---
+title: "Payment Audit"
+description: "ClickHouse-backed payment audit read endpoint."
+openapi: "decision_engine_openapi-specs.json GET /analytics/payment-audit"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsPreviewTrace.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsPreviewTrace.mdx
new file mode 100644
index 0000000000..fd0d666cb9
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsPreviewTrace.mdx
@@ -0,0 +1,5 @@
+---
+title: "Preview Trace"
+description: "ClickHouse-backed rule preview trace read endpoint."
+openapi: "decision_engine_openapi-specs.json GET /analytics/preview-trace"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsRoutingEvents.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsRoutingEvents.mdx
new file mode 100644
index 0000000000..f93d50aa3a
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsRoutingEvents.mdx
@@ -0,0 +1,5 @@
+---
+title: "Routing Events"
+description: "ClickHouse-backed routing events read endpoint."
+openapi: "decision_engine_openapi-specs.json GET /analytics/routing-events"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsRoutingStats.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsRoutingStats.mdx
new file mode 100644
index 0000000000..b73c3878bd
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsRoutingStats.mdx
@@ -0,0 +1,5 @@
+---
+title: "Analytics Routing Stats"
+description: "ClickHouse-backed routing stats read endpoint."
+openapi: "decision_engine_openapi-specs.json GET /analytics/routing-stats"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/createApiKey.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/createApiKey.mdx
new file mode 100644
index 0000000000..107d9de943
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/createApiKey.mdx
@@ -0,0 +1,5 @@
+---
+title: "Create API Key"
+description: "Create a service-to-service API key for a merchant."
+openapi: "decision_engine_openapi-specs.json POST /api-key/create"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/listApiKeys.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/listApiKeys.mdx
new file mode 100644
index 0000000000..2a4404027f
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/listApiKeys.mdx
@@ -0,0 +1,5 @@
+---
+title: "List API Keys"
+description: "List active and revoked API keys for a merchant."
+openapi: "decision_engine_openapi-specs.json GET /api-key/list/{merchant_id}"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/listUserMerchants.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/listUserMerchants.mdx
new file mode 100644
index 0000000000..b1eab6f70e
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/listUserMerchants.mdx
@@ -0,0 +1,5 @@
+---
+title: "List User Merchants"
+description: "Return merchants available to the current user."
+openapi: "decision_engine_openapi-specs.json GET /auth/merchants"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/login.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/login.mdx
new file mode 100644
index 0000000000..0081879ca8
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/login.mdx
@@ -0,0 +1,5 @@
+---
+title: "Login"
+description: "Create a dashboard JWT session."
+openapi: "decision_engine_openapi-specs.json POST /auth/login"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/logout.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/logout.mdx
new file mode 100644
index 0000000000..6d46c52870
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/logout.mdx
@@ -0,0 +1,5 @@
+---
+title: "Logout"
+description: "Revoke the current dashboard JWT."
+openapi: "decision_engine_openapi-specs.json POST /auth/logout"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/me.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/me.mdx
new file mode 100644
index 0000000000..d9caa8b32f
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/me.mdx
@@ -0,0 +1,5 @@
+---
+title: "Current User"
+description: "Return current authenticated user and merchant context."
+openapi: "decision_engine_openapi-specs.json GET /auth/me"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/onboardMerchant.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/onboardMerchant.mdx
new file mode 100644
index 0000000000..e8a7ad01d8
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/onboardMerchant.mdx
@@ -0,0 +1,5 @@
+---
+title: "Onboard Merchant"
+description: "Create and attach a merchant to the current operator user."
+openapi: "decision_engine_openapi-specs.json POST /onboarding/merchant"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/revokeApiKey.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/revokeApiKey.mdx
new file mode 100644
index 0000000000..ba1db8d7b7
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/revokeApiKey.mdx
@@ -0,0 +1,5 @@
+---
+title: "Revoke API Key"
+description: "Mark an API key inactive and clear its Redis cache entry."
+openapi: "decision_engine_openapi-specs.json DELETE /api-key/{key_id}"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/signup.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/signup.mdx
new file mode 100644
index 0000000000..7168b00de4
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/signup.mdx
@@ -0,0 +1,5 @@
+---
+title: "Signup"
+description: "Create an operator account. Password must meet dashboard password policy."
+openapi: "decision_engine_openapi-specs.json POST /auth/signup"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/switchMerchant.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/switchMerchant.mdx
new file mode 100644
index 0000000000..f84f912c2d
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/auth/switchMerchant.mdx
@@ -0,0 +1,5 @@
+---
+title: "Switch Merchant"
+description: "Switch the current dashboard merchant context."
+openapi: "decision_engine_openapi-specs.json POST /auth/switch-merchant"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/compatibility/configSrDimension.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/compatibility/configSrDimension.mdx
new file mode 100644
index 0000000000..e3153ce180
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/compatibility/configSrDimension.mdx
@@ -0,0 +1,5 @@
+---
+title: "Configure SR Dimensions"
+description: "Configure success-rate routing dimensions."
+openapi: "decision_engine_openapi-specs.json POST /config-sr-dimension"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/compatibility/getRoutingConfig.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/compatibility/getRoutingConfig.mdx
new file mode 100644
index 0000000000..68fdb8a258
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/compatibility/getRoutingConfig.mdx
@@ -0,0 +1,5 @@
+---
+title: "Get Routing Config"
+description: "Return rule-builder routing keys and supported values."
+openapi: "decision_engine_openapi-specs.json GET /config/routing-keys"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/compatibility/getSrDimensions.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/compatibility/getSrDimensions.mdx
new file mode 100644
index 0000000000..da861260da
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/compatibility/getSrDimensions.mdx
@@ -0,0 +1,5 @@
+---
+title: "Get SR Dimensions"
+description: "Retrieve the success-rate routing dimension configuration for a merchant."
+openapi: "decision_engine_openapi-specs.json GET /config-sr-dimension/{merchant_id}"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/compatibility/legacyDecisionGateway.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/compatibility/legacyDecisionGateway.mdx
new file mode 100644
index 0000000000..7a54330ecf
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/compatibility/legacyDecisionGateway.mdx
@@ -0,0 +1,5 @@
+---
+title: "Legacy Decision Gateway"
+description: "Legacy compatibility route. New integrations should use /decide-gateway."
+openapi: "decision_engine_openapi-specs.json POST /decision_gateway"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/compatibility/legacyUpdateScore.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/compatibility/legacyUpdateScore.mdx
new file mode 100644
index 0000000000..a981ff46c3
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/compatibility/legacyUpdateScore.mdx
@@ -0,0 +1,5 @@
+---
+title: "Legacy Update Score"
+description: "Legacy compatibility route. New integrations should use /update-gateway-score."
+openapi: "decision_engine_openapi-specs.json POST /update-score"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/deleteConnectorCredentials.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/deleteConnectorCredentials.mdx
new file mode 100644
index 0000000000..e0244aac59
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/deleteConnectorCredentials.mdx
@@ -0,0 +1,5 @@
+---
+title: "Delete Connector Credentials"
+description: "Remove a connector account's stored cost-report credentials."
+openapi: "decision_engine_openapi-specs.json DELETE /merchant-account/{merchant_id}/connectors/{connector}/credentials/{account}"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/deleteCostIngestion.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/deleteCostIngestion.mdx
new file mode 100644
index 0000000000..6ea8844e95
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/deleteCostIngestion.mdx
@@ -0,0 +1,5 @@
+---
+title: "Delete Cost Ingestion"
+description: "Delete a specific cost ingestion and its staged data."
+openapi: "decision_engine_openapi-specs.json DELETE /merchant-account/{merchant_id}/cost-ingestions/{ingestion_id}"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/deleteInvoiceAddon.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/deleteInvoiceAddon.mdx
new file mode 100644
index 0000000000..e9143c2c3e
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/deleteInvoiceAddon.mdx
@@ -0,0 +1,5 @@
+---
+title: "Delete Invoice Add-on"
+description: "Remove a connector's invoice-derived fee add-on."
+openapi: "decision_engine_openapi-specs.json DELETE /merchant-account/{merchant_id}/connectors/{connector}/invoice-addon"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/getCostCoverage.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/getCostCoverage.mdx
new file mode 100644
index 0000000000..3334826e15
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/getCostCoverage.mdx
@@ -0,0 +1,5 @@
+---
+title: "Get Cost Coverage"
+description: "Summary of how much of the merchant's volume is covered by good (well-modelled) cost clusters."
+openapi: "decision_engine_openapi-specs.json GET /merchant-account/{merchant_id}/cost-coverage"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/getInvoiceReconciliation.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/getInvoiceReconciliation.mdx
new file mode 100644
index 0000000000..fae9b4bd19
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/getInvoiceReconciliation.mdx
@@ -0,0 +1,5 @@
+---
+title: "Get Invoice Reconciliation"
+description: "Reconciliation of invoice subtotals against modelled + add-on captured fees, per connector."
+openapi: "decision_engine_openapi-specs.json GET /merchant-account/{merchant_id}/invoice-reconciliation"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/listConnectorCredentials.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/listConnectorCredentials.mdx
new file mode 100644
index 0000000000..74c12a14e9
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/listConnectorCredentials.mdx
@@ -0,0 +1,5 @@
+---
+title: "List Connector Credentials"
+description: "Masked list of connector cost-report credentials configured for the merchant."
+openapi: "decision_engine_openapi-specs.json GET /merchant-account/{merchant_id}/connectors"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/listConnectorFees.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/listConnectorFees.mdx
new file mode 100644
index 0000000000..1fa6c9f251
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/listConnectorFees.mdx
@@ -0,0 +1,5 @@
+---
+title: "List Connector Fees"
+description: "Per-connector modelled and effective fee rates (model, override and effective pct_bps/fixed)."
+openapi: "decision_engine_openapi-specs.json GET /merchant-account/{merchant_id}/connector-fees"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/listCostClusters.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/listCostClusters.mdx
new file mode 100644
index 0000000000..31f203f742
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/listCostClusters.mdx
@@ -0,0 +1,5 @@
+---
+title: "List Cost Clusters"
+description: "Learned per-dimension cost clusters (network/funding/country/currency/IC category) with modelled and effective fees."
+openapi: "decision_engine_openapi-specs.json GET /merchant-account/{merchant_id}/cost-clusters"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/listCostIngestions.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/listCostIngestions.mdx
new file mode 100644
index 0000000000..ff465b5550
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/listCostIngestions.mdx
@@ -0,0 +1,5 @@
+---
+title: "List Cost Ingestions"
+description: "History of uploaded/pulled cost-report ingestions with staged rows, gross, and status."
+openapi: "decision_engine_openapi-specs.json GET /merchant-account/{merchant_id}/cost-ingestions"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/listCostPriceChanges.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/listCostPriceChanges.mdx
new file mode 100644
index 0000000000..7df7b44bc6
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/listCostPriceChanges.mdx
@@ -0,0 +1,5 @@
+---
+title: "List Cost Price Changes"
+description: "Detected changes in cluster pricing (old vs new pct_bps/fixed) across ingestions."
+openapi: "decision_engine_openapi-specs.json GET /merchant-account/{merchant_id}/cost-price-changes"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/listInvoiceAddons.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/listInvoiceAddons.mdx
new file mode 100644
index 0000000000..89af8bdb95
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/listInvoiceAddons.mdx
@@ -0,0 +1,5 @@
+---
+title: "List Invoice Add-ons"
+description: "Per-connector periodic-fee add-ons learned from uploaded invoices."
+openapi: "decision_engine_openapi-specs.json GET /merchant-account/{merchant_id}/invoice-addons"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/setClusterOverride.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/setClusterOverride.mdx
new file mode 100644
index 0000000000..6557f6fcf0
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/setClusterOverride.mdx
@@ -0,0 +1,5 @@
+---
+title: "Set Cost Cluster Override"
+description: "Override the modelled fee for a specific cost cluster identified by its cluster key."
+openapi: "decision_engine_openapi-specs.json PUT /merchant-account/{merchant_id}/cost-clusters/{cluster_key}/fee-override"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/setConnectorCredentials.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/setConnectorCredentials.mdx
new file mode 100644
index 0000000000..33fe069fa1
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/setConnectorCredentials.mdx
@@ -0,0 +1,5 @@
+---
+title: "Set Connector Credentials"
+description: "Store the account and report-download credentials used to pull a connector's cost reports."
+openapi: "decision_engine_openapi-specs.json POST /merchant-account/{merchant_id}/connectors/{connector}/credentials"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/setFeeOverride.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/setFeeOverride.mdx
new file mode 100644
index 0000000000..7f51e85152
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/connector-costs/setFeeOverride.mdx
@@ -0,0 +1,5 @@
+---
+title: "Set Connector Fee Override"
+description: "Manually override the effective fee (pct_bps + fixed) for a connector."
+openapi: "decision_engine_openapi-specs.json PUT /merchant-account/{merchant_id}/connectors/{connector}/fee-override"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/features/getMerchantFeatures.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/features/getMerchantFeatures.mdx
new file mode 100644
index 0000000000..ea1c9c04d5
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/features/getMerchantFeatures.mdx
@@ -0,0 +1,5 @@
+---
+title: "Get Merchant Features"
+description: "List the merchant's feature-flag states (GSM scoring, explore/exploit, A/B, multi-objective, elimination)."
+openapi: "decision_engine_openapi-specs.json GET /merchant-account/{merchant_id}/features"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/features/resetGatewayScores.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/features/resetGatewayScores.mdx
new file mode 100644
index 0000000000..18ad92da92
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/features/resetGatewayScores.mdx
@@ -0,0 +1,5 @@
+---
+title: "Reset Gateway Scores"
+description: "Flush a merchant's live gateway (success-rate) scores and any manual overrides."
+openapi: "decision_engine_openapi-specs.json POST /gateway-score/reset"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/features/updateMerchantFeature.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/features/updateMerchantFeature.mdx
new file mode 100644
index 0000000000..98813701d8
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/features/updateMerchantFeature.mdx
@@ -0,0 +1,5 @@
+---
+title: "Update Merchant Feature"
+description: "Enable or disable a single feature flag for the merchant."
+openapi: "decision_engine_openapi-specs.json POST /merchant-account/{merchant_id}/features/{feature}"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/gateway-decision/decideGateway.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/gateway-decision/decideGateway.mdx
new file mode 100644
index 0000000000..bea7088a8d
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/gateway-decision/decideGateway.mdx
@@ -0,0 +1,199 @@
+---
+title: "Decide Gateway"
+description: "Core routing decision API. Given a payment context and a list of eligible gateways, returns the optimal gateway to route to."
+openapi: "decision_engine_openapi-specs.json POST /decide-gateway"
+---
+
+# Decide Gateway
+
+## Use case
+
+Runs the core gateway decision flow for a payment. The same endpoint supports auth-rate routing, priority-list routing, debit/network routing, and network+SR hybrid routing.
+
+## Authentication
+
+Protected. Send either `Authorization: Bearer <jwt_token>` or `x-api-key: <api_key>`. In sandbox, also send `x-feature: decision-engine`.
+
+For local development, start with:
+
+```bash
+export BASE_URL=http://localhost:8080
+export AUTH_HEADER="Authorization: Bearer <jwt_token>"
+# Sandbox only:
+# export BASE_URL=https://sandbox.hyperswitch.io
+# export FEATURE_HEADER="x-feature: decision-engine"
+```
+
+## Request
+
+- Method and path: `POST /decide-gateway`
+- Parameters: none.
+- Body: JSON body with `merchantId`, `paymentInfo`, `eligibleGatewayList`, and `rankingAlgorithm`. `rankingAlgorithm` must be one of `SR_BASED_ROUTING`, `PL_BASED_ROUTING`, `NTW_BASED_ROUTING`, or `NTW_SR_HYBRID_ROUTING`.
+
+## Example
+
+### SR based routing
+
+```bash
+curl --location "$BASE_URL/decide-gateway" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchantId": "merchant_demo",
+ "eligibleGatewayList": ["stripe", "adyen", "checkout"],
+ "rankingAlgorithm": "SR_BASED_ROUTING",
+ "eliminationEnabled": true,
+ "paymentInfo": {
+ "paymentId": "pay_sr_001",
+ "amount": 1000,
+ "currency": "USD",
+ "country": "US",
+ "paymentType": "ORDER_PAYMENT",
+ "paymentMethodType": "CARD",
+ "paymentMethod": "CREDIT",
+ "authType": "THREE_DS",
+ "cardIsin": "424242"
+ }
+}'
+```
+
+### Priority-list routing
+
+```bash
+curl --location "$BASE_URL/decide-gateway" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchantId": "merchant_demo",
+ "eligibleGatewayList": ["stripe", "adyen", "checkout"],
+ "rankingAlgorithm": "PL_BASED_ROUTING",
+ "eliminationEnabled": true,
+ "paymentInfo": {
+ "paymentId": "pay_pl_001",
+ "amount": 1000,
+ "currency": "USD",
+ "country": "US",
+ "paymentType": "ORDER_PAYMENT",
+ "paymentMethodType": "CARD",
+ "paymentMethod": "CREDIT",
+ "authType": "THREE_DS",
+ "cardIsin": "424242"
+ }
+}'
+```
+
+### Debit/network routing
+
+```bash
+curl --location "$BASE_URL/decide-gateway" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchantId": "merchant_demo",
+ "eligibleGatewayList": ["stripe", "adyen"],
+ "rankingAlgorithm": "NTW_BASED_ROUTING",
+ "paymentInfo": {
+ "paymentId": "pay_debit_001",
+ "amount": 1000,
+ "currency": "USD",
+ "country": "US",
+ "paymentType": "ORDER_PAYMENT",
+ "paymentMethodType": "CARD",
+ "paymentMethod": "DEBIT",
+ "authType": "THREE_DS",
+ "metadata": "{\"merchant_category_code\":\"merchant_category_code_0001\",\"acquirer_country\":\"US\",\"co_badged_card_data\":{\"card_type\":\"debit\",\"issuer_country\":\"US\",\"is_regulated\":false,\"regulated_name\":null,\"card_networks\":[\"VISA\",\"NYCE\",\"PULSE\",\"STAR\"]}}"
+ }
+}'
+```
+
+### Multi-objective routing
+
+```bash
+curl --location "$BASE_URL/decide-gateway" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchantId": "merchant_demo",
+ "eligibleGatewayList": ["stripe", "adyen", "checkout"],
+ "rankingAlgorithm": "SR_BASED_ROUTING",
+ "eliminationEnabled": true,
+ "enableMultiObjective": true,
+ "paymentInfo": {
+ "paymentId": "pay_mo_001",
+ "amount": 1000,
+ "currency": "USD",
+ "country": "US",
+ "paymentType": "ORDER_PAYMENT",
+ "paymentMethodType": "CARD",
+ "paymentMethod": "CREDIT",
+ "authType": "THREE_DS",
+ "cardIsin": "424242"
+ }
+}'
+```
+
+### Network + SR hybrid routing
+
+```bash
+curl --location "$BASE_URL/decide-gateway" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchantId": "merchant_demo",
+ "eligibleGatewayList": ["stripe", "adyen"],
+ "rankingAlgorithm": "NTW_SR_HYBRID_ROUTING",
+ "paymentInfo": {
+ "paymentId": "pay_hybrid_001",
+ "amount": 1000,
+ "currency": "USD",
+ "country": "US",
+ "paymentType": "ORDER_PAYMENT",
+ "paymentMethodType": "CARD",
+ "paymentMethod": "DEBIT",
+ "authType": "THREE_DS",
+ "metadata": "{\"merchant_category_code\":\"merchant_category_code_0001\",\"acquirer_country\":\"US\",\"co_badged_card_data\":{\"card_type\":\"debit\",\"issuer_country\":\"US\",\"is_regulated\":false,\"regulated_name\":null,\"card_networks\":[\"VISA\",\"NYCE\",\"PULSE\",\"STAR\"]}}"
+ }
+}'
+```
+
+## Response
+
+```json
+{
+ "decided_gateway": "stripe",
+ "gateway_priority_map": {
+ "stripe": 0.94,
+ "adyen": 0.91
+ },
+ "routing_approach": "SR_SELECTION_V3_ROUTING",
+ "gateway_before_evaluation": "stripe",
+ "debit_routing_output": {
+ "co_badged_card_networks_info": [
+ {
+ "network": "NYCE",
+ "saving_percentage": 1.2
+ }
+ ],
+ "issuer_country": "US",
+ "is_regulated": false,
+ "card_type": "debit"
+ },
+ "is_rust_based_decider": true
+}
+```
+
+## Notes
+
+- Use backend enum strings exactly; camelCase values such as `NtwBasedRouting` are invalid.
+- Debit routing requires the merchant debit-routing flag to be enabled and debit metadata encoded as a JSON string in `paymentInfo.metadata`.
+- Multi-objective routing is not a `rankingAlgorithm` value: it is a cost-aware post-step on SR-based scoring, toggled per request with `enableMultiObjective` or per merchant with the `multi_objective_routing_enabled` feature flag. When it runs, the response carries a `multi_objective_info` block, and `routing_approach` becomes `SR_SELECTION_MULTI_OBJECTIVE` when a cheaper gateway wins on expected value.
+- A successful call emits analytics/audit events asynchronously.
+
+## Related
+
+- [Decide Gateway: SR Based Routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-sr-based)
+- [Decide Gateway: PL Based Routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-pl-based)
+- [Decide Gateway: Debit Routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-debit-routing)
+- [Decide Gateway: Hybrid Routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-hybrid-routing)
+- [Decide Gateway: Multi-Objective Routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-multi-objective)
+- [Update Gateway Score](/decision-engine-api-reference/api-reference/endpoint/score-feedback/updateGatewayScore)
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/health/healthCheck.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/health/healthCheck.mdx
new file mode 100644
index 0000000000..347b10f257
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/health/healthCheck.mdx
@@ -0,0 +1,5 @@
+---
+title: "Health Check"
+description: "Service liveness check."
+openapi: "decision_engine_openapi-specs.json GET /health"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/health/healthDiagnostics.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/health/healthDiagnostics.mdx
new file mode 100644
index 0000000000..16e20ee31d
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/health/healthDiagnostics.mdx
@@ -0,0 +1,5 @@
+---
+title: "Health Diagnostics"
+description: "Database diagnostics for local and deployment troubleshooting."
+openapi: "decision_engine_openapi-specs.json GET /health/diagnostics"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/health/healthReady.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/health/healthReady.mdx
new file mode 100644
index 0000000000..1a1e3aacaf
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/health/healthReady.mdx
@@ -0,0 +1,5 @@
+---
+title: "Health Ready"
+description: "Returns Up when the process is ready to serve traffic."
+openapi: "decision_engine_openapi-specs.json GET /health/ready"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/merchant-account/createMerchant.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/merchant-account/createMerchant.mdx
new file mode 100644
index 0000000000..1e48d8d1e6
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/merchant-account/createMerchant.mdx
@@ -0,0 +1,5 @@
+---
+title: "Create Merchant"
+description: "Register a new merchant account. The merchant ID is the primary identifier used in all subsequent routing and scoring calls."
+openapi: "decision_engine_openapi-specs.json POST /merchant-account/create"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/merchant-account/deleteMerchant.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/merchant-account/deleteMerchant.mdx
new file mode 100644
index 0000000000..8374b0268f
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/merchant-account/deleteMerchant.mdx
@@ -0,0 +1,5 @@
+---
+title: "Delete Merchant"
+description: "Delete a merchant account and all associated routing configuration."
+openapi: "decision_engine_openapi-specs.json DELETE /merchant-account/{merchant_id}"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/merchant-account/getMerchant.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/merchant-account/getMerchant.mdx
new file mode 100644
index 0000000000..3ec42c2c55
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/merchant-account/getMerchant.mdx
@@ -0,0 +1,5 @@
+---
+title: "Get Merchant"
+description: "Retrieve a merchant account by ID."
+openapi: "decision_engine_openapi-specs.json GET /merchant-account/{merchant_id}"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/merchant-account/getMerchantDebitRouting.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/merchant-account/getMerchantDebitRouting.mdx
new file mode 100644
index 0000000000..4c4c50e994
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/merchant-account/getMerchantDebitRouting.mdx
@@ -0,0 +1,5 @@
+---
+title: "Get Merchant Debit Routing"
+description: "Return whether debit/network routing is enabled for a merchant. Missing flag configuration is treated as disabled."
+openapi: "decision_engine_openapi-specs.json GET /merchant-account/{merchant_id}/debit-routing"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/merchant-account/updateMerchantDebitRouting.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/merchant-account/updateMerchantDebitRouting.mdx
new file mode 100644
index 0000000000..c8d9de3318
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/merchant-account/updateMerchantDebitRouting.mdx
@@ -0,0 +1,5 @@
+---
+title: "Update Merchant Debit Routing"
+description: "Enable or disable runtime debit/network routing for a merchant."
+openapi: "decision_engine_openapi-specs.json POST /merchant-account/{merchant_id}/debit-routing"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/routing-rules/activateRoutingRule.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/routing-rules/activateRoutingRule.mdx
new file mode 100644
index 0000000000..87b4f6fa41
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/routing-rules/activateRoutingRule.mdx
@@ -0,0 +1,5 @@
+---
+title: "Activate Routing Rule"
+description: "Activate a routing rule by ID for a merchant. Only one rule can be active at a time — activating a new rule deactivates the previous one."
+openapi: "decision_engine_openapi-specs.json POST /routing/activate"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/routing-rules/createRoutingRule.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/routing-rules/createRoutingRule.mdx
new file mode 100644
index 0000000000..b8d08d40c8
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/routing-rules/createRoutingRule.mdx
@@ -0,0 +1,5 @@
+---
+title: "Create Routing Rule"
+description: "Create a new Euclid declarative routing rule for a merchant. Supports `advanced` (full Euclid DSL), `priority` (ordered gateway list), `single` (fixed gateway), and `volume_split` (percentage-based distribution) algorithm types."
+openapi: "decision_engine_openapi-specs.json POST /routing/create"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/routing-rules/deactivateRoutingRule.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/routing-rules/deactivateRoutingRule.mdx
new file mode 100644
index 0000000000..a9ca5341d3
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/routing-rules/deactivateRoutingRule.mdx
@@ -0,0 +1,5 @@
+---
+title: "Deactivate Routing Rule"
+description: "Deactivate a routing rule by ID for a merchant without deleting the saved rule."
+openapi: "decision_engine_openapi-specs.json POST /routing/deactivate"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/routing-rules/evaluateRoutingRule.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/routing-rules/evaluateRoutingRule.mdx
new file mode 100644
index 0000000000..79b9e51c32
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/routing-rules/evaluateRoutingRule.mdx
@@ -0,0 +1,5 @@
+---
+title: "Evaluate Routing Rule"
+description: "Evaluate the active routing rule for a merchant against a payment context. Returns the ordered list of gateways selected by the rule without consuming SR data."
+openapi: "decision_engine_openapi-specs.json POST /routing/evaluate"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/routing-rules/getActiveRoutingRule.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/routing-rules/getActiveRoutingRule.mdx
new file mode 100644
index 0000000000..9a1a8649c2
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/routing-rules/getActiveRoutingRule.mdx
@@ -0,0 +1,5 @@
+---
+title: "Get Active Routing Rule"
+description: "Retrieve the currently active routing rule for a merchant."
+openapi: "decision_engine_openapi-specs.json POST /routing/list/active/{created_by}"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/routing-rules/hybridRouting.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/routing-rules/hybridRouting.mdx
new file mode 100644
index 0000000000..e6726394a8
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/routing-rules/hybridRouting.mdx
@@ -0,0 +1,5 @@
+---
+title: "Hybrid Routing"
+description: "Evaluate hybrid routing using the active routing rule plus runtime payment context."
+openapi: "decision_engine_openapi-specs.json POST /routing/hybrid"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/routing-rules/listRoutingRules.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/routing-rules/listRoutingRules.mdx
new file mode 100644
index 0000000000..cf967d1a70
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/routing-rules/listRoutingRules.mdx
@@ -0,0 +1,5 @@
+---
+title: "List Routing Rules"
+description: "List all routing rules for a merchant."
+openapi: "decision_engine_openapi-specs.json POST /routing/list/{created_by}"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/rule-configuration/createRuleConfig.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/rule-configuration/createRuleConfig.mdx
new file mode 100644
index 0000000000..b17fa7f015
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/rule-configuration/createRuleConfig.mdx
@@ -0,0 +1,5 @@
+---
+title: "Create Rule Config"
+description: "Create a service-level configuration for `successRate` or `elimination` scoring. Controls the time window, minimum data thresholds, and other parameters used in SR computation."
+openapi: "decision_engine_openapi-specs.json POST /rule/create"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/rule-configuration/deleteRuleConfig.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/rule-configuration/deleteRuleConfig.mdx
new file mode 100644
index 0000000000..a0f37b7f09
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/rule-configuration/deleteRuleConfig.mdx
@@ -0,0 +1,5 @@
+---
+title: "Delete Rule Config"
+description: "Delete a rule configuration."
+openapi: "decision_engine_openapi-specs.json POST /rule/delete"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/rule-configuration/getRuleConfig.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/rule-configuration/getRuleConfig.mdx
new file mode 100644
index 0000000000..bf23a63ce6
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/rule-configuration/getRuleConfig.mdx
@@ -0,0 +1,5 @@
+---
+title: "Get Rule Config"
+description: "Retrieve an existing rule configuration by merchant and type."
+openapi: "decision_engine_openapi-specs.json POST /rule/get"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/rule-configuration/updateRuleConfig.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/rule-configuration/updateRuleConfig.mdx
new file mode 100644
index 0000000000..72a4f90ab9
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/rule-configuration/updateRuleConfig.mdx
@@ -0,0 +1,5 @@
+---
+title: "Update Rule Config"
+description: "Update an existing rule configuration."
+openapi: "decision_engine_openapi-specs.json POST /rule/update"
+---
diff --git a/api-reference/decision-engine-api-reference/api-reference/endpoint/score-feedback/updateGatewayScore.mdx b/api-reference/decision-engine-api-reference/api-reference/endpoint/score-feedback/updateGatewayScore.mdx
new file mode 100644
index 0000000000..e987a53b20
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/endpoint/score-feedback/updateGatewayScore.mdx
@@ -0,0 +1,73 @@
+---
+title: "Update Gateway Score"
+description: "Feed a transaction outcome back into the success-rate model. Call this after every transaction so the engine has accurate SR data for future routing decisions."
+openapi: "decision_engine_openapi-specs.json POST /update-gateway-score"
+---
+
+# Update Gateway Score
+
+## Use case
+
+Records the observed transaction outcome for a previously selected gateway so auth-rate analytics can learn from real payment results.
+
+## Authentication
+
+Protected. Send either `Authorization: Bearer <jwt_token>` or `x-api-key: <api_key>`. In sandbox, also send `x-feature: decision-engine`.
+
+For local development, start with:
+
+```bash
+export BASE_URL=http://localhost:8080
+export AUTH_HEADER="Authorization: Bearer <jwt_token>"
+# Sandbox only:
+# export BASE_URL=https://sandbox.hyperswitch.io
+# export FEATURE_HEADER="x-feature: decision-engine"
+```
+
+## Request
+
+- Method and path: `POST /update-gateway-score`
+- Parameters: none.
+- Body: JSON body should include merchant/payment identity, selected gateway, status, and latency/outcome details expected by the score updater.
+
+## Example
+
+### Update gateway score
+
+```bash
+curl --location "$BASE_URL/update-gateway-score" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchantId": "merchant_demo",
+ "paymentId": "pay_sr_001",
+ "gateway": "stripe",
+ "status": "success",
+ "amount": 1000,
+ "currency": "USD",
+ "paymentMethodType": "CARD",
+ "paymentMethod": "CREDIT",
+ "authType": "THREE_DS",
+ "latency": 120
+}'
+```
+
+## Response
+
+```json
+{
+ "status": "success",
+ "message": "gateway score updated"
+}
+```
+
+## Notes
+
+- Do not call this after `NTW_BASED_ROUTING` just to record the selected debit network; debit audit comes from `/decide-gateway` analytics.
+- Call it after payment authorization completes, not before.
+
+## Related
+
+- [Decide Gateway](/decision-engine-api-reference/api-reference/endpoint/gateway-decision/decideGateway)
+- [Analytics Gateway Scores](/decision-engine-api-reference/api-reference/endpoint/analytics/analyticsGatewayScores)
+- [Update Gateway Score](/decision-engine-api-reference/api-reference/guides/feedback-scoring/update-gateway-score)
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/ab-testing/ab-testing-create.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/ab-testing/ab-testing-create.mdx
new file mode 100644
index 0000000000..63cce78337
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/ab-testing/ab-testing-create.mdx
@@ -0,0 +1,132 @@
+---
+title: "A/B Testing: Create An Experiment"
+description: "Curl examples for creating and activating a routing A/B test via /routing/create."
+---
+
+# A/B Testing: Create An Experiment
+
+A/B testing lets you compare two routing strategies — or two configurations of the same strategy — on a live split of traffic, with built-in guardrails and statistical significance checks. There is no separate create/manage API: an experiment is just another `algorithm.type` on the existing [`/routing/create`](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-create) endpoint, alongside `single`, `priority`, `volume_split`, and `advanced`.
+
+## Why run one
+
+Any routing change — turning on multi-objective routing, enabling autopilot, retuning hedging — is a bet that the new behaviour beats what you have today. The honest way to settle that bet is to run both on the *same* live traffic at the same time and measure the difference, rather than flip the change globally and hope the week-over-week numbers move for the right reason. That's what an experiment does: it holds one arm (**control**) on your current behaviour and sends a minority slice to the other (**variant**), so the two are compared under identical market conditions.
+
+The design has two safety properties built in:
+
+- **A guardrail.** If the variant's authorisation rate falls more than `guardrail_threshold_pp` percentage points below control, the experiment is flagged `GuardrailBreached` immediately — this is a deliberately eager point-estimate check, because no cost saving is worth an auth regression, and it trips without waiting for statistical significance (once past the minimum sample gate).
+- **A significance test.** A winner is only declared when the difference is statistically real. Once each arm clears `min_sample_size`, results run a two-sample z-test on per-transaction economic value (which collapses to a plain two-proportion auth-rate test when no cost dimension is involved). Until then the verdict stays `CollectingData`; a positive-but-noisy gap stays `NotSignificant` rather than prematurely crowning the variant. Only a `p < 0.05` gap yields `VariantWins` / `VariantLoses`. See [A/B Testing: Results](/decision-engine-api-reference/api-reference/guides/ab-testing/ab-testing-results) for reading the verdict.
+
+Because control and variant differ only in the routing behaviour you're testing, the measured delta is attributable to that change — which is exactly why you'd run an experiment before flipping a merchant-wide flag like [multi-objective routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-multi-objective).
+
+## algorithm.type = "ab_test"
+
+```bash
+curl --location "$BASE_URL/routing/create" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "name": "cost-vs-auth-test",
+ "description": "A/B test: 20% variant traffic",
+ "created_by": "merchant_demo",
+ "algorithm_for": "payment",
+ "metadata": {},
+ "algorithm": {
+ "type": "ab_test",
+ "data": {
+ "control_algorithm_id": "sr_routing",
+ "variant_algorithm_id": "sr_routing",
+ "variant_split_pct": 20,
+ "min_sample_size": 1000,
+ "guardrail_threshold_pp": 3.0,
+ "control_sr_config": { "enable_multi_objective": false, "use_autopilot": false },
+ "variant_sr_config": { "enable_multi_objective": true, "use_autopilot": false }
+ }
+ }
+ }'
+```
+
+Response is the standard routing-algorithm create response:
+
+```json
+{
+ "rule_id": "routing_a1b2c3d4-1111-2222-3333-444455556666",
+ "name": "cost-vs-auth-test",
+ "created_at": "2026-07-16 10:00:00",
+ "modified_at": "2026-07-16 10:00:00"
+}
+```
+
+## algorithm.data (ABTestData) Fields
+
+| Field | Type | Meaning |
+| --- | --- | --- |
+| `control_algorithm_id` | string | Algorithm the control arm uses. `"sr_routing"` for success-rate scoring, or the `rule_id` of an existing `single`/`priority`/`volume_split`/`advanced` algorithm. |
+| `variant_algorithm_id` | string | Same, for the variant arm. |
+| `variant_split_pct` | integer, 1–49 | Percentage of traffic sent to the variant arm. Capped below 50 so the variant is always the minority arm. |
+| `min_sample_size` | integer | Transactions each arm needs before results are considered statistically meaningful. |
+| `guardrail_threshold_pp` | number | Auto-pause guardrail: if the variant's auth rate drops this many percentage points below control, the experiment result is marked `GuardrailBreached`. |
+| `control_sr_config` | object, optional | Per-arm SR override — see below. Only meaningful when the arm's algorithm is `sr_routing`. |
+| `variant_sr_config` | object, optional | Same, for the variant arm. |
+
+### SR Config Override
+
+```json
+{
+ "hedging_percent": 5.0,
+ "elimination_threshold": 0.35,
+ "enable_multi_objective": true,
+ "margin": 0.2,
+ "use_autopilot": false
+}
+```
+
+All fields are optional — set only the ones you want to override for that arm; anything omitted falls back to the merchant's live SR config. `enable_multi_objective` and `use_autopilot` are the same dials used by [multi-objective routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-multi-objective) and [autopilot](/decision-engine-api-reference/api-reference/guides/autopilot/merchant-features), scoped to just this arm.
+
+## Common Experiment Shapes
+
+The dashboard's A/B test builder resolves its strategy dropdown into these four `sr_routing` + override combinations — useful presets when constructing the payload by hand:
+
+| Arm preset | `variant_sr_config` |
+| --- | --- |
+| SR routing (auth based) | `{ "enable_multi_objective": false, "use_autopilot": false }` |
+| SR routing (auth based, autopilot) | `{ "enable_multi_objective": false, "use_autopilot": true }` |
+| SR routing (multi-objective, manual) | `{ "enable_multi_objective": true, "use_autopilot": false }` |
+| SR routing (multi-objective, autopilot) | `{ "enable_multi_objective": true, "use_autopilot": true }` |
+
+A `sr_config_tuning` experiment (compare two SR tunings rather than two strategies) uses `sr_routing` for both arms and only sets `hedging_percent`/`elimination_threshold` on the variant, leaving control on the live config.
+
+## Activate The Experiment
+
+Creating an experiment does not make it active — activate it like any other routing algorithm:
+
+```bash
+curl --location "$BASE_URL/routing/activate" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "created_by": "merchant_demo",
+ "routing_algorithm_id": "routing_a1b2c3d4-1111-2222-3333-444455556666"
+ }'
+```
+
+## How Traffic Is Split
+
+Arm assignment is deterministic per payment: `payment_id` is hashed and taken modulo 100 against `variant_split_pct`, so retries of the same payment always land in the same arm.
+
+Two integration points use this assignment:
+
+- **Real payments** — `/decide-gateway` / `/decision_gateway` route into the assigned arm. This only happens when the merchant feature `ab-test-real-payments` is enabled — see [Merchant Features](/decision-engine-api-reference/api-reference/guides/autopilot/merchant-features). Off by default so a newly created experiment doesn't affect live traffic until you opt in.
+- **Simulation / Decision Explorer** — [`/routing/evaluate`](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-evaluate) previews what each arm would do for a given payment context, without a real transaction.
+
+If an arm's algorithm id resolves to `sr_routing`, the payment proceeds through normal SR routing carrying that arm's `SrConfigOverride`. If it resolves to another algorithm's id, that algorithm's output is used directly and the response's `routing_approach` becomes `AB_TEST_STATIC_ALGORITHM`.
+
+## Editing Or Removing An Experiment
+
+Only an **inactive** experiment can be edited or deleted — see [Update & Delete Routing Algorithm](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-update-delete). Deactivate first with [`/routing/deactivate`](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-deactivate) if it's currently live.
+
+## Related
+
+- [A/B Testing: Results](/decision-engine-api-reference/api-reference/guides/ab-testing/ab-testing-results)
+- [Merchant Features](/decision-engine-api-reference/api-reference/guides/autopilot/merchant-features) — enabling `ab-test-real-payments` and autopilot.
+- [Multi-Objective Routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-multi-objective)
+- [Create Routing Algorithm](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-create)
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/ab-testing/ab-testing-results.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/ab-testing/ab-testing-results.mdx
new file mode 100644
index 0000000000..56e9a96360
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/ab-testing/ab-testing-results.mdx
@@ -0,0 +1,119 @@
+---
+title: "A/B Testing: Results"
+description: "Curl examples for reading A/B test results, transaction logs, and enabling real-payment interception."
+---
+
+# A/B Testing: Results
+
+Once an experiment (see [Create An Experiment](/decision-engine-api-reference/api-reference/guides/ab-testing/ab-testing-create)) is active and taking traffic, use these endpoints to monitor it. Both routes below live under `/analytics/` and require `$TENANT_HEADER` in addition to `$AUTH_HEADER` — see [Environment setup](/decision-engine-api-reference/api-reference/guides/api-ref#environment-setup).
+
+## Experiment Results
+
+Runs a statistical significance test (two-sample z-test on expected value, or plain auth-rate when the experiment is auth-only) between the control and variant arms.
+
+```bash
+curl "$BASE_URL/analytics/experiment/routing_a1b2c3d4-1111-2222-3333-444455556666/results" \
+ --header "$AUTH_HEADER" \
+ --header "$TENANT_HEADER"
+```
+
+Optional query parameters: `start_ms`, `end_ms`, `min_sample_size`, `guardrail_threshold_pp`, `evaluation_margin` — override the experiment's stored thresholds for an ad-hoc window or sensitivity check.
+
+```json
+{
+ "experiment_id": "routing_a1b2c3d4-1111-2222-3333-444455556666",
+ "merchant_id": "merchant_demo",
+ "control": {
+ "arm": "control",
+ "transaction_count": 4820,
+ "success_count": 4531,
+ "failure_count": 289,
+ "auth_rate": 0.94,
+ "first_attempt_auth_rate": 0.91,
+ "total_cost_saved": null,
+ "avg_latency_ms": 6.2,
+ "avg_chosen_cost_bps": 182.4,
+ "avg_cost_saved_bps": null,
+ "net_ev_bps": 17660.0
+ },
+ "variant": {
+ "arm": "variant",
+ "transaction_count": 1204,
+ "success_count": 1101,
+ "failure_count": 103,
+ "auth_rate": 0.914,
+ "first_attempt_auth_rate": 0.887,
+ "total_cost_saved": 962.3,
+ "avg_latency_ms": 6.5,
+ "avg_chosen_cost_bps": 150.1,
+ "avg_cost_saved_bps": 32.3,
+ "net_ev_bps": 17944.0
+ },
+ "delta_pp": -2.6,
+ "p_value": 0.031,
+ "confidence_interval": [-4.9, -0.3],
+ "verdict": "variant_wins",
+ "min_sample_size": 1000,
+ "net_delta_bps": 284.0,
+ "evaluation_margin": 0.2
+}
+```
+
+### Verdict Values
+
+| Verdict | Meaning |
+| --- | --- |
+| `collecting_data` | At least one arm hasn't reached `min_sample_size` yet. |
+| `not_significant` | Enough data, but the difference isn't statistically significant. |
+| `variant_wins` | Variant significantly outperforms control on net expected value. |
+| `variant_loses` | Variant significantly underperforms control. |
+| `guardrail_breached` | Variant's auth rate dropped more than `guardrail_threshold_pp` below control — short-circuits before significance is even computed. |
+
+For an auth-only experiment (no cost data / multi-objective involved on either arm), the significance test collapses to a pure auth-rate z-test and cost-related fields (`total_cost_saved`, `avg_cost_saved_bps`, `net_ev_bps`, `net_delta_bps`) are `null`.
+
+## Experiment Transactions
+
+Paginated per-transaction log — which arm each payment landed in and its outcome. Useful for spot-checking arm assignment or debugging a specific payment.
+
+```bash
+curl "$BASE_URL/analytics/experiment/routing_a1b2c3d4-1111-2222-3333-444455556666/transactions?page=1&page_size=20" \
+ --header "$AUTH_HEADER" \
+ --header "$TENANT_HEADER"
+```
+
+```json
+{
+ "experiment_id": "routing_a1b2c3d4-1111-2222-3333-444455556666",
+ "total": 6024,
+ "transactions": [
+ {
+ "payment_id": "pay_9f21",
+ "variant_arm": "variant",
+ "gateway": "adyen",
+ "status": "success",
+ "created_at_ms": 1784271600000
+ }
+ ]
+}
+```
+
+`page_size` is capped at 100. Optional `start_ms` narrows to a time window.
+
+## Enabling Real-Payment Interception
+
+A newly created experiment does not affect live traffic until real-payment interception is turned on for the merchant:
+
+```bash
+curl --location "$BASE_URL/merchant-account/merchant_demo/features/ab-test-real-payments" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{ "enabled": true }'
+```
+
+See [Merchant Features](/decision-engine-api-reference/api-reference/guides/autopilot/merchant-features) for the full feature-flag reference. Until this is enabled, `/routing/evaluate` still previews both arms for simulation purposes even though `/decide-gateway` traffic is unaffected.
+
+## Related
+
+- [A/B Testing: Create An Experiment](/decision-engine-api-reference/api-reference/guides/ab-testing/ab-testing-create)
+- [Merchant Features](/decision-engine-api-reference/api-reference/guides/autopilot/merchant-features)
+- [Analytics Endpoints](/decision-engine-api-reference/api-reference/guides/analytics-audit/analytics-endpoints)
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/analytics-audit/analytics-endpoints.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/analytics-audit/analytics-endpoints.mdx
new file mode 100644
index 0000000000..1d6da44a9f
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/analytics-audit/analytics-endpoints.mdx
@@ -0,0 +1,254 @@
+---
+title: "Analytics Endpoints"
+description: "Curl examples for ClickHouse-backed analytics, charts, payment audit, and decision trace."
+---
+
+# Analytics Endpoints
+
+Analytics routes derive the merchant from the authenticated user/API key context and read from the analytics store. Use these endpoints for dashboard charts, payment audit, rule/volume decision inspection, and debit-routing audit.
+
+Every route on this page also requires `x-tenant-id` (`$TENANT_HEADER` — see [Environment setup](/decision-engine-api-reference/api-reference/guides/api-ref#environment-setup)) in addition to `$AUTH_HEADER`. It has no fallback: omitting it fails with `TE_03: x-tenant-id not found in headers` even with a valid API key or JWT. This is the one header group most other Decision Engine routes (`/decide-gateway`, `/routing/*`, `/merchant-account/*`, etc.) don't need.
+
+Common query parameters:
+
+| Parameter | Values |
+| --- | --- |
+| `range` | `15m`, `1h`, `12h`, `1d`, `1w` |
+| `start_ms`, `end_ms` | custom epoch-millisecond window |
+| `page`, `page_size` | paginated list endpoints |
+| `gateway`, `status`, `route`, `flow_type`, `routing_approach`, `exclude_routing_approach` | filters |
+| `payment_id` | exact payment lookup for audit and trace views |
+| `error_code` | failure filtering |
+
+## Overview
+
+High-level dashboard summary for the selected merchant and time window.
+
+```bash
+curl "$BASE_URL/analytics/overview?range=1d" \
+ --header "$AUTH_HEADER" \
+ --header "$TENANT_HEADER"
+```
+
+```json
+{
+ "request_count": 42,
+ "top_gateway": "adyen",
+ "gateway_share": [
+ { "gateway": "adyen", "count": 22, "share": 52.4 }
+ ]
+}
+```
+
+## Gateway Scores
+
+Auth-rate score snapshots and connector success-rate trend.
+
+```bash
+curl "$BASE_URL/analytics/gateway-scores?range=1d&gateway=stripe,adyen" \
+ --header "$AUTH_HEADER" \
+ --header "$TENANT_HEADER"
+```
+
+```json
+{
+ "latest": [
+ { "gateway": "adyen", "score": 0.831 },
+ { "gateway": "stripe", "score": 0.829 }
+ ],
+ "series": [
+ { "timestamp_ms": 1777136400000, "gateway": "adyen", "score": 0.831 }
+ ]
+}
+```
+
+## Decisions
+
+Decision volume by connector and routing approach.
+
+```bash
+curl "$BASE_URL/analytics/decisions?range=1d" \
+ --header "$AUTH_HEADER" \
+ --header "$TENANT_HEADER"
+```
+
+```bash
+curl "$BASE_URL/analytics/decisions?range=1d&exclude_routing_approach=NTW_BASED_ROUTING" \
+ --header "$AUTH_HEADER" \
+ --header "$TENANT_HEADER"
+```
+
+## Routing Stats
+
+Connector share, rule hits, routing filter options, and chart data.
+
+```bash
+curl "$BASE_URL/analytics/routing-stats?range=1d&payment_method_type=CARD" \
+ --header "$AUTH_HEADER" \
+ --header "$TENANT_HEADER"
+```
+
+## Log Summaries
+
+Failure aggregates and recent error samples.
+
+```bash
+curl "$BASE_URL/analytics/log-summaries?range=1d&status=failure" \
+ --header "$AUTH_HEADER" \
+ --header "$TENANT_HEADER"
+```
+
+## Payment Audit
+
+Payment-level trail search. Prefer `payment_id` for exact lookup.
+
+```bash
+curl "$BASE_URL/analytics/payment-audit?range=1d&page=1&page_size=12&payment_id=pay_001" \
+ --header "$AUTH_HEADER" \
+ --header "$TENANT_HEADER"
+```
+
+```bash
+curl "$BASE_URL/analytics/payment-audit?range=1d&gateway=stripe&status=success&page=1&page_size=10" \
+ --header "$AUTH_HEADER" \
+ --header "$TENANT_HEADER"
+```
+
+```json
+{
+ "summary": {
+ "matching_payments": 1,
+ "failures": 0,
+ "active_gateways": ["stripe"]
+ },
+ "payments": [
+ {
+ "payment_id": "pay_001",
+ "latest_status": "success",
+ "gateways": ["stripe"]
+ }
+ ],
+ "timeline": [
+ {
+ "route": "decide_gateway",
+ "event_stage": "gateway_decided",
+ "gateway": "stripe",
+ "status": "success"
+ }
+ ]
+}
+```
+
+## Preview Trace
+
+Rule/volume decisions captured from `/routing/evaluate`. The transport route remains `/analytics/preview-trace` even when the UI labels these as decisions.
+
+```bash
+curl "$BASE_URL/analytics/preview-trace?range=1d&page=1&page_size=12&route=routing_evaluate" \
+ --header "$AUTH_HEADER" \
+ --header "$TENANT_HEADER"
+```
+
+```bash
+curl "$BASE_URL/analytics/preview-trace?range=1d&payment_id=volume_decision_001" \
+ --header "$AUTH_HEADER" \
+ --header "$TENANT_HEADER"
+```
+
+## Debit Routing Audit
+
+```bash
+curl "$BASE_URL/analytics/payment-audit?range=1d&routing_approach=NTW_BASED_ROUTING" \
+ --header "$AUTH_HEADER" \
+ --header "$TENANT_HEADER"
+```
+
+## Cost Savings
+
+Rollup of savings attributed to [multi-objective routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-multi-objective) — how much cheaper the chosen gateway was versus the plain SR head, trended over the window.
+
+```bash
+curl "$BASE_URL/analytics/cost-savings?range=1w&currency=USD" \
+ --header "$AUTH_HEADER" \
+ --header "$TENANT_HEADER"
+```
+
+```json
+{
+ "merchant_id": "merchant_demo",
+ "range": "1w",
+ "currency": "USD",
+ "available_currencies": [
+ { "currency": "USD", "decision_count": 4820 },
+ { "currency": "EUR", "decision_count": 612 }
+ ],
+ "trend": [
+ { "bucket_ms": 1784112000000, "saved_value": 128.42 }
+ ],
+ "totals": {
+ "saved_value": 962.3,
+ "cost_won_count": 341,
+ "total_decisions": 4820
+ }
+}
+```
+
+`currency` is optional — omit it to aggregate across all currencies present in the window.
+
+## Routing Events
+
+Historical feed of routing-relevant state changes — SR leader changes, gateways entering/exiting the multi-objective auth band, and autopilot calibration runs. Powers the dashboard's routing timeline and the simulation UI's "Autopilot Actions" panel.
+
+```bash
+curl "$BASE_URL/analytics/routing-events?range=1d&payment_method_type=CARD" \
+ --header "$AUTH_HEADER" \
+ --header "$TENANT_HEADER"
+```
+
+```json
+{
+ "merchant_id": "merchant_demo",
+ "range": "1d",
+ "generated_at_ms": 1784271600000,
+ "events": [
+ {
+ "id": "evt_a1b2c3",
+ "event_type": "leader_changed",
+ "merchant_id": "merchant_demo",
+ "payment_method_type": "CARD",
+ "payment_method": "CREDIT",
+ "bucket_ms": 1784268000000,
+ "gateway": "adyen",
+ "previous_gateway": "stripe",
+ "score": 0.91,
+ "previous_score": 0.885,
+ "transaction_count": 214
+ }
+ ]
+}
+```
+
+`event_type` is one of `leader_changed`, `gateway_entered_auth_band`, `gateway_exited_auth_band`, or `calibration_applied` (an autopilot re-tune — see [Merchant Features](/decision-engine-api-reference/api-reference/guides/autopilot/merchant-features)). Auth-band events only fire when multi-objective routing is enabled for the merchant. Additional filters: `min_transaction_count`, `min_score_delta`, `tolerance_pp` (auth-band width override), `limit`.
+
+## A/B Test Experiment Results
+
+Statistical significance results and the per-transaction log for a routing A/B test. Full reference, including the verdict enum and guardrail behavior: [A/B Testing: Results](/decision-engine-api-reference/api-reference/guides/ab-testing/ab-testing-results).
+
+```bash
+curl "$BASE_URL/analytics/experiment/routing_a1b2c3d4-1111-2222-3333-444455556666/results" \
+ --header "$AUTH_HEADER" \
+ --header "$TENANT_HEADER"
+```
+
+```bash
+curl "$BASE_URL/analytics/experiment/routing_a1b2c3d4-1111-2222-3333-444455556666/transactions?page=1&page_size=20" \
+ --header "$AUTH_HEADER" \
+ --header "$TENANT_HEADER"
+```
+
+## Notes
+
+- Use `range` for preset windows and `start_ms`/`end_ms` for custom windows.
+- Use `page` and `page_size` on list-heavy views such as payment audit and preview trace.
+- Use `exclude_routing_approach=NTW_BASED_ROUTING` when auth-rate audit should hide debit-routing decisions.
+- Freshly inserted analytics events may take a short moment to appear because writes are asynchronous.
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/api-ref.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/api-ref.mdx
new file mode 100644
index 0000000000..5ab5a89533
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/api-ref.mdx
@@ -0,0 +1,172 @@
+---
+title: "API Guide"
+description: "A practical, copy-paste guide to the Decision Engine API — from creating a merchant to running routed transactions and reading analytics."
+---
+
+# Decision Engine API Guide
+
+This guide walks the Decision Engine API in the order you'll actually use it: set up a merchant, configure how transactions should be routed, send transactions to `/decide-gateway`, feed outcomes back, and review analytics.
+
+Every page below includes ready-to-run `curl` examples with realistic payloads. For exact request and response schemas plus an interactive playground, use the [OpenAPI Reference](/decision-engine-api-reference/api-reference).
+
+<Note>
+ **Two reference surfaces are available.** Start here for task-oriented flows; switch to the OpenAPI Reference when you need exact schemas.
+
+ | Surface | Best for |
+ | --- | --- |
+ | **API Guide** (this section) | Copy-paste `curl` examples, end-to-end flows, and request variants. |
+ | **[OpenAPI Reference](/decision-engine-api-reference/api-reference)** | One page per endpoint with full schemas and a request playground. |
+</Note>
+
+## Integration flow
+
+A typical integration follows these steps. Each links to the page with the exact request.
+
+<Steps>
+ <Step title="Create a merchant">
+ Create the merchant record that owns your routing config, API keys, and analytics.
+ See [Create Merchant Account](/decision-engine-api-reference/api-reference/guides/merchant-accounts/merchant-account-create).
+ </Step>
+ <Step title="Create an API key">
+ Issue a server-to-server API key to authenticate the calls that follow.
+ See [API Keys](/decision-engine-api-reference/api-reference/guides/auth-onboarding/api-keys).
+ </Step>
+ <Step title="Configure routing">
+ Decide how connectors are chosen — a fixed connector, a priority list, a volume split, or an advanced rule tree — then activate it.
+ See [Create Routing Algorithm](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-create).
+ </Step>
+ <Step title="Run transactions">
+ Call `/decide-gateway` for each payment to get the connector to use.
+ See [Run Transactions](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-sr-based).
+ </Step>
+ <Step title="Send feedback">
+ Report the authorization outcome so scoring and analytics stay accurate.
+ See [Update Gateway Score](/decision-engine-api-reference/api-reference/guides/feedback-scoring/update-gateway-score).
+ </Step>
+ <Step title="Review analytics">
+ Inspect gateway scores, decisions, and audit trails.
+ See [Analytics & Audit](/decision-engine-api-reference/api-reference/guides/analytics-audit/analytics-endpoints).
+ </Step>
+</Steps>
+
+## Environment setup
+
+Set these once in your shell and reuse them across every example.
+
+```bash
+# Base URL — local source build or Docker Compose
+export BASE_URL=http://localhost:8080
+
+# Sandbox (routed through Hyperswitch), when applicable
+# export BASE_URL=https://sandbox.hyperswitch.io
+
+# Protected endpoints accept either a dashboard JWT or an API key
+export AUTH_HEADER="Authorization: Bearer <jwt_token>"
+# export AUTH_HEADER="x-api-key: DE_<api_key>"
+
+# Sandbox-only routing header
+export FEATURE_HEADER="x-feature: decision-engine"
+
+# Required on analytics routes, /health/diagnostics, and /gateway-score/reset only.
+# "public" is the only tenant the shipped config files define.
+export TENANT_HEADER="x-tenant-id: public"
+```
+
+Public routes need no auth. Protected routes include `AUTH_HEADER`:
+
+```bash
+curl "$BASE_URL/analytics/overview?range=1d" \
+ --header "$AUTH_HEADER" \
+ --header "$TENANT_HEADER" \
+ --header "$FEATURE_HEADER"
+```
+
+## Authentication & access
+
+| Access class | Routes | Required headers |
+| --- | --- | --- |
+| Public health | `GET /health`, `GET /health/ready` | None |
+| Public health (tenant-scoped) | `GET /health/diagnostics` | `TENANT_HEADER` — no auth |
+| Public auth entry | `POST /auth/signup`, `POST /auth/login` | None |
+| Admin bootstrap | `POST /merchant-account/create` | Admin secret configured for the deployment |
+| Protected APIs | API keys, merchant reads/deletes, routing, rule config, decisions, score updates, config | `Authorization: Bearer <jwt_token>` or `x-api-key: <api_key>` |
+| Protected APIs (tenant-scoped) | All `GET /analytics/*`, `POST /gateway-score/reset` | The above, **plus** `TENANT_HEADER` |
+| Sandbox (Hyperswitch) | Same rules, served through `https://sandbox.hyperswitch.io` | Add `x-feature: decision-engine` |
+
+<Warning>
+ `TENANT_HEADER` (`x-tenant-id`) has no fallback — omitting it on a route that needs it fails with `TE_03: x-tenant-id not found in headers`, regardless of a valid `AUTH_HEADER`. It's easy to miss because most routes (`/decide-gateway`, `/routing/*`, `/rule/*`, `/merchant-account/*`, `/update-gateway-score`, `/auth/*`, `/api-key/*`) resolve the tenant internally and need no such header — only the routes listed above do.
+</Warning>
+
+## Browse by task
+
+<CardGroup cols={2}>
+ <Card title="Health & Status" icon="heart-pulse" href="/decision-engine-api-reference/api-reference/guides/health-status/health-check">
+ Liveness, readiness, and dependency diagnostics.
+ </Card>
+ <Card title="Authentication & Onboarding" icon="key" href="/decision-engine-api-reference/api-reference/guides/auth-onboarding/auth-and-onboarding">
+ Sign up, log in, switch merchants, and manage API keys.
+ </Card>
+ <Card title="Merchant Accounts" icon="building" href="/decision-engine-api-reference/api-reference/guides/merchant-accounts/merchant-account-create">
+ Create, read, delete a merchant, and manage debit routing.
+ </Card>
+ <Card title="Configure Routing" icon="route" href="/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-create">
+ Single, priority, volume-split, and advanced rule trees — plus activation.
+ </Card>
+ <Card title="Scoring Configuration" icon="sliders" href="/decision-engine-api-reference/api-reference/guides/scoring-config/success-rate-config-create">
+ Success-rate and elimination (downtime) scoring config.
+ </Card>
+ <Card title="Run Transactions" icon="bolt" href="/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-sr-based">
+ Choose a connector per payment via `/decide-gateway`.
+ </Card>
+ <Card title="Feedback & Scoring" icon="arrow-rotate-left" href="/decision-engine-api-reference/api-reference/guides/feedback-scoring/update-gateway-score">
+ Report authorization outcomes to keep scoring accurate.
+ </Card>
+ <Card title="Analytics & Audit" icon="chart-line" href="/decision-engine-api-reference/api-reference/guides/analytics-audit/analytics-endpoints">
+ Overview, gateway scores, decisions, routing stats, and audit.
+ </Card>
+ <Card title="Multi-Objective Routing" icon="scale-balanced" href="/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-multi-objective">
+ Cost-aware post-step that re-ranks gateways on expected value.
+ </Card>
+ <Card title="Cost Data Ingestion" icon="file-invoice-dollar" href="/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-setup">
+ Learn real per-gateway fees from settlement reports and invoices.
+ </Card>
+ <Card title="A/B Testing" icon="flask" href="/decision-engine-api-reference/api-reference/guides/ab-testing/ab-testing-create">
+ Compare two routing strategies on live traffic with guardrails.
+ </Card>
+ <Card title="Autopilot & Feature Flags" icon="sliders" href="/decision-engine-api-reference/api-reference/guides/autopilot/merchant-features">
+ Self-tuning SR scoring, plus every merchant-level toggle.
+ </Card>
+</CardGroup>
+
+## Ways to route transactions
+
+`/decide-gateway` supports several strategies, selected per request with `rankingAlgorithm`.
+
+| Strategy | Request value | Guide |
+| --- | --- | --- |
+| Success-rate (auth-rate) based | `SR_BASED_ROUTING` | [SR-based routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-sr-based) |
+| Priority-list based | `PL_BASED_ROUTING` | [Priority-list routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-pl-based) |
+| Debit / network based | `NTW_BASED_ROUTING` | [Debit routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-debit-routing) |
+| Network + SR hybrid | `NTW_SR_HYBRID_ROUTING` | [Hybrid routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-hybrid-routing) |
+
+<Info>
+ **Multi-objective (cost-aware) routing** is not a `rankingAlgorithm` value. It is a post-step on success-rate scoring, toggled per request with `enableMultiObjective` or per merchant with the `multi_objective_routing_enabled` feature flag. When active, responses carry a `multi_objective_info` block. See [Multi-objective routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-multi-objective).
+</Info>
+
+## Advanced capabilities
+
+Beyond the core decide/feedback loop, Decision Engine ships several self-contained systems that build on it:
+
+| Capability | What it does | Start here |
+| --- | --- | --- |
+| Cost data ingestion | Learns each connector's actual fee (from settlement reports and invoices) at a per-cluster level, feeding multi-objective routing's expected-value ranking. | [Connector setup](/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-setup) → [uploads](/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-uploads) → [fees & coverage](/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-fees) |
+| A/B testing | Splits traffic between a control and variant routing strategy — auth vs. cost-aware, manual vs. autopilot, or any two saved algorithms — with a guardrail and significance testing. | [Create an experiment](/decision-engine-api-reference/api-reference/guides/ab-testing/ab-testing-create) → [read results](/decision-engine-api-reference/api-reference/guides/ab-testing/ab-testing-results) |
+| Simulation | Preview what any routing algorithm (including an A/B test arm) would decide for a given payment context, without a real transaction. | [Evaluate Routing Algorithm](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-evaluate) |
+| Autopilot & auto-calibration | Background job that self-tunes SR hedging % and bucket size from observed traffic, with a hard-reset endpoint for simulation runs. | [Merchant Features](/decision-engine-api-reference/api-reference/guides/autopilot/merchant-features) |
+
+## Backward compatibility
+
+Legacy routes are kept for older integrations. New integrations should use `/decide-gateway` and `/update-gateway-score`.
+
+- [Legacy decision endpoint](/decision-engine-api-reference/api-reference/guides/legacy/decision-gateway-legacy) — the older `/decision_gateway` route.
+- [Legacy update score](/decision-engine-api-reference/api-reference/guides/legacy/update-score-legacy) — the older `/update-score` route.
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/auth-onboarding/api-keys.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/auth-onboarding/api-keys.mdx
new file mode 100644
index 0000000000..a83ec64a00
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/auth-onboarding/api-keys.mdx
@@ -0,0 +1,45 @@
+---
+title: "API Keys"
+description: "Curl examples for creating, listing, and revoking Decision Engine API keys."
+---
+
+# API Keys
+
+API keys are intended for service-to-service traffic. Use the returned `api_key` value as `x-api-key` for protected endpoints.
+
+## Create API Key
+
+```bash
+curl --location "$BASE_URL/api-key/create" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchant_id": "merchant_demo",
+ "description": "backend integration key"
+ }'
+```
+
+```json
+{
+ "key_id": "018f...",
+ "api_key": "DE_...",
+ "key_prefix": "DE_abcd",
+ "merchant_id": "merchant_demo",
+ "description": "backend integration key",
+ "created_at": "2026-04-25 10:00:00"
+}
+```
+
+## List API Keys
+
+```bash
+curl "$BASE_URL/api-key/list/merchant_demo" \
+ --header "$AUTH_HEADER"
+```
+
+## Revoke API Key
+
+```bash
+curl --request DELETE "$BASE_URL/api-key/018f-key-id" \
+ --header "$AUTH_HEADER"
+```
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/auth-onboarding/auth-and-onboarding.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/auth-onboarding/auth-and-onboarding.mdx
new file mode 100644
index 0000000000..a7e055f752
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/auth-onboarding/auth-and-onboarding.mdx
@@ -0,0 +1,150 @@
+---
+title: "Auth And Onboarding"
+description: "Curl examples for dashboard auth, merchant selection, and merchant onboarding."
+---
+
+# Auth And Onboarding
+
+## Sign Up
+
+```bash
+curl --location "$BASE_URL/auth/signup" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "email": "[email protected]",
+ "password": "StrongPass#123",
+ "merchant_id": "merchant_demo"
+ }'
+```
+
+## Login
+
+```bash
+curl --location "$BASE_URL/auth/login" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "email": "[email protected]",
+ "password": "StrongPass#123"
+ }'
+```
+
+Response contains a dashboard JWT:
+
+```json
+{
+ "token": "eyJ...",
+ "user_id": "user_123",
+ "email": "[email protected]",
+ "merchant_id": "merchant_demo",
+ "role": "admin",
+ "merchants": []
+}
+```
+
+## Current User
+
+```bash
+curl "$BASE_URL/auth/me" \
+ --header "$AUTH_HEADER"
+```
+
+## List User Merchants
+
+```bash
+curl "$BASE_URL/auth/merchants" \
+ --header "$AUTH_HEADER"
+```
+
+## Switch Merchant
+
+```bash
+curl --location "$BASE_URL/auth/switch-merchant" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{ "merchant_id": "merchant_demo" }'
+```
+
+## Create Merchant From Dashboard
+
+```bash
+curl --location "$BASE_URL/onboarding/merchant" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{ "merchant_name": "Demo Merchant" }'
+```
+
+## Logout
+
+```bash
+curl --location "$BASE_URL/auth/logout" \
+ --header "$AUTH_HEADER" \
+ --request POST
+```
+
+## Verify Email
+
+Public route — the link sent by the signup email-verification flow calls this with the token from the email.
+
+```bash
+curl "$BASE_URL/auth/verify-email?token=vf_9f21a6c0..."
+```
+
+```json
+{ "message": "Email verified successfully." }
+```
+
+## Change Password
+
+```bash
+curl --location "$BASE_URL/auth/change-password" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "current_password": "StrongPass#123",
+ "new_password": "EvenStrongerPass#456"
+ }'
+```
+
+```json
+{ "message": "Password updated successfully." }
+```
+
+## Team Management
+
+Invite and manage members on the authenticated merchant account. Inviting requires the caller's JWT to carry the `admin` role.
+
+### List Members
+
+```bash
+curl "$BASE_URL/merchant/members" \
+ --header "$AUTH_HEADER"
+```
+
+```json
+[
+ { "user_id": "user_123", "email": "[email protected]", "role": "admin" },
+ { "user_id": "user_456", "email": "[email protected]", "role": "member" }
+]
+```
+
+### Invite A Member
+
+```bash
+curl --location "$BASE_URL/merchant/members/invite" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{ "email": "[email protected]", "role": "member" }'
+```
+
+`role` is optional and defaults to `"member"`; the only other accepted value is `"admin"`.
+
+```json
+{
+ "email": "[email protected]",
+ "is_new_user": true,
+ "password": "TempPass#8821",
+ "role": "member"
+}
+```
+
+`password` is only present when the invite creates a brand-new user account — share it out of band so they can log in and change it. Inviting an email that's already a user omits `password` and just adds the membership.
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/autopilot/merchant-features.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/autopilot/merchant-features.mdx
new file mode 100644
index 0000000000..149cef35e7
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/autopilot/merchant-features.mdx
@@ -0,0 +1,102 @@
+---
+title: "Merchant Features: Autopilot & Feature Flags"
+description: "Curl examples for reading and toggling merchant-level feature flags — including Autopilot and SR Auto-Calibration — and resetting gateway scores."
+---
+
+# Merchant Features: Autopilot & Feature Flags
+
+Every merchant-level toggle — multi-objective routing, A/B test real-payment interception, elimination, and the two self-tuning features (Autopilot and SR Auto-Calibration) — is read and set through one small feature-flag API.
+
+## List Feature Flags
+
+```bash
+curl "$BASE_URL/merchant-account/merchant_demo/features" \
+ --header "$AUTH_HEADER"
+```
+
+```json
+{
+ "merchant_id": "merchant_demo",
+ "features": [
+ { "feature": "gsm-scoring-filter", "enabled": false },
+ { "feature": "explore-exploit-srv3", "enabled": false },
+ { "feature": "ab-test-real-payments", "enabled": true },
+ { "feature": "multi-objective-routing", "enabled": true },
+ { "feature": "elimination", "enabled": true },
+ { "feature": "auto-calibration", "enabled": true },
+ { "feature": "autopilot", "enabled": true }
+ ]
+}
+```
+
+## Toggle A Feature
+
+```bash
+curl --location "$BASE_URL/merchant-account/merchant_demo/features/autopilot" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{ "enabled": true }'
+```
+
+Response is the same shape as the list call, re-read after the change so you always see the current effective state of every flag.
+
+## Known Features
+
+| Slug | What it controls |
+| --- | --- |
+| `gsm-scoring-filter` | Filters gateway scoring using Gateway Status Mapper error-code classification. |
+| `explore-exploit-srv3` | Explore/exploit hedging on the SRv3 scoring path. |
+| `ab-test-real-payments` | Whether active A/B test experiments intercept real `/decide-gateway` traffic — see [A/B Testing: Results](/decision-engine-api-reference/api-reference/guides/ab-testing/ab-testing-results). |
+| `multi-objective-routing` | Merchant-wide default for the cost-aware post-step — see [Multi-Objective Routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-multi-objective). Per-request `enableMultiObjective` overrides this. |
+| `elimination` | Gateway-level SR-based elimination (excluding gateways in downtime). |
+| `auto-calibration` | Enables the self-tuning background job (see below). Must be on **together with** `autopilot` for the job to actually write changes. |
+| `autopilot` | Master write-permission switch for the self-tuning job. With `auto-calibration` off, this alone does nothing. |
+
+## What Autopilot & Auto-Calibration Do
+
+The success-rate scorer has two knobs — **bucket size** (how many recent transactions each gateway's score is averaged over) and **hedging %** (how much traffic is explored away from the current leader). The right values depend on how much traffic a merchant sees and how many gateways it spreads across, and the ideal settings drift as that traffic changes through the day. Tuning them by hand is tedious and quickly goes stale.
+
+**Autopilot is the self-tuning layer that sets those two knobs for you, continuously, from observed traffic.** Instead of a fixed configuration, it watches each merchant's real volume and gateway spread and re-derives the bucket size and hedging % that keep scoring both responsive (fast to notice a gateway degrading) and stable (not thrashing on noise). "Auto-Calibration" is the background job that does the deriving; "Autopilot" is the switch that lets it actually write its results back. The two are split so you can enrol a merchant for observation without granting write access until you're ready.
+
+These two flags jointly control a background job — there is no separate "run autopilot" endpoint. `auto-calibration` gates whether the job considers a merchant at all; `autopilot` gates whether it's allowed to write. Both must be enabled for self-tuning to take effect.
+
+Every polling interval (default 900s, configurable via `[sr_auto_calibration]` in `config/*.toml` or `SR_AUTO_CALIBRATION_INTERVAL_SECS`), the job:
+
+1. Reads recent traffic volume from ClickHouse (default 3600s lookback).
+2. Derives two SRv3 knobs purely from observed data — no merchant input:
+ - **Bucket size** — clamped between 100 and 2000, only rewritten on a meaningful (25-step) change.
+ - **Hedging %** — capped at 30%, with a 1.0pp minimum move before it updates.
+3. Writes the result back into the merchant's SR config (readable via [`GET /config/routing-keys`](/decision-engine-api-reference/api-reference/guides/scoring-config/config-endpoints) and [`GET /config-sr-dimension/:merchant_id`](/decision-engine-api-reference/api-reference/guides/scoring-config/config-endpoints#get-sr-dimensions)), stamped with `"source": "autopilot"` so autopilot-written values are distinguishable from human-authored overrides.
+
+Every calibration run also emits an analytics event (`flow_type: autopilot_calibration`) — this is what powers the "Autopilot Actions" panel in the simulation UI, and is queryable via [Routing Events](/decision-engine-api-reference/api-reference/guides/analytics-audit/analytics-endpoints#routing-events).
+
+## Reset Gateway Scores
+
+Flushes all SR v2/v3 score and queue keys for a merchant from Redis, and strips any autopilot-written (`source: "autopilot"`) sub-level config overrides — human-authored overrides are preserved. Used by the simulator's "Hard refresh" so a new simulation run starts from a clean slate.
+
+Unlike the feature-flag calls above, this route requires `$TENANT_HEADER` in addition to `$AUTH_HEADER` — see [Environment setup](/decision-engine-api-reference/api-reference/guides/api-ref#environment-setup).
+
+```bash
+curl --location "$BASE_URL/gateway-score/reset" \
+ --header "$AUTH_HEADER" \
+ --header "$TENANT_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{ "merchant_id": "merchant_demo" }'
+```
+
+```json
+{
+ "merchant_id": "merchant_demo",
+ "deleted_keys": 214,
+ "removed_overrides": 3
+}
+```
+
+This does not disable routing or delete configuration — it only clears live scoring state so the next decisions start from a fresh baseline.
+
+## Related
+
+- [A/B Testing: Create An Experiment](/decision-engine-api-reference/api-reference/guides/ab-testing/ab-testing-create)
+- [Multi-Objective Routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-multi-objective)
+- [Routing Config Endpoints](/decision-engine-api-reference/api-reference/guides/scoring-config/config-endpoints)
+- [Analytics Endpoints](/decision-engine-api-reference/api-reference/guides/analytics-audit/analytics-endpoints)
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-advanced-example.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-advanced-example.mdx
new file mode 100644
index 0000000000..3c9e37bbde
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-advanced-example.mdx
@@ -0,0 +1,353 @@
+---
+title: "Advanced Routing Example"
+description: "Advanced Euclid rule tree examples for /routing/create, including AND, OR, nested rules, and value variants."
+---
+
+# Advanced Routing Example
+
+Use `algorithm.type = advanced` when a merchant needs conditional rule-based routing instead of a fixed connector order. Advanced rules evaluate payment attributes, choose the first matching rule output, and fall back to `default_selection` when no rule matches.
+
+## Advanced Program Shape
+
+```json
+{
+ "globals": {},
+ "default_selection": {
+ "priority": [
+ { "gateway_name": "stripe", "gateway_id": "mca_stripe" }
+ ]
+ },
+ "rules": [],
+ "metadata": {}
+}
+```
+
+| Field | Meaning |
+| --- | --- |
+| `globals` | Optional reusable value sets referenced by `global_ref`. |
+| `default_selection` | Fallback `single`, `priority`, `volume_split`, or `volume_split_priority` output. |
+| `rules[].routing_type` | Rule output behavior: `priority`, `volume_split`, or `volume_split_priority`. |
+| `rules[].output` | Connector output returned when the rule matches. |
+| `rules[].statements[].condition` | Conditions inside one statement. All conditions in the same array must match. |
+| `rules[].statements[].nested` | Optional nested statements. Parent condition must match and then nested statements are evaluated. |
+
+## Full Create Request
+
+```bash
+curl --location "$BASE_URL/routing/create" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "name": "advanced card routing",
+ "created_by": "merchant_demo",
+ "description": "Route Visa card traffic by priority, otherwise fallback to stripe",
+ "algorithm_for": "payment",
+ "algorithm": {
+ "type": "advanced",
+ "data": {
+ "globals": {},
+ "default_selection": {
+ "priority": [
+ { "gateway_name": "stripe", "gateway_id": "mca_stripe" }
+ ]
+ },
+ "rules": [
+ {
+ "name": "visa_card_rule",
+ "routing_type": "priority",
+ "output": {
+ "priority": [
+ { "gateway_name": "adyen", "gateway_id": "mca_adyen" },
+ { "gateway_name": "stripe", "gateway_id": "mca_stripe" }
+ ]
+ },
+ "statements": [
+ {
+ "condition": [
+ {
+ "lhs": "payment_method_type",
+ "comparison": "equal",
+ "value": { "type": "enum_variant", "value": "CARD" },
+ "metadata": {}
+ },
+ {
+ "lhs": "card_network",
+ "comparison": "equal",
+ "value": { "type": "enum_variant", "value": "Visa" },
+ "metadata": {}
+ }
+ ],
+ "nested": null
+ }
+ ]
+ }
+ ],
+ "metadata": {}
+ }
+ }
+ }'
+```
+
+## Logic Variants
+
+### AND Rule
+
+Use one `condition` array when all conditions must match.
+
+```json
+{
+ "name": "high_value_netherlands_rule",
+ "routing_type": "volume_split",
+ "output": {
+ "volume_split": [
+ {
+ "split": 60,
+ "output": { "gateway_name": "hdfc", "gateway_id": "mca_hdfc" }
+ },
+ {
+ "split": 40,
+ "output": { "gateway_name": "instamojo", "gateway_id": "mca_instamojo" }
+ }
+ ]
+ },
+ "statements": [
+ {
+ "condition": [
+ {
+ "lhs": "amount",
+ "comparison": "greater_than",
+ "value": { "type": "number", "value": 100 },
+ "metadata": {}
+ },
+ {
+ "lhs": "billing_country",
+ "comparison": "equal",
+ "value": { "type": "enum_variant", "value": "Netherlands" },
+ "metadata": {}
+ }
+ ],
+ "nested": null
+ }
+ ]
+}
+```
+
+### OR Rule
+
+Use multiple statements when any statement can trigger the rule.
+
+```json
+{
+ "name": "card_or_high_value_rule",
+ "routing_type": "priority",
+ "output": {
+ "priority": [
+ { "gateway_name": "paytm", "gateway_id": "mca_paytm" },
+ { "gateway_name": "adyen", "gateway_id": "mca_adyen" }
+ ]
+ },
+ "statements": [
+ {
+ "condition": [
+ {
+ "lhs": "payment_method_type",
+ "comparison": "equal",
+ "value": { "type": "enum_variant", "value": "CARD" },
+ "metadata": {}
+ }
+ ],
+ "nested": null
+ },
+ {
+ "condition": [
+ {
+ "lhs": "amount",
+ "comparison": "greater_than",
+ "value": { "type": "number", "value": 100 },
+ "metadata": {}
+ }
+ ],
+ "nested": null
+ }
+ ]
+}
+```
+
+### Nested AND + OR Rule
+
+Use `nested` when a parent condition must match and then one nested branch can match.
+
+```json
+{
+ "name": "amount_and_card_network_or_country_rule",
+ "routing_type": "priority",
+ "output": {
+ "priority": [
+ { "gateway_name": "rbl", "gateway_id": "mca_rbl" },
+ { "gateway_name": "instamojo", "gateway_id": "mca_instamojo" }
+ ]
+ },
+ "statements": [
+ {
+ "condition": [
+ {
+ "lhs": "amount",
+ "comparison": "greater_than",
+ "value": { "type": "number", "value": 10 },
+ "metadata": {}
+ }
+ ],
+ "nested": [
+ {
+ "condition": [
+ {
+ "lhs": "card_network",
+ "comparison": "equal",
+ "value": { "type": "enum_variant", "value": "Visa" },
+ "metadata": {}
+ }
+ ],
+ "nested": null
+ },
+ {
+ "condition": [
+ {
+ "lhs": "billing_country",
+ "comparison": "equal",
+ "value": { "type": "enum_variant", "value": "India" },
+ "metadata": {}
+ }
+ ],
+ "nested": null
+ }
+ ]
+ }
+ ]
+}
+```
+
+## Output Variants
+
+### Priority Output
+
+```json
+{
+ "routing_type": "priority",
+ "output": {
+ "priority": [
+ { "gateway_name": "adyen", "gateway_id": "mca_adyen" },
+ { "gateway_name": "stripe", "gateway_id": "mca_stripe" }
+ ]
+ }
+}
+```
+
+### Volume Split Output
+
+```json
+{
+ "routing_type": "volume_split",
+ "output": {
+ "volume_split": [
+ {
+ "split": 70,
+ "output": { "gateway_name": "stripe", "gateway_id": "mca_stripe" }
+ },
+ {
+ "split": 30,
+ "output": { "gateway_name": "adyen", "gateway_id": "mca_adyen" }
+ }
+ ]
+ }
+}
+```
+
+### Volume Split Priority Output
+
+Use `volume_split_priority` when each split should return a priority list rather than a single connector.
+
+```json
+{
+ "routing_type": "volume_split_priority",
+ "output": {
+ "volume_split_priority": [
+ {
+ "split": 60,
+ "output": [
+ { "gateway_name": "stripe", "gateway_id": "mca_stripe" },
+ { "gateway_name": "adyen", "gateway_id": "mca_adyen" }
+ ]
+ },
+ {
+ "split": 40,
+ "output": [
+ { "gateway_name": "checkout", "gateway_id": "mca_checkout" },
+ { "gateway_name": "stripe", "gateway_id": "mca_stripe" }
+ ]
+ }
+ ]
+ }
+}
+```
+
+## Value Variants
+
+### Enum Variant Array
+
+```json
+{
+ "lhs": "card_network",
+ "comparison": "equal",
+ "value": {
+ "type": "enum_variant_array",
+ "value": ["Visa", "Mastercard"]
+ },
+ "metadata": {}
+}
+```
+
+### Number Array
+
+```json
+{
+ "lhs": "amount",
+ "comparison": "equal",
+ "value": {
+ "type": "number_array",
+ "value": [1000, 2000, 5000]
+ },
+ "metadata": {}
+}
+```
+
+### Number Comparison Array
+
+```json
+{
+ "lhs": "amount",
+ "comparison": "equal",
+ "value": {
+ "type": "number_comparison_array",
+ "value": [
+ { "comparison_type": "greater_than", "number": 1000 },
+ { "comparison_type": "less_than_equal", "number": 5000 }
+ ]
+ },
+ "metadata": {}
+}
+```
+
+## Notes
+
+- Advanced algorithms require `statements`; top-level `single`, `priority`, and `volume_split` algorithms do not.
+- Conditions in the same `condition` array behave like AND.
+- Multiple statements behave like OR.
+- `nested` allows a parent condition plus nested branch matching.
+- `volume_split` percentages should add up to 100.
+
+## Related
+
+- [Create Routing Algorithm](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-create)
+- [Evaluate Routing Algorithm](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-evaluate)
+- [Priority Routing](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-priority-example)
+- [Volume Split Routing](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-volume-split-example)
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-activate.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-activate.mdx
new file mode 100644
index 0000000000..112af01602
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-activate.mdx
@@ -0,0 +1,29 @@
+---
+title: "Activate Routing Algorithm"
+description: "Curl example for activating a routing algorithm."
+---
+
+# Activate Routing Algorithm
+
+At a given time, one algorithm for each `algorithm_for` value can be active for one merchant.
+
+## Request
+
+```bash
+curl --location "$BASE_URL/routing/activate" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "created_by": "merchant_demo",
+ "routing_algorithm_id": "routing_e641380c-6f24-4405-8454-5ae6cbceb7a0"
+ }'
+```
+
+## Response
+
+Success returns HTTP `200` with an empty response body.
+
+## Related
+
+- [Deactivate Routing Algorithm](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-deactivate)
+- [List Active Routing Algorithms](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-list-active)
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-create.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-create.mdx
new file mode 100644
index 0000000000..7cb213546e
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-create.mdx
@@ -0,0 +1,157 @@
+---
+title: "Create Routing Algorithm"
+description: "Curl examples for /routing/create."
+---
+
+# Create Routing Algorithm
+
+Use `/routing/create` to persist a merchant-scoped routing algorithm. Creating an algorithm does not make it active; call [`/routing/activate`](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-activate) after creation.
+
+Supported `algorithm.type` values:
+
+| Type | Use case | Full example |
+| --- | --- | --- |
+| `single` | Always return one connector. | [Single connector](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-single-connector-example) |
+| `priority` | Return connectors in the configured order. | [Priority routing](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-priority-example) |
+| `volume_split` | Split decisions by percentage. | [Volume split](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-volume-split-example) |
+| `advanced` | Evaluate AND/OR/nested conditions before returning an output. | [Advanced routing](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-advanced-example) |
+| `ab_test` | Split traffic between a control and variant strategy with guardrails and significance testing. | [A/B testing](/decision-engine-api-reference/api-reference/guides/ab-testing/ab-testing-create) |
+
+Use [`/routing/deactivate`](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-deactivate) to deactivate the currently active algorithm without deleting it, and [update or delete](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-update-delete) an inactive algorithm in place.
+
+## Priority Rule
+
+```bash
+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" }
+ ]
+ }
+ }'
+```
+
+## Single Connector Rule
+
+```bash
+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" }
+ }
+ }'
+```
+
+## Volume Split Rule
+
+```bash
+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" }
+ }
+ ]
+ }
+ }'
+```
+
+## Advanced Rule
+
+Use `advanced` for conditional routing. The complete AND/OR/nested reference is in [Advanced Routing Example](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-advanced-example).
+
+```bash
+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": {}
+ }
+ }
+ }'
+```
+
+## Response
+
+```json
+{
+ "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"
+}
+```
+
+## Related
+
+- [Activate Routing Algorithm](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-activate)
+- [Update & Delete Routing Algorithm](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-update-delete)
+- [List Routing Algorithms](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-list)
+- [Evaluate Routing Algorithm](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-evaluate)
+- [Advanced Routing Example](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-advanced-example)
+- [A/B Testing: Create An Experiment](/decision-engine-api-reference/api-reference/guides/ab-testing/ab-testing-create)
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-deactivate.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-deactivate.mdx
new file mode 100644
index 0000000000..de861c68cd
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-deactivate.mdx
@@ -0,0 +1,36 @@
+---
+title: "Deactivate Routing Algorithm"
+description: "Curl example for deactivating a routing algorithm."
+---
+
+# Deactivate Routing Algorithm
+
+Use `/routing/deactivate` to remove the active mapping for a merchant-scoped routing algorithm without deleting the algorithm itself.
+
+## Request
+
+```bash
+curl --location "$BASE_URL/routing/deactivate" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "created_by": "merchant_demo",
+ "routing_algorithm_id": "routing_e641380c-6f24-4405-8454-5ae6cbceb7a0"
+ }'
+```
+
+## Response
+
+Success returns HTTP `200` with an empty response body.
+
+## Behavior
+
+- If the routing algorithm exists and is active for the merchant, the active mapping is deleted.
+- If the routing algorithm exists but is already inactive, the request still succeeds.
+- If the routing algorithm ID does not exist, the request fails with `400`.
+
+## Related
+
+- [Create Routing Algorithm](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-create)
+- [Activate Routing Algorithm](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-activate)
+- [List Active Routing Algorithms](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-list-active)
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-evaluate.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-evaluate.mdx
new file mode 100644
index 0000000000..fc3405507c
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-evaluate.mdx
@@ -0,0 +1,39 @@
+---
+title: "Evaluate Routing Algorithm"
+description: "Curl example for /routing/evaluate."
+---
+
+# Evaluate Routing Algorithm
+
+`/routing/evaluate` evaluates the active routing algorithm for a payment context. It does not update SR scores.
+
+## Request
+
+```bash
+curl --location "$BASE_URL/routing/evaluate" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchantId": "merchant_demo",
+ "paymentInfo": {
+ "paymentId": "eval_001",
+ "amount": 1000,
+ "currency": "USD",
+ "paymentType": "ORDER_PAYMENT",
+ "paymentMethodType": "CARD",
+ "paymentMethod": "CREDIT",
+ "authType": "THREE_DS"
+ }
+ }'
+```
+
+## Response
+
+```json
+{
+ "priority": [
+ { "gateway_name": "stripe", "gateway_id": "mca_111" },
+ { "gateway_name": "adyen", "gateway_id": "mca_112" }
+ ]
+}
+```
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-list-active.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-list-active.mdx
new file mode 100644
index 0000000000..596a8703b6
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-list-active.mdx
@@ -0,0 +1,26 @@
+---
+title: "List Active Routing Algorithms"
+description: "Curl example for listing active routing algorithms."
+---
+
+# List Active Routing Algorithms
+
+## Request
+
+```bash
+curl --location --request POST "$BASE_URL/routing/list/active/merchant_demo" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json"
+```
+
+## Response
+
+```json
+[
+ {
+ "rule_id": "routing_e641380c-6f24-4405-8454-5ae6cbceb7a0",
+ "name": "priority rule",
+ "algorithm_for": "payment"
+ }
+]
+```
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-list.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-list.mdx
new file mode 100644
index 0000000000..b753d01582
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-list.mdx
@@ -0,0 +1,25 @@
+---
+title: "List Routing Algorithms"
+description: "Curl example for listing routing algorithms."
+---
+
+# List Routing Algorithms
+
+## Request
+
+```bash
+curl --request POST "$BASE_URL/routing/list/merchant_demo" \
+ --header "$AUTH_HEADER"
+```
+
+## Response
+
+```json
+[
+ {
+ "rule_id": "routing_e641380c-6f24-4405-8454-5ae6cbceb7a0",
+ "name": "priority rule",
+ "algorithm_for": "payment"
+ }
+]
+```
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-update-delete.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-update-delete.mdx
new file mode 100644
index 0000000000..4bed5a5897
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-update-delete.mdx
@@ -0,0 +1,71 @@
+---
+title: "Update & Delete Routing Algorithm"
+description: "Curl examples for /routing/update and /routing/delete."
+---
+
+# Update & Delete Routing Algorithm
+
+Edit or remove a previously created routing algorithm — including [A/B test experiments](/decision-engine-api-reference/api-reference/guides/ab-testing/ab-testing-create), which are stored the same way. Both operations only work on an **inactive** algorithm; deactivate it first with [`/routing/deactivate`](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-deactivate) if it's currently live.
+
+## Update
+
+Rewrites the name, description, and algorithm definition in place — the `rule_id` doesn't change.
+
+```bash
+curl --location "$BASE_URL/routing/update" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "created_by": "merchant_demo",
+ "routing_algorithm_id": "routing_e641380c-6f24-4405-8454-5ae6cbceb7a0",
+ "name": "priority rule (v2)",
+ "description": "try adyen before stripe",
+ "algorithm": {
+ "type": "priority",
+ "data": [
+ { "gateway_name": "adyen", "gateway_id": "mca_112" },
+ { "gateway_name": "stripe", "gateway_id": "mca_111" }
+ ]
+ }
+ }'
+```
+
+`algorithm` accepts the same `type` values as [`/routing/create`](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-create) — `single`, `priority`, `volume_split`, `advanced`, or `ab_test`.
+
+```json
+{
+ "id": "routing_e641380c-6f24-4405-8454-5ae6cbceb7a0",
+ "name": "priority rule (v2)",
+ "algorithm_for": "payment",
+ "created_at": "2026-07-01 09:12:04",
+ "modified_at": "2026-07-16 10:00:00"
+}
+```
+
+Returns an error if the algorithm is currently active, or if `created_by` doesn't own the algorithm.
+
+## Delete
+
+```bash
+curl --location "$BASE_URL/routing/delete" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "created_by": "merchant_demo",
+ "routing_algorithm_id": "routing_e641380c-6f24-4405-8454-5ae6cbceb7a0"
+ }'
+```
+
+```json
+{
+ "status": "deleted",
+ "routing_algorithm_id": "routing_e641380c-6f24-4405-8454-5ae6cbceb7a0"
+}
+```
+
+## Related
+
+- [Create Routing Algorithm](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-create)
+- [Activate Routing Algorithm](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-activate)
+- [Deactivate Routing Algorithm](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-deactivate)
+- [A/B Testing: Create An Experiment](/decision-engine-api-reference/api-reference/guides/ab-testing/ab-testing-create)
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-hybrid.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-hybrid.mdx
new file mode 100644
index 0000000000..88b1f3b2fa
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-hybrid.mdx
@@ -0,0 +1,35 @@
+---
+title: "Hybrid Routing Evaluation"
+description: "Curl example for /routing/hybrid."
+---
+
+# Hybrid Routing Evaluation
+
+`/routing/hybrid` evaluates the active rule path together with runtime routing context.
+
+```bash
+curl --location "$BASE_URL/routing/hybrid" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchantId": "merchant_demo",
+ "paymentInfo": {
+ "paymentId": "hybrid_eval_001",
+ "amount": 1000,
+ "currency": "USD",
+ "paymentType": "ORDER_PAYMENT",
+ "paymentMethodType": "CARD",
+ "paymentMethod": "CREDIT"
+ },
+ "eligibleGatewayList": ["stripe", "adyen"]
+ }'
+```
+
+```json
+{
+ "priority": [
+ { "gateway_name": "stripe", "gateway_id": "mca_111" },
+ { "gateway_name": "adyen", "gateway_id": "mca_112" }
+ ]
+}
+```
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-priority-example.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-priority-example.mdx
new file mode 100644
index 0000000000..e5aaf11e1c
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-priority-example.mdx
@@ -0,0 +1,25 @@
+---
+title: "Priority Routing Example"
+description: "Priority-list routing create example."
+---
+
+# Priority Routing Example
+
+```bash
+curl --location "$BASE_URL/routing/create" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "name": "priority rule",
+ "created_by": "merchant_demo",
+ "algorithm_for": "payment",
+ "algorithm": {
+ "type": "priority",
+ "data": [
+ { "gateway_name": "stripe", "gateway_id": "mca_111" },
+ { "gateway_name": "adyen", "gateway_id": "mca_112" },
+ { "gateway_name": "checkout", "gateway_id": "mca_113" }
+ ]
+ }
+ }'
+```
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-single-connector-example.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-single-connector-example.mdx
new file mode 100644
index 0000000000..c641bf5054
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-single-connector-example.mdx
@@ -0,0 +1,21 @@
+---
+title: "Single Connector Example"
+description: "Single-connector routing create example."
+---
+
+# Single Connector Example
+
+```bash
+curl --location "$BASE_URL/routing/create" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "name": "single connector rule",
+ "created_by": "merchant_demo",
+ "algorithm_for": "payment",
+ "algorithm": {
+ "type": "single",
+ "data": { "gateway_name": "stripe", "gateway_id": "mca_111" }
+ }
+ }'
+```
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-volume-split-example.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-volume-split-example.mdx
new file mode 100644
index 0000000000..c3c2750c39
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/configure-routing/routing-volume-split-example.mdx
@@ -0,0 +1,30 @@
+---
+title: "Volume Split Example"
+description: "Volume-split routing create example."
+---
+
+# Volume Split Example
+
+```bash
+curl --location "$BASE_URL/routing/create" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "name": "volume split rule",
+ "created_by": "merchant_demo",
+ "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" }
+ }
+ ]
+ }
+ }'
+```
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-fees.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-fees.mdx
new file mode 100644
index 0000000000..067e66f5f9
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-fees.mdx
@@ -0,0 +1,178 @@
+---
+title: "Cost Ingestion: Fees & Coverage"
+description: "Curl examples for reading fitted connector fees, setting manual overrides, inspecting top cost clusters, and checking cost-model coverage."
+---
+
+# Cost Ingestion: Fees & Coverage
+
+Once settlement data has been ingested (see [Connector Setup](/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-setup) and [Uploads](/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-uploads)), Decision Engine fits a per-cluster cost model — the input to [multi-objective routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-multi-objective)'s expected-value ranking. These endpoints read that model and let you override it manually.
+
+Overrides take priority in this order: **cluster override** → **connector override** → **learned model**.
+
+## Connector Fees
+
+Per-connector blended fee (volume-weighted over trustworthy clusters), any manual override, and which one is effective.
+
+```bash
+curl "$BASE_URL/merchant-account/merchant_demo/connector-fees" \
+ --header "$AUTH_HEADER"
+```
+
+```json
+[
+ {
+ "connector": "adyen",
+ "account": "YOUR_ADYEN_MERCHANT_ACCOUNT_CODE",
+ "has_credentials": true,
+ "model_pct_bps": 182.4,
+ "model_fixed": 0.1,
+ "good_gross": 1284302.55,
+ "override_pct_bps": null,
+ "override_fixed": null,
+ "override_updated_at": null,
+ "effective_pct_bps": 182.4,
+ "effective_fixed": 0.1,
+ "source": "model"
+ }
+]
+```
+
+`source` is `"override"`, `"model"`, or `"none"` (configured but no fitted data yet).
+
+### Set A Connector Fee Override
+
+Replaces the learned model for every expected-value calculation on this connector.
+
+```bash
+curl --request PUT \
+ "$BASE_URL/merchant-account/merchant_demo/connectors/adyen/fee-override" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{ "pct_bps": 175.0, "fixed": 0.1 }'
+```
+
+### Delete A Connector Fee Override
+
+```bash
+curl --request DELETE \
+ "$BASE_URL/merchant-account/merchant_demo/connectors/adyen/fee-override" \
+ --header "$AUTH_HEADER"
+```
+
+Both `pct_bps` and `fixed` must be finite and non-negative. Setting or clearing an override refreshes this merchant's served cost model immediately rather than waiting for the periodic refresh.
+
+## Cost Clusters
+
+The highest-traffic fitted clusters (by GMV) — the fine-grained segments underneath a connector's blended fee, and the target for surgical per-cluster overrides.
+
+```bash
+curl "$BASE_URL/merchant-account/merchant_demo/cost-clusters?limit=10" \
+ --header "$AUTH_HEADER"
+```
+
+Narrow to one connector's latest snapshot, or one exact ingestion:
+
+```bash
+curl "$BASE_URL/merchant-account/merchant_demo/cost-clusters?connector=adyen&account=YOUR_ADYEN_MERCHANT_ACCOUNT_CODE" \
+ --header "$AUTH_HEADER"
+```
+
+```json
+[
+ {
+ "key": "adyen|visa|credit|credit|us|usd|domestic",
+ "connector": "adyen",
+ "card_network": "visa",
+ "variant": "credit",
+ "funding": "credit",
+ "issuer_country": "us",
+ "currency": "usd",
+ "ic_category": "domestic",
+ "n": 18422,
+ "gross_sum": 512300.2,
+ "model_pct_bps": 178.2,
+ "model_fixed": 0.1,
+ "override_pct_bps": null,
+ "override_fixed": null,
+ "override_updated_at": null,
+ "effective_pct_bps": 178.2,
+ "effective_fixed": 0.1,
+ "source": "model"
+ }
+]
+```
+
+`key` is the opaque `connector|network|variant|funding|issuer|currency|ic_category` identifier used for the override calls below. `limit` defaults to 10, capped at 50.
+
+### Set A Cluster Fee Override
+
+```bash
+curl --request PUT \
+ "$BASE_URL/merchant-account/merchant_demo/cost-clusters/adyen%7Cvisa%7Ccredit%7Ccredit%7Cus%7Cusd%7Cdomestic/fee-override" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{ "pct_bps": 165.0, "fixed": 0.1 }'
+```
+
+### Delete A Cluster Fee Override
+
+```bash
+curl --request DELETE \
+ "$BASE_URL/merchant-account/merchant_demo/cost-clusters/adyen%7Cvisa%7Ccredit%7Ccredit%7Cus%7Cusd%7Cdomestic/fee-override" \
+ --header "$AUTH_HEADER"
+```
+
+The `|` separators in `key` must be URL-encoded (`%7C`) when used as a path segment.
+
+## Cost Coverage
+
+Cost-aware routing is only as good as the cost data behind it. A fitted model is trustworthy for some clusters and shaky for others, and routing decisions made on a shaky estimate can do more harm than good. **Cost coverage is the honesty check**: it tells you what fraction of a merchant's real volume actually has a cost model solid enough to route on, so you know whether to lean on multi-objective routing or hold off until more settlement data arrives.
+
+Every fitted cluster is graded with one of three verdicts:
+
+- **`GOOD`** — enough transactions (`n ≥ 200`) and a tight linear fit (per-transaction error `bps_rmse ≤ 15`). These are the clusters cost routing trusts.
+- **`THIN`** — too little settlement volume to fit confidently yet. More data over time promotes these to `GOOD`.
+- **`NON_LINEAR`** — plenty of data, but the fee doesn't follow a clean `pct × amount + fixed` line (tiered pricing, surcharges, mixed assessments), so the linear estimate isn't reliable.
+
+Coverage is reported by **volume (money), not by cluster count**, because that's what matters economically: a merchant can have hundreds of tiny `THIN` clusters that together carry a rounding error of GMV. `good_gross_pct` — the share of settled *value* sitting in `GOOD` clusters — is therefore the headline number. Everything outside a `GOOD` cluster simply falls back to plain success-rate routing, so a low coverage figure doesn't break routing; it just means fewer payments get the cost lens. As a rule of thumb, wait for `good_gross_pct` to climb into a comfortable range before flipping the merchant-wide multi-objective flag.
+
+The raw fields:
+
+Answers "is cost estimation actually working for this merchant?" — the dashboard health-card summary. `good_gross_pct` (share of settled *volume* with a trustworthy model) is the headline number; everything not covered falls back to plain success-rate routing.
+
+```bash
+curl "$BASE_URL/merchant-account/merchant_demo/cost-coverage" \
+ --header "$AUTH_HEADER"
+```
+
+```json
+{
+ "total_clusters": 214,
+ "good_clusters": 178,
+ "thin_clusters": 28,
+ "non_linear_clusters": 8,
+ "total_txns": 96430,
+ "good_txns": 88112,
+ "thin_txns": 6900,
+ "non_linear_txns": 1418,
+ "good_txn_pct": 91.4,
+ "total_gross": 3182004.11,
+ "good_gross": 2984502.9,
+ "thin_gross": 154002.4,
+ "non_linear_gross": 43498.81,
+ "good_gross_pct": 93.79,
+ "bps_rmse_p50": 2.1,
+ "bps_rmse_p90": 6.4,
+ "report_date": "2026-07-01"
+}
+```
+
+- `GOOD` clusters have enough consistent data to trust; `THIN` have too little volume; `NON_LINEAR` have a fee structure the linear fit can't capture well.
+- `bps_rmse_p50`/`p90` are the fit accuracy (basis-point error) of the `GOOD` clusters.
+
+## Related
+
+- [Cost Ingestion: Connector Setup](/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-setup)
+- [Cost Ingestion: Uploads](/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-uploads)
+- [Multi-Objective Routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-multi-objective)
+- [Analytics Endpoints](/decision-engine-api-reference/api-reference/guides/analytics-audit/analytics-endpoints) — see Cost Savings for the merchant-facing rollup.
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-setup.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-setup.mdx
new file mode 100644
index 0000000000..10678bc022
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-setup.mdx
@@ -0,0 +1,113 @@
+---
+title: "Cost Ingestion: Connector Setup"
+description: "Curl examples for registering connector settlement credentials and receiving settlement webhooks — the entry point for cost data ingestion."
+---
+
+# Cost Ingestion: Connector Setup
+
+Cost ingestion learns each connector's *actual* per-transaction fee (percentage + flat component) from real settlement reports and invoices, at a fine-grained cluster level (connector × card network × card variant × funding × issuer country × currency × interchange category). That fitted cost model is what [multi-objective routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-multi-objective) ranks gateways on.
+
+### Why it's learned, not configured
+
+Processor pricing is rarely a single number. The effective cost of a transaction depends on the card network, whether the card is credit or debit, where it was issued, the currency, and the interchange category — and published rate cards drift from what actually lands on the settlement statement once assessments, downgrades, and blended tiers are applied. Rather than ask a merchant to enter fee schedules by hand (which go stale the moment a processor re-prices), Decision Engine **reads the money that actually moved.** For each cluster it fits a simple linear model against real settlements — `fee ≈ pct_bps × amount + fixed` — using ordinary least squares. The slope becomes the percentage component (in basis points) and the intercept the flat per-transaction fee. That fitted `(pct_bps, fixed)` pair is the cost estimate every expected-value calculation uses.
+
+Because the fit is per-cluster, the model captures that (say) Visa credit issued in the US costs a different amount than a domestic debit card — precisely the differences that make one gateway cheaper for one slice of traffic and pricier for another. How much of a merchant's volume has a *trustworthy* fit (versus too little data, or a fee structure the linear model can't capture) is what [cost coverage](/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-fees#cost-coverage) reports.
+
+Before any report or invoice can be ingested, register the connector account's settlement credentials.
+
+## Data Sources
+
+Settlement data reaches Decision Engine through three paths, all feeding the same `cost_ingestion` pipeline:
+
+| Source | How it works | Docs |
+| --- | --- | --- |
+| Webhook push | The connector calls Decision Engine when a report is ready. Verified via the stored `webhook_secret`, then queued. | This page |
+| Scheduled poll | A background job polls the connector's reporting API for ready reports. No merchant action needed once credentials are set. | This page |
+| Manual upload | Upload a report or invoice file directly — useful before webhooks are wired, for backfills, or testing. | [Uploads](/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-uploads) |
+
+## Register Connector Credentials
+
+```bash
+curl --location "$BASE_URL/merchant-account/merchant_demo/connectors/adyen/credentials" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "account": "YOUR_ADYEN_MERCHANT_ACCOUNT_CODE",
+ "webhook_secret": "whsec_...",
+ "download_auth": "report_user:report_password"
+ }'
+```
+
+- `account` — the connector-side account (e.g. Adyen's `merchantAccountCode`).
+- `webhook_secret` — used to verify inbound webhook signatures for this account.
+- `download_auth` — credential used to authenticate report downloads for the scheduled poller. Either `"user:password"` for Basic auth, or a bare API key (sent as `X-API-Key`).
+
+Response:
+
+```json
+{
+ "merchant_id": "merchant_demo",
+ "connector": "adyen",
+ "account": "YOUR_ADYEN_MERCHANT_ACCOUNT_CODE",
+ "status": "saved"
+}
+```
+
+Secrets are encrypted at rest and never returned by the API — subsequent reads only return masked hints.
+
+## List Configured Connectors
+
+```bash
+curl "$BASE_URL/merchant-account/merchant_demo/connectors" \
+ --header "$AUTH_HEADER"
+```
+
+```json
+[
+ {
+ "connector": "adyen",
+ "account": "YOUR_ADYEN_MERCHANT_ACCOUNT_CODE",
+ "webhook_secret_hint": "••••af31",
+ "download_auth_hint": "report_user:••••"
+ }
+]
+```
+
+## Remove Credentials
+
+```bash
+curl --request DELETE \
+ "$BASE_URL/merchant-account/merchant_demo/connectors/adyen/credentials/YOUR_ADYEN_MERCHANT_ACCOUNT_CODE" \
+ --header "$AUTH_HEADER"
+```
+
+Returns `204 No Content`. Deleting a source that isn't configured also returns success (idempotent).
+
+## Settlement Webhook (Connector → Decision Engine)
+
+Once credentials are registered, point the connector's settlement-report notification at:
+
+```
+POST /webhooks/settlement/:connector
+```
+
+This route is **public** (no `AUTH_HEADER`) — the connector authenticates itself via its own signature, which Decision Engine verifies against the `webhook_secret` stored for that `(connector, account)` pair. Adyen is the first supported connector (`:connector = adyen`).
+
+```bash
+curl --location "$BASE_URL/webhooks/settlement/adyen" \
+ --header "Content-Type: application/json" \
+ --data @adyen-settlement-notification.json
+```
+
+The handler ACKs immediately and enqueues the report for background processing — download, parse, and re-fit all happen asynchronously in the ingest worker, so the connector always gets a fast response. A bad signature returns `401`; an unrecognized connector or malformed payload returns `400`.
+
+## Notes
+
+- Manual and webhook/poll-based ingestions share the same pipeline and history — see [Uploads](/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-uploads) for the manual path and ingestion history.
+- Once enough settlement data has been fitted, check [Cost Coverage](/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-fees#cost-coverage) to see what share of volume has a trustworthy cost model.
+
+## Related
+
+- [Cost Ingestion: Uploads](/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-uploads)
+- [Cost Ingestion: Fees & Coverage](/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-fees)
+- [Multi-Objective Routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-multi-objective)
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-uploads.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-uploads.mdx
new file mode 100644
index 0000000000..abf8c77ba6
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-uploads.mdx
@@ -0,0 +1,165 @@
+---
+title: "Cost Ingestion: Uploads"
+description: "Curl examples for manually uploading settlement reports and invoices, and inspecting ingestion history."
+---
+
+# Cost Ingestion: Uploads
+
+Use manual upload when webhooks aren't wired yet, for backfilling historical data, or for testing. Manual uploads share the same `cost_ingestion` pipeline and history as webhook- and poll-based ingestion (see [Connector Setup](/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-setup)).
+
+## Upload A Settlement Report
+
+Settlement reports can run to several GB, so the request body is streamed straight to disk and processed in the background — the request returns immediately with a job id to poll.
+
+```bash
+curl --location "$BASE_URL/merchant-account/merchant_demo/connectors/adyen/report?account=YOUR_ADYEN_MERCHANT_ACCOUNT_CODE" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: text/csv" \
+ --data-binary @settlement-report.csv
+```
+
+Returns `202 Accepted` immediately:
+
+```json
+{
+ "id": "ing_8f21a6c0",
+ "status": "processing"
+}
+```
+
+Upload is capped at 8 GiB per file.
+
+## Check Ingestion History
+
+Poll to see history and in-flight progress, newest first:
+
+```bash
+curl "$BASE_URL/merchant-account/merchant_demo/cost-ingestions" \
+ --header "$AUTH_HEADER"
+```
+
+```json
+[
+ {
+ "id": "ing_8f21a6c0",
+ "connector": "adyen",
+ "account": "YOUR_ADYEN_MERCHANT_ACCOUNT_CODE",
+ "source": "manual",
+ "status": "completed",
+ "staged_rows": 48213,
+ "report_date": "2026-07-01",
+ "period_start": "2026-06-01",
+ "period_end": "2026-06-30",
+ "currency_count": 3,
+ "currencies": ["USD", "EUR", "GBP"],
+ "country_count": 12,
+ "countries": ["US", "GB", "DE"],
+ "total_gross": 1284302.55,
+ "total_clusters": 214,
+ "good_clusters": 178,
+ "last_error": null,
+ "created_at": "2026-07-01T03:12:44Z"
+ }
+]
+```
+
+`source` is `"manual"`, `"webhook"`, or `"poll"` depending on how the report arrived. `status` is `"processing"`, `"completed"`, or `"failed"` (see `last_error`).
+
+## Delete An Ingestion
+
+Removes the transactions that ingestion contributed, re-fits the affected connector/account so the served cost model reflects the deletion, and deletes the history row.
+
+```bash
+curl --request DELETE \
+ "$BASE_URL/merchant-account/merchant_demo/cost-ingestions/ing_8f21a6c0" \
+ --header "$AUTH_HEADER"
+```
+
+Returns `204 No Content`. Returns `409 Conflict` if the ingestion is still `processing`.
+
+## Detect Price Changes
+
+Surfaces fee-regime changes detected by diffing each cluster's two most recent fits — useful for noticing when a connector silently repriced.
+
+```bash
+curl "$BASE_URL/merchant-account/merchant_demo/cost-price-changes" \
+ --header "$AUTH_HEADER"
+```
+
+## Upload An Invoice
+
+Invoices are small (a few hundred lines) and processed synchronously — the computed cost add-on is returned directly in the response. Use this to recover invoice-only fees (e.g. periodic/flat fees) that a settlement report alone doesn't capture.
+
+```bash
+curl --location "$BASE_URL/merchant-account/merchant_demo/connectors/adyen/invoice?account=YOUR_ADYEN_MERCHANT_ACCOUNT_CODE&invoice_ref=INV-2026-06" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/pdf" \
+ --data-binary @adyen-invoice-june.pdf
+```
+
+```json
+{
+ "merchant_id": "merchant_demo",
+ "connector": "adyen",
+ "account": "YOUR_ADYEN_MERCHANT_ACCOUNT_CODE",
+ "pct_addon_bps": 2.4,
+ "fixed_addon": 0.01,
+ "total_addon_per_txn": 0.034,
+ "subtotal_ex_tax": 4820.55,
+ "card_volume": 1284302.55,
+ "txn_count": 48213,
+ "currency": "EUR",
+ "lines": 6,
+ "breakdown": [
+ {
+ "description": "Monthly platform fee",
+ "kind": "flat_per_txn",
+ "added": true,
+ "amount": 500.0,
+ "per_txn": 0.0104
+ },
+ {
+ "description": "Interchange (already in settlement data)",
+ "kind": "already_modeled",
+ "added": false,
+ "amount": 3200.0,
+ "per_txn": 0.0
+ }
+ ]
+}
+```
+
+Invoice uploads are capped at 32 MiB. `breakdown[].added` is `true` for fee lines this add-on newly captures, `false` for lines already reflected in the settlement-report model (e.g. interchange) or ignored (volume-only lines).
+
+## List Invoice Add-Ons
+
+```bash
+curl "$BASE_URL/merchant-account/merchant_demo/invoice-addons" \
+ --header "$AUTH_HEADER"
+```
+
+## Delete An Invoice Add-On
+
+Reverts the merchant's served cost model to the learned-only (settlement-report-based) cost.
+
+```bash
+curl --request DELETE \
+ "$BASE_URL/merchant-account/merchant_demo/connectors/adyen/invoice-addon" \
+ --header "$AUTH_HEADER"
+```
+
+Returns `204 No Content`.
+
+## Invoice Reconciliation
+
+Ties each stored invoice add-on back to coverage before/after, so you can see how much of the invoice's cost is now explained by the model.
+
+```bash
+curl "$BASE_URL/merchant-account/merchant_demo/invoice-reconciliation" \
+ --header "$AUTH_HEADER"
+```
+
+## Related
+
+- [Cost Ingestion: Connector Setup](/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-setup)
+- [Cost Ingestion: Fees & Coverage](/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-fees)
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/feedback-scoring/update-gateway-score.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/feedback-scoring/update-gateway-score.mdx
new file mode 100644
index 0000000000..cc8355be55
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/feedback-scoring/update-gateway-score.mdx
@@ -0,0 +1,30 @@
+---
+title: "Update Gateway Score"
+description: "Curl example for /update-gateway-score."
+---
+
+# Update Gateway Score
+
+Call this after non-debit runtime payments so SR data stays current. Do not call it for `NTW_BASED_ROUTING` debit runs where `decided_gateway` is not the selected network.
+
+## Request
+
+```bash
+curl --location "$BASE_URL/update-gateway-score" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchantId": "merchant_demo",
+ "gateway": "stripe",
+ "gatewayReferenceId": null,
+ "status": "CHARGED",
+ "paymentId": "sr_001",
+ "enforceDynamicRoutingFailure": null
+ }'
+```
+
+## Response
+
+```text
+Success
+```
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/health-status/health-check.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/health-status/health-check.mdx
new file mode 100644
index 0000000000..6a38756bad
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/health-status/health-check.mdx
@@ -0,0 +1,49 @@
+---
+title: "Health Checks"
+description: "Curl examples for /health, /health/ready, and /health/diagnostics."
+---
+
+# Health Checks
+
+Health routes are public and do not require `AUTH_HEADER`. `/health/diagnostics` is the one exception — it needs `x-tenant-id`, see below.
+
+## Liveness
+
+```bash
+curl "$BASE_URL/health"
+```
+
+```json
+{ "message": "Health is good" }
+```
+
+## Readiness
+
+```bash
+curl "$BASE_URL/health/ready"
+```
+
+```json
+{ "message": "Up" }
+```
+
+## Diagnostics
+
+Unlike `/health` and `/health/ready`, this route resolves a tenant and requires `x-tenant-id` — omitting it fails with `TE_03: x-tenant-id not found in headers` even though no `AUTH_HEADER` is needed. `public` is the only tenant the shipped config files define.
+
+```bash
+curl "$BASE_URL/health/diagnostics" \
+ --header "x-tenant-id: public"
+```
+
+```json
+{
+ "key_custodian_locked": false,
+ "database": {
+ "database_connection": "Working",
+ "database_read": "Working",
+ "database_write": "Working",
+ "database_delete": "Working"
+ }
+}
+```
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/legacy/decision-gateway-legacy.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/legacy/decision-gateway-legacy.mdx
new file mode 100644
index 0000000000..6d2cffeda2
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/legacy/decision-gateway-legacy.mdx
@@ -0,0 +1,27 @@
+---
+title: "Legacy Decision Gateway"
+description: "Compatibility example for the legacy /decision_gateway route."
+---
+
+# Legacy Decision Gateway
+
+`/decision_gateway` is retained for compatibility with older integrations. New integrations should use [`/decide-gateway`](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-sr-based).
+
+```bash
+curl --location "$BASE_URL/decision_gateway" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchantId": "merchant_demo",
+ "eligibleGatewayList": ["stripe", "adyen"],
+ "rankingAlgorithm": "SR_BASED_ROUTING",
+ "paymentInfo": {
+ "paymentId": "legacy_001",
+ "amount": 1000,
+ "currency": "USD",
+ "paymentType": "ORDER_PAYMENT",
+ "paymentMethodType": "CARD",
+ "paymentMethod": "CREDIT"
+ }
+ }'
+```
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/legacy/update-score-legacy.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/legacy/update-score-legacy.mdx
new file mode 100644
index 0000000000..efa62cd7da
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/legacy/update-score-legacy.mdx
@@ -0,0 +1,20 @@
+---
+title: "Legacy Update Score"
+description: "Compatibility example for the legacy /update-score route."
+---
+
+# Legacy Update Score
+
+`/update-score` is retained for compatibility. New integrations should use [`/update-gateway-score`](/decision-engine-api-reference/api-reference/guides/feedback-scoring/update-gateway-score).
+
+```bash
+curl --location "$BASE_URL/update-score" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchantId": "merchant_demo",
+ "gateway": "stripe",
+ "paymentId": "pay_001",
+ "status": "CHARGED"
+ }'
+```
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/merchant-accounts/merchant-account-create.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/merchant-accounts/merchant-account-create.mdx
new file mode 100644
index 0000000000..3171d454c2
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/merchant-accounts/merchant-account-create.mdx
@@ -0,0 +1,31 @@
+---
+title: "Create Merchant Account"
+description: "Curl example for creating a merchant account."
+---
+
+# Create Merchant Account
+
+This public bootstrap route requires the configured admin secret.
+
+## Request
+
+```bash
+curl --location "$BASE_URL/merchant-account/create" \
+ --header "x-admin-secret: <admin_secret>" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchant_id": "merchant_demo",
+ "gateway_success_rate_based_decider_input": null
+ }'
+```
+
+## Response
+
+```json
+{
+ "message": "Merchant account created successfully",
+ "merchant_id": "merchant_demo",
+ "gateway_success_rate_based_decider_input": null,
+ "api_key": "DE_..."
+}
+```
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/merchant-accounts/merchant-account-delete.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/merchant-accounts/merchant-account-delete.mdx
new file mode 100644
index 0000000000..61af081205
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/merchant-accounts/merchant-account-delete.mdx
@@ -0,0 +1,22 @@
+---
+title: "Delete Merchant Account"
+description: "Curl example for deleting a merchant account."
+---
+
+# Delete Merchant Account
+
+## Request
+
+```bash
+curl --request DELETE "$BASE_URL/merchant-account/merchant_demo" \
+ --header "$AUTH_HEADER"
+```
+
+## Response
+
+```json
+{
+ "message": "Merchant account deleted successfully",
+ "merchant_id": "merchant_demo"
+}
+```
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/merchant-accounts/merchant-account-get.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/merchant-accounts/merchant-account-get.mdx
new file mode 100644
index 0000000000..53f1e2cfc7
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/merchant-accounts/merchant-account-get.mdx
@@ -0,0 +1,22 @@
+---
+title: "Get Merchant Account"
+description: "Curl example for retrieving a merchant account."
+---
+
+# Get Merchant Account
+
+## Request
+
+```bash
+curl "$BASE_URL/merchant-account/merchant_demo" \
+ --header "$AUTH_HEADER"
+```
+
+## Response
+
+```json
+{
+ "merchant_id": "merchant_demo",
+ "gateway_success_rate_based_decider_input": null
+}
+```
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/merchant-accounts/merchant-debit-routing.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/merchant-accounts/merchant-debit-routing.mdx
new file mode 100644
index 0000000000..eeeb4e82a7
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/merchant-accounts/merchant-debit-routing.mdx
@@ -0,0 +1,101 @@
+---
+title: "Merchant Debit Routing Flag"
+description: "Curl examples for reading and updating the merchant debit-routing feature flag."
+---
+
+# Merchant Debit Routing Flag
+
+Debit/network routing is gated per merchant. Missing config defaults to disabled. Enable this flag before calling `/decide-gateway` with `NTW_BASED_ROUTING` or `NTW_SR_HYBRID_ROUTING`.
+
+## Read Flag
+
+```bash
+curl "$BASE_URL/merchant-account/merchant_demo/debit-routing" \
+ --header "$AUTH_HEADER"
+```
+
+```json
+{
+ "merchant_id": "merchant_demo",
+ "debit_routing_enabled": false
+}
+```
+
+## Enable Flag
+
+```bash
+curl --location "$BASE_URL/merchant-account/merchant_demo/debit-routing" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{ "enabled": true }'
+```
+
+```json
+{
+ "merchant_id": "merchant_demo",
+ "debit_routing_enabled": true
+}
+```
+
+## Disable Flag
+
+```bash
+curl --location "$BASE_URL/merchant-account/merchant_demo/debit-routing" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{ "enabled": false }'
+```
+
+## Run Debit Routing Transaction
+
+After enabling the flag, send a debit card transaction through `/decide-gateway`. The debit router expects `paymentInfo.metadata` to be a JSON string containing `merchant_category_code`, `acquirer_country`, and `co_badged_card_data`.
+
+```bash
+curl --location "$BASE_URL/decide-gateway" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchantId": "merchant_demo",
+ "eligibleGatewayList": ["stripe", "adyen"],
+ "rankingAlgorithm": "NTW_BASED_ROUTING",
+ "paymentInfo": {
+ "paymentId": "debit_001",
+ "amount": 1000,
+ "currency": "USD",
+ "country": "US",
+ "paymentType": "ORDER_PAYMENT",
+ "paymentMethodType": "CARD",
+ "paymentMethod": "DEBIT",
+ "authType": "THREE_DS",
+ "metadata": "{\"merchant_category_code\":\"merchant_category_code_0001\",\"acquirer_country\":\"US\",\"co_badged_card_data\":{\"card_type\":\"debit\",\"issuer_country\":\"US\",\"is_regulated\":false,\"regulated_name\":null,\"card_networks\":[\"VISA\",\"NYCE\",\"PULSE\",\"STAR\"]}}"
+ }
+ }'
+```
+
+```json
+{
+ "decided_gateway": "stripe",
+ "routing_approach": "NTW_BASED_ROUTING",
+ "debit_routing_output": {
+ "co_badged_card_networks_info": [
+ { "network": "NYCE", "saving_percentage": 1.2 },
+ { "network": "PULSE", "saving_percentage": 0.8 }
+ ],
+ "issuer_country": "US",
+ "is_regulated": false,
+ "card_type": "debit"
+ }
+}
+```
+
+## Notes
+
+- Use backend enum strings: `NTW_BASED_ROUTING` and `NTW_SR_HYBRID_ROUTING`.
+- `co_badged_card_data.card_type` must be lowercase `debit` or `credit` inside metadata.
+- If the flag is disabled, debit-routing transactions should fail with a debit-routing-not-enabled error.
+
+## Related
+
+- [Debit Gateway Transaction](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-debit-routing)
+- [Network + SR Hybrid Routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-hybrid-routing)
+- [Payment Audit](/decision-engine-api-reference/api-reference/guides/analytics-audit/analytics-endpoints)
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-debit-routing.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-debit-routing.mdx
new file mode 100644
index 0000000000..f29c024e5f
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-debit-routing.mdx
@@ -0,0 +1,70 @@
+---
+title: "Decide Gateway: Debit Routing"
+description: "Curl example for /decide-gateway using NTW_BASED_ROUTING."
+---
+
+# Decide Gateway: Debit Routing
+
+Enable the merchant debit-routing flag before this call. The backend reads debit inputs from `paymentInfo.metadata`, so `metadata` must be a JSON string with `co_badged_card_data`.
+
+## Request
+
+```bash
+curl --location "$BASE_URL/decide-gateway" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchantId": "merchant_demo",
+ "eligibleGatewayList": ["stripe", "adyen"],
+ "rankingAlgorithm": "NTW_BASED_ROUTING",
+ "eliminationEnabled": false,
+ "enableMultiObjective": false,
+ "paymentInfo": {
+ "paymentId": "debit_001",
+ "amount": 1000,
+ "currency": "USD",
+ "paymentType": "ORDER_PAYMENT",
+ "paymentMethodType": "CARD",
+ "paymentMethod": "DEBIT",
+ "authType": "THREE_DS",
+ "metadata": "{\"merchant_category_code\":\"merchant_category_code_0001\",\"acquirer_country\":\"US\",\"co_badged_card_data\":{\"co_badged_card_networks\":[\"VISA\",\"NYCE\",\"PULSE\",\"STAR\"],\"issuer_country\":\"US\",\"is_regulated\":false,\"regulated_name\":null,\"card_type\":\"debit\"}}"
+ }
+ }'
+```
+
+## Response
+
+```json
+{
+ "decided_gateway": "stripe",
+ "gateway_priority_map": null,
+ "filter_wise_gateways": null,
+ "priority_logic_tag": null,
+ "routing_approach": "NTW_BASED_ROUTING",
+ "gateway_before_evaluation": null,
+ "priority_logic_output": null,
+ "debit_routing_output": {
+ "co_badged_card_networks_info": [
+ { "network": "NYCE", "saving_percentage": 1.2 },
+ { "network": "PULSE", "saving_percentage": 0.9 },
+ { "network": "VISA", "saving_percentage": 0.1 }
+ ],
+ "issuer_country": "US",
+ "is_regulated": false,
+ "regulated_name": null,
+ "card_type": "debit"
+ },
+ "reset_approach": "NO_RESET",
+ "routing_dimension": null,
+ "routing_dimension_level": null,
+ "is_scheduled_outage": false,
+ "is_dynamic_mga_enabled": false,
+ "gateway_mga_id_map": null,
+ "is_rust_based_decider": true,
+ "multi_objective_info": null
+}
+```
+
+## Multi-Objective Option
+
+When multi-objective routing is enabled (request field `enableMultiObjective`, or the `multi_objective_routing_enabled` merchant feature flag), a cost-aware post-step may re-rank the SR result and the response gains a `multi_objective_info` block. Details and examples: [Multi-objective routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-multi-objective).
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-hybrid-routing.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-hybrid-routing.mdx
new file mode 100644
index 0000000000..7f337fee27
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-hybrid-routing.mdx
@@ -0,0 +1,53 @@
+---
+title: "Decide Gateway: Network + SR Hybrid"
+description: "Curl example for /decide-gateway using NTW_SR_HYBRID_ROUTING."
+---
+
+# Decide Gateway: Network + SR Hybrid
+
+`NTW_SR_HYBRID_ROUTING` combines debit/network metadata with SR-based gateway scoring.
+
+```bash
+curl --location "$BASE_URL/decide-gateway" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchantId": "merchant_demo",
+ "eligibleGatewayList": ["stripe", "adyen"],
+ "rankingAlgorithm": "NTW_SR_HYBRID_ROUTING",
+ "eliminationEnabled": false,
+ "enableMultiObjective": false,
+ "paymentInfo": {
+ "paymentId": "hybrid_001",
+ "amount": 1000,
+ "currency": "USD",
+ "paymentType": "ORDER_PAYMENT",
+ "paymentMethodType": "CARD",
+ "paymentMethod": "DEBIT",
+ "authType": "THREE_DS",
+ "metadata": "{\"merchant_category_code\":\"merchant_category_code_0001\",\"acquirer_country\":\"US\",\"co_badged_card_data\":{\"co_badged_card_networks\":[\"VISA\",\"NYCE\",\"PULSE\",\"STAR\"],\"issuer_country\":\"US\",\"is_regulated\":false,\"regulated_name\":null,\"card_type\":\"debit\"}}"
+ }
+ }'
+```
+
+```json
+{
+ "decided_gateway": "stripe",
+ "routing_approach": "NTW_BASED_ROUTING",
+ "debit_routing_output": {
+ "co_badged_card_networks_info": [
+ { "network": "NYCE", "saving_percentage": 1.2 },
+ { "network": "PULSE", "saving_percentage": 0.9 }
+ ],
+ "issuer_country": "US",
+ "is_regulated": false,
+ "regulated_name": null,
+ "card_type": "debit"
+ },
+ "multi_objective_info": null
+}
+```
+
+## Multi-Objective Option
+
+When multi-objective routing is enabled (request field `enableMultiObjective`, or the `multi_objective_routing_enabled` merchant feature flag), a cost-aware post-step may re-rank the SR result and the response gains a `multi_objective_info` block. Details and examples: [Multi-objective routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-multi-objective).
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-multi-objective.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-multi-objective.mdx
new file mode 100644
index 0000000000..880da01b9c
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-multi-objective.mdx
@@ -0,0 +1,182 @@
+---
+title: "Decide Gateway: Multi-Objective Routing"
+description: "Curl example for /decide-gateway with the multi-objective (cost-aware) post-step and the multi_objective_info response block."
+---
+
+# Decide Gateway: Multi-Objective Routing
+
+## What multi-objective routing is
+
+Plain success-rate (SR) routing optimises a single objective: send each payment to the gateway most likely to authorise it. But the *cheapest* path to a successful payment is not always the one with the highest auth rate — a gateway that is one point worse on auth but materially cheaper per transaction can leave the merchant with more money in hand. Multi-objective routing balances **two** objectives at once — authorisation *and* processing cost — so routing maximises the merchant's economic outcome, not just the raw approval odds.
+
+It is implemented as a **cost-aware post-step layered on top of SR scoring**, not a replacement for it. The SR scorer runs first and produces its usual ranking; the post-step then takes those scores, attaches a per-gateway fee estimate to each, and re-ranks the candidates on expected value. Because it only ever runs *after* SR scoring, everything SR gives you (dimension-level buckets, elimination, hedging) is preserved — cost is simply an additional lens applied at the end.
+
+## How the ranking works
+
+After the success-rate scorer picks its head gateway, the engine fetches per-PSP fee estimates and re-ranks every gateway that has cost data on economic value:
+
+```
+Economic value (EV) = auth rate × settlement value
+settlement value = txn amount − cost of payment processing (acquirer, issuer & network fee)
+```
+
+The settlement value is derived from the merchant's `margin` and the per-PSP cost estimate (see the `margin` field on [Create success-rate config](/decision-engine-api-reference/api-reference/guides/scoring-config/success-rate-config-create)).
+
+If a cheaper PSP has a strictly higher expected value than the SR head, it is promoted (`outcome: COST_WON`) and `routing_approach` becomes `SR_SELECTION_MULTI_OBJECTIVE`. Otherwise the SR head is kept (`outcome: AUTH_WON`) and `routing_approach` keeps its normal SR value. Either way, the response carries a `multi_objective_info` block explaining the decision — which gateway SR would have picked, which one cost analysis chose, and by how much — so every cost-driven override is auditable.
+
+## Enablement
+
+| Switch | Scope | Behaviour |
+| --- | --- | --- |
+| `multi_objective_routing_enabled` feature flag | Merchant | Primary rollout switch. Used whenever the request omits `enableMultiObjective`. |
+| `enableMultiObjective` request field | Per request | Optional boolean override. `true` forces the post-step on, `false` forces it off, omitted falls back to the merchant flag. |
+
+Notes:
+
+- The post-step only runs on SR-scored decisions and is skipped while hedging (exploration) is active for the transaction.
+- `margin` (fraction of ticket, e.g. `0.20`) comes from the merchant's success-rate config — see [Create success-rate config](/decision-engine-api-reference/api-reference/guides/scoring-config/success-rate-config-create). It defaults to `1.0` when unset.
+- This post-step re-ranks the SR scores it is handed; it does not tune them. [Autopilot](/decision-engine-api-reference/api-reference/guides/autopilot/merchant-features) is the separate self-tuning job that calibrates SR hedging and bucket size, and can run alongside this post-step (they are independent dials — `enableMultiObjective` and `use_autopilot`).
+- Gateways without fee data cannot be ranked on expected value and never win on cost; if the SR head itself has no fee data, the SR order is kept.
+- Per-gateway fee data comes from [cost ingestion](/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-setup) — settlement reports and invoices fitted into a per-cluster cost model. Check [cost coverage](/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-fees#cost-coverage) to see what share of volume actually has a trustworthy fee estimate before relying on this post-step.
+- To compare cost-aware routing against a plain auth-rate baseline on live traffic before flipping the merchant flag, run it as an [A/B test experiment](/decision-engine-api-reference/api-reference/guides/ab-testing/ab-testing-create) arm (`enable_multi_objective: true` on one arm only).
+
+## Request
+
+```bash
+curl --location "$BASE_URL/decide-gateway" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchantId": "merchant_demo",
+ "eligibleGatewayList": ["stripe", "adyen", "checkout"],
+ "rankingAlgorithm": "SR_BASED_ROUTING",
+ "eliminationEnabled": true,
+ "enableMultiObjective": true,
+ "paymentInfo": {
+ "paymentId": "mo_001",
+ "amount": 1000,
+ "currency": "USD",
+ "country": "US",
+ "paymentType": "ORDER_PAYMENT",
+ "metadata": null,
+ "paymentMethodType": "CARD",
+ "paymentMethod": "CREDIT",
+ "authType": "THREE_DS",
+ "cardIsin": "424242"
+ }
+ }'
+```
+
+## Response: cost won
+
+`adyen` is promoted over the SR head `stripe` because its expected value is higher at the configured margin; fallbacks are re-ordered by descending expected value (gateways without fee data follow, ordered by auth rate).
+
+```json
+{
+ "decided_gateway": "adyen",
+ "fallback_gateways": ["stripe", "checkout"],
+ "gateway_priority_map": {
+ "stripe": 0.94,
+ "adyen": 0.91,
+ "checkout": 0.88
+ },
+ "filter_wise_gateways": null,
+ "priority_logic_tag": null,
+ "routing_approach": "SR_SELECTION_MULTI_OBJECTIVE",
+ "gateway_before_evaluation": "stripe",
+ "reset_approach": "NO_RESET",
+ "routing_dimension": "ORDER_PAYMENT,CARD,CREDIT,UNKNOWN",
+ "routing_dimension_level": "CARD_LEVEL",
+ "is_scheduled_outage": false,
+ "is_dynamic_mga_enabled": false,
+ "gateway_mga_id_map": null,
+ "is_rust_based_decider": true,
+ "multi_objective_info": {
+ "outcome": "COST_WON",
+ "reason": "Promoted 'adyen' over 'stripe' on expected value — saves 80.00 bps for 3.00pp auth.",
+ "srHead": { "psp": "stripe", "authRate": 0.94, "costBps": 180.0 },
+ "chosen": { "psp": "adyen", "authRate": 0.91, "costBps": 100.0 },
+ "costSavedBps": 80.0,
+ "qualifiedCount": 3,
+ "margin": 0.2,
+ "evGapTop2": 0.00182
+ }
+}
+```
+
+## Response: auth won
+
+The post-step ran but the SR head was already the highest expected-value gateway, so nothing moves and `routing_approach` keeps its normal SR value. Note `margin: 1` — the default applied when the merchant's success-rate config sets no `margin`.
+
+```json
+{
+ "decided_gateway": "adyen",
+ "fallback_gateways": [
+ "stripe",
+ "checkout"
+ ],
+ "gateway_priority_map": {
+ "adyen": 0.65,
+ "checkout": 0.58,
+ "stripe": 0.65
+ },
+ "filter_wise_gateways": null,
+ "priority_logic_tag": null,
+ "routing_approach": "SR_SELECTION_V3_ROUTING",
+ "gateway_before_evaluation": "adyen",
+ "priority_logic_output": {
+ "isEnforcement": false,
+ "gws": [
+ "stripe",
+ "adyen",
+ "checkout"
+ ],
+ "priorityLogicTag": null,
+ "gatewayReferenceIds": {},
+ "primaryLogic": null,
+ "fallbackLogic": null
+ },
+ "debit_routing_output": null,
+ "reset_approach": "NO_RESET",
+ "routing_dimension": "ORDER_PAYMENT, CARD, DEBIT, DEBIT",
+ "routing_dimension_level": "CARD_LEVEL",
+ "is_scheduled_outage": false,
+ "is_dynamic_mga_enabled": false,
+ "gateway_mga_id_map": null,
+ "is_rust_based_decider": true,
+ "latency": 3,
+ "multi_objective_info": {
+ "outcome": "AUTH_WON",
+ "reason": "SR head retained — it is the highest expected-value PSP (3 ranked on EV).",
+ "srHead": {
+ "psp": "adyen",
+ "authRate": 0.65,
+ "costBps": 156.94736842105263
+ },
+ "chosen": {
+ "psp": "adyen",
+ "authRate": 0.65,
+ "costBps": 156.94736842105263
+ },
+ "costSavedBps": null,
+ "qualifiedCount": 3,
+ "margin": 1,
+ "evGapTop2": 0.013780000000000014
+ }
+}
+```
+
+## multi_objective_info Fields
+
+| Field | Type | Meaning |
+| --- | --- | --- |
+| `outcome` | `COST_WON` \| `AUTH_WON` | Terminal outcome of the post-step. `COST_WON` means a higher-EV PSP was promoted above the SR head. |
+| `reason` | string | Human-readable explanation of the decision. |
+| `srHead` | object \| null | The PSP the SR scorer would have picked (`psp`, `authRate`, `costBps`). |
+| `chosen` | object \| null | The PSP the post-step actually chose. Equals `srHead` when auth won. |
+| `costSavedBps` | number \| null | Fee saved in bps when `outcome == COST_WON` (`srHead.costBps − chosen.costBps`). |
+| `qualifiedCount` | integer | Number of PSPs that had cost data and were ranked on expected value. |
+| `margin` | number | Merchant margin (fraction of ticket) applied for this transaction. |
+| `evGapTop2` | number \| null | Expected-value gap between the top-two EV-ranked PSPs, as a fraction of ticket. Small values mean the decision was close. `null` when fewer than two PSPs had cost data. |
+
+The block is absent (`null`) when the post-step did not run at all — feature off, hedging active, or a non-SR routing flavour.
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-pl-based.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-pl-based.mdx
new file mode 100644
index 0000000000..aa4eb3478f
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-pl-based.mdx
@@ -0,0 +1,49 @@
+---
+title: "Decide Gateway: Priority List Based"
+description: "Curl example for /decide-gateway using PL_BASED_ROUTING."
+---
+
+# Decide Gateway: Priority List Based
+
+`PL_BASED_ROUTING` evaluates active priority logic and returns the selected connector order.
+
+```bash
+curl --location "$BASE_URL/decide-gateway" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchantId": "merchant_demo",
+ "eligibleGatewayList": ["stripe", "adyen", "checkout"],
+ "rankingAlgorithm": "PL_BASED_ROUTING",
+ "eliminationEnabled": false,
+ "enableMultiObjective": false,
+ "paymentInfo": {
+ "paymentId": "pl_001",
+ "amount": 1000,
+ "currency": "USD",
+ "country": "US",
+ "paymentType": "ORDER_PAYMENT",
+ "paymentMethodType": "CARD",
+ "paymentMethod": "CREDIT",
+ "authType": "THREE_DS"
+ }
+ }'
+```
+
+```json
+{
+ "decided_gateway": "stripe",
+ "routing_approach": "PRIORITY_LOGIC",
+ "priority_logic_output": {
+ "isEnforcement": false,
+ "gws": ["stripe", "adyen", "checkout"],
+ "gatewayReferenceIds": {}
+ },
+ "reset_approach": "NO_RESET",
+ "multi_objective_info": null
+}
+```
+
+## Multi-Objective Option
+
+When multi-objective routing is enabled (request field `enableMultiObjective`, or the `multi_objective_routing_enabled` merchant feature flag), a cost-aware post-step may re-rank the SR result and the response gains a `multi_objective_info` block. Details and examples: [Multi-objective routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-multi-objective).
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-sr-based.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-sr-based.mdx
new file mode 100644
index 0000000000..a63c742a5e
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-sr-based.mdx
@@ -0,0 +1,82 @@
+---
+title: "Decide Gateway: SR Based Routing"
+description: "Curl example for /decide-gateway using SR_BASED_ROUTING."
+---
+
+# Decide Gateway: SR Based Routing
+
+`SR_BASED_ROUTING` uses auth-rate history, downtime state, and eligible gateway filters to choose a connector.
+
+## Request
+
+```bash
+curl --location "$BASE_URL/decide-gateway" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchantId": "merchant_demo",
+ "eligibleGatewayList": ["stripe", "adyen", "checkout"],
+ "rankingAlgorithm": "SR_BASED_ROUTING",
+ "eliminationEnabled": true,
+ "enableMultiObjective": false,
+ "paymentInfo": {
+ "paymentId": "sr_001",
+ "amount": 1000,
+ "currency": "USD",
+ "country": "US",
+ "paymentType": "ORDER_PAYMENT",
+ "metadata": null,
+ "paymentMethodType": "CARD",
+ "paymentMethod": "CREDIT",
+ "authType": "THREE_DS",
+ "cardIsin": "424242"
+ }
+ }'
+```
+
+## Response
+
+```json
+{
+ "decided_gateway": "stripe",
+ "gateway_priority_map": {
+ "stripe": 0.94,
+ "adyen": 0.91,
+ "checkout": 0.88
+ },
+ "filter_wise_gateways": null,
+ "priority_logic_tag": null,
+ "routing_approach": "SR_SELECTION_V3_ROUTING",
+ "gateway_before_evaluation": "stripe",
+ "priority_logic_output": {
+ "isEnforcement": false,
+ "gws": ["stripe", "adyen", "checkout"],
+ "priorityLogicTag": null,
+ "gatewayReferenceIds": {},
+ "primaryLogic": null,
+ "fallbackLogic": null
+ },
+ "reset_approach": "NO_RESET",
+ "routing_dimension": "ORDER_PAYMENT,CARD,CREDIT,UNKNOWN",
+ "routing_dimension_level": "CARD_LEVEL",
+ "is_scheduled_outage": false,
+ "is_dynamic_mga_enabled": false,
+ "gateway_mga_id_map": null,
+ "is_rust_based_decider": true,
+ "multi_objective_info": null
+}
+```
+
+## Routing Approach Values
+
+- `SR_SELECTION_V3_ROUTING`: best eligible gateway from SR score at the active routing dimension.
+- `SR_V3_DOWNTIME_ROUTING`: some eligible gateways were deprioritized due to downtime.
+- `SR_V3_ALL_DOWNTIME_ROUTING`: all eligible gateways are in downtime and the best degraded option is selected.
+- `SR_V3_HEDGING`: exploration mode across eligible gateways.
+- `SR_V3_DOWNTIME_HEDGING`: hedging with partial downtime.
+- `SR_V3_ALL_DOWNTIME_HEDGING`: hedging while all eligible gateways are down.
+- `SR_SELECTION_MULTI_OBJECTIVE`: the multi-objective post-step promoted a cheaper gateway over the SR head on expected value — see [Multi-objective routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-multi-objective).
+
+## Multi-Objective Option
+
+When multi-objective routing is enabled (request field `enableMultiObjective`, or the `multi_objective_routing_enabled` merchant feature flag), a cost-aware post-step may re-rank the SR result and the response gains a `multi_objective_info` block. Details and examples: [Multi-objective routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-multi-objective).
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/config-endpoints.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/config-endpoints.mdx
new file mode 100644
index 0000000000..75cb844c8b
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/config-endpoints.mdx
@@ -0,0 +1,75 @@
+---
+title: "Routing Config Endpoints"
+description: "Curl examples for routing key metadata and SR dimension configuration."
+---
+
+# Routing Config Endpoints
+
+## Routing Keys
+
+The dashboard uses this route to discover valid rule builder keys.
+
+```bash
+curl "$BASE_URL/config/routing-keys" \
+ --header "$AUTH_HEADER"
+```
+
+## Configure SR Dimensions
+
+```bash
+curl --location "$BASE_URL/config-sr-dimension" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchant_id": "merchant_demo",
+ "dimensions": ["payment_method_type", "payment_method", "currency"]
+ }'
+```
+
+## Get SR Dimensions
+
+Read back the SR scoring dimensions currently configured for a merchant.
+
+```bash
+curl "$BASE_URL/config-sr-dimension/merchant_demo" \
+ --header "$AUTH_HEADER"
+```
+
+```json
+{
+ "merchant_id": "merchant_demo",
+ "paymentInfo": {
+ "udfs": [],
+ "fields": ["payment_method_type", "payment_method", "currency"]
+ }
+}
+```
+
+Returns an empty default (`fields: null`) when nothing has been configured for the merchant yet.
+
+## GSM Options
+
+Gateway Status Mapper rule catalog — the error-code classification options used by the `gsm-scoring-filter` merchant feature (see [Merchant Features](/decision-engine-api-reference/api-reference/guides/autopilot/merchant-features)).
+
+```bash
+curl "$BASE_URL/gsm/options" \
+ --header "$AUTH_HEADER"
+```
+
+```json
+{
+ "rules": [
+ {
+ "connector": "stripe",
+ "flow": "authorize",
+ "subFlow": "card",
+ "errorCode": "card_declined",
+ "errorMessage": "Your card was declined.",
+ "errorCategory": "soft_decline",
+ "unifiedCode": "UE_001",
+ "unifiedMessage": "Card declined by issuer",
+ "decision": "retry"
+ }
+ ]
+}
+```
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/elimination-config-create.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/elimination-config-create.mdx
new file mode 100644
index 0000000000..5fad71c0bb
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/elimination-config-create.mdx
@@ -0,0 +1,26 @@
+---
+title: "Create Elimination Config"
+description: "Curl example for creating elimination config."
+---
+
+# Create Elimination Config
+
+```bash
+curl --location "$BASE_URL/rule/create" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchant_id": "merchant_demo",
+ "config": {
+ "type": "elimination",
+ "data": {
+ "bucketSize": 5,
+ "eliminationThreshold": 0.2
+ }
+ }
+ }'
+```
+
+```json
+{ "merchant_id": "merchant_demo", "config": { "type": "elimination" } }
+```
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/elimination-config-delete.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/elimination-config-delete.mdx
new file mode 100644
index 0000000000..9dba1ad08a
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/elimination-config-delete.mdx
@@ -0,0 +1,20 @@
+---
+title: "Delete Elimination Config"
+description: "Curl example for deleting elimination config."
+---
+
+# Delete Elimination Config
+
+```bash
+curl --location "$BASE_URL/rule/delete" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchant_id": "merchant_demo",
+ "algorithm": "elimination"
+ }'
+```
+
+```json
+{ "message": "Rule config deleted successfully" }
+```
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/elimination-config-get.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/elimination-config-get.mdx
new file mode 100644
index 0000000000..e23c28988c
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/elimination-config-get.mdx
@@ -0,0 +1,20 @@
+---
+title: "Get Elimination Config"
+description: "Curl example for reading elimination config."
+---
+
+# Get Elimination Config
+
+```bash
+curl --location "$BASE_URL/rule/get" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchant_id": "merchant_demo",
+ "algorithm": "elimination"
+ }'
+```
+
+```json
+{ "merchant_id": "merchant_demo", "config": { "type": "elimination" } }
+```
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/elimination-config-update.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/elimination-config-update.mdx
new file mode 100644
index 0000000000..ae093db4f4
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/elimination-config-update.mdx
@@ -0,0 +1,26 @@
+---
+title: "Update Elimination Config"
+description: "Curl example for updating elimination config."
+---
+
+# Update Elimination Config
+
+```bash
+curl --location "$BASE_URL/rule/update" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchant_id": "merchant_demo",
+ "config": {
+ "type": "elimination",
+ "data": {
+ "bucketSize": 10,
+ "eliminationThreshold": 0.15
+ }
+ }
+ }'
+```
+
+```json
+{ "merchant_id": "merchant_demo", "config": { "type": "elimination" } }
+```
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/success-rate-config-create.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/success-rate-config-create.mdx
new file mode 100644
index 0000000000..3f8414157a
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/success-rate-config-create.mdx
@@ -0,0 +1,45 @@
+---
+title: "Create Success Rate Config"
+description: "Curl example for creating success-rate scoring config."
+---
+
+# Create Success Rate Config
+
+Success-rate (SR) routing is Decision Engine's default scoring strategy: for each payment it estimates how likely every eligible gateway is to authorise *right now* and sends the payment to the strongest one. The estimate is not a static number — it is learned continuously from the live outcomes (success/failure) the engine observes, so the routing follows real-time gateway health instead of a fixed priority list. The success-rate config is where you tune how that learning behaves.
+
+Three knobs do most of the work:
+
+- **`defaultBucketSize`** — how many of the most recent transactions per gateway the score is computed over. A small bucket reacts fast to a gateway going down but is noisier; a large bucket is stable but slower to notice change. This is a sliding window: new outcomes push old ones out, so the score always reflects recent behaviour.
+- **`defaultHedgingPercent`** — the share of traffic deliberately *explored* away from the current best gateway. Without exploration the engine would starve non-leading gateways of traffic and never learn that they have recovered; hedging keeps every candidate's score fresh. (This is the same dial [Autopilot](/decision-engine-api-reference/api-reference/guides/autopilot/merchant-features) tunes automatically.)
+- **`defaultLatencyThreshold`** — optional latency ceiling used when penalising slow gateways.
+
+You can override any of these per traffic segment via **`subLevelInputConfig`** — keyed by dimensions such as `paymentMethodType`, card network, currency, or country — so a merchant can, for example, run a larger bucket for high-volume card traffic and a smaller one for a thin wallet segment. Anything not overridden falls back to the `default*` values.
+
+```bash
+curl --location "$BASE_URL/rule/create" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchant_id": "merchant_demo",
+ "config": {
+ "type": "successRate",
+ "data": {
+ "defaultBucketSize": 20,
+ "defaultLatencyThreshold": null,
+ "defaultHedgingPercent": null,
+ "margin": 0.20,
+ "subLevelInputConfig": {
+ "paymentMethodType": {
+ "CARD": { "bucketSize": 30, "hedgingPercent": 0.05 }
+ }
+ }
+ }
+ }
+ }'
+```
+
+```json
+{ "merchant_id": "merchant_demo", "config": { "type": "successRate" } }
+```
+
+`margin` is the merchant margin as a fraction of ticket (e.g. `0.20` for 20%). It feeds the [multi-objective routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-multi-objective) economic-value ranking `EV = auth rate × settlement value` (settlement value = txn amount − cost of payment processing) by setting the merchant's share of the ticket, and defaults to `1.0` when unset.
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/success-rate-config-delete.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/success-rate-config-delete.mdx
new file mode 100644
index 0000000000..e869fb2c10
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/success-rate-config-delete.mdx
@@ -0,0 +1,20 @@
+---
+title: "Delete Success Rate Config"
+description: "Curl example for deleting success-rate scoring config."
+---
+
+# Delete Success Rate Config
+
+```bash
+curl --location "$BASE_URL/rule/delete" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchant_id": "merchant_demo",
+ "algorithm": "successRate"
+ }'
+```
+
+```json
+{ "message": "Rule config deleted successfully" }
+```
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/success-rate-config-get.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/success-rate-config-get.mdx
new file mode 100644
index 0000000000..3d025f0784
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/success-rate-config-get.mdx
@@ -0,0 +1,20 @@
+---
+title: "Get Success Rate Config"
+description: "Curl example for reading success-rate scoring config."
+---
+
+# Get Success Rate Config
+
+```bash
+curl --location "$BASE_URL/rule/get" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchant_id": "merchant_demo",
+ "algorithm": "successRate"
+ }'
+```
+
+```json
+{ "merchant_id": "merchant_demo", "config": { "type": "successRate" } }
+```
diff --git a/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/success-rate-config-update.mdx b/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/success-rate-config-update.mdx
new file mode 100644
index 0000000000..27a79a8466
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/api-reference/guides/scoring-config/success-rate-config-update.mdx
@@ -0,0 +1,27 @@
+---
+title: "Update Success Rate Config"
+description: "Curl example for updating success-rate scoring config."
+---
+
+# Update Success Rate Config
+
+```bash
+curl --location "$BASE_URL/rule/update" \
+ --header "$AUTH_HEADER" \
+ --header "Content-Type: application/json" \
+ --data '{
+ "merchant_id": "merchant_demo",
+ "config": {
+ "type": "successRate",
+ "data": {
+ "defaultBucketSize": 30,
+ "defaultLatencyThreshold": 2500,
+ "defaultHedgingPercent": 0.1
+ }
+ }
+ }'
+```
+
+```json
+{ "merchant_id": "merchant_demo", "config": { "type": "successRate" } }
+```
diff --git a/api-reference/decision-engine-api-reference/benchmarks.mdx b/api-reference/decision-engine-api-reference/benchmarks.mdx
new file mode 100644
index 0000000000..db83ee91bd
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/benchmarks.mdx
@@ -0,0 +1,269 @@
+---
+title: "Performance Benchmarks"
+description: "Throughput and latency of the /decide-gateway and /routing/evaluate endpoints under sustained load"
+---
+
+## Overview
+
+The decision engine contributes **~6 ms** (server-side average) to a payment routing
+decision at typical load. A single 2-core pod sustains **835 req/s peak** with zero
+errors, and throughput scales linearly with additional pods — both routing modes are
+stateless and share no per-request mutable state.
+
+These figures are from k6 load tests against a single containerised pod. All latency
+numbers in the tables below represent the server-side processing time reported in each
+`/decide-gateway` response — the time the pod spends on the routing decision itself,
+excluding network distance to and from your application.
+
+| Endpoint | Algorithm | Use case |
+|----------|-----------|----------|
+| `POST /decide-gateway` | SR_BASED_ROUTING | Success-rate driven gateway selection |
+| `POST /routing/evaluate` | RULE_BASED_ROUTING | Priority-rule evaluation using the active configured routing rule |
+
+---
+
+## Test Environment
+
+**Cluster node**
+
+| Property | Value |
+|----------|-------|
+| vCPU capacity | 8 |
+| Memory capacity | 15.41 GiB |
+| Architecture | linux/amd64 |
+| Kernel | Amazon Linux 2023 (6.12.x) |
+
+**Pod provisioning**
+
+| Resource | Request | Limit |
+|----------|--------:|------:|
+| CPU | 1000m | 2000m |
+| Memory | 256 MiB | 512 MiB |
+
+**Log level:** `INFO`
+
+---
+
+## Test Methodology
+
+**Tool:** [k6](https://k6.io) — 30s steady load per VU step.
+
+**Metrics**
+- **Round-trip (RT)** — total time measured by the load generator, including local network.
+- **Server-side** — processing time reported by the pod in the `/decide-gateway` response
+ `latency` field, isolating pure compute. Not available for `/routing/evaluate`.
+- **HTTP overhead** — round-trip minus server-side: HTTP framing, request routing, and response
+ serialisation outside the handler's timer. Add your production network RTT on top of this.
+
+---
+
+## SR_BASED_ROUTING — `/decide-gateway`
+
+Payload: 3 card variants rotated across VUs (VISA Debit/AED, Mastercard Credit/USD,
+Amex Debit/EUR), 2–3 eligible gateways each.
+
+### Throughput and latency
+
+| VUs | Throughput | RT avg | RT p50 | RT p95 | Server avg | Server p50 | Server p95 | HTTP avg | HTTP p95 |
+|----:|-----------:|-------:|-------:|-------:|-----------:|-----------:|-----------:|--------:|--------:|
+| 5 | 38 req/s | 8 ms | 7 ms | 15 ms | 5 ms | 4 ms | 10 ms | 3 ms | 6 ms |
+| 20 | 147 req/s | 10 ms | 8 ms | 20 ms | 6 ms | 5 ms | 14 ms | 4 ms | 9 ms |
+| 50 | 345 req/s | 15 ms | 12 ms | 33 ms | 10 ms | 8 ms | 23 ms | 6 ms | 13 ms |
+
+<Tip>
+Every `/decide-gateway` response includes a `latency` field (milliseconds) reporting
+the pod's own processing time. Use this in your monitoring to separate compute time
+from HTTP stack overhead in production.
+</Tip>
+
+**Key observations**
+- Server-side p95 holds at **14 ms up to 147 req/s** (20 VUs) — gateway outages and
+ payment-flow config are served from in-process caches, eliminating per-request DB queries.
+- At 50 VUs (345 req/s), server p95 is **23 ms**.
+- The HTTP overhead column (round-trip − server-side) reflects HTTP framing and serialisation
+ cost, not network distance. Add your production RTT on top of the round-trip figures.
+
+<Note>
+These figures model realistic client behaviour with a 100 ms pause between requests.
+They reflect sustainable throughput for a typical integration, not raw server capacity.
+See the saturation section below for the throughput ceiling.
+</Note>
+
+### Feedback path — `/update-gateway-score`
+
+Every `/decide-gateway` call is followed by a fire-and-forget feedback write to
+`/update-gateway-score`. This is what keeps SR scores current — it records the
+outcome of each routing decision back into Redis so the next decision reflects
+real gateway performance. It runs outside the routing response path and does not
+block the caller, but it does consume pod resources and contributes to Redis load.
+
+| VUs | Feedback avg | Feedback p95 |
+|----:|-------------:|-------------:|
+| 5 | 2 ms | 4 ms |
+| 20 | 3 ms | 7 ms |
+| 50 | 3 ms | 6 ms |
+
+Feedback latency stays flat under load because it is a single Redis write with no
+read dependencies. At 345 req/s (50 VUs) this means ~345 score updates per second
+— well within the Redis pool capacity at `pool_size = 5` with auto-pipelining.
+
+---
+
+### Saturation point
+
+To find the raw throughput ceiling, the same endpoint was driven with **no sleep**
+between requests — each VU fires as fast as the server can respond.
+
+Test conditions: release build (LTO, `codegen-units=1`), 2-CPU Docker limit,
+0% error rate throughout. CPU% captured via `docker stats` in parallel; 200% = 2 cores fully utilized.
+
+| VUs | Throughput | CPU% |
+|----:|--------------:|---------:|
+| 5 | 678 req/s | 151% |
+| 10 | 816 req/s | 190% |
+| **20** | **835 req/s** | **195%** |
+| 30 | 831 req/s | 198% |
+| 50 | 815 req/s | 198% |
+| 75 | 792 req/s | 196% |
+| 100 | 789 req/s | 198% |
+| 150 | 779 req/s | 197% |
+| 200 | 741 req/s | 197% |
+| 300 | 725 req/s | 199% |
+
+**Interpretation**
+
+- **Peak: 835 req/s at 20 in-flight requests.** CPU crosses 190% at 10 VUs and stays
+ there — both cores are fully loaded from that point on.
+- **Sustained ceiling: 725–835 req/s** from 20 to 300 VUs with zero errors. The pod
+ does not shed requests under overload; it queues them.
+- The sleep-based figures (345 req/s at 50 VUs) represent 41% of this ceiling. The
+ gap is client think-time, not server capacity.
+
+```bash
+bash scripts/load-test/benchmark.sh --saturation --max-vus 300 --step-dur 20s
+```
+
+---
+
+## RULE_BASED_ROUTING — `/routing/evaluate`
+
+Payload: same 3 payment attribute variants (amount + authentication_type), evaluated
+against an active priority rule: **checkout → stripe → adyen**.
+
+### Throughput and latency
+
+| VUs | Throughput | RT avg | RT p50 | RT p95 | Error rate |
+|----:|-----------:|-------:|-------:|-------:|-----------:|
+| 5 | 39 req/s | 6 ms | 4 ms | 17 ms | 0.06% |
+| 20 | 153 req/s | 7 ms | 4 ms | 17 ms | 0.01% |
+| 50 | 389 req/s | 6 ms | 4 ms | 14 ms | 0.01% |
+
+<Note>
+`/routing/evaluate` does not include a `latency` field in the response, so server-side
+and network latency cannot be separated for this endpoint.
+</Note>
+
+**Key observations**
+- p95 stays flat at **14–17 ms across all concurrency levels** and does not grow under load.
+- Throughput scales to **389 req/s on a single 2-core pod** — rule evaluation is pure
+ in-memory computation with no Redis or DB I/O.
+
+---
+
+## SR vs Rule-based
+
+| VUs | SR throughput | SR server p95 | Rule RT p95 |
+|----:|--------------:|--------------:|------------:|
+| 5 | 38 req/s | 10 ms | 17 ms |
+| 20 | 147 req/s | 14 ms | 17 ms |
+| 50 | 345 req/s | 23 ms | 14 ms |
+
+SR server-side p95 climbs at 50 VUs as Redis round-trips grow under contention.
+This is well below the pod's CPU saturation point (~835 req/s peak with no-sleep
+load); the sleep-based test reaches Redis contention before it saturates CPU.
+Rule-based p95 stays flat because it issues no external I/O.
+
+---
+
+## Scaling Guide
+
+### SR_BASED_ROUTING
+
+Ceiling per 2-core pod: **~725–835 req/s** (835 req/s peak at 20 in-flight requests,
+sustained above 725 req/s all the way to 300 in-flight with zero errors).
+
+| Target throughput | Pods | CPU per pod | Notes |
+|------------------:|-----:|------------:|-------|
+| < 100 req/s | 1 | 2 cores | Comfortable headroom — well below saturation |
+| 100 – 400 req/s | 1 | 2 cores | Pod within capacity; latency remains flat |
+| 400 – 800 req/s | 1 | 2 cores | Approaching ceiling; monitor server p95 |
+| > 800 req/s | 2+ | 2 cores | Add pods; raise Redis `pool_size` proportionally |
+
+### RULE_BASED_ROUTING
+
+| Target throughput | Pods | CPU per pod | Notes |
+|------------------:|-----:|------------:|-------|
+| < 400 req/s | 1 | 2 cores | Single pod handles comfortably |
+| > 400 req/s | 2+ | 2 cores | Linear scale-out; p95 remains flat |
+
+<Note>
+Do not set CPU requests below 1000m. The Tokio async runtime sizes its worker thread
+pool based on available CPUs — a very small quota results in a single worker thread
+and elevated latency under concurrency.
+</Note>
+
+---
+
+## What Affects Performance
+
+**Log level — largest single factor**
+
+Running at `DEBUG` emits ~55 JSON-serialised log lines per request. At 345 req/s
+(50 VUs) this means ~19 000 extra serialisations per second and raises server-side p95
+significantly. Always set `INFO` or higher outside of active debugging.
+
+```toml
+[log.console]
+level = "INFO"
+```
+
+**Redis round-trips (SR routing only)**
+
+Each SR routing decision reads per-gateway SR scores from Redis, checks in-flight
+keys, and writes feedback scores. Gateway outage lists and per-merchant payment-flow
+config are served from in-process caches (30 s and 60 s TTL respectively) so only
+the SR score lookups reach Redis on the hot path. With `pool_size = 5` and
+auto-pipelining this handles the full ~835 req/s pod ceiling on a single 2-core pod.
+Raise `pool_size` proportionally when adding pods.
+
+```toml
+[redis]
+pool_size = 10 # default 5; raise when adding pods beyond the first
+auto_pipeline = true # keep enabled
+```
+
+**CPU allocation**
+
+The runtime sizes its worker pool based on available CPUs. With a 2-core limit the pod
+runs 2 concurrent async workers, which is the binding constraint for SR routing throughput.
+
+---
+
+## Reproducing These Results
+
+```bash
+# SR + Rule-based routing (sleep-based, realistic think-time)
+bash scripts/load-test/benchmark.sh
+
+# Saturation test — find raw throughput ceiling (no sleep, ramps to max VUs)
+bash scripts/load-test/benchmark.sh --saturation
+bash scripts/load-test/benchmark.sh --saturation --max-vus 300 --step-dur 20s
+
+# Results are saved to scripts/load-test/profile_results/ after each run
+```
+
+## Related Docs
+
+- [Configuration](/decision-engine-api-reference/configuration) — log level and Redis pool settings referenced above.
+- [Local Setup Guide](/decision-engine-api-reference/local-setup) — bringing up the stack these benchmarks run against.
+- [API Guide](/decision-engine-api-reference/api-reference/guides/api-ref) — `/decide-gateway` and `/routing/evaluate` request examples.
diff --git a/api-reference/decision-engine-api-reference/clickhouse-analytics.mdx b/api-reference/decision-engine-api-reference/clickhouse-analytics.mdx
new file mode 100644
index 0000000000..70ff1bb568
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/clickhouse-analytics.mdx
@@ -0,0 +1,130 @@
+---
+title: "ClickHouse Analytics"
+description: "ClickHouse setup notes for analytics"
+---
+
+## Overview
+
+Decision Engine uses a Kafka to ClickHouse analytics pipeline:
+
+- API server captures full request and response bodies for API analytics events
+- API server publishes analytics events to Kafka
+- ClickHouse Kafka engine queue tables consume Kafka and materialized views fan into the raw tables
+
+ClickHouse remains the analytics read store for:
+
+- business-domain analytics events
+- raw API request and response events
+
+The analytics read path uses the two raw tables:
+
+- `analytics_domain_events`
+- `analytics_api_events`
+
+The ingestion path is explicit in ClickHouse too:
+
+- `analytics_domain_events_queue`
+- `analytics_api_events_queue`
+- `analytics_payment_audit_summary_buckets`
+- `analytics_domain_events_mv`
+- `analytics_api_events_mv`
+- `analytics_payment_audit_summary_buckets_mv`
+
+Payment Audit and Preview Trace now use a two-layer read shape:
+
+- raw event timelines still read from `analytics_domain_events`
+- summary lists read from the pre-aggregated `analytics_payment_audit_summary_buckets`
+
+The correlation key for those reads is the write-time `lookup_key`:
+
+- `payment_id` when present
+- otherwise `request_id`
+
+## Local Bring-Up
+
+Start the local analytics stack:
+
+```bash
+COMPOSE_PROFILES= docker compose --profile analytics-clickhouse up -d
+```
+
+That profile now includes ClickHouse, Kafka, and topic creation. The full runtime profiles use the same ClickHouse-native ingestion path. There is no separate Rust worker process anymore.
+
+Local Compose versions:
+
+- ClickHouse: `clickhouse/clickhouse-server:26.1`
+- Kafka: `apache/kafka:3.8.1`
+- ClickHouse database: `default`
+
+The bootstrap DDL now lives in:
+
+- `clickhouse/scripts/`
+
+ClickHouse loads those shell scripts on first boot through `/docker-entrypoint-initdb.d`. They create the raw tables, recreate the Kafka queue tables and materialized views, create the payment-audit summary bucket table, and bind the queue tables to the configured Kafka brokers and topics.
+
+The analytics data volume is persistent, so normal restarts keep historical data.
+
+If you need a clean reset:
+
+```bash
+make reset-analytics-clickhouse
+```
+
+## Config
+
+Relevant config lives under:
+
+```toml
+[analytics]
+enabled = true
+
+[analytics.capture]
+details_max_bytes = 65536
+
+[analytics.kafka]
+# container-to-container traffic uses the internal listener
+brokers = "kafka:19092"
+client_id = "decision-engine"
+api_topic = "api"
+domain_topic = "domain"
+acks = "all"
+compression = "lz4"
+message_timeout_ms = 5000
+queue_capacity = 250
+
+[analytics.clickhouse]
+url = "http://clickhouse:8123"
+database = "default"
+user = "decision_engine"
+password = "decision_engine"
+```
+
+There is no direct API-server write path to ClickHouse anymore. ClickHouse owns Kafka consumption through the queue tables and materialized views.
+
+## Retention
+
+The raw analytics tables retain data for 18 months:
+
+- `analytics_api_events`
+- `analytics_domain_events`
+
+Custom query windows are normalized to the same 18-month lookback horizon.
+
+## Troubleshooting
+
+Useful checks when ingestion looks stalled:
+
+```sql
+SHOW TABLES FROM default;
+SELECT * FROM system.kafka_consumers WHERE database = 'default';
+SELECT count() FROM default.analytics_api_events;
+SELECT count() FROM default.analytics_domain_events;
+SELECT count() FROM default.analytics_payment_audit_summary_buckets;
+SELECT name, engine FROM system.tables WHERE database = 'default' AND name LIKE 'analytics_%';
+```
+
+## Related Docs
+
+- [Analytics](/decision-engine-api-reference/analytics) — the operator-facing view built on this pipeline.
+- [Payment Audit](/decision-engine-api-reference/payment-audit) — single-payment timeline lookups against these tables.
+- [Local Setup Guide](/decision-engine-api-reference/local-setup) — bringing up the `analytics-clickhouse` profile.
diff --git a/api-reference/decision-engine-api-reference/configuration.md b/api-reference/decision-engine-api-reference/configuration.md
new file mode 100644
index 0000000000..3da21f9eed
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/configuration.md
@@ -0,0 +1,228 @@
+---
+title: "Configuration"
+description: "Configure Decision Engine via config files and environment variable overrides."
+---
+
+# Configuration Guide
+
+This document explains how to configure Decision Engine for local and on-prem deployments.
+
+## Primary Config Files
+
+- `config/development.toml`: used for host/source runs
+- `config/docker-configuration.toml`: used for Docker and Compose runs
+- `helm-charts/config/development.toml`: Kubernetes chart template config
+
+These files already exist with all required sections. Edit the one that matches your runtime rather than copying from `config.example.toml`, which is incomplete.
+
+## Config Sections
+
+### Server
+
+```toml
+[server]
+host = "0.0.0.0"
+port = 8080
+```
+
+`host` is the bind address. Use `0.0.0.0` for Docker/deployed, `127.0.0.1` for local-only.
+
+### Logging
+
+```toml
+[log.console]
+enabled = true
+level = "DEBUG"
+log_format = "default"
+```
+
+`log_format` accepts `"default"` (human-readable) or `"json"` (structured, recommended for prod).
+
+### Metrics
+
+```toml
+[metrics]
+host = "0.0.0.0"
+port = 9094
+```
+
+Prometheus metrics are exposed at `host:port/metrics`. Used by the `monitoring` Compose profile (Prometheus scrapes `9094`, Grafana at `3000`).
+
+### Rate Limiting
+
+```toml
+[limit]
+request_count = 1
+duration = 60
+```
+
+Controls rate limiting on the delete APIs. `request_count` requests allowed per `duration` seconds.
+
+### Redis cache config
+
+```toml
+[cache_config]
+service_config_redis_prefix = "DE_service_config_"
+service_config_ttl = 300 # Redis TTL for service config entries, in seconds
+```
+
+### Database
+
+MySQL and PostgreSQL use separate config sections.
+
+**MySQL:**
+
+```toml
+[database]
+username = "db_user"
+password = "db_pass"
+host = "localhost"
+port = 3306
+dbname = "decision_engine_db"
+```
+
+**PostgreSQL:**
+
+```toml
+[pg_database]
+pg_username = "db_user"
+pg_password = "db_pass"
+pg_host = "localhost"
+pg_port = 5432
+pg_dbname = "decision_engine_db"
+```
+
+For Docker Compose runs both are pre-wired via service names in `config/docker-configuration.toml`.
+
+### Multi-Tenant Schema
+
+```toml
+[tenant_secrets]
+public = { schema = "public" }
+```
+
+Maps tenant identifiers to database schemas. The shipped config files (`config/development.toml`, `config/docker-configuration.toml`) define only the `public` tenant — add entries for any additional tenant you want to support.
+
+Some routes resolve the tenant from an `x-tenant-id` request header rather than the authenticated merchant, and reject the request outright if it's missing (`TE_03`). Send `x-tenant-id: public` on `GET /health/diagnostics`, every `GET /analytics/*` route, and `POST /gateway-score/reset` — see [API Guide](/decision-engine-api-reference/api-reference/guides/api-ref#environment-setup).
+
+### Redis
+
+```toml
+[redis]
+host = "127.0.0.1"
+port = 6379
+```
+
+Redis is required — it's used for caching routing config and service config. For Docker, use the service name as host.
+
+### Auth
+
+```toml
+[user_auth]
+jwt_secret = "change_me_in_production_use_32chars!!"
+jwt_expiry_seconds = 86400
+email_verification_enabled = false
+```
+
+Use a strong, random `jwt_secret` — 32+ characters recommended. Set `email_verification_enabled = true` if you've wired an email provider.
+
+### Admin Secret
+
+```toml
+[admin_secret]
+secret = "test_admin"
+```
+
+Used to authenticate the `POST /merchant-account/create` endpoint (admin bootstrap). Change this in production.
+
+### API Key Auth
+
+```toml
+api_key_auth_enabled = true
+```
+
+Top-level flag. When `true`, protected routes accept `x-api-key` in addition to JWT bearer tokens. When `false`, the auth middleware allows **all requests through without authentication** — this effectively disables auth for every protected route. Do not set this to `false` in any environment that should enforce auth.
+
+### Analytics
+
+Both Kafka and ClickHouse require `enabled = true` — without it, analytics is disabled even if the connection details are configured.
+
+```toml
+[analytics.kafka]
+enabled = true
+brokers = "localhost:9092"
+api_topic = "api"
+domain_topic = "domain"
+
+[analytics.clickhouse]
+enabled = true
+url = "http://localhost:8123"
+user = "decision_engine"
+password = "decision_engine"
+```
+
+Decision outcomes are published to Kafka and consumed into ClickHouse. Both are required for analytics and audit dashboard views. For Docker runs, these are pre-configured and enabled via the Compose profiles.
+
+### TLS
+
+```toml
+[tls]
+certificate = "cert.pem"
+private_key = "key.pem"
+```
+
+Paths to PEM-format certificate and key files. Only needed if you're terminating TLS at the app layer rather than a reverse proxy.
+
+### API Client
+
+```toml
+[api_client]
+client_idle_timeout = 90
+pool_max_idle_per_host = 10
+identity = ""
+```
+
+Controls the outbound HTTP client used for upstream calls. Set `identity` to a PEM path if you need mTLS.
+
+## Secrets Management
+
+By default, secrets in config are stored in plaintext. For production, use one of the two supported backends.
+
+### AWS KMS
+
+Requires the `kms-aws` feature (included in the `release` feature set).
+
+```toml
+[secrets_management]
+secrets_manager = "aws_kms"
+
+[secrets_management.aws_kms]
+key_id = "your-kms-key-id"
+region = "us-east-1"
+```
+
+### HashiCorp Vault
+
+Requires the `kms-hashicorp-vault` feature.
+
+```toml
+[secrets_management]
+secrets_manager = "hashi_corp_vault"
+
+[secrets_management.hashi_corp_vault]
+url = "http://127.0.0.1:8200"
+token = "hvs.your_token"
+```
+
+When a secrets manager is configured, sensitive fields like `database.password` and `user_auth.jwt_secret` are resolved from the vault rather than the config file.
+
+## Environment Overrides
+
+Selected values can be overridden at runtime via environment variables. This is useful in Helm deployments via `extraEnvVars`. Consult `src/config.rs` for the full mapping.
+
+## Related Docs
+
+- [Installation](/decision-engine-api-reference/installation)
+- [Local Setup Guide](/decision-engine-api-reference/local-setup)
+- [API Guide](/decision-engine-api-reference/api-reference/guides/api-ref)
+- [API Reference](/decision-engine-api-reference/api-reference)
diff --git a/api-reference/decision-engine-api-reference/dashboard-guide.mdx b/api-reference/decision-engine-api-reference/dashboard-guide.mdx
new file mode 100644
index 0000000000..cbc98aa69d
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/dashboard-guide.mdx
@@ -0,0 +1,64 @@
+---
+title: "Dashboard"
+description: "Local dashboard routes and how they are served"
+---
+
+## Availability
+
+The dashboard is available in the `dashboard-*` Docker Compose profiles.
+
+Example:
+
+```bash
+COMPOSE_PROFILES= docker compose --profile dashboard-postgres-ghcr up -d
+```
+
+Then open:
+
+- `http://localhost:8081/dashboard/`
+
+The dashboard is served by Nginx from the built assets in `website/dist`. This docs page intentionally lives at `/dashboard-guide` — `/dashboard/` is reserved for the React app itself.
+
+## What It Includes
+
+Based on the React routes in `website/src/App.tsx`, the dashboard exposes:
+
+- `/dashboard/`
+- `/dashboard/login`
+- `/dashboard/signup`
+- `/dashboard/onboarding`
+- `/dashboard/routing`
+- `/dashboard/routing/sr`
+- `/dashboard/routing/rules`
+- `/dashboard/routing/volume`
+- `/dashboard/routing/debit`
+- `/dashboard/decisions`
+- `/dashboard/analytics`
+- `/dashboard/audit`
+
+For source-run Vite development, the same React routes are mounted at `http://localhost:5173/`.
+For external production hosting, the preferred route is `/decision-engine/` with API traffic proxied through `/decision-engine-api/*`.
+
+## Docs And API In The Same Profile
+
+The same `dashboard-*` profiles also expose:
+
+- Mintlify docs at `http://localhost:8081/introduction`
+- API examples at `http://localhost:8081/api-refs/api-ref`
+- the API at `http://localhost:8080`
+
+Proxy behavior is defined in `nginx/nginx.conf`.
+
+## Related Files
+
+- `website/src/App.tsx`
+- `website/src/components/pages/*`
+- `docker-compose.yaml`
+- `nginx/nginx.conf`
+
+## Related Docs
+
+- [Installation](/decision-engine-api-reference/installation)
+- [Local Setup Guide](/decision-engine-api-reference/local-setup)
+- [Analytics](/decision-engine-api-reference/analytics)
+- [Payment Audit](/decision-engine-api-reference/payment-audit)
diff --git a/api-reference/decision-engine-api-reference/installation.md b/api-reference/decision-engine-api-reference/installation.md
new file mode 100644
index 0000000000..d61ddc42a4
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/installation.md
@@ -0,0 +1,58 @@
+---
+title: "Installation"
+description: "Everything needed to get Decision Engine running locally, end to end."
+---
+
+# Installation Guide
+
+This section covers everything needed to get Decision Engine running locally — from a single `docker compose up` to the full CLI, Docker, Compose, and Helm matrix.
+
+## Prerequisites
+
+The Quick Start below pulls prebuilt images from GHCR, so you do **not** need Rust, `make`, or a local database. You do need:
+
+- **Docker Engine 20+**
+- **Docker Compose v2+** (the `docker compose` subcommand, not the legacy `docker-compose` binary)
+- **The repository cloned locally** — the compose command reads `docker-compose.yaml`, so run it from the repo root:
+
+ ```bash
+ git clone https://github.com/juspay/decision-engine.git
+ cd decision-engine
+ ```
+
+- Network access to pull `ghcr.io/juspay/...` images and a few GB of free disk (the first run pulls the app, PostgreSQL, Redis, Kafka, ClickHouse, and Mailpit).
+
+## Quick Start
+
+The fastest path to a running instance. Every service in `docker-compose.yaml` is gated behind a profile, so a profile is required — there is no default/unprofiled bring-up:
+
+```bash
+docker compose --profile postgres-ghcr up -d
+curl http://localhost:8080/health
+```
+
+Expected response:
+
+```json
+{ "message": "Health is good" }
+```
+
+For the API, dashboard, and docs together, use `--profile dashboard-postgres-ghcr` instead — see [Dashboard](/decision-engine-api-reference/dashboard-guide).
+
+## In This Section
+
+| Page | Use it for |
+| --- | --- |
+| [Local Setup](/decision-engine-api-reference/local-setup) | The canonical guide — Compose profiles, source builds, Docker images without Compose, Helm, and troubleshooting. |
+| [PostgreSQL Setup](/decision-engine-api-reference/setup-guide-postgres) | Postgres-specific Compose profiles, `make` targets, and verification. |
+| [MySQL Setup](/decision-engine-api-reference/setup-guide-mysql) | The same, for MySQL. |
+| [Configuration](/decision-engine-api-reference/configuration) | Config file reference and environment variable overrides once the service is up. |
+| [Dashboard](/decision-engine-api-reference/dashboard-guide) | Bring up the React operator dashboard alongside the API. |
+
+## Choosing A Database
+
+Decision Engine supports PostgreSQL and MySQL as interchangeable backends. Pick one and follow its dedicated guide, or go straight to [Local Setup](/decision-engine-api-reference/local-setup) if you want the full profile matrix (dashboard, monitoring, source builds) rather than a database-first walkthrough.
+
+## Next Steps
+
+- [API Guide](/decision-engine-api-reference/api-reference/guides/api-ref) — copy-paste `curl` examples once the service is running.
diff --git a/api-reference/decision-engine-api-reference/introduction.mdx b/api-reference/decision-engine-api-reference/introduction.mdx
new file mode 100644
index 0000000000..18c5c7786a
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/introduction.mdx
@@ -0,0 +1,102 @@
+---
+title: "Decision Engine"
+description: "What Decision Engine does — routing strategies, cost-aware routing, A/B testing, autopilot, analytics, and the dashboard"
+---
+
+## What It Is
+
+Decision Engine is a Rust service that sits between your orchestrator and your payment gateways. On every payment, it picks the best gateway from an eligible list — by rule, by live success rate, by cost, or some mix of all three — and records the outcome so future decisions keep improving. It runs standalone over HTTP: no vendor lock-in, no mandatory orchestrator.
+
+## Core Capabilities
+
+### Routing Strategies
+
+`POST /decide-gateway` picks a connector using one of these strategies:
+
+| Strategy | What it does |
+| --- | --- |
+| **Rule-based routing** | Priority order, single fixed connector, percentage volume split, or a full AND/OR/nested condition tree — authored via Euclid, Juspay's open rule engine, and evaluated in `POST /routing/create`/`/routing/evaluate`. |
+| **Success-rate (auth-rate) based routing** | `SR_BASED_ROUTING` — ranks gateways by live transaction success rate, with hedging (exploration) and automatic downtime elimination for failing gateways. |
+| **Debit / network-based routing** | `NTW_BASED_ROUTING` — routes debit transactions by co-badged card network for cost/compliance reasons. |
+| **Network + SR hybrid routing** | `NTW_SR_HYBRID_ROUTING` — combines network eligibility with success-rate ranking. |
+| **Multi-objective (cost-aware) routing** | Not a `rankingAlgorithm` value — a post-step *on top of* success-rate routing. Re-ranks gateways with cost data by expected value and promotes a cheaper one if it wins. See below. |
+
+The first four are selected per request with `rankingAlgorithm`. See the [routing configuration guides](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-create) and [decide-gateway examples](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-sr-based) for full request/response detail.
+
+### Multi-Objective (Cost-Aware) Routing
+
+A post-step on top of success-rate scoring: after SR picks a head gateway, Decision Engine re-ranks every gateway with cost data by **economic value** (`EV = auth rate × settlement value`, where `settlement value = txn amount − cost of payment processing (acquirer, issuer & network fee)`), and promotes a cheaper gateway if it wins on EV. Toggle it per request (`enableMultiObjective`) or per merchant (`multi_objective_routing_enabled` feature flag). See [Multi-Objective Routing](/decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-multi-objective).
+
+### Cost Data Ingestion
+
+Learns each connector's *real* fee — not a static rate card — from settlement reports and invoices, fitted down to a per-cluster level (connector × card network × variant × funding × issuer country × currency × interchange category). This is what feeds multi-objective routing's cost side. Reports arrive by webhook, scheduled poll, or manual upload; fees can be read, overridden per connector or per cluster, and audited for coverage. See [Cost Ingestion: Connector Setup](/decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-setup).
+
+### A/B Testing
+
+Split live traffic between a control and variant routing strategy — auth-only vs. cost-aware, manual vs. autopilot, or any two saved algorithms — with a configurable split percentage, a minimum sample size, and a guardrail that auto-flags a regression before it does damage. Built-in statistical significance testing (two-sample z-test) tells you when a variant actually wins. See [A/B Testing: Create An Experiment](/decision-engine-api-reference/api-reference/guides/ab-testing/ab-testing-create).
+
+### Autopilot & Auto-Calibration
+
+A background job that self-tunes success-rate scoring — hedging percentage and bucket size — from observed traffic, with no manual retuning. Every calibration run is logged as an auditable event, and a merchant can hard-reset live scores back to a clean baseline at any time. See [Merchant Features: Autopilot & Feature Flags](/decision-engine-api-reference/api-reference/guides/autopilot/merchant-features).
+
+### Analytics & Audit
+
+ClickHouse-backed views for everything above: routing overview, gateway score trends, decision volume, cost savings, routing events (leader changes, autopilot re-tunes), and a single-payment audit trail that answers "which gateway was picked, and why" for any transaction. See [Analytics Endpoints](/decision-engine-api-reference/api-reference/guides/analytics-audit/analytics-endpoints) and [Payment Audit](/decision-engine-api-reference/payment-audit).
+
+### Dashboard
+
+A React operator UI for configuring routing, running A/B tests, watching analytics, and auditing decisions without touching the API directly. See [Dashboard](/decision-engine-api-reference/dashboard-guide).
+
+### Platform
+
+- **Multi-DB** — MySQL and PostgreSQL as interchangeable backends.
+- **Team management** — invite and manage members per merchant account, with role-based access.
+- **API keys** — server-to-server auth alongside dashboard JWT sessions.
+- **Debit routing gate** — per-merchant toggle for debit-network routing.
+
+## Main API Surface
+
+The API is organized into the following endpoint groups:
+
+| Group | Endpoints | Purpose |
+| --- | --- | --- |
+| Health | `GET /health`, `GET /health/ready`, `GET /health/diagnostics` | Liveness, readiness, and dependency diagnostics. |
+| Auth | `POST /auth/signup`, `POST /auth/login`, `GET /auth/me` | Dashboard operator sign-up, login, and session. |
+| Decisions | `POST /decide-gateway` | Choose a connector for a payment — see Routing Strategies above. |
+| Feedback | `POST /update-gateway-score` | Report authorization outcomes back to scoring. |
+| Merchant accounts | `POST /merchant-account/create`, `GET`/`DELETE /merchant-account/{merchantId}`, feature flags, debit-routing settings | Manage merchants and their configuration. |
+| Routing | `POST /routing/*`, `POST /rule/*` | Create, activate, evaluate, and A/B test routing algorithms. |
+| Cost ingestion | `POST/GET/DELETE /merchant-account/{merchantId}/connectors/*`, `.../cost-*` | Connector credentials, settlement/invoice uploads, fee overrides. |
+| Analytics | `GET /analytics/*` | Gateway scores, decisions, cost savings, routing events, experiment results, audit. |
+
+For copy-paste `curl` examples of each flow, see the [API Guide](/decision-engine-api-reference/api-reference/guides/api-ref). For exact request and response schemas, use the OpenAPI-backed endpoint pages under [API Reference](/decision-engine-api-reference/api-reference).
+
+## Run Locally
+
+For API only:
+
+```bash
+docker compose --profile postgres-ghcr up -d
+curl http://localhost:8080/health
+```
+
+For API + dashboard + docs:
+
+```bash
+docker compose --profile dashboard-postgres-ghcr up -d
+```
+
+URLs:
+
+- API: `http://localhost:8080`
+- Dashboard: `http://localhost:8081/dashboard/`
+- Docs: `http://localhost:8081/introduction`
+
+Use [Installation](/decision-engine-api-reference/installation) for the full Compose, database, and Helm matrix.
+
+## Where To Go Next
+
+- [Installation](/decision-engine-api-reference/installation) — Docker Compose, PostgreSQL/MySQL setup, and configuration, end to end.
+- [Dashboard](/decision-engine-api-reference/dashboard-guide) — route-by-route guide to the React operator dashboard.
+- [API Guide (curl examples)](/decision-engine-api-reference/api-reference/guides/api-ref) — copy-paste flows for every route family, including cost ingestion, A/B testing, and autopilot.
+- [API Reference (OpenAPI)](/decision-engine-api-reference/api-reference) — schema-backed endpoint pages with a request playground.
diff --git a/api-reference/decision-engine-api-reference/local-setup.md b/api-reference/decision-engine-api-reference/local-setup.md
new file mode 100644
index 0000000000..94d4d09db8
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/local-setup.md
@@ -0,0 +1,273 @@
+---
+title: "Local Setup"
+description: "Full Docker Compose, source-build, and Helm matrix for running Decision Engine locally."
+---
+
+# Local Setup Guide
+
+This is the canonical local startup guide for Decision Engine.
+
+## Prerequisites
+
+- Docker 20+
+- Docker Compose v2+
+- Git 2+
+
+Required for source runs:
+
+- Rust 1.85+
+- PostgreSQL or MySQL
+- Redis
+- [`just`](https://just.systems) — required for PostgreSQL source runs (`just migrate-pg`); MySQL can use `diesel migration run` directly
+
+## Runtime Tracks
+
+Decision Engine supports two local tracks:
+
+1. **Published-image track** — pull existing images.
+2. **Local-build track** — build images or binaries from the current source tree.
+
+Default tags used in this repo:
+
+- `DECISION_ENGINE_TAG=v1.4`
+- `GROOVY_RUNNER_TAG=v1.4`
+
+## Docker Compose Profiles
+
+You must pass at least one profile.
+
+### Core runtime profiles
+
+| Profile | DB | Includes |
+|---|---|---|
+| `postgres-ghcr` | PostgreSQL | API + PostgreSQL + Redis + Kafka + ClickHouse + PG migrations |
+| `postgres-local` | PostgreSQL | API + PostgreSQL + Redis + Kafka + ClickHouse + PG migrations |
+| `mysql-ghcr` | MySQL | API + MySQL + Redis + Kafka + ClickHouse + MySQL migrations + routing-config |
+| `mysql-local` | MySQL | API + MySQL + Redis + Kafka + ClickHouse + MySQL migrations + routing-config |
+
+### Dashboard profiles
+
+| Profile | DB | Includes |
+|---|---|---|
+| `dashboard-postgres-ghcr` | PostgreSQL | core PG stack + dashboard + Mintlify docs |
+| `dashboard-postgres-local` | PostgreSQL | core PG stack + dashboard + Mintlify docs |
+| `dashboard-mysql-ghcr` | MySQL | core MySQL stack + dashboard + Mintlify docs |
+| `dashboard-mysql-local` | MySQL | core MySQL stack + dashboard + Mintlify docs |
+
+### Optional profiles
+
+| Profile | Adds |
+|---|---|
+| `monitoring` | Prometheus + Grafana |
+| `groovy-ghcr` | Groovy runner image |
+| `groovy-local` | Groovy runner built from local source |
+| `analytics-clickhouse` | Kafka topic init + ClickHouse analytics bootstrap only |
+
+## Fastest Bring-Up
+
+### One-Command Local Dev
+
+For local source-run development with the full PostgreSQL analytics stack:
+
+```bash
+./oneclick.sh
+```
+
+For the full end-to-end regression gate owned by the Cypress branch:
+
+```bash
+npm run test:e2e
+```
+
+That command runs:
+
+- source-run validation through `oneclick.sh`
+- Docker Compose validation through `dashboard-postgres-local`
+- the full Cypress API/UI/docs smoke contract against both modes
+
+Mode-specific entrypoints:
+
+```bash
+npm run test:e2e:source
+npm run test:e2e:docker
+```
+
+This flow:
+
+- starts PostgreSQL, Redis, Kafka, ClickHouse, and the analytics init jobs with Docker Compose
+- waits for infra health
+- runs PostgreSQL migrations
+- starts the API locally with `cargo run --no-default-features --features postgres`
+- starts the dashboard locally with Vite on `http://localhost:5173/`
+
+By default, `Ctrl+C` stops the local API/dashboard processes and any infra services that `oneclick.sh`
+started itself. To keep infra running after exit:
+
+```bash
+ONECLICK_KEEP_INFRA=1 ./oneclick.sh
+```
+
+### API Only
+
+```bash
+docker compose --profile postgres-ghcr up -d
+```
+
+### API + Dashboard + Docs
+
+```bash
+docker compose --profile dashboard-postgres-ghcr up -d
+```
+
+### With Monitoring
+
+```bash
+docker compose --profile postgres-ghcr --profile monitoring up -d
+```
+
+## Make Targets
+
+Common wrappers:
+
+```bash
+make init-pg-ghcr
+make init-pg-local
+make init-mysql-ghcr
+make init-mysql-local
+make run-pg-ghcr
+make run-mysql-local
+make reset-analytics-clickhouse
+make stop
+```
+
+## Analytics Bootstrap
+
+The Kafka to ClickHouse analytics path is bootstrapped automatically.
+
+- Kafka topics are created by `kafka-init`
+- ClickHouse loads analytics SQL from `clickhouse/scripts/` on first boot
+- analytics data is stored in the named Docker volume `clickhouse-data`
+- normal restarts keep analytics history intact
+
+If you need a clean analytics rebuild, use:
+
+```bash
+make reset-analytics-clickhouse
+```
+
+That removes the ClickHouse analytics volume and recreates the Kafka + ClickHouse analytics stack.
+
+## Source Build And Run
+
+### PostgreSQL
+
+```bash
+cargo build --release --no-default-features --features middleware,kms-aws,postgres
+just migrate-pg
+RUSTFLAGS="-Awarnings" cargo run --no-default-features --features postgres
+```
+
+### MySQL
+
+```bash
+cargo build --release --features release
+RUSTFLAGS="-Awarnings" cargo run --features release
+```
+
+## Docker Builds Without Compose
+
+```bash
+docker build --platform=linux/amd64 -t decision-engine-mysql:local -f Dockerfile .
+docker build --platform=linux/amd64 -t decision-engine-pg:local -f Dockerfile.postgres .
+```
+
+Example container run:
+
+```bash
+docker run --platform=linux/amd64 \
+ -v $(pwd)/config/docker-configuration.toml:/local/config/development.toml \
+ -p 8080:8080 \
+ decision-engine-pg:local
+```
+
+## Helm
+
+Chart location: `helm-charts/`
+
+```bash
+cd helm-charts
+helm dependency update
+helm install my-release .
+```
+
+Use `helm dependency update`, not `helm dependency build` — the committed `Chart.lock` digest can drift out of sync with `Chart.yaml`, and `build` fails hard on any mismatch (`Error: the lock file (Chart.lock) is out of sync with the dependencies file`). `update` re-resolves and re-fetches the `postgresql`, `mysql`, and `redis` subcharts from the Bitnami repo unconditionally.
+
+For image overrides, use `image.repository`, `image.version`, and `image.pullPolicy`. Verify with `helm install --dry-run` or `helm template` before applying to a cluster.
+
+## Verification
+
+```bash
+curl http://localhost:8080/health
+```
+
+Expected response:
+
+```json
+{"message":"Health is good"}
+```
+
+Dashboard profiles also expose:
+
+- Dashboard: `http://localhost:8081/dashboard/`
+- Docs: `http://localhost:8081/introduction`
+- API examples: `http://localhost:8081/api-refs/api-ref`
+
+Monitoring profile also exposes:
+
+- Prometheus: `http://localhost:9090`
+- Grafana: `http://localhost:3000`
+
+## Troubleshooting
+
+### Recreate a profile with clean volumes
+
+```bash
+docker compose --profile postgres-ghcr down -v
+docker compose --profile postgres-ghcr up -d
+```
+
+### Inspect migration jobs
+
+```bash
+docker compose logs db-migrator-postgres
+docker compose logs db-migrator
+```
+
+### Inspect analytics infrastructure
+
+```bash
+docker compose logs kafka-init
+docker compose logs clickhouse
+```
+
+Check the ClickHouse schema directly:
+
+```bash
+curl --user decision_engine:decision_engine \
+ "http://localhost:8123/?query=SHOW%20TABLES%20FROM%20default"
+```
+
+### Common Next Files To Inspect
+
+- `docker-compose.yaml`
+- `config/docker-configuration.toml`
+- `src/config.rs`
+- `src/app.rs`
+
+## Related Docs
+
+- [Installation](/decision-engine-api-reference/installation)
+- [PostgreSQL Setup](/decision-engine-api-reference/setup-guide-postgres)
+- [MySQL Setup](/decision-engine-api-reference/setup-guide-mysql)
+- [Configuration](/decision-engine-api-reference/configuration)
+- [API Guide](/decision-engine-api-reference/api-reference/guides/api-ref)
diff --git a/api-reference/decision-engine-api-reference/payment-audit.mdx b/api-reference/decision-engine-api-reference/payment-audit.mdx
new file mode 100644
index 0000000000..159c4bd51b
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/payment-audit.mdx
@@ -0,0 +1,101 @@
+---
+title: "Payment Audit"
+description: "Search a payment or request and inspect the full routing timeline"
+---
+
+## What It Shows
+
+Payment Audit is the operator-facing timeline view for a single payment or request.
+
+Use it when you want to answer questions like:
+
+- which gateway was decided for this payment
+- which priority rule was hit
+- whether a score update succeeded or failed
+- what structured event payload was captured at each step
+
+The page is designed for exact lookups first and broad operator filtering second.
+
+## Search Inputs
+
+The page supports these filters:
+
+- `payment_id`
+- `request_id`
+- `gateway`
+- `route`
+- `status`
+- `flow_type`
+- time window: `15m`, `1h`, `12h`, `1d`, `1w`
+
+Use an exact `payment_id` when you have it. If you only have a request trace, use `request_id`.
+Payment Audit is always merchant-scoped by the authenticated JWT or API key. The route does not
+accept `scope` or `merchant_id` query params.
+
+## Timeline Stages
+
+The timeline is built from analytics events captured by the live request flows.
+
+Current stages include:
+
+- `gateway_decided`
+- `rule_applied`
+- `score_updated`
+- `preview_evaluated`
+- `request_read_failed`
+- `validation_failed`
+- `request_parse_failed`
+- `score_update_failed`
+
+The raw flow type remains visible as well, for example `decide_gateway_decision`,
+`decide_gateway_rule_hit`, `update_gateway_score_update`, or `routing_evaluate_advanced`.
+
+## Data Sources
+
+Payment Audit reads from the same ClickHouse analytics store used by the analytics surface.
+
+The read path is split intentionally:
+
+- exact `payment_id` / `request_id` lookups read the raw `analytics_domain_events` timeline
+- broad search results read pre-aggregated `analytics_payment_audit_summary_buckets`
+
+Both views correlate events through the write-time `lookup_key`, which prefers `payment_id` and
+falls back to `request_id`.
+
+Relevant fields include:
+
+- `merchant_id`
+- `payment_id`
+- `request_id`
+- `event_stage`
+- `route`
+- `gateway`
+- `routing_approach`
+- `rule_name`
+- `status`
+- `error_code`
+- `error_message`
+- `details`
+
+The `details` field is shown as structured JSON when available.
+
+## Route
+
+When the dashboard profile is running, open:
+
+- `http://localhost:8081/dashboard/audit`
+
+## Related Files
+
+- `website/src/components/pages/PaymentAuditPage.tsx`
+- `src/routes/analytics.rs`
+- `src/analytics/models.rs`
+- `src/analytics/service.rs`
+- `src/decider/gatewaydecider/`
+- `src/feedback/gateway_scoring_service.rs`
+
+## Related Docs
+
+- [Analytics](/decision-engine-api-reference/analytics) — the broader operator-facing metrics view.
+- [ClickHouse Analytics](/decision-engine-api-reference/clickhouse-analytics) — the underlying ingestion pipeline and schema.
+- [Dashboard](/decision-engine-api-reference/dashboard-guide) — where this view is surfaced.
diff --git a/api-reference/decision-engine-api-reference/setup-guide-mysql.md b/api-reference/decision-engine-api-reference/setup-guide-mysql.md
new file mode 100644
index 0000000000..b3a755fe5b
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/setup-guide-mysql.md
@@ -0,0 +1,59 @@
+---
+title: "MySQL Setup"
+description: "Set up Decision Engine with a MySQL database."
+---
+
+# MySQL Setup Guide
+
+This page provides MySQL-focused commands. For the full end-to-end setup — CLI, Docker, Compose, Helm — see the [Local Setup Guide](/decision-engine-api-reference/local-setup).
+
+## Docker Compose (GHCR track)
+
+```bash
+export DECISION_ENGINE_TAG=v1.4
+COMPOSE_PROFILES= docker compose --profile mysql-ghcr up -d
+```
+
+With dashboard + docs:
+
+```bash
+COMPOSE_PROFILES= docker compose --profile dashboard-mysql-ghcr up -d
+```
+
+## Docker Compose (Local build track)
+
+```bash
+COMPOSE_PROFILES= docker compose --profile mysql-local up -d --build
+```
+
+With dashboard + docs:
+
+```bash
+COMPOSE_PROFILES= docker compose --profile dashboard-mysql-local up -d --build
+```
+
+## Make targets
+
+```bash
+make init-mysql-ghcr
+make init-mysql-local
+```
+
+## Verify
+
+```bash
+curl http://localhost:8080/health
+```
+
+Expected response:
+
+```json
+{"message":"Health is good"}
+```
+
+## Related Docs
+
+- [Installation](/decision-engine-api-reference/installation)
+- [Local Setup Guide](/decision-engine-api-reference/local-setup)
+- [PostgreSQL Setup](/decision-engine-api-reference/setup-guide-postgres)
+- [Configuration](/decision-engine-api-reference/configuration)
diff --git a/api-reference/decision-engine-api-reference/setup-guide-postgres.md b/api-reference/decision-engine-api-reference/setup-guide-postgres.md
new file mode 100644
index 0000000000..e080eb7d3f
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/setup-guide-postgres.md
@@ -0,0 +1,59 @@
+---
+title: "PostgreSQL Setup"
+description: "Set up Decision Engine with a PostgreSQL database."
+---
+
+# PostgreSQL Setup Guide
+
+This page provides PostgreSQL-focused commands. For the full end-to-end setup — CLI, Docker, Compose, Helm — see the [Local Setup Guide](/decision-engine-api-reference/local-setup).
+
+## Docker Compose (GHCR track)
+
+```bash
+export DECISION_ENGINE_TAG=v1.4
+COMPOSE_PROFILES= docker compose --profile postgres-ghcr up -d
+```
+
+With dashboard + docs:
+
+```bash
+COMPOSE_PROFILES= docker compose --profile dashboard-postgres-ghcr up -d
+```
+
+## Docker Compose (Local build track)
+
+```bash
+COMPOSE_PROFILES= docker compose --profile postgres-local up -d --build
+```
+
+With dashboard + docs:
+
+```bash
+COMPOSE_PROFILES= docker compose --profile dashboard-postgres-local up -d --build
+```
+
+## Make targets
+
+```bash
+make init-pg-ghcr
+make init-pg-local
+```
+
+## Verify
+
+```bash
+curl http://localhost:8080/health
+```
+
+Expected response:
+
+```json
+{"message":"Health is good"}
+```
+
+## Related Docs
+
+- [Installation](/decision-engine-api-reference/installation)
+- [Local Setup Guide](/decision-engine-api-reference/local-setup)
+- [MySQL Setup](/decision-engine-api-reference/setup-guide-mysql)
+- [Configuration](/decision-engine-api-reference/configuration)
diff --git a/api-reference/decision-engine-api-reference/setup-guide.md b/api-reference/decision-engine-api-reference/setup-guide.md
new file mode 100644
index 0000000000..d7790f77b6
--- /dev/null
+++ b/api-reference/decision-engine-api-reference/setup-guide.md
@@ -0,0 +1,11 @@
+# Setup Guide
+
+This page has been consolidated.
+
+Use the canonical guide:
+
+- [Local Setup Guide](/decision-engine-api-reference/local-setup)
+
+For database-specific walkthroughs:
+- [PostgreSQL Setup Guide](/decision-engine-api-reference/setup-guide-postgres)
+- [MySQL Setup Guide](/decision-engine-api-reference/setup-guide-mysql)
diff --git a/api-reference/decision_engine_openapi-specs.json b/api-reference/decision_engine_openapi-specs.json
new file mode 100644
index 0000000000..147b90adba
--- /dev/null
+++ b/api-reference/decision_engine_openapi-specs.json
@@ -0,0 +1,7601 @@
+{
+ "openapi": "3.1.0",
+ "info": {
+ "title": "Decision Engine",
+ "description": "Open-source payment gateway routing service by Juspay. Selects the optimal payment processor for each transaction in real-time using success-rate scoring, rule-based routing, and elimination logic.\n\n## Authentication\n\nThis API supports two authentication methods:\n\n1. **JWT Bearer Token** - For dashboard/user sessions\n - Header: `Authorization: Bearer <jwt_token>`\n - Obtain via `/auth/login` endpoint\n\n2. **API Key** - For service-to-service/programmatic access\n - Header: `x-api-key: DE_<64_char_hex>`\n - Create via `/api-key/create` endpoint\n\nProtected endpoints require one of these authentication methods.",
+ "version": "1.4.0",
+ "contact": {
+ "name": "Juspay",
+ "url": "https://github.com/juspay/decision-engine"
+ },
+ "license": {
+ "name": "AGPL-3.0",
+ "url": "https://www.gnu.org/licenses/agpl-3.0.html"
+ }
+ },
+ "servers": [
+ {
+ "url": "http://localhost:8080",
+ "description": "Local development"
+ },
+ {
+ "url": "https://sandbox.hyperswitch.io",
+ "description": "Hyperswitch sandbox with x-feature: decision-engine"
+ }
+ ],
+ "tags": [
+ {
+ "name": "Health",
+ "description": "Service liveness, readiness, and diagnostics"
+ },
+ {
+ "name": "Auth",
+ "description": "Dashboard auth and merchant selection"
+ },
+ {
+ "name": "API Keys",
+ "description": "Service-to-service API key management"
+ },
+ {
+ "name": "Gateway Decision",
+ "description": "Core routing decision APIs"
+ },
+ {
+ "name": "Score Feedback",
+ "description": "Feed transaction outcomes back to improve SR scoring"
+ },
+ {
+ "name": "Merchant Account",
+ "description": "Merchant configuration management"
+ },
+ {
+ "name": "Routing Rules",
+ "description": "Euclid declarative routing rules engine"
+ },
+ {
+ "name": "Rule Configuration",
+ "description": "Service-level SR/elimination config"
+ },
+ {
+ "name": "Config",
+ "description": "Routing key and dimension metadata"
+ },
+ {
+ "name": "Analytics",
+ "description": "ClickHouse-backed analytics and audit reads"
+ },
+ {
+ "name": "Compatibility",
+ "description": "Legacy compatibility routes"
+ },
+ {
+ "name": "Connector Costs"
+ },
+ {
+ "name": "Merchant Features"
+ },
+ {
+ "name": "Autopilot"
+ }
+ ],
+ "paths": {
+ "/analytics/decisions": {
+ "get": {
+ "operationId": "analyticsDecisions",
+ "tags": [
+ "Analytics"
+ ],
+ "summary": "Decisions",
+ "description": "ClickHouse-backed decisions read endpoint.",
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "parameters": [
+ {
+ "name": "x-tenant-id",
+ "in": "header",
+ "required": true,
+ "description": "Tenant to resolve. The shipped config files define only the \"public\" tenant. No fallback \u2014 omitting this fails with TE_03.",
+ "schema": {
+ "type": "string",
+ "default": "public"
+ }
+ },
+ {
+ "name": "range",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "start_ms",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "end_ms",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "page",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "page_size",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "payment_method_type",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "payment_method",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "card_network",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "card_is_in",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "currency",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "country",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "auth_type",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "gateway",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "payment_id",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "request_id",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "route",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "status",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "flow_type",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "routing_approach",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "exclude_routing_approach",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "error_code",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "merchant_id",
+ "in": "query",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AnalyticsDecisionResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/analytics/gateway-scores": {
+ "get": {
+ "operationId": "analyticsGatewayScores",
+ "tags": [
+ "Analytics"
+ ],
+ "summary": "Gateway scores",
+ "description": "ClickHouse-backed gateway scores read endpoint.",
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "parameters": [
+ {
+ "name": "x-tenant-id",
+ "in": "header",
+ "required": true,
+ "description": "Tenant to resolve. The shipped config files define only the \"public\" tenant. No fallback \u2014 omitting this fails with TE_03.",
+ "schema": {
+ "type": "string",
+ "default": "public"
+ }
+ },
+ {
+ "name": "range",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "start_ms",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "end_ms",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "page",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "page_size",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "payment_method_type",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "payment_method",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "card_network",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "card_is_in",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "currency",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "country",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "auth_type",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "gateway",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "payment_id",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "request_id",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "route",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "status",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "flow_type",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "routing_approach",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "exclude_routing_approach",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "error_code",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "merchant_id",
+ "in": "query",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AnalyticsGatewayScoresResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/analytics/log-summaries": {
+ "get": {
+ "operationId": "analyticsLogSummaries",
+ "tags": [
+ "Analytics"
+ ],
+ "summary": "Log summaries",
+ "description": "ClickHouse-backed log summaries read endpoint.",
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "parameters": [
+ {
+ "name": "x-tenant-id",
+ "in": "header",
+ "required": true,
+ "description": "Tenant to resolve. The shipped config files define only the \"public\" tenant. No fallback \u2014 omitting this fails with TE_03.",
+ "schema": {
+ "type": "string",
+ "default": "public"
+ }
+ },
+ {
+ "name": "range",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "start_ms",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "end_ms",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "page",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "page_size",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "payment_method_type",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "payment_method",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "card_network",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "card_is_in",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "currency",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "country",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "auth_type",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "gateway",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "payment_id",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "request_id",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "route",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "status",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "flow_type",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "routing_approach",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "exclude_routing_approach",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "error_code",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "merchant_id",
+ "in": "query",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AnalyticsLogSummariesResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/analytics/overview": {
+ "get": {
+ "operationId": "analyticsOverview",
+ "tags": [
+ "Analytics"
+ ],
+ "summary": "Overview",
+ "description": "ClickHouse-backed overview read endpoint.",
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "parameters": [
+ {
+ "name": "x-tenant-id",
+ "in": "header",
+ "required": true,
+ "description": "Tenant to resolve. The shipped config files define only the \"public\" tenant. No fallback \u2014 omitting this fails with TE_03.",
+ "schema": {
+ "type": "string",
+ "default": "public"
+ }
+ },
+ {
+ "name": "range",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "start_ms",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "end_ms",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "page",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "page_size",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "payment_method_type",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "payment_method",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "card_network",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "card_is_in",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "currency",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "country",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "auth_type",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "gateway",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "payment_id",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "request_id",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "route",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "status",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "flow_type",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "routing_approach",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "exclude_routing_approach",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "error_code",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "merchant_id",
+ "in": "query",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AnalyticsOverviewResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/analytics/payment-audit": {
+ "get": {
+ "operationId": "analyticsPaymentAudit",
+ "tags": [
+ "Analytics"
+ ],
+ "summary": "Payment audit",
+ "description": "ClickHouse-backed payment audit read endpoint.",
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "parameters": [
+ {
+ "name": "x-tenant-id",
+ "in": "header",
+ "required": true,
+ "description": "Tenant to resolve. The shipped config files define only the \"public\" tenant. No fallback \u2014 omitting this fails with TE_03.",
+ "schema": {
+ "type": "string",
+ "default": "public"
+ }
+ },
+ {
+ "name": "range",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "start_ms",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "end_ms",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "page",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "page_size",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "payment_method_type",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "payment_method",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "card_network",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "card_is_in",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "currency",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "country",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "auth_type",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "gateway",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "payment_id",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "request_id",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "route",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "status",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "flow_type",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "routing_approach",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "exclude_routing_approach",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "error_code",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "merchant_id",
+ "in": "query",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PaymentAuditResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/analytics/preview-trace": {
+ "get": {
+ "operationId": "analyticsPreviewTrace",
+ "tags": [
+ "Analytics"
+ ],
+ "summary": "Preview trace",
+ "description": "ClickHouse-backed rule preview trace read endpoint.",
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "parameters": [
+ {
+ "name": "x-tenant-id",
+ "in": "header",
+ "required": true,
+ "description": "Tenant to resolve. The shipped config files define only the \"public\" tenant. No fallback \u2014 omitting this fails with TE_03.",
+ "schema": {
+ "type": "string",
+ "default": "public"
+ }
+ },
+ {
+ "name": "range",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "start_ms",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "end_ms",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "page",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "page_size",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "payment_method_type",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "payment_method",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "card_network",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "card_is_in",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "currency",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "country",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "auth_type",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "gateway",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "payment_id",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "request_id",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "route",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "status",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "flow_type",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "routing_approach",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "exclude_routing_approach",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "error_code",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "merchant_id",
+ "in": "query",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PaymentAuditResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/analytics/routing-stats": {
+ "get": {
+ "operationId": "analyticsRoutingStats",
+ "tags": [
+ "Analytics"
+ ],
+ "summary": "Routing stats",
+ "description": "ClickHouse-backed routing stats read endpoint.",
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "parameters": [
+ {
+ "name": "x-tenant-id",
+ "in": "header",
+ "required": true,
+ "description": "Tenant to resolve. The shipped config files define only the \"public\" tenant. No fallback \u2014 omitting this fails with TE_03.",
+ "schema": {
+ "type": "string",
+ "default": "public"
+ }
+ },
+ {
+ "name": "range",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "start_ms",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "end_ms",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "page",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "page_size",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "payment_method_type",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "payment_method",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "card_network",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "card_is_in",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "currency",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "country",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "auth_type",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "gateway",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "payment_id",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "request_id",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "route",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "status",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "flow_type",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "routing_approach",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "exclude_routing_approach",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "error_code",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "merchant_id",
+ "in": "query",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AnalyticsRoutingStatsResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/api-key/{key_id}": {
+ "delete": {
+ "operationId": "revokeApiKey",
+ "tags": [
+ "API Keys"
+ ],
+ "summary": "Revoke API key",
+ "description": "Mark an API key inactive and clear its Redis cache entry.",
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "parameters": [
+ {
+ "name": "key_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/RevokeApiKeyResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/api-key/create": {
+ "post": {
+ "operationId": "createApiKey",
+ "tags": [
+ "API Keys"
+ ],
+ "summary": "Create API key",
+ "description": "Create a service-to-service API key for a merchant.",
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CreateApiKeyRequest"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Created API key",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CreateApiKeyResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/api-key/list/{merchant_id}": {
+ "get": {
+ "operationId": "listApiKeys",
+ "tags": [
+ "API Keys"
+ ],
+ "summary": "List API keys",
+ "description": "List active and revoked API keys for a merchant.",
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "parameters": [
+ {
+ "name": "merchant_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "API keys",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ApiKeyListItem"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/auth/login": {
+ "post": {
+ "operationId": "login",
+ "tags": [
+ "Auth"
+ ],
+ "summary": "Login",
+ "description": "Create a dashboard JWT session.",
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/LoginRequest"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Authenticated user",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AuthResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/auth/logout": {
+ "post": {
+ "operationId": "logout",
+ "tags": [
+ "Auth"
+ ],
+ "summary": "Logout",
+ "description": "Revoke the current dashboard JWT.",
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Logged out",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/MessageResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/auth/me": {
+ "get": {
+ "operationId": "me",
+ "tags": [
+ "Auth"
+ ],
+ "summary": "Current user",
+ "description": "Return current authenticated user and merchant context.",
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Current user",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AuthResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/auth/merchants": {
+ "get": {
+ "operationId": "listUserMerchants",
+ "tags": [
+ "Auth"
+ ],
+ "summary": "List user merchants",
+ "description": "Return merchants available to the current user.",
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Merchant list",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/MerchantInfo"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/auth/signup": {
+ "post": {
+ "operationId": "signup",
+ "tags": [
+ "Auth"
+ ],
+ "summary": "Signup",
+ "description": "Create an operator account. Password must meet dashboard password policy.",
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/SignupRequest"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Authenticated user",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AuthResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/auth/switch-merchant": {
+ "post": {
+ "operationId": "switchMerchant",
+ "tags": [
+ "Auth"
+ ],
+ "summary": "Switch merchant",
+ "description": "Switch the current dashboard merchant context.",
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/SwitchMerchantRequest"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Authenticated user",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AuthResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/config-sr-dimension": {
+ "post": {
+ "operationId": "configSrDimension",
+ "tags": [
+ "Config"
+ ],
+ "summary": "Configure SR dimensions",
+ "description": "Configure success-rate routing dimensions.",
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/SrDimensionConfig"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/config/routing-keys": {
+ "get": {
+ "operationId": "getRoutingConfig",
+ "tags": [
+ "Config"
+ ],
+ "summary": "Get routing keys",
+ "description": "Return rule-builder routing keys and supported values.",
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GenericObject"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/decide-gateway": {
+ "post": {
+ "operationId": "decideGateway",
+ "tags": [
+ "Gateway Decision"
+ ],
+ "summary": "Decide gateway",
+ "description": "Core routing decision API. Given a payment context and a list of eligible gateways, returns the optimal gateway to route to.\n\nThe engine applies a sequence of filters (currency, card brand, auth type, EMI, etc.) then scores remaining gateways using success rate history, elimination status, and contract obligations.\n\n**Authentication:** Requires either JWT Bearer token or API Key.",
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/DecideGatewayRequest"
+ },
+ "examples": {
+ "sr_routing": {
+ "summary": "SR-based routing",
+ "value": {
+ "merchantId": "test_merchant",
+ "paymentInfo": {
+ "paymentId": "pay_001",
+ "amount": 1000,
+ "currency": "USD",
+ "country": "US",
+ "customerId": "cust_123",
+ "paymentType": "ORDER_PAYMENT",
+ "paymentMethodType": "CARD",
+ "paymentMethod": "CREDIT",
+ "authType": "THREE_DS",
+ "cardIsin": "411111"
+ },
+ "eligibleGatewayList": [
+ "stripe",
+ "paypal",
+ "adyen"
+ ],
+ "rankingAlgorithm": "SR_BASED_ROUTING",
+ "eliminationEnabled": false
+ }
+ },
+ "debit_routing": {
+ "summary": "Debit/network-based routing",
+ "value": {
+ "merchantId": "merchant_demo",
+ "paymentInfo": {
+ "paymentId": "debit_001",
+ "amount": 1000,
+ "currency": "USD",
+ "paymentType": "ORDER_PAYMENT",
+ "paymentMethodType": "CARD",
+ "paymentMethod": "DEBIT",
+ "authType": "THREE_DS",
+ "metadata": "{\"merchant_category_code\":\"merchant_category_code_0001\",\"acquirer_country\":\"US\",\"co_badged_card_data\":{\"co_badged_card_networks\":[\"VISA\",\"NYCE\",\"PULSE\",\"STAR\"],\"issuer_country\":\"US\",\"is_regulated\":false,\"regulated_name\":null,\"card_type\":\"debit\"}}"
+ },
+ "eligibleGatewayList": [
+ "stripe",
+ "adyen"
+ ],
+ "rankingAlgorithm": "NTW_BASED_ROUTING",
+ "eliminationEnabled": false
+ }
+ },
+ "hybrid_routing": {
+ "summary": "Hybrid SR + debit routing",
+ "value": {
+ "merchantId": "test_merchant",
+ "paymentInfo": {
+ "paymentId": "pay_003",
+ "amount": 750,
+ "currency": "USD",
+ "paymentType": "ORDER_PAYMENT",
+ "paymentMethodType": "CARD",
+ "paymentMethod": "DEBIT"
+ },
+ "eligibleGatewayList": [
+ "stripe",
+ "braintree",
+ "adyen"
+ ],
+ "rankingAlgorithm": "NTW_SR_HYBRID_ROUTING",
+ "eliminationEnabled": false
+ }
+ },
+ "multi_objective_routing": {
+ "summary": "Multi-objective routing",
+ "value": {
+ "merchantId": "merchant_demo",
+ "paymentInfo": {
+ "paymentId": "mo_001",
+ "amount": 1000,
+ "currency": "USD",
+ "country": "US",
+ "paymentType": "ORDER_PAYMENT",
+ "paymentMethodType": "CARD",
+ "paymentMethod": "CREDIT",
+ "authType": "THREE_DS",
+ "cardIsin": "424242"
+ },
+ "eligibleGatewayList": [
+ "stripe",
+ "adyen",
+ "checkout"
+ ],
+ "rankingAlgorithm": "SR_BASED_ROUTING",
+ "eliminationEnabled": true,
+ "enableMultiObjective": true
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Gateway decision result",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/DecidedGateway"
+ },
+ "examples": {
+ "sr_routing": {
+ "summary": "SR-based routing",
+ "value": {
+ "decided_gateway": "stripe",
+ "routing_approach": "SR_SELECTION_V3_ROUTING",
+ "gateway_priority_map": {
+ "stripe": 0.94,
+ "adyen": 0.87,
+ "paypal": 0.72
+ },
+ "routing_dimension": "CARD_BRAND",
+ "routing_dimension_level": "visa",
+ "reset_approach": "NoReset",
+ "is_scheduled_outage": false,
+ "is_rust_based_decider": true,
+ "latency": 8,
+ "multi_objective_info": null
+ }
+ },
+ "debit_routing": {
+ "summary": "Debit/network-based routing",
+ "value": {
+ "decided_gateway": "stripe",
+ "gateway_priority_map": null,
+ "filter_wise_gateways": null,
+ "priority_logic_tag": null,
+ "routing_approach": "NTW_BASED_ROUTING",
+ "gateway_before_evaluation": null,
+ "priority_logic_output": null,
+ "debit_routing_output": {
+ "co_badged_card_networks_info": [
+ {
+ "network": "NYCE",
+ "saving_percentage": 1.2
+ },
+ {
+ "network": "PULSE",
+ "saving_percentage": 0.9
+ },
+ {
+ "network": "VISA",
+ "saving_percentage": 0.1
+ }
+ ],
+ "issuer_country": "US",
+ "is_regulated": false,
+ "regulated_name": null,
+ "card_type": "debit"
+ },
+ "reset_approach": "NO_RESET",
+ "routing_dimension": null,
+ "routing_dimension_level": null,
+ "is_scheduled_outage": false,
+ "is_dynamic_mga_enabled": false,
+ "gateway_mga_id_map": null,
+ "is_rust_based_decider": true,
+ "multi_objective_info": null
+ }
+ },
+ "hybrid_routing": {
+ "summary": "Hybrid SR + debit routing",
+ "value": {
+ "decided_gateway": "stripe",
+ "routing_approach": "NTW_BASED_ROUTING",
+ "debit_routing_output": {
+ "co_badged_card_networks_info": [
+ {
+ "network": "NYCE",
+ "saving_percentage": 1.2
+ },
+ {
+ "network": "PULSE",
+ "saving_percentage": 0.9
+ }
+ ],
+ "issuer_country": "US",
+ "is_regulated": false,
+ "regulated_name": null,
+ "card_type": "debit"
+ },
+ "reset_approach": "NO_RESET",
+ "is_scheduled_outage": false,
+ "is_rust_based_decider": true,
+ "multi_objective_info": null
+ }
+ },
+ "multi_objective_routing": {
+ "summary": "Multi-objective routing \u2014 auth won (SR head retained)",
+ "value": {
+ "decided_gateway": "adyen",
+ "fallback_gateways": [
+ "stripe",
+ "checkout"
+ ],
+ "gateway_priority_map": {
+ "adyen": 0.65,
+ "checkout": 0.58,
+ "stripe": 0.65
+ },
+ "filter_wise_gateways": null,
+ "priority_logic_tag": null,
+ "routing_approach": "SR_SELECTION_V3_ROUTING",
+ "gateway_before_evaluation": "adyen",
+ "priority_logic_output": {
+ "isEnforcement": false,
+ "gws": [
+ "stripe",
+ "adyen",
+ "checkout"
+ ],
+ "priorityLogicTag": null,
+ "gatewayReferenceIds": {},
+ "primaryLogic": null,
+ "fallbackLogic": null
+ },
+ "debit_routing_output": null,
+ "reset_approach": "NO_RESET",
+ "routing_dimension": "ORDER_PAYMENT, CARD, DEBIT, DEBIT",
+ "routing_dimension_level": "CARD_LEVEL",
+ "is_scheduled_outage": false,
+ "is_dynamic_mga_enabled": false,
+ "gateway_mga_id_map": null,
+ "is_rust_based_decider": true,
+ "latency": 3,
+ "multi_objective_info": {
+ "outcome": "AUTH_WON",
+ "reason": "SR head retained \u2014 it is the highest expected-value PSP (3 ranked on EV).",
+ "srHead": {
+ "psp": "adyen",
+ "authRate": 0.65,
+ "costBps": 156.94736842105263
+ },
+ "chosen": {
+ "psp": "adyen",
+ "authRate": 0.65,
+ "costBps": 156.94736842105263
+ },
+ "costSavedBps": null,
+ "qualifiedCount": 3,
+ "margin": 1,
+ "evGapTop2": 0.013780000000000014
+ }
+ }
+ },
+ "multi_objective_cost_won": {
+ "summary": "Multi-objective routing \u2014 cost won (cheaper gateway promoted)",
+ "value": {
+ "decided_gateway": "adyen",
+ "fallback_gateways": [
+ "stripe",
+ "checkout"
+ ],
+ "gateway_priority_map": {
+ "stripe": 0.94,
+ "adyen": 0.91,
+ "checkout": 0.88
+ },
+ "routing_approach": "SR_SELECTION_MULTI_OBJECTIVE",
+ "gateway_before_evaluation": "stripe",
+ "reset_approach": "NO_RESET",
+ "routing_dimension": "ORDER_PAYMENT,CARD,CREDIT,UNKNOWN",
+ "routing_dimension_level": "CARD_LEVEL",
+ "is_scheduled_outage": false,
+ "is_dynamic_mga_enabled": false,
+ "is_rust_based_decider": true,
+ "multi_objective_info": {
+ "outcome": "COST_WON",
+ "reason": "Promoted 'adyen' over 'stripe' on expected value \u2014 saves 80.00 bps for 3.00pp auth.",
+ "srHead": {
+ "psp": "stripe",
+ "authRate": 0.94,
+ "costBps": 180.0
+ },
+ "chosen": {
+ "psp": "adyen",
+ "authRate": 0.91,
+ "costBps": 100.0
+ },
+ "costSavedBps": 80.0,
+ "qualifiedCount": 3,
+ "margin": 0.2,
+ "evGapTop2": 0.00182
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Bad request",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/decision_gateway": {
+ "post": {
+ "operationId": "legacyDecisionGateway",
+ "tags": [
+ "Compatibility"
+ ],
+ "summary": "Legacy decision gateway",
+ "description": "Legacy compatibility route. New integrations should use /decide-gateway.",
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/DecideGatewayRequest"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Gateway decision result",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/DecidedGateway"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/health": {
+ "get": {
+ "operationId": "healthCheck",
+ "tags": [
+ "Health"
+ ],
+ "summary": "Health check",
+ "description": "Service liveness check.",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/HealthRespPayload"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/health/diagnostics": {
+ "get": {
+ "operationId": "healthDiagnostics",
+ "tags": [
+ "Health"
+ ],
+ "summary": "Diagnostics",
+ "description": "Database diagnostics for local and deployment troubleshooting.",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GenericObject"
+ }
+ }
+ }
+ }
+ },
+ "parameters": [
+ {
+ "name": "x-tenant-id",
+ "in": "header",
+ "required": true,
+ "description": "Tenant to resolve. The shipped config files define only the \"public\" tenant. No fallback \u2014 omitting this fails with TE_03.",
+ "schema": {
+ "type": "string",
+ "default": "public"
+ }
+ }
+ ]
+ }
+ },
+ "/health/ready": {
+ "get": {
+ "operationId": "healthReady",
+ "tags": [
+ "Health"
+ ],
+ "summary": "Readiness check",
+ "description": "Returns Up when the process is ready to serve traffic.",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/HealthRespPayload"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/merchant-account/create": {
+ "post": {
+ "operationId": "createMerchant",
+ "tags": [
+ "Merchant Account"
+ ],
+ "summary": "Create merchant",
+ "description": "Register a new merchant account. The merchant ID is the primary identifier used in all subsequent routing and scoring calls.",
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CreateMerchantRequest"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/MerchantAccountCreateResponse"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "AdminSecret": []
+ }
+ ]
+ }
+ },
+ "/onboarding/merchant": {
+ "post": {
+ "operationId": "onboardMerchant",
+ "tags": [
+ "Auth"
+ ],
+ "summary": "Create merchant from dashboard",
+ "description": "Create and attach a merchant to the current operator user.",
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CreateDashboardMerchantRequest"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CreateMerchantResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/routing/activate": {
+ "post": {
+ "operationId": "activateRoutingRule",
+ "tags": [
+ "Routing Rules"
+ ],
+ "summary": "Activate routing rule",
+ "description": "Activate a routing rule by ID for a merchant. Only one rule can be active at a time \u2014 activating a new rule deactivates the previous one.",
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ActivateRoutingRuleRequest"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Rule activated. The response body is empty."
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/routing/deactivate": {
+ "post": {
+ "operationId": "deactivateRoutingRule",
+ "tags": [
+ "Routing Rules"
+ ],
+ "summary": "Deactivate routing rule",
+ "description": "Deactivate an active routing rule mapping by routing algorithm ID for a merchant. The call is idempotent: if the algorithm exists but is already inactive for the merchant, the API returns success.",
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/DeactivateRoutingRuleRequest"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Rule deactivated. The response body is empty."
+ },
+ "400": {
+ "description": "Routing algorithm ID was not found.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/routing/create": {
+ "post": {
+ "operationId": "createRoutingRule",
+ "tags": [
+ "Routing Rules"
+ ],
+ "summary": "Create routing rule",
+ "description": "Create a new Euclid declarative routing rule for a merchant. Supports `advanced` (full Euclid DSL), `priority` (ordered gateway list), `single` (fixed gateway), and `volume_split` (percentage-based distribution) algorithm types.",
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CreateRoutingRuleRequest"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Routing rule created",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/RoutingRule"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/routing/evaluate": {
+ "post": {
+ "operationId": "evaluateRoutingRule",
+ "tags": [
+ "Routing Rules"
+ ],
+ "summary": "Evaluate routing rule",
+ "description": "Evaluate the active routing rule for a merchant against a payment context. Returns the ordered list of gateways selected by the rule without consuming SR data.",
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/RoutingRequest"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/RoutingEvaluateResponse"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/routing/hybrid": {
+ "post": {
+ "operationId": "hybridRouting",
+ "tags": [
+ "Routing Rules"
+ ],
+ "summary": "Hybrid routing evaluation",
+ "description": "Evaluate hybrid routing using the active routing rule plus runtime payment context.",
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GenericObject"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GenericObject"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/routing/list/{created_by}": {
+ "post": {
+ "operationId": "listRoutingRules",
+ "tags": [
+ "Routing Rules"
+ ],
+ "summary": "List routing rules",
+ "description": "List all routing rules for a merchant.",
+ "parameters": [
+ {
+ "name": "created_by",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "List of routing rules",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/RoutingRule"
+ }
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/routing/list/active/{created_by}": {
+ "post": {
+ "operationId": "getActiveRoutingRule",
+ "tags": [
+ "Routing Rules"
+ ],
+ "summary": "Get active routing rule",
+ "description": "Retrieve the currently active routing rule for a merchant.",
+ "parameters": [
+ {
+ "name": "created_by",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Active routing rule",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/RoutingRule"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "No active rule",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/rule/create": {
+ "post": {
+ "operationId": "createRuleConfig",
+ "tags": [
+ "Rule Configuration"
+ ],
+ "summary": "Create rule config",
+ "description": "Create a service-level configuration for `successRate` or `elimination` scoring. Controls the time window, minimum data thresholds, and other parameters used in SR computation.",
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/RuleConfigRequest"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Rule config created",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/RuleConfigResponse"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/rule/delete": {
+ "post": {
+ "operationId": "deleteRuleConfig",
+ "tags": [
+ "Rule Configuration"
+ ],
+ "summary": "Delete rule config",
+ "description": "Delete a rule configuration.",
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/RuleConfigGetRequest"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Rule config deleted",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/DeleteResponse"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/rule/get": {
+ "post": {
+ "operationId": "getRuleConfig",
+ "tags": [
+ "Rule Configuration"
+ ],
+ "summary": "Get rule config",
+ "description": "Retrieve an existing rule configuration by merchant and type.",
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/RuleConfigGetRequest"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/RuleConfig"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/rule/update": {
+ "post": {
+ "operationId": "updateRuleConfig",
+ "tags": [
+ "Rule Configuration"
+ ],
+ "summary": "Update rule config",
+ "description": "Update an existing rule configuration.",
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/RuleConfigRequest"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Rule config updated",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/RuleConfigResponse"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/update-gateway-score": {
+ "post": {
+ "operationId": "updateGatewayScore",
+ "tags": [
+ "Score Feedback"
+ ],
+ "summary": "Update gateway score",
+ "description": "Feed a transaction outcome back into the success-rate model. Call this after every transaction so the engine has accurate SR data for future routing decisions.\n\nA `CHARGED` status increases the gateway's SR; failure statuses (`AUTHENTICATION_FAILED`, `AUTHORIZATION_FAILED`, etc.) decrease it.",
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/UpdateGatewayScoreRequest"
+ },
+ "example": {
+ "merchantId": "test_merchant",
+ "gateway": "stripe",
+ "paymentId": "pay_001",
+ "status": "CHARGED",
+ "gatewayReferenceId": "stripe_ref_001",
+ "enforceDynamicRoutingFailure": false
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Score updated",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/UpdateScoreResponse"
+ },
+ "example": {
+ "message": "Score updated",
+ "merchant_id": "test_merchant",
+ "gateway": "stripe",
+ "payment_id": "pay_001"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/update-score": {
+ "post": {
+ "operationId": "legacyUpdateScore",
+ "tags": [
+ "Compatibility"
+ ],
+ "summary": "Legacy update score",
+ "description": "Legacy compatibility route. New integrations should use /update-gateway-score.",
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/UpdateGatewayScoreRequest"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/analytics/cost-savings": {
+ "get": {
+ "operationId": "analyticsCostSavings",
+ "tags": [
+ "Analytics"
+ ],
+ "summary": "Cost savings",
+ "description": "ClickHouse-backed rollup of savings attributed to multi-objective (cost-aware) routing, trended over the window.",
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "parameters": [
+ {
+ "name": "x-tenant-id",
+ "in": "header",
+ "required": true,
+ "description": "Tenant to resolve. The shipped config files define only the \"public\" tenant. No fallback \u2014 omitting this fails with TE_03.",
+ "schema": {
+ "type": "string",
+ "default": "public"
+ }
+ },
+ {
+ "name": "range",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "start_ms",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "end_ms",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "page",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "page_size",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "payment_method_type",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "payment_method",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "card_network",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "card_is_in",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "currency",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "country",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "auth_type",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "gateway",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "payment_id",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "request_id",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "route",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "status",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "flow_type",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "routing_approach",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "exclude_routing_approach",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "error_code",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "merchant_id",
+ "in": "query",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AnalyticsCostSavingsResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/analytics/routing-events": {
+ "get": {
+ "operationId": "analyticsRoutingEvents",
+ "tags": [
+ "Analytics"
+ ],
+ "summary": "Routing events",
+ "description": "Historical feed of routing-relevant state changes: SR leader changes, gateways entering/exiting the multi-objective auth band, and autopilot calibration runs.",
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "parameters": [
+ {
+ "name": "x-tenant-id",
+ "in": "header",
+ "required": true,
+ "description": "Tenant to resolve. The shipped config files define only the \"public\" tenant. No fallback \u2014 omitting this fails with TE_03.",
+ "schema": {
+ "type": "string",
+ "default": "public"
+ }
+ },
+ {
+ "name": "range",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "start_ms",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "end_ms",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "payment_method_type",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "payment_method",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "min_transaction_count",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "min_score_delta",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "number"
+ }
+ },
+ {
+ "name": "tolerance_pp",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "number"
+ }
+ },
+ {
+ "name": "limit",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "bucket",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "merchant_id",
+ "in": "query",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/RoutingEventsResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/analytics/experiment/{experiment_id}/results": {
+ "get": {
+ "operationId": "analyticsExperimentResults",
+ "tags": [
+ "Analytics"
+ ],
+ "summary": "A/B test experiment results",
+ "description": "Statistical significance results (control vs. variant) for a routing A/B test experiment, with guardrail evaluation.",
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "parameters": [
+ {
+ "name": "x-tenant-id",
+ "in": "header",
+ "required": true,
+ "description": "Tenant to resolve. The shipped config files define only the \"public\" tenant. No fallback \u2014 omitting this fails with TE_03.",
+ "schema": {
+ "type": "string",
+ "default": "public"
+ }
+ },
+ {
+ "name": "experiment_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "start_ms",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "end_ms",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "min_sample_size",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "guardrail_threshold_pp",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "number"
+ }
+ },
+ {
+ "name": "evaluation_margin",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "number"
+ }
+ },
+ {
+ "name": "merchant_id",
+ "in": "query",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "range",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string",
+ "enum": [
+ "M15",
+ "H1",
+ "H12",
+ "D1",
+ "W1"
+ ]
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ExperimentResultsResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/analytics/experiment/{experiment_id}/transactions": {
+ "get": {
+ "operationId": "analyticsExperimentTransactions",
+ "tags": [
+ "Analytics"
+ ],
+ "summary": "A/B test experiment transactions",
+ "description": "Paginated per-transaction log for a routing A/B test experiment, including arm assignment and outcome.",
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "parameters": [
+ {
+ "name": "x-tenant-id",
+ "in": "header",
+ "required": true,
+ "description": "Tenant to resolve. The shipped config files define only the \"public\" tenant. No fallback \u2014 omitting this fails with TE_03.",
+ "schema": {
+ "type": "string",
+ "default": "public"
+ }
+ },
+ {
+ "name": "experiment_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "start_ms",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "page",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "page_size",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "merchant_id",
+ "in": "query",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "range",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string",
+ "enum": [
+ "M15",
+ "H1",
+ "H12",
+ "D1",
+ "W1"
+ ]
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ExperimentTransactionsResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/merchant-account/{merchant_id}/connectors": {
+ "get": {
+ "operationId": "listConnectorCredentials",
+ "tags": [
+ "Connector Costs"
+ ],
+ "summary": "List Connector Credentials",
+ "description": "Masked list of connector cost-report credentials configured for the merchant.",
+ "parameters": [
+ {
+ "name": "merchant_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ },
+ "example": "merchant_demo"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/MaskedSource"
+ }
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/merchant-account/{merchant_id}/connectors/{connector}/credentials": {
+ "post": {
+ "operationId": "setConnectorCredentials",
+ "tags": [
+ "Connector Costs"
+ ],
+ "summary": "Set Connector Credentials",
+ "description": "Store the account and report-download credentials used to pull a connector's cost reports.",
+ "parameters": [
+ {
+ "name": "merchant_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ },
+ "example": "merchant_demo"
+ },
+ {
+ "name": "connector",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ },
+ "example": "adyen"
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/SetCredentialsRequest"
+ },
+ "example": {
+ "account": "MERCHANT_ACCT",
+ "webhook_secret": "whsec_...",
+ "download_auth": "report-user:password"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/SetCredentialsResponse"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/merchant-account/{merchant_id}/connectors/{connector}/credentials/{account}": {
+ "delete": {
+ "operationId": "deleteConnectorCredentials",
+ "tags": [
+ "Connector Costs"
+ ],
+ "summary": "Delete Connector Credentials",
+ "description": "Remove a connector account's stored cost-report credentials.",
+ "parameters": [
+ {
+ "name": "merchant_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ },
+ "example": "merchant_demo"
+ },
+ {
+ "name": "connector",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ },
+ "example": "adyen"
+ },
+ {
+ "name": "account",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ },
+ "example": "acct_123"
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "Deleted"
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/merchant-account/{merchant_id}/connector-fees": {
+ "get": {
+ "operationId": "listConnectorFees",
+ "tags": [
+ "Connector Costs"
+ ],
+ "summary": "List Connector Fees",
+ "description": "Per-connector modelled and effective fee rates (model, override and effective pct_bps/fixed).",
+ "parameters": [
+ {
+ "name": "merchant_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ },
+ "example": "merchant_demo"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ConnectorFee"
+ }
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/merchant-account/{merchant_id}/connectors/{connector}/fee-override": {
+ "put": {
+ "operationId": "setFeeOverride",
+ "tags": [
+ "Connector Costs"
+ ],
+ "summary": "Set Connector Fee Override",
+ "description": "Manually override the effective fee (pct_bps + fixed) for a connector.",
+ "parameters": [
+ {
+ "name": "merchant_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ },
+ "example": "merchant_demo"
+ },
+ {
+ "name": "connector",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ },
+ "example": "adyen"
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/SetFeeOverrideRequest"
+ },
+ "example": {
+ "pct_bps": 180.0,
+ "fixed": 0.1
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/FeeOverrideResponse"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/merchant-account/{merchant_id}/cost-clusters": {
+ "get": {
+ "operationId": "listCostClusters",
+ "tags": [
+ "Connector Costs"
+ ],
+ "summary": "List Cost Clusters",
+ "description": "Learned per-dimension cost clusters (network/funding/country/currency/IC category) with modelled and effective fees.",
+ "parameters": [
+ {
+ "name": "merchant_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ },
+ "example": "merchant_demo"
+ },
+ {
+ "name": "limit",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer",
+ "format": "int32",
+ "nullable": true
+ }
+ },
+ {
+ "name": "connector",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string",
+ "nullable": true
+ }
+ },
+ {
+ "name": "account",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string",
+ "nullable": true
+ }
+ },
+ {
+ "name": "report_date",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string",
+ "nullable": true
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ClusterFee"
+ }
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/merchant-account/{merchant_id}/cost-clusters/{cluster_key}/fee-override": {
+ "put": {
+ "operationId": "setClusterOverride",
+ "tags": [
+ "Connector Costs"
+ ],
+ "summary": "Set Cost Cluster Override",
+ "description": "Override the modelled fee for a specific cost cluster identified by its cluster key.",
+ "parameters": [
+ {
+ "name": "merchant_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ },
+ "example": "merchant_demo"
+ },
+ {
+ "name": "cluster_key",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ },
+ "example": "visa|credit|US|USD"
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/SetClusterOverrideRequest"
+ },
+ "example": {
+ "pct_bps": 210.0,
+ "fixed": 0.12
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ClusterOverride"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/merchant-account/{merchant_id}/cost-coverage": {
+ "get": {
+ "operationId": "getCostCoverage",
+ "tags": [
+ "Connector Costs"
+ ],
+ "summary": "Get Cost Coverage",
+ "description": "Summary of how much of the merchant's volume is covered by good (well-modelled) cost clusters.",
+ "parameters": [
+ {
+ "name": "merchant_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ },
+ "example": "merchant_demo"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CoverageSummary"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/merchant-account/{merchant_id}/cost-ingestions": {
+ "get": {
+ "operationId": "listCostIngestions",
+ "tags": [
+ "Connector Costs"
+ ],
+ "summary": "List Cost Ingestions",
+ "description": "History of uploaded/pulled cost-report ingestions with staged rows, gross, and status.",
+ "parameters": [
+ {
+ "name": "merchant_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ },
+ "example": "merchant_demo"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/IngestionDto"
+ }
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/merchant-account/{merchant_id}/cost-ingestions/{ingestion_id}": {
+ "delete": {
+ "operationId": "deleteCostIngestion",
+ "tags": [
+ "Connector Costs"
+ ],
+ "summary": "Delete Cost Ingestion",
+ "description": "Delete a specific cost ingestion and its staged data.",
+ "parameters": [
+ {
+ "name": "merchant_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ },
+ "example": "merchant_demo"
+ },
+ {
+ "name": "ingestion_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ },
+ "example": "ing_123"
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "Deleted"
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/merchant-account/{merchant_id}/cost-price-changes": {
+ "get": {
+ "operationId": "listCostPriceChanges",
+ "tags": [
+ "Connector Costs"
+ ],
+ "summary": "List Cost Price Changes",
+ "description": "Detected changes in cluster pricing (old vs new pct_bps/fixed) across ingestions.",
+ "parameters": [
+ {
+ "name": "merchant_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ },
+ "example": "merchant_demo"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/PriceChange"
+ }
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/merchant-account/{merchant_id}/invoice-addons": {
+ "get": {
+ "operationId": "listInvoiceAddons",
+ "tags": [
+ "Connector Costs"
+ ],
+ "summary": "List Invoice Add-ons",
+ "description": "Per-connector periodic-fee add-ons learned from uploaded invoices.",
+ "parameters": [
+ {
+ "name": "merchant_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ },
+ "example": "merchant_demo"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/AddonDto"
+ }
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/merchant-account/{merchant_id}/connectors/{connector}/invoice-addon": {
+ "delete": {
+ "operationId": "deleteInvoiceAddon",
+ "tags": [
+ "Connector Costs"
+ ],
+ "summary": "Delete Invoice Add-on",
+ "description": "Remove a connector's invoice-derived fee add-on.",
+ "parameters": [
+ {
+ "name": "merchant_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ },
+ "example": "merchant_demo"
+ },
+ {
+ "name": "connector",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ },
+ "example": "adyen"
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "Deleted"
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/merchant-account/{merchant_id}/invoice-reconciliation": {
+ "get": {
+ "operationId": "getInvoiceReconciliation",
+ "tags": [
+ "Connector Costs"
+ ],
+ "summary": "Get Invoice Reconciliation",
+ "description": "Reconciliation of invoice subtotals against modelled + add-on captured fees, per connector.",
+ "parameters": [
+ {
+ "name": "merchant_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ },
+ "example": "merchant_demo"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Reconciliation"
+ }
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/merchant-account/{merchant_id}/features": {
+ "get": {
+ "operationId": "getMerchantFeatures",
+ "tags": [
+ "Merchant Features"
+ ],
+ "summary": "Get Merchant Features",
+ "description": "List the merchant's feature-flag states (GSM scoring, explore/exploit, A/B, multi-objective, elimination).",
+ "parameters": [
+ {
+ "name": "merchant_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ },
+ "example": "merchant_demo"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/MerchantFeaturesResponse"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/merchant-account/{merchant_id}/features/{feature}": {
+ "post": {
+ "operationId": "updateMerchantFeature",
+ "tags": [
+ "Merchant Features"
+ ],
+ "summary": "Update Merchant Feature",
+ "description": "Enable or disable a single feature flag for the merchant.",
+ "parameters": [
+ {
+ "name": "merchant_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ },
+ "example": "merchant_demo"
+ },
+ {
+ "name": "feature",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ },
+ "example": "multi-objective-routing"
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/UpdateFeatureRequest"
+ },
+ "example": {
+ "enabled": true
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/MerchantFeaturesResponse"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/gateway-score/reset": {
+ "post": {
+ "operationId": "resetGatewayScores",
+ "tags": [
+ "Autopilot"
+ ],
+ "summary": "Reset Gateway Scores",
+ "description": "Flush a merchant's live gateway (success-rate) scores and any manual overrides.",
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ResetGatewayScoresRequest"
+ },
+ "example": {
+ "merchant_id": "merchant_demo"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ResetGatewayScoresResponse"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/config-sr-dimension/{merchant_id}": {
+ "get": {
+ "operationId": "getSrDimensions",
+ "tags": [
+ "Config"
+ ],
+ "summary": "Get SR dimensions",
+ "description": "Retrieve the success-rate routing dimension configuration for a merchant.",
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "parameters": [
+ {
+ "name": "merchant_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/SrDimensionConfig"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/merchant-account/{merchant_id}": {
+ "get": {
+ "operationId": "getMerchant",
+ "tags": [
+ "Merchant Account"
+ ],
+ "summary": "Get merchant",
+ "description": "Retrieve a merchant account by ID.",
+ "parameters": [
+ {
+ "name": "merchant_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Merchant account",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/MerchantAccount"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Merchant not found",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ },
+ "delete": {
+ "operationId": "deleteMerchant",
+ "tags": [
+ "Merchant Account"
+ ],
+ "summary": "Delete merchant",
+ "description": "Delete a merchant account and all associated routing configuration.",
+ "parameters": [
+ {
+ "name": "merchant_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Merchant deleted",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/DeleteResponse"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ },
+ "/merchant-account/{merchant_id}/debit-routing": {
+ "get": {
+ "operationId": "getMerchantDebitRouting",
+ "tags": [
+ "Merchant Account"
+ ],
+ "summary": "Get debit routing flag",
+ "description": "Return whether debit/network routing is enabled for a merchant. Missing flag configuration is treated as disabled.",
+ "parameters": [
+ {
+ "name": "merchant_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Debit routing flag",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/DebitRoutingResponse"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Merchant not found",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ },
+ "post": {
+ "operationId": "updateMerchantDebitRouting",
+ "tags": [
+ "Merchant Account"
+ ],
+ "summary": "Update debit routing flag",
+ "description": "Enable or disable runtime debit/network routing for a merchant.",
+ "parameters": [
+ {
+ "name": "merchant_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/DebitRoutingRequest"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Debit routing flag updated",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/DebitRoutingResponse"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Merchant not found",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ }
+ },
+ "security": [
+ {
+ "BearerAuth": []
+ },
+ {
+ "ApiKeyAuth": []
+ }
+ ]
+ }
+ }
+ },
+ "components": {
+ "securitySchemes": {
+ "BearerAuth": {
+ "type": "http",
+ "scheme": "bearer",
+ "bearerFormat": "JWT",
+ "description": "JWT token obtained from /auth/login"
+ },
+ "ApiKeyAuth": {
+ "type": "apiKey",
+ "in": "header",
+ "name": "x-api-key",
+ "description": "API key created via /api-key/create"
+ },
+ "AdminSecret": {
+ "type": "apiKey",
+ "in": "header",
+ "name": "x-admin-secret",
+ "description": "Admin bootstrap secret for creating merchant accounts"
+ }
+ },
+ "schemas": {
+ "HealthResponse": {
+ "type": "object",
+ "properties": {
+ "message": {
+ "type": "string",
+ "example": "Health is good"
+ }
+ }
+ },
+ "ErrorResponse": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "type": "string"
+ },
+ "message": {
+ "type": "string"
+ }
+ }
+ },
+ "DeleteResponse": {
+ "type": "object",
+ "properties": {
+ "message": {
+ "type": "string"
+ },
+ "merchant_id": {
+ "type": "string"
+ }
+ }
+ },
+ "PaymentInfo": {
+ "type": "object",
+ "required": [
+ "paymentId",
+ "amount",
+ "currency",
+ "paymentType",
+ "paymentMethodType",
+ "paymentMethod"
+ ],
+ "properties": {
+ "paymentId": {
+ "type": "string",
+ "example": "pay_001"
+ },
+ "amount": {
+ "type": "number",
+ "format": "double",
+ "example": 1000
+ },
+ "currency": {
+ "type": "string",
+ "description": "ISO 4217 currency code.",
+ "example": "USD"
+ },
+ "country": {
+ "type": "string",
+ "nullable": true,
+ "description": "ISO 3166-1 alpha-2 country code.",
+ "example": "US"
+ },
+ "customerId": {
+ "type": "string",
+ "nullable": true,
+ "example": "cust_123"
+ },
+ "udfs": {
+ "type": "object",
+ "nullable": true,
+ "description": "User-defined fields, keyed udf1..udf20.",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "preferredGateway": {
+ "type": "string",
+ "nullable": true,
+ "description": "Pins routing to a specific gateway when set."
+ },
+ "paymentType": {
+ "type": "string",
+ "enum": [
+ "ORDER_PAYMENT",
+ "MANDATE_REGISTER",
+ "EMANDATE_REGISTER",
+ "MANDATE_PAYMENT",
+ "EMANDATE_PAYMENT",
+ "TPV_PAYMENT",
+ "TPV_EMANDATE_REGISTER",
+ "TPV_MANDATE_REGISTER",
+ "TPV_EMANDATE_PAYMENT",
+ "TPV_MANDATE_PAYMENT",
+ "PARTIAL_CAPTURE",
+ "PARTIAL_VOID",
+ "VAN_PAYMENT",
+ "MOTO_PAYMENT",
+ "UNKNOWN"
+ ],
+ "example": "ORDER_PAYMENT"
+ },
+ "metadata": {
+ "type": "string",
+ "nullable": true
+ },
+ "internalMetadata": {
+ "type": "string",
+ "nullable": true
+ },
+ "isEmi": {
+ "type": "boolean",
+ "nullable": true
+ },
+ "emiBank": {
+ "type": "string",
+ "nullable": true
+ },
+ "emiTenure": {
+ "type": "integer",
+ "format": "int32",
+ "nullable": true
+ },
+ "paymentMethodType": {
+ "type": "string",
+ "description": "Connector-defined payment method type, e.g. CARD, UPI, WALLET, NETBANKING.",
+ "example": "CARD"
+ },
+ "paymentMethod": {
+ "type": "string",
+ "description": "Connector-defined payment method, e.g. CREDIT, DEBIT, GPAY.",
+ "example": "CREDIT"
+ },
+ "paymentSource": {
+ "type": "string",
+ "nullable": true
+ },
+ "authType": {
+ "type": "string",
+ "nullable": true,
+ "enum": [
+ "ATMPIN",
+ "THREE_DS",
+ "THREE_DS2",
+ "OTP",
+ "OBO_OTP",
+ "VIES",
+ "NO_THREE_DS",
+ "NETWORK_TOKEN",
+ "MOTO",
+ "FIDO",
+ "CTP"
+ ],
+ "example": "THREE_DS"
+ },
+ "cardIssuerBankName": {
+ "type": "string",
+ "nullable": true
+ },
+ "cardIsin": {
+ "type": "string",
+ "nullable": true,
+ "example": "411111"
+ },
+ "cardType": {
+ "type": "string",
+ "nullable": true,
+ "description": "e.g. CREDIT, DEBIT, PREPAID, UPI, NB.",
+ "example": "CREDIT"
+ },
+ "cardSwitchProvider": {
+ "type": "string",
+ "nullable": true
+ },
+ "cardProgram": {
+ "type": "string",
+ "nullable": true
+ },
+ "cardIssuerCountry": {
+ "type": "string",
+ "nullable": true
+ },
+ "channel": {
+ "type": "string",
+ "nullable": true,
+ "description": "Acceptance channel: ecom / pos / contactless."
+ }
+ }
+ },
+ "DecideGatewayRequest": {
+ "type": "object",
+ "required": [
+ "merchantId",
+ "paymentInfo",
+ "eligibleGatewayList",
+ "rankingAlgorithm"
+ ],
+ "properties": {
+ "merchantId": {
+ "type": "string",
+ "example": "test_merchant"
+ },
+ "paymentInfo": {
+ "$ref": "#/components/schemas/PaymentInfo"
+ },
+ "eligibleGatewayList": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "example": [
+ "stripe",
+ "paypal",
+ "adyen"
+ ]
+ },
+ "rankingAlgorithm": {
+ "type": "string",
+ "enum": [
+ "SR_BASED_ROUTING",
+ "PL_BASED_ROUTING",
+ "NTW_BASED_ROUTING",
+ "NTW_SR_HYBRID_ROUTING"
+ ],
+ "example": "SR_BASED_ROUTING"
+ },
+ "eliminationEnabled": {
+ "type": "boolean",
+ "default": false
+ },
+ "enableMultiObjective": {
+ "type": "boolean",
+ "description": "Per-request override for the multi-objective (cost-aware) post-step. true forces it on, false forces it off; omitted falls back to the merchant's multi_objective_routing_enabled feature flag."
+ }
+ }
+ },
+ "DecidedGateway": {
+ "type": "object",
+ "properties": {
+ "decided_gateway": {
+ "type": "string",
+ "example": "stripe"
+ },
+ "routing_approach": {
+ "type": "string",
+ "example": "SR_SELECTION_V3_ROUTING",
+ "description": "Routing approach used. SR_SELECTION_MULTI_OBJECTIVE indicates the multi-objective post-step promoted a cheaper gateway over the SR head."
+ },
+ "gateway_priority_map": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "number"
+ },
+ "example": {
+ "stripe": 0.94,
+ "adyen": 0.87,
+ "paypal": 0.72
+ }
+ },
+ "routing_dimension": {
+ "type": "string"
+ },
+ "routing_dimension_level": {
+ "type": "string"
+ },
+ "reset_approach": {
+ "type": "string"
+ },
+ "is_scheduled_outage": {
+ "type": "boolean"
+ },
+ "is_rust_based_decider": {
+ "type": "boolean"
+ },
+ "debit_routing_output": {
+ "$ref": "#/components/schemas/DebitRoutingOutput"
+ },
+ "latency": {
+ "type": "number"
+ },
+ "multi_objective_info": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/MultiObjectiveInfo"
+ }
+ ],
+ "nullable": true,
+ "description": "Populated when the multi-objective post-step ran (multi_objective_routing_enabled feature flag or enableMultiObjective request field, outside hedging). Null otherwise."
+ }
+ }
+ },
+ "DebitRoutingOutput": {
+ "type": "object",
+ "properties": {
+ "co_badged_card_networks_info": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "network": {
+ "type": "string",
+ "example": "NYCE"
+ },
+ "saving_percentage": {
+ "type": "number",
+ "example": 1.2
+ }
+ }
+ }
+ },
+ "issuer_country": {
+ "type": "string",
+ "example": "US"
+ },
+ "is_regulated": {
+ "type": "boolean",
+ "example": false
+ },
+ "regulated_name": {
+ "type": "string",
+ "nullable": true
+ },
+ "card_type": {
+ "type": "string",
+ "example": "Debit"
+ }
+ }
+ },
+ "UpdateGatewayScoreRequest": {
+ "type": "object",
+ "required": [
+ "merchantId",
+ "gateway",
+ "paymentId",
+ "status"
+ ],
+ "properties": {
+ "merchantId": {
+ "type": "string",
+ "example": "test_merchant"
+ },
+ "gateway": {
+ "type": "string",
+ "example": "stripe"
+ },
+ "paymentId": {
+ "type": "string",
+ "example": "pay_001"
+ },
+ "status": {
+ "type": "string",
+ "enum": [
+ "CHARGED",
+ "AUTHENTICATION_FAILED",
+ "AUTHORIZATION_FAILED",
+ "JUSPAY_DECLINED",
+ "FAILURE"
+ ],
+ "example": "CHARGED"
+ },
+ "gatewayReferenceId": {
+ "type": "string",
+ "example": "stripe_ref_001"
+ },
+ "enforceDynamicRoutingFailure": {
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "UpdateScoreResponse": {
+ "type": "object",
+ "properties": {
+ "message": {
+ "type": "string"
+ },
+ "merchant_id": {
+ "type": "string"
+ },
+ "gateway": {
+ "type": "string"
+ },
+ "payment_id": {
+ "type": "string"
+ }
+ }
+ },
+ "CreateMerchantRequest": {
+ "type": "object",
+ "required": [
+ "merchant_id"
+ ],
+ "properties": {
+ "merchant_id": {
+ "type": "string",
+ "example": "my_merchant"
+ },
+ "gateway_success_rate_based_decider_input": {
+ "type": "string",
+ "nullable": true
+ }
+ }
+ },
+ "MerchantAccount": {
+ "type": "object",
+ "properties": {
+ "message": {
+ "type": "string"
+ },
+ "merchant_id": {
+ "type": "string",
+ "example": "my_merchant"
+ },
+ "gateway_success_rate_based_decider_input": {
+ "type": "string",
+ "nullable": true
+ }
+ }
+ },
+ "DebitRoutingRequest": {
+ "type": "object",
+ "required": [
+ "enabled"
+ ],
+ "properties": {
+ "enabled": {
+ "type": "boolean",
+ "example": true
+ }
+ }
+ },
+ "DebitRoutingResponse": {
+ "type": "object",
+ "properties": {
+ "merchant_id": {
+ "type": "string",
+ "example": "my_merchant"
+ },
+ "debit_routing_enabled": {
+ "type": "boolean",
+ "example": true
+ }
+ }
+ },
+ "CreateRoutingRuleRequest": {
+ "type": "object",
+ "required": [
+ "name",
+ "created_by",
+ "algorithm"
+ ],
+ "properties": {
+ "name": {
+ "type": "string",
+ "example": "default-priority"
+ },
+ "description": {
+ "type": "string",
+ "example": ""
+ },
+ "created_by": {
+ "type": "string",
+ "example": "test_merchant"
+ },
+ "algorithm_for": {
+ "type": "string",
+ "enum": [
+ "payment",
+ "payout",
+ "three_ds_authentication"
+ ],
+ "default": "payment"
+ },
+ "algorithm": {
+ "$ref": "#/components/schemas/RoutingAlgorithm"
+ },
+ "metadata": {
+ "type": "object",
+ "nullable": true,
+ "description": "Arbitrary metadata attached to the rule."
+ }
+ }
+ },
+ "RoutingAlgorithm": {
+ "type": "object",
+ "required": [
+ "type",
+ "data"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "priority",
+ "single",
+ "volume_split",
+ "advanced",
+ "ab_test"
+ ],
+ "example": "priority"
+ },
+ "data": {
+ "description": "Depends on type: array of ConnectorInfo ({gateway_name, gateway_id}) for `priority`; single ConnectorInfo for `single`; array of {split, output} for `volume_split`; Euclid AST Program for `advanced`; ABTestData ({control_algorithm_id, variant_algorithm_id, variant_split_pct, min_sample_size, guardrail_threshold_pp, variant_sr_config?, control_sr_config?}) for `ab_test`"
+ }
+ }
+ },
+ "ActivateRoutingRuleRequest": {
+ "type": "object",
+ "required": [
+ "created_by",
+ "routing_algorithm_id"
+ ],
+ "properties": {
+ "created_by": {
+ "type": "string",
+ "example": "test_merchant"
+ },
+ "routing_algorithm_id": {
+ "type": "string",
+ "example": "rule_abc123"
+ }
+ }
+ },
+ "DeactivateRoutingRuleRequest": {
+ "type": "object",
+ "required": [
+ "created_by",
+ "routing_algorithm_id"
+ ],
+ "properties": {
+ "created_by": {
+ "type": "string",
+ "example": "test_merchant"
+ },
+ "routing_algorithm_id": {
+ "type": "string",
+ "example": "rule_abc123"
+ }
+ }
+ },
+ "RoutingRule": {
+ "type": "object",
+ "properties": {
+ "rule_id": {
+ "type": "string",
+ "nullable": true,
+ "example": "rule_abc123"
+ },
+ "name": {
+ "type": "string"
+ },
+ "description": {
+ "type": "string"
+ },
+ "created_by": {
+ "type": "string",
+ "example": "test_merchant"
+ },
+ "algorithm_for": {
+ "type": "string"
+ },
+ "algorithm": {
+ "$ref": "#/components/schemas/RoutingAlgorithm"
+ },
+ "metadata": {
+ "type": "object",
+ "nullable": true,
+ "description": "Arbitrary metadata attached to the rule."
+ }
+ }
+ },
+ "RuleConfigRequest": {
+ "type": "object",
+ "required": [
+ "merchant_id",
+ "config"
+ ],
+ "properties": {
+ "merchant_id": {
+ "type": "string",
+ "example": "test_merchant"
+ },
+ "config": {
+ "type": "object",
+ "description": "Tagged config variant. `type` is `successRate`, `elimination`, or `debitRouting`. `data` holds the variant-specific fields."
+ }
+ }
+ },
+ "RuleConfigGetRequest": {
+ "type": "object",
+ "required": [
+ "merchant_id",
+ "algorithm"
+ ],
+ "properties": {
+ "merchant_id": {
+ "type": "string",
+ "example": "test_merchant"
+ },
+ "algorithm": {
+ "type": "string",
+ "enum": [
+ "successRate",
+ "elimination",
+ "debitRouting"
+ ],
+ "example": "successRate"
+ }
+ }
+ },
+ "RuleConfigResponse": {
+ "type": "object",
+ "properties": {
+ "message": {
+ "type": "string"
+ },
+ "merchant_id": {
+ "type": "string"
+ },
+ "config": {
+ "type": "object"
+ }
+ }
+ },
+ "GenericObject": {
+ "type": "object",
+ "additionalProperties": true
+ },
+ "MessageResponse": {
+ "type": "object",
+ "properties": {
+ "message": {
+ "type": "string"
+ }
+ }
+ },
+ "AuthResponse": {
+ "type": "object",
+ "properties": {
+ "token": {
+ "type": "string"
+ },
+ "user_id": {
+ "type": "string"
+ },
+ "email": {
+ "type": "string"
+ },
+ "merchant_id": {
+ "type": "string"
+ },
+ "role": {
+ "type": "string"
+ },
+ "merchants": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/MerchantInfo"
+ }
+ }
+ }
+ },
+ "MerchantInfo": {
+ "type": "object",
+ "properties": {
+ "merchant_id": {
+ "type": "string"
+ },
+ "merchant_name": {
+ "type": "string"
+ },
+ "role": {
+ "type": "string"
+ }
+ }
+ },
+ "CreateDashboardMerchantRequest": {
+ "type": "object",
+ "required": [
+ "merchant_name"
+ ],
+ "properties": {
+ "merchant_name": {
+ "type": "string",
+ "example": "Demo Merchant"
+ }
+ }
+ },
+ "SwitchMerchantRequest": {
+ "type": "object",
+ "required": [
+ "merchant_id"
+ ],
+ "properties": {
+ "merchant_id": {
+ "type": "string",
+ "example": "merchant_demo"
+ }
+ }
+ },
+ "CreateApiKeyRequest": {
+ "type": "object",
+ "required": [
+ "merchant_id"
+ ],
+ "properties": {
+ "merchant_id": {
+ "type": "string",
+ "example": "merchant_demo"
+ },
+ "description": {
+ "type": "string",
+ "nullable": true,
+ "example": "backend integration key"
+ }
+ }
+ },
+ "CreateApiKeyResponse": {
+ "type": "object",
+ "properties": {
+ "key_id": {
+ "type": "string"
+ },
+ "api_key": {
+ "type": "string",
+ "example": "DE_..."
+ },
+ "key_prefix": {
+ "type": "string"
+ },
+ "merchant_id": {
+ "type": "string"
+ },
+ "description": {
+ "type": "string",
+ "nullable": true
+ },
+ "created_at": {
+ "type": "string"
+ }
+ }
+ },
+ "ApiKeyListItem": {
+ "type": "object",
+ "properties": {
+ "key_id": {
+ "type": "string"
+ },
+ "key_prefix": {
+ "type": "string"
+ },
+ "merchant_id": {
+ "type": "string"
+ },
+ "description": {
+ "type": "string",
+ "nullable": true
+ },
+ "is_active": {
+ "type": "boolean"
+ },
+ "created_at": {
+ "type": "string"
+ }
+ }
+ },
+ "AnalyticsQueryParams": {
+ "type": "object",
+ "properties": {
+ "range": {
+ "type": "string",
+ "enum": [
+ "15m",
+ "1h",
+ "12h",
+ "1d",
+ "1w"
+ ]
+ },
+ "start_ms": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "end_ms": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "page": {
+ "type": "integer",
+ "minimum": 1
+ },
+ "page_size": {
+ "type": "integer",
+ "minimum": 1,
+ "maximum": 50
+ },
+ "gateway": {
+ "type": "string"
+ },
+ "payment_id": {
+ "type": "string"
+ },
+ "request_id": {
+ "type": "string"
+ },
+ "route": {
+ "type": "string"
+ },
+ "status": {
+ "type": "string"
+ },
+ "flow_type": {
+ "type": "string"
+ },
+ "routing_approach": {
+ "type": "string"
+ },
+ "exclude_routing_approach": {
+ "type": "string"
+ },
+ "error_code": {
+ "type": "string"
+ }
+ }
+ },
+ "PspSummary": {
+ "type": "object",
+ "properties": {
+ "psp": {
+ "type": "string",
+ "example": "adyen"
+ },
+ "authRate": {
+ "type": "number",
+ "example": 0.91
+ },
+ "costBps": {
+ "type": "number",
+ "nullable": true,
+ "example": 100.0
+ }
+ }
+ },
+ "MultiObjectiveInfo": {
+ "type": "object",
+ "description": "Present when the multi-objective (cost-aware) post-step ran. Explains why the gateway was picked: the SR head was kept (AUTH_WON) or a higher economic-value PSP was promoted (COST_WON). Economic value is auth rate \u00d7 settlement value, where settlement value = txn amount \u2212 cost of payment processing (acquirer, issuer & network fee).",
+ "properties": {
+ "outcome": {
+ "type": "string",
+ "enum": [
+ "COST_WON",
+ "AUTH_WON"
+ ],
+ "example": "COST_WON"
+ },
+ "reason": {
+ "type": "string",
+ "example": "Promoted 'adyen' over 'stripe' on expected value \u2014 saves 80.00 bps for 3.00pp auth."
+ },
+ "srHead": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PspSummary"
+ }
+ ],
+ "nullable": true,
+ "description": "The PSP the SR scorer would have picked."
+ },
+ "chosen": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/PspSummary"
+ }
+ ],
+ "nullable": true,
+ "description": "The PSP the post-step actually chose. Equals srHead when auth won."
+ },
+ "costSavedBps": {
+ "type": "number",
+ "nullable": true,
+ "description": "Fee saved in bps when outcome is COST_WON (srHead.costBps - chosen.costBps).",
+ "example": 80.0
+ },
+ "qualifiedCount": {
+ "type": "integer",
+ "description": "Number of PSPs that had cost data and were ranked on expected value.",
+ "example": 3
+ },
+ "margin": {
+ "type": "number",
+ "description": "Merchant margin (fraction of ticket) applied for this transaction. Configured via the successRate config margin field; defaults to 1.0.",
+ "example": 0.2
+ },
+ "evGapTop2": {
+ "type": "number",
+ "nullable": true,
+ "description": "Expected-value gap between the top-two EV-ranked PSPs, as a fraction of ticket. Null when fewer than two PSPs had cost data.",
+ "example": 0.00182
+ }
+ }
+ },
+ "MaskedSource": {
+ "type": "object",
+ "properties": {
+ "connector": {
+ "type": "string"
+ },
+ "account": {
+ "type": "string"
+ },
+ "webhook_secret_hint": {
+ "type": "string"
+ },
+ "download_auth_hint": {
+ "type": "string"
+ }
+ }
+ },
+ "SetCredentialsRequest": {
+ "type": "object",
+ "properties": {
+ "account": {
+ "type": "string"
+ },
+ "webhook_secret": {
+ "type": "string"
+ },
+ "download_auth": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "account",
+ "webhook_secret",
+ "download_auth"
+ ]
+ },
+ "SetCredentialsResponse": {
+ "type": "object",
+ "properties": {
+ "merchant_id": {
+ "type": "string"
+ },
+ "connector": {
+ "type": "string"
+ },
+ "account": {
+ "type": "string"
+ },
+ "status": {
+ "type": "string"
+ }
+ }
+ },
+ "ConnectorFee": {
+ "type": "object",
+ "properties": {
+ "connector": {
+ "type": "string"
+ },
+ "account": {
+ "type": "string",
+ "nullable": true
+ },
+ "has_credentials": {
+ "type": "boolean"
+ },
+ "model_pct_bps": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "model_fixed": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "good_gross": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "override_pct_bps": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "override_fixed": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "override_updated_at": {
+ "type": "string",
+ "nullable": true
+ },
+ "effective_pct_bps": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "effective_fixed": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "source": {
+ "type": "string"
+ }
+ }
+ },
+ "SetFeeOverrideRequest": {
+ "type": "object",
+ "properties": {
+ "pct_bps": {
+ "type": "number",
+ "format": "double"
+ },
+ "fixed": {
+ "type": "number",
+ "format": "double"
+ }
+ },
+ "required": [
+ "pct_bps",
+ "fixed"
+ ]
+ },
+ "FeeOverrideResponse": {
+ "type": "object",
+ "properties": {
+ "merchant_id": {
+ "type": "string"
+ },
+ "connector": {
+ "type": "string"
+ },
+ "pct_bps": {
+ "type": "number",
+ "format": "double"
+ },
+ "fixed": {
+ "type": "number",
+ "format": "double"
+ },
+ "updated_at": {
+ "type": "string"
+ }
+ }
+ },
+ "ClusterFee": {
+ "type": "object",
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "connector": {
+ "type": "string"
+ },
+ "card_network": {
+ "type": "string"
+ },
+ "variant": {
+ "type": "string"
+ },
+ "funding": {
+ "type": "string"
+ },
+ "issuer_country": {
+ "type": "string"
+ },
+ "currency": {
+ "type": "string"
+ },
+ "ic_category": {
+ "type": "string"
+ },
+ "n": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "gross_sum": {
+ "type": "number",
+ "format": "double"
+ },
+ "model_pct_bps": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "model_fixed": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "override_pct_bps": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "override_fixed": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "override_updated_at": {
+ "type": "string",
+ "nullable": true
+ },
+ "effective_pct_bps": {
+ "type": "number",
+ "format": "double"
+ },
+ "effective_fixed": {
+ "type": "number",
+ "format": "double"
+ },
+ "source": {
+ "type": "string"
+ }
+ }
+ },
+ "SetClusterOverrideRequest": {
+ "type": "object",
+ "properties": {
+ "pct_bps": {
+ "type": "number",
+ "format": "double"
+ },
+ "fixed": {
+ "type": "number",
+ "format": "double"
+ }
+ },
+ "required": [
+ "pct_bps",
+ "fixed"
+ ]
+ },
+ "ClusterDims": {
+ "type": "object",
+ "description": "Cluster dimension breakdown (connector, card network, funding, issuer country, currency, IC category).",
+ "additionalProperties": true
+ },
+ "ClusterOverride": {
+ "type": "object",
+ "properties": {
+ "dims": {
+ "$ref": "#/components/schemas/ClusterDims"
+ },
+ "pct_bps": {
+ "type": "number",
+ "format": "double"
+ },
+ "fixed": {
+ "type": "number",
+ "format": "double"
+ },
+ "updated_at": {
+ "type": "string"
+ }
+ }
+ },
+ "CoverageSummary": {
+ "type": "object",
+ "properties": {
+ "total_clusters": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "good_clusters": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "thin_clusters": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "non_linear_clusters": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "total_txns": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "good_txns": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "thin_txns": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "non_linear_txns": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "good_txn_pct": {
+ "type": "number",
+ "format": "double"
+ },
+ "total_gross": {
+ "type": "number",
+ "format": "double"
+ },
+ "good_gross": {
+ "type": "number",
+ "format": "double"
+ },
+ "thin_gross": {
+ "type": "number",
+ "format": "double"
+ },
+ "non_linear_gross": {
+ "type": "number",
+ "format": "double"
+ },
+ "good_gross_pct": {
+ "type": "number",
+ "format": "double"
+ },
+ "bps_rmse_p50": {
+ "type": "number",
+ "format": "double"
+ },
+ "bps_rmse_p90": {
+ "type": "number",
+ "format": "double"
+ },
+ "report_date": {
+ "type": "string"
+ }
+ }
+ },
+ "IngestionDto": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ },
+ "connector": {
+ "type": "string"
+ },
+ "account": {
+ "type": "string"
+ },
+ "source": {
+ "type": "string"
+ },
+ "status": {
+ "type": "string"
+ },
+ "staged_rows": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "report_date": {
+ "type": "string",
+ "nullable": true
+ },
+ "period_start": {
+ "type": "string",
+ "nullable": true
+ },
+ "period_end": {
+ "type": "string",
+ "nullable": true
+ },
+ "currency_count": {
+ "type": "integer",
+ "format": "int32"
+ },
+ "currencies": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "country_count": {
+ "type": "integer",
+ "format": "int32"
+ },
+ "countries": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "total_gross": {
+ "type": "number",
+ "format": "double"
+ },
+ "total_clusters": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "good_clusters": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "last_error": {
+ "type": "string",
+ "nullable": true
+ },
+ "created_at": {
+ "type": "string"
+ }
+ }
+ },
+ "PriceChange": {
+ "type": "object",
+ "properties": {
+ "connector": {
+ "type": "string"
+ },
+ "account": {
+ "type": "string"
+ },
+ "card_network": {
+ "type": "string"
+ },
+ "variant": {
+ "type": "string"
+ },
+ "funding": {
+ "type": "string"
+ },
+ "issuer_country": {
+ "type": "string"
+ },
+ "currency": {
+ "type": "string"
+ },
+ "ic_category": {
+ "type": "string"
+ },
+ "old_pct_bps": {
+ "type": "number",
+ "format": "double"
+ },
+ "new_pct_bps": {
+ "type": "number",
+ "format": "double"
+ },
+ "old_fixed": {
+ "type": "number",
+ "format": "double"
+ },
+ "new_fixed": {
+ "type": "number",
+ "format": "double"
+ },
+ "changed_on": {
+ "type": "string"
+ }
+ }
+ },
+ "StoredAddon": {
+ "type": "object",
+ "properties": {
+ "pct_addon_bps": {
+ "type": "number",
+ "format": "double"
+ },
+ "fixed_addon": {
+ "type": "number",
+ "format": "double"
+ },
+ "invoice_ref": {
+ "type": "string"
+ },
+ "subtotal_ex_tax": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "card_volume": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "txn_count": {
+ "type": "integer",
+ "format": "int64",
+ "nullable": true
+ },
+ "currency": {
+ "type": "string"
+ },
+ "period_start": {
+ "type": "string",
+ "nullable": true
+ },
+ "period_end": {
+ "type": "string",
+ "nullable": true
+ },
+ "updated_at": {
+ "type": "string"
+ }
+ }
+ },
+ "AddonDto": {
+ "type": "object",
+ "properties": {
+ "connector": {
+ "type": "string"
+ },
+ "addon": {
+ "$ref": "#/components/schemas/StoredAddon"
+ }
+ }
+ },
+ "Reconciliation": {
+ "type": "object",
+ "properties": {
+ "connector": {
+ "type": "string"
+ },
+ "invoice_subtotal": {
+ "type": "number",
+ "format": "double"
+ },
+ "model_captured": {
+ "type": "number",
+ "format": "double"
+ },
+ "addon_contribution": {
+ "type": "number",
+ "format": "double"
+ },
+ "model_all_in": {
+ "type": "number",
+ "format": "double"
+ },
+ "residual": {
+ "type": "number",
+ "format": "double"
+ },
+ "coverage_before": {
+ "type": "number",
+ "format": "double"
+ },
+ "coverage_after": {
+ "type": "number",
+ "format": "double"
+ }
+ }
+ },
+ "MerchantFeatureEntry": {
+ "type": "object",
+ "properties": {
+ "feature": {
+ "type": "string",
+ "enum": [
+ "gsm-scoring-filter",
+ "explore-exploit-srv3",
+ "ab-test-real-payments",
+ "multi-objective-routing",
+ "elimination"
+ ]
+ },
+ "enabled": {
+ "type": "boolean"
+ }
+ }
+ },
+ "MerchantFeaturesResponse": {
+ "type": "object",
+ "properties": {
+ "merchant_id": {
+ "type": "string"
+ },
+ "features": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/MerchantFeatureEntry"
+ }
+ }
+ }
+ },
+ "UpdateFeatureRequest": {
+ "type": "object",
+ "properties": {
+ "enabled": {
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "enabled"
+ ]
+ },
+ "ResetGatewayScoresRequest": {
+ "type": "object",
+ "properties": {
+ "merchant_id": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "merchant_id"
+ ]
+ },
+ "ResetGatewayScoresResponse": {
+ "type": "object",
+ "properties": {
+ "merchant_id": {
+ "type": "string"
+ },
+ "deleted_keys": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "removed_overrides": {
+ "type": "integer",
+ "format": "int64"
+ }
+ }
+ },
+ "SrDimensionInfo": {
+ "type": "object",
+ "required": [
+ "udfs"
+ ],
+ "properties": {
+ "udfs": {
+ "type": "array",
+ "items": {
+ "type": "integer",
+ "format": "int32"
+ }
+ },
+ "fields": {
+ "type": "array",
+ "nullable": true,
+ "items": {
+ "type": "string",
+ "enum": [
+ "currency",
+ "country",
+ "auth_type",
+ "card_is_in",
+ "card_network"
+ ]
+ },
+ "description": "Success-rate routing dimensions. Must be from the eligible set."
+ }
+ }
+ },
+ "SrDimensionConfig": {
+ "type": "object",
+ "required": [
+ "merchant_id",
+ "paymentInfo"
+ ],
+ "properties": {
+ "merchant_id": {
+ "type": "string",
+ "example": "merchant_demo"
+ },
+ "paymentInfo": {
+ "$ref": "#/components/schemas/SrDimensionInfo"
+ }
+ }
+ },
+ "AnalyticsKpi": {
+ "type": "object",
+ "properties": {
+ "label": {
+ "type": "string"
+ },
+ "value": {
+ "type": "string"
+ },
+ "subtitle": {
+ "type": "string",
+ "nullable": true
+ }
+ }
+ },
+ "AnalyticsRouteHit": {
+ "type": "object",
+ "properties": {
+ "route": {
+ "type": "string"
+ },
+ "count": {
+ "type": "integer",
+ "format": "int64"
+ }
+ }
+ },
+ "AnalyticsRuleHit": {
+ "type": "object",
+ "properties": {
+ "rule_name": {
+ "type": "string",
+ "nullable": true
+ },
+ "count": {
+ "type": "integer",
+ "format": "int64"
+ }
+ }
+ },
+ "SmartRetryTrigger": {
+ "type": "object",
+ "properties": {
+ "gateway": {
+ "type": "string"
+ },
+ "error_code": {
+ "type": "string",
+ "nullable": true
+ },
+ "count": {
+ "type": "integer",
+ "format": "int64"
+ }
+ }
+ },
+ "SmartRetryFallback": {
+ "type": "object",
+ "properties": {
+ "gateway": {
+ "type": "string"
+ },
+ "retried": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "recovered": {
+ "type": "integer",
+ "format": "int64"
+ }
+ }
+ },
+ "SmartRetryStats": {
+ "type": "object",
+ "properties": {
+ "retried_count": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "recovered_count": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "by_trigger": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/SmartRetryTrigger"
+ }
+ },
+ "by_fallback": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/SmartRetryFallback"
+ }
+ }
+ }
+ },
+ "GatewayScoreSnapshot": {
+ "type": "object",
+ "properties": {
+ "merchant_id": {
+ "type": "string",
+ "nullable": true
+ },
+ "payment_method_type": {
+ "type": "string",
+ "nullable": true
+ },
+ "payment_method": {
+ "type": "string",
+ "nullable": true
+ },
+ "gateway": {
+ "type": "string",
+ "nullable": true
+ },
+ "score_value": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "sigma_factor": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "average_latency": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "tp99_latency": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "transaction_count": {
+ "type": "integer",
+ "format": "int64",
+ "nullable": true
+ },
+ "last_updated_ms": {
+ "type": "integer",
+ "format": "int64"
+ }
+ }
+ },
+ "GatewayScoreSeriesPoint": {
+ "type": "object",
+ "properties": {
+ "bucket_ms": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "merchant_id": {
+ "type": "string",
+ "nullable": true
+ },
+ "payment_method_type": {
+ "type": "string",
+ "nullable": true
+ },
+ "payment_method": {
+ "type": "string",
+ "nullable": true
+ },
+ "gateway": {
+ "type": "string",
+ "nullable": true
+ },
+ "score_value": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ }
+ }
+ },
+ "AnalyticsErrorSummary": {
+ "type": "object",
+ "properties": {
+ "route": {
+ "type": "string",
+ "nullable": true
+ },
+ "error_code": {
+ "type": "string",
+ "nullable": true
+ },
+ "error_message": {
+ "type": "string",
+ "nullable": true
+ },
+ "count": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "last_seen_ms": {
+ "type": "integer",
+ "format": "int64"
+ }
+ }
+ },
+ "AnalyticsDecisionPoint": {
+ "type": "object",
+ "properties": {
+ "bucket_ms": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "routing_approach": {
+ "type": "string",
+ "nullable": true
+ },
+ "count": {
+ "type": "integer",
+ "format": "int64"
+ }
+ }
+ },
+ "AnalyticsGatewaySharePoint": {
+ "type": "object",
+ "properties": {
+ "bucket_ms": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "gateway": {
+ "type": "string",
+ "nullable": true
+ },
+ "count": {
+ "type": "integer",
+ "format": "int64"
+ }
+ }
+ },
+ "RoutingFilterDimension": {
+ "type": "object",
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ },
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "RoutingFilterDimensionHint": {
+ "type": "object",
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "label": {
+ "type": "string"
+ }
+ }
+ },
+ "RoutingFilterOptions": {
+ "type": "object",
+ "properties": {
+ "dimensions": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/RoutingFilterDimension"
+ }
+ },
+ "missing_dimensions": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/RoutingFilterDimensionHint"
+ }
+ },
+ "gateways": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "AnalyticsAvailableCurrency": {
+ "type": "object",
+ "properties": {
+ "currency": {
+ "type": "string"
+ },
+ "decision_count": {
+ "type": "integer",
+ "format": "int64"
+ }
+ }
+ },
+ "AnalyticsCostSavingsTrendPoint": {
+ "type": "object",
+ "properties": {
+ "bucket_ms": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "saved_value": {
+ "type": "number",
+ "format": "double"
+ }
+ }
+ },
+ "AnalyticsCostSavingsTotals": {
+ "type": "object",
+ "properties": {
+ "saved_value": {
+ "type": "number",
+ "format": "double"
+ },
+ "cost_won_count": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "total_decisions": {
+ "type": "integer",
+ "format": "int64"
+ }
+ }
+ },
+ "AnalyticsLogSample": {
+ "type": "object",
+ "properties": {
+ "route": {
+ "type": "string",
+ "nullable": true
+ },
+ "merchant_id": {
+ "type": "string",
+ "nullable": true
+ },
+ "payment_id": {
+ "type": "string",
+ "nullable": true
+ },
+ "request_id": {
+ "type": "string",
+ "nullable": true
+ },
+ "global_request_id": {
+ "type": "string",
+ "nullable": true
+ },
+ "trace_id": {
+ "type": "string",
+ "nullable": true
+ },
+ "gateway": {
+ "type": "string",
+ "nullable": true
+ },
+ "routing_approach": {
+ "type": "string",
+ "nullable": true
+ },
+ "status": {
+ "type": "string",
+ "nullable": true
+ },
+ "error_code": {
+ "type": "string",
+ "nullable": true
+ },
+ "error_message": {
+ "type": "string",
+ "nullable": true
+ },
+ "flow_type": {
+ "type": "string",
+ "nullable": true
+ },
+ "created_at_ms": {
+ "type": "integer",
+ "format": "int64"
+ }
+ }
+ },
+ "PaymentAuditSummary": {
+ "type": "object",
+ "properties": {
+ "lookup_key": {
+ "type": "string"
+ },
+ "payment_id": {
+ "type": "string",
+ "nullable": true
+ },
+ "request_id": {
+ "type": "string",
+ "nullable": true
+ },
+ "merchant_id": {
+ "type": "string",
+ "nullable": true
+ },
+ "first_seen_ms": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "last_seen_ms": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "event_count": {
+ "type": "integer"
+ },
+ "latest_status": {
+ "type": "string",
+ "nullable": true
+ },
+ "latest_gateway": {
+ "type": "string",
+ "nullable": true
+ },
+ "latest_stage": {
+ "type": "string",
+ "nullable": true
+ },
+ "gateways": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "routes": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "PaymentAuditEvent": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ },
+ "flow_type": {
+ "type": "string"
+ },
+ "event_stage": {
+ "type": "string",
+ "nullable": true
+ },
+ "route": {
+ "type": "string",
+ "nullable": true
+ },
+ "merchant_id": {
+ "type": "string",
+ "nullable": true
+ },
+ "payment_id": {
+ "type": "string",
+ "nullable": true
+ },
+ "request_id": {
+ "type": "string",
+ "nullable": true
+ },
+ "global_request_id": {
+ "type": "string",
+ "nullable": true
+ },
+ "trace_id": {
+ "type": "string",
+ "nullable": true
+ },
+ "payment_method_type": {
+ "type": "string",
+ "nullable": true
+ },
+ "payment_method": {
+ "type": "string",
+ "nullable": true
+ },
+ "gateway": {
+ "type": "string",
+ "nullable": true
+ },
+ "routing_approach": {
+ "type": "string",
+ "nullable": true
+ },
+ "rule_name": {
+ "type": "string",
+ "nullable": true
+ },
+ "status": {
+ "type": "string",
+ "nullable": true
+ },
+ "error_code": {
+ "type": "string",
+ "nullable": true
+ },
+ "error_message": {
+ "type": "string",
+ "nullable": true
+ },
+ "score_value": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "sigma_factor": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "average_latency": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "tp99_latency": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "transaction_count": {
+ "type": "integer",
+ "format": "int64",
+ "nullable": true
+ },
+ "details": {
+ "type": "string",
+ "nullable": true
+ },
+ "details_json": {
+ "type": "object",
+ "nullable": true
+ },
+ "created_at_ms": {
+ "type": "integer",
+ "format": "int64"
+ }
+ }
+ },
+ "ExperimentArmMetrics": {
+ "type": "object",
+ "properties": {
+ "arm": {
+ "type": "string"
+ },
+ "transaction_count": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "success_count": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "failure_count": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "auth_rate": {
+ "type": "number",
+ "format": "double"
+ },
+ "first_attempt_auth_rate": {
+ "type": "number",
+ "format": "double"
+ },
+ "total_cost_saved": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "avg_latency_ms": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "avg_chosen_cost_bps": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "avg_cost_saved_bps": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "net_ev_bps": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ }
+ }
+ },
+ "ExperimentTransaction": {
+ "type": "object",
+ "properties": {
+ "payment_id": {
+ "type": "string"
+ },
+ "variant_arm": {
+ "type": "string"
+ },
+ "gateway": {
+ "type": "string",
+ "nullable": true
+ },
+ "status": {
+ "type": "string",
+ "nullable": true
+ },
+ "created_at_ms": {
+ "type": "integer",
+ "format": "int64"
+ }
+ }
+ },
+ "RoutingEvent": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ },
+ "event_type": {
+ "$ref": "#/components/schemas/RoutingEventType"
+ },
+ "merchant_id": {
+ "type": "string"
+ },
+ "payment_method_type": {
+ "type": "string",
+ "nullable": true
+ },
+ "payment_method": {
+ "type": "string",
+ "nullable": true
+ },
+ "bucket_ms": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "gateway": {
+ "type": "string"
+ },
+ "previous_gateway": {
+ "type": "string",
+ "nullable": true
+ },
+ "score": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "previous_score": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "transaction_count": {
+ "type": "integer",
+ "format": "int64",
+ "nullable": true
+ },
+ "bucket_size": {
+ "type": "integer",
+ "format": "int32",
+ "nullable": true
+ },
+ "previous_bucket_size": {
+ "type": "integer",
+ "format": "int32",
+ "nullable": true
+ },
+ "hedging_percent": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "previous_hedging_percent": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "card_network": {
+ "type": "string",
+ "nullable": true
+ },
+ "currency": {
+ "type": "string",
+ "nullable": true
+ },
+ "country": {
+ "type": "string",
+ "nullable": true
+ },
+ "auth_type": {
+ "type": "string",
+ "nullable": true
+ }
+ }
+ },
+ "AnalyticsOverviewResponse": {
+ "type": "object",
+ "properties": {
+ "merchant_id": {
+ "type": "string"
+ },
+ "kpis": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/AnalyticsKpi"
+ }
+ },
+ "route_hits": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/AnalyticsRouteHit"
+ }
+ },
+ "top_scores": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/GatewayScoreSnapshot"
+ }
+ },
+ "top_errors": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/AnalyticsErrorSummary"
+ }
+ },
+ "top_rules": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/AnalyticsRuleHit"
+ }
+ },
+ "smart_retry_stats": {
+ "$ref": "#/components/schemas/SmartRetryStats"
+ }
+ }
+ },
+ "AnalyticsGatewayScoresResponse": {
+ "type": "object",
+ "properties": {
+ "merchant_id": {
+ "type": "string"
+ },
+ "range": {
+ "type": "string"
+ },
+ "snapshots": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/GatewayScoreSnapshot"
+ }
+ },
+ "series": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/GatewayScoreSeriesPoint"
+ }
+ }
+ }
+ },
+ "AnalyticsDecisionResponse": {
+ "type": "object",
+ "properties": {
+ "merchant_id": {
+ "type": "string"
+ },
+ "range": {
+ "type": "string"
+ },
+ "tiles": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/AnalyticsKpi"
+ }
+ },
+ "series": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/AnalyticsDecisionPoint"
+ }
+ },
+ "approaches": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/AnalyticsRuleHit"
+ }
+ }
+ }
+ },
+ "AnalyticsRoutingStatsResponse": {
+ "type": "object",
+ "properties": {
+ "merchant_id": {
+ "type": "string"
+ },
+ "range": {
+ "type": "string"
+ },
+ "gateway_share": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/AnalyticsGatewaySharePoint"
+ }
+ },
+ "top_rules": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/AnalyticsRuleHit"
+ }
+ },
+ "sr_trend": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/GatewayScoreSeriesPoint"
+ }
+ },
+ "available_filters": {
+ "$ref": "#/components/schemas/RoutingFilterOptions"
+ }
+ }
+ },
+ "AnalyticsCostSavingsResponse": {
+ "type": "object",
+ "properties": {
+ "merchant_id": {
+ "type": "string"
+ },
+ "range": {
+ "type": "string"
+ },
+ "currency": {
+ "type": "string",
+ "nullable": true
+ },
+ "available_currencies": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/AnalyticsAvailableCurrency"
+ }
+ },
+ "trend": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/AnalyticsCostSavingsTrendPoint"
+ }
+ },
+ "totals": {
+ "$ref": "#/components/schemas/AnalyticsCostSavingsTotals"
+ }
+ }
+ },
+ "AnalyticsLogSummariesResponse": {
+ "type": "object",
+ "properties": {
+ "merchant_id": {
+ "type": "string"
+ },
+ "range": {
+ "type": "string"
+ },
+ "total_errors": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "errors": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/AnalyticsErrorSummary"
+ }
+ },
+ "samples": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/AnalyticsLogSample"
+ }
+ },
+ "page": {
+ "type": "integer"
+ },
+ "page_size": {
+ "type": "integer"
+ }
+ }
+ },
+ "PaymentAuditResponse": {
+ "type": "object",
+ "properties": {
+ "merchant_id": {
+ "type": "string"
+ },
+ "range": {
+ "type": "string"
+ },
+ "payment_id": {
+ "type": "string",
+ "nullable": true
+ },
+ "request_id": {
+ "type": "string",
+ "nullable": true
+ },
+ "gateway": {
+ "type": "string",
+ "nullable": true
+ },
+ "route": {
+ "type": "string",
+ "nullable": true
+ },
+ "status": {
+ "type": "string",
+ "nullable": true
+ },
+ "flow_type": {
+ "type": "string",
+ "nullable": true
+ },
+ "routing_approach": {
+ "type": "string",
+ "nullable": true
+ },
+ "error_code": {
+ "type": "string",
+ "nullable": true
+ },
+ "page": {
+ "type": "integer"
+ },
+ "page_size": {
+ "type": "integer"
+ },
+ "total_results": {
+ "type": "integer"
+ },
+ "total_success": {
+ "type": "integer"
+ },
+ "total_failure": {
+ "type": "integer"
+ },
+ "results": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/PaymentAuditSummary"
+ }
+ },
+ "timeline": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/PaymentAuditEvent"
+ }
+ }
+ }
+ },
+ "ExperimentResultsResponse": {
+ "type": "object",
+ "properties": {
+ "experiment_id": {
+ "type": "string"
+ },
+ "merchant_id": {
+ "type": "string"
+ },
+ "control": {
+ "$ref": "#/components/schemas/ExperimentArmMetrics"
+ },
+ "variant": {
+ "$ref": "#/components/schemas/ExperimentArmMetrics"
+ },
+ "delta_pp": {
+ "type": "number",
+ "format": "double"
+ },
+ "p_value": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "confidence_interval": {
+ "type": "array",
+ "items": {
+ "type": "number"
+ },
+ "nullable": true
+ },
+ "verdict": {
+ "$ref": "#/components/schemas/ExperimentVerdict"
+ },
+ "min_sample_size": {
+ "type": "integer",
+ "format": "int32"
+ },
+ "net_delta_bps": {
+ "type": "number",
+ "format": "double",
+ "nullable": true
+ },
+ "evaluation_margin": {
+ "type": "number",
+ "format": "double"
+ }
+ }
+ },
+ "ExperimentTransactionsResponse": {
+ "type": "object",
+ "properties": {
+ "experiment_id": {
+ "type": "string"
+ },
+ "total": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "transactions": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ExperimentTransaction"
+ }
+ }
+ }
+ },
+ "RoutingEventsResponse": {
+ "type": "object",
+ "properties": {
+ "merchant_id": {
+ "type": "string"
+ },
+ "range": {
+ "type": "string"
+ },
+ "events": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/RoutingEvent"
+ }
+ },
+ "generated_at_ms": {
+ "type": "integer",
+ "format": "int64"
+ }
+ }
+ },
+ "ExperimentVerdict": {
+ "type": "string",
+ "enum": [
+ "CollectingData",
+ "NotSignificant",
+ "VariantWins",
+ "VariantLoses",
+ "GuardrailBreached"
+ ]
+ },
+ "RoutingEventType": {
+ "type": "string",
+ "enum": [
+ "LeaderChanged",
+ "GatewayEnteredAuthBand",
+ "GatewayExitedAuthBand",
+ "CalibrationApplied"
+ ]
+ },
+ "RuleConfig": {
+ "type": "object",
+ "properties": {
+ "merchant_id": {
+ "type": "string"
+ },
+ "config": {
+ "type": "object"
+ }
+ }
+ },
+ "MerchantAccountCreateResponse": {
+ "type": "object",
+ "properties": {
+ "message": {
+ "type": "string"
+ },
+ "merchant_id": {
+ "type": "string"
+ },
+ "gateway_success_rate_based_decider_input": {
+ "type": "string",
+ "nullable": true
+ },
+ "api_key": {
+ "type": "string",
+ "nullable": true
+ }
+ }
+ },
+ "RevokeApiKeyResponse": {
+ "type": "object",
+ "properties": {
+ "key_id": {
+ "type": "string"
+ },
+ "message": {
+ "type": "string"
+ }
+ }
+ },
+ "CreateMerchantResponse": {
+ "type": "object",
+ "properties": {
+ "token": {
+ "type": "string"
+ },
+ "merchant_id": {
+ "type": "string"
+ },
+ "merchant_name": {
+ "type": "string"
+ },
+ "merchants": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/MerchantInfo"
+ }
+ }
+ }
+ },
+ "HealthRespPayload": {
+ "type": "object",
+ "properties": {
+ "message": {
+ "type": "string"
+ }
+ }
+ },
+ "ConnectorInfo": {
+ "type": "object",
+ "properties": {
+ "gateway_name": {
+ "type": "string"
+ },
+ "gateway_id": {
+ "type": "string",
+ "nullable": true
+ }
+ }
+ },
+ "RoutingEvaluateResponse": {
+ "type": "object",
+ "properties": {
+ "payment_id": {
+ "type": "string",
+ "nullable": true
+ },
+ "status": {
+ "type": "string"
+ },
+ "output": {
+ "type": "object"
+ },
+ "evaluated_output": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ConnectorInfo"
+ }
+ },
+ "eligible_connectors": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ConnectorInfo"
+ }
+ }
+ }
+ },
+ "ValueType": {
+ "type": "object",
+ "required": [
+ "type"
+ ],
+ "description": "Euclid condition value. Tagged by `type`; `value` holds the payload.",
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "number",
+ "enum_variant",
+ "metadata_variant",
+ "str_value",
+ "global_ref",
+ "number_array",
+ "enum_variant_array",
+ "number_comparison_array"
+ ]
+ },
+ "value": {
+ "description": "Shape depends on `type`: number->integer, enum_variant/str_value/global_ref->string, number_array/enum_variant_array->array of number/string, number_comparison_array->array of comparisons."
+ }
+ }
+ },
+ "RoutingRequest": {
+ "type": "object",
+ "required": [
+ "created_by",
+ "parameters"
+ ],
+ "description": "Request body for POST /routing/evaluate (src/euclid/types.rs::RoutingRequest). No camelCase rename \u2014 snake_case field names.",
+ "properties": {
+ "payment_id": {
+ "type": "string",
+ "nullable": true
+ },
+ "created_by": {
+ "type": "string",
+ "example": "test_merchant"
+ },
+ "fallback_output": {
+ "type": "array",
+ "nullable": true,
+ "items": {
+ "$ref": "#/components/schemas/ConnectorInfo"
+ },
+ "description": "Used when the rule evaluation yields no eligible connector."
+ },
+ "parameters": {
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/ValueType"
+ },
+ "description": "Map of DSL parameter name (e.g. currency, amount, cardType) to its ValueType.",
+ "example": {
+ "currency": {
+ "type": "str_value",
+ "value": "USD"
+ }
+ }
+ }
+ }
+ },
+ "LoginRequest": {
+ "type": "object",
+ "required": [
+ "email",
+ "password"
+ ],
+ "properties": {
+ "email": {
+ "type": "string",
+ "example": "[email protected]"
+ },
+ "password": {
+ "type": "string",
+ "example": "StrongPass#123"
+ }
+ }
+ },
+ "SignupRequest": {
+ "type": "object",
+ "required": [
+ "email",
+ "password"
+ ],
+ "properties": {
+ "email": {
+ "type": "string",
+ "example": "[email protected]"
+ },
+ "password": {
+ "type": "string",
+ "example": "StrongPass#123"
+ },
+ "merchant_id": {
+ "type": "string",
+ "nullable": true,
+ "example": "merchant_demo"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/api-reference/docs.json b/api-reference/docs.json
index 82960fdff3..55b843491b 100644
--- a/api-reference/docs.json
+++ b/api-reference/docs.json
@@ -559,47 +559,253 @@
]
},
{
- "tab": "Intelligent Router API Reference",
+ "tab": "Decision Engine API Reference",
"groups": [
{
- "group": "Hyperswitch Intelligent Router",
+ "group": "Overview",
"pages": [
- "intelligent-router-api-reference/overview"
+ "decision-engine-api-reference/introduction",
+ {
+ "group": "Installation",
+ "pages": [
+ "decision-engine-api-reference/installation",
+ "decision-engine-api-reference/local-setup",
+ "decision-engine-api-reference/setup-guide-postgres",
+ "decision-engine-api-reference/setup-guide-mysql",
+ "decision-engine-api-reference/configuration",
+ "decision-engine-api-reference/dashboard-guide"
+ ]
+ },
+ "decision-engine-api-reference/api-reference/guides/api-ref",
+ "decision-engine-api-reference/analytics",
+ "decision-engine-api-reference/payment-audit",
+ "decision-engine-api-reference/clickhouse-analytics",
+ "decision-engine-api-reference/benchmarks"
]
},
{
- "group": "API Reference",
+ "group": "OpenAPI: Health",
+ "pages": [
+ "decision-engine-api-reference/api-reference/endpoint/health/healthCheck",
+ "decision-engine-api-reference/api-reference/endpoint/health/healthReady",
+ "decision-engine-api-reference/api-reference/endpoint/health/healthDiagnostics"
+ ]
+ },
+ {
+ "group": "OpenAPI: Gateway Decision",
+ "pages": [
+ "decision-engine-api-reference/api-reference/endpoint/gateway-decision/decideGateway"
+ ]
+ },
+ {
+ "group": "OpenAPI: Score Feedback",
+ "pages": [
+ "decision-engine-api-reference/api-reference/endpoint/score-feedback/updateGatewayScore"
+ ]
+ },
+ {
+ "group": "OpenAPI: Merchant Account",
+ "pages": [
+ "decision-engine-api-reference/api-reference/endpoint/merchant-account/createMerchant",
+ "decision-engine-api-reference/api-reference/endpoint/merchant-account/getMerchant",
+ "decision-engine-api-reference/api-reference/endpoint/merchant-account/deleteMerchant",
+ "decision-engine-api-reference/api-reference/endpoint/merchant-account/getMerchantDebitRouting",
+ "decision-engine-api-reference/api-reference/endpoint/merchant-account/updateMerchantDebitRouting"
+ ]
+ },
+ {
+ "group": "OpenAPI: Routing Rules",
+ "pages": [
+ "decision-engine-api-reference/api-reference/endpoint/routing-rules/createRoutingRule",
+ "decision-engine-api-reference/api-reference/endpoint/routing-rules/activateRoutingRule",
+ "decision-engine-api-reference/api-reference/endpoint/routing-rules/deactivateRoutingRule",
+ "decision-engine-api-reference/api-reference/endpoint/routing-rules/listRoutingRules",
+ "decision-engine-api-reference/api-reference/endpoint/routing-rules/getActiveRoutingRule",
+ "decision-engine-api-reference/api-reference/endpoint/routing-rules/evaluateRoutingRule",
+ "decision-engine-api-reference/api-reference/endpoint/routing-rules/hybridRouting"
+ ]
+ },
+ {
+ "group": "OpenAPI: Rule Configuration",
+ "pages": [
+ "decision-engine-api-reference/api-reference/endpoint/rule-configuration/createRuleConfig",
+ "decision-engine-api-reference/api-reference/endpoint/rule-configuration/getRuleConfig",
+ "decision-engine-api-reference/api-reference/endpoint/rule-configuration/updateRuleConfig",
+ "decision-engine-api-reference/api-reference/endpoint/rule-configuration/deleteRuleConfig"
+ ]
+ },
+ {
+ "group": "OpenAPI: Auth And API Keys",
+ "pages": [
+ "decision-engine-api-reference/api-reference/endpoint/auth/signup",
+ "decision-engine-api-reference/api-reference/endpoint/auth/login",
+ "decision-engine-api-reference/api-reference/endpoint/auth/logout",
+ "decision-engine-api-reference/api-reference/endpoint/auth/me",
+ "decision-engine-api-reference/api-reference/endpoint/auth/listUserMerchants",
+ "decision-engine-api-reference/api-reference/endpoint/auth/switchMerchant",
+ "decision-engine-api-reference/api-reference/endpoint/auth/onboardMerchant",
+ "decision-engine-api-reference/api-reference/endpoint/auth/createApiKey",
+ "decision-engine-api-reference/api-reference/endpoint/auth/listApiKeys",
+ "decision-engine-api-reference/api-reference/endpoint/auth/revokeApiKey"
+ ]
+ },
+ {
+ "group": "OpenAPI: Analytics",
+ "pages": [
+ "decision-engine-api-reference/api-reference/endpoint/analytics/analyticsOverview",
+ "decision-engine-api-reference/api-reference/endpoint/analytics/analyticsGatewayScores",
+ "decision-engine-api-reference/api-reference/endpoint/analytics/analyticsDecisions",
+ "decision-engine-api-reference/api-reference/endpoint/analytics/analyticsRoutingStats",
+ "decision-engine-api-reference/api-reference/endpoint/analytics/analyticsLogSummaries",
+ "decision-engine-api-reference/api-reference/endpoint/analytics/analyticsPaymentAudit",
+ "decision-engine-api-reference/api-reference/endpoint/analytics/analyticsPreviewTrace",
+ "decision-engine-api-reference/api-reference/endpoint/analytics/analyticsCostSavings",
+ "decision-engine-api-reference/api-reference/endpoint/analytics/analyticsRoutingEvents",
+ "decision-engine-api-reference/api-reference/endpoint/analytics/analyticsExperimentResults",
+ "decision-engine-api-reference/api-reference/endpoint/analytics/analyticsExperimentTransactions"
+ ]
+ },
+ {
+ "group": "OpenAPI: Compatibility And Config",
+ "pages": [
+ "decision-engine-api-reference/api-reference/endpoint/compatibility/legacyDecisionGateway",
+ "decision-engine-api-reference/api-reference/endpoint/compatibility/legacyUpdateScore",
+ "decision-engine-api-reference/api-reference/endpoint/compatibility/getRoutingConfig",
+ "decision-engine-api-reference/api-reference/endpoint/compatibility/configSrDimension",
+ "decision-engine-api-reference/api-reference/endpoint/compatibility/getSrDimensions"
+ ]
+ },
+ {
+ "group": "OpenAPI: Connector Costs & Ingestion",
"pages": [
+ "decision-engine-api-reference/api-reference/endpoint/connector-costs/listConnectorCredentials",
+ "decision-engine-api-reference/api-reference/endpoint/connector-costs/setConnectorCredentials",
+ "decision-engine-api-reference/api-reference/endpoint/connector-costs/deleteConnectorCredentials",
+ "decision-engine-api-reference/api-reference/endpoint/connector-costs/listConnectorFees",
+ "decision-engine-api-reference/api-reference/endpoint/connector-costs/setFeeOverride",
+ "decision-engine-api-reference/api-reference/endpoint/connector-costs/listCostClusters",
+ "decision-engine-api-reference/api-reference/endpoint/connector-costs/setClusterOverride",
+ "decision-engine-api-reference/api-reference/endpoint/connector-costs/getCostCoverage",
+ "decision-engine-api-reference/api-reference/endpoint/connector-costs/listCostIngestions",
+ "decision-engine-api-reference/api-reference/endpoint/connector-costs/deleteCostIngestion",
+ "decision-engine-api-reference/api-reference/endpoint/connector-costs/listCostPriceChanges",
+ "decision-engine-api-reference/api-reference/endpoint/connector-costs/listInvoiceAddons",
+ "decision-engine-api-reference/api-reference/endpoint/connector-costs/deleteInvoiceAddon",
+ "decision-engine-api-reference/api-reference/endpoint/connector-costs/getInvoiceReconciliation"
+ ]
+ },
+ {
+ "group": "OpenAPI: Feature Flags & Autopilot",
+ "pages": [
+ "decision-engine-api-reference/api-reference/endpoint/features/getMerchantFeatures",
+ "decision-engine-api-reference/api-reference/endpoint/features/updateMerchantFeature",
+ "decision-engine-api-reference/api-reference/endpoint/features/resetGatewayScores"
+ ]
+ },
+ {
+ "group": "API Examples (curl flows)",
+ "pages": [
+ {
+ "group": "Health & Status",
+ "pages": [
+ "decision-engine-api-reference/api-reference/guides/health-status/health-check"
+ ]
+ },
+ {
+ "group": "Authentication & Onboarding",
+ "pages": [
+ "decision-engine-api-reference/api-reference/guides/auth-onboarding/auth-and-onboarding",
+ "decision-engine-api-reference/api-reference/guides/auth-onboarding/api-keys"
+ ]
+ },
+ {
+ "group": "Merchant Accounts",
+ "pages": [
+ "decision-engine-api-reference/api-reference/guides/merchant-accounts/merchant-account-create",
+ "decision-engine-api-reference/api-reference/guides/merchant-accounts/merchant-account-get",
+ "decision-engine-api-reference/api-reference/guides/merchant-accounts/merchant-account-delete",
+ "decision-engine-api-reference/api-reference/guides/merchant-accounts/merchant-debit-routing"
+ ]
+ },
+ {
+ "group": "Configure Routing",
+ "pages": [
+ "decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-create",
+ "decision-engine-api-reference/api-reference/guides/configure-routing/routing-single-connector-example",
+ "decision-engine-api-reference/api-reference/guides/configure-routing/routing-priority-example",
+ "decision-engine-api-reference/api-reference/guides/configure-routing/routing-volume-split-example",
+ "decision-engine-api-reference/api-reference/guides/configure-routing/routing-advanced-example",
+ "decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-activate",
+ "decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-deactivate",
+ "decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-update-delete",
+ "decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-list",
+ "decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-list-active",
+ "decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-evaluate",
+ "decision-engine-api-reference/api-reference/guides/configure-routing/routing-hybrid"
+ ]
+ },
+ {
+ "group": "Scoring Configuration",
+ "pages": [
+ "decision-engine-api-reference/api-reference/guides/scoring-config/success-rate-config-create",
+ "decision-engine-api-reference/api-reference/guides/scoring-config/success-rate-config-get",
+ "decision-engine-api-reference/api-reference/guides/scoring-config/success-rate-config-update",
+ "decision-engine-api-reference/api-reference/guides/scoring-config/success-rate-config-delete",
+ "decision-engine-api-reference/api-reference/guides/scoring-config/elimination-config-create",
+ "decision-engine-api-reference/api-reference/guides/scoring-config/elimination-config-get",
+ "decision-engine-api-reference/api-reference/guides/scoring-config/elimination-config-update",
+ "decision-engine-api-reference/api-reference/guides/scoring-config/elimination-config-delete",
+ "decision-engine-api-reference/api-reference/guides/scoring-config/config-endpoints"
+ ]
+ },
+ {
+ "group": "Cost Data Ingestion",
+ "pages": [
+ "decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-setup",
+ "decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-uploads",
+ "decision-engine-api-reference/api-reference/guides/cost-ingestion/cost-ingestion-fees"
+ ]
+ },
+ {
+ "group": "A/B Testing",
+ "pages": [
+ "decision-engine-api-reference/api-reference/guides/ab-testing/ab-testing-create",
+ "decision-engine-api-reference/api-reference/guides/ab-testing/ab-testing-results"
+ ]
+ },
+ {
+ "group": "Autopilot & Feature Flags",
+ "pages": [
+ "decision-engine-api-reference/api-reference/guides/autopilot/merchant-features"
+ ]
+ },
{
- "group": "Success Rate",
+ "group": "Run Transactions",
"pages": [
- "intelligent-router-api-reference/success-rate/fetch-success-rate-for-an-entity",
- "intelligent-router-api-reference/success-rate/update-success-rate-window",
- "intelligent-router-api-reference/success-rate/invalidate-windows",
- "intelligent-router-api-reference/success-rate/fetch-entity-and-global-success-rates"
+ "decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-sr-based",
+ "decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-pl-based",
+ "decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-debit-routing",
+ "decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-hybrid-routing",
+ "decision-engine-api-reference/api-reference/guides/run-transactions/decide-gateway-multi-objective"
]
},
{
- "group": "Elimination",
+ "group": "Feedback & Scoring",
"pages": [
- "intelligent-router-api-reference/elimination/fetch-eliminated-processor-list",
- "intelligent-router-api-reference/elimination/update-elimination-bucket",
- "intelligent-router-api-reference/elimination/invalidate-elimination-bucket"
+ "decision-engine-api-reference/api-reference/guides/feedback-scoring/update-gateway-score"
]
},
{
- "group": "Contract Routing",
+ "group": "Analytics & Audit",
"pages": [
- "intelligent-router-api-reference/contract-routing/fetch-contract-scores-for-an-entity",
- "intelligent-router-api-reference/contract-routing/update-contract-information-for-an-entity",
- "intelligent-router-api-reference/contract-routing/invalidate-contract-information-for-an-entity"
+ "decision-engine-api-reference/api-reference/guides/analytics-audit/analytics-endpoints"
]
},
{
- "group": "Static Routing",
+ "group": "Legacy & Compatibility",
"pages": [
- "intelligent-router-api-reference/static-routing/create-a-routing-rule",
- "intelligent-router-api-reference/static-routing/evaluate-routing-rule"
+ "decision-engine-api-reference/api-reference/guides/legacy/decision-gateway-legacy",
+ "decision-engine-api-reference/api-reference/guides/legacy/update-score-legacy"
]
}
]
@@ -616,7 +822,8 @@
"openapi": [
"v1/openapi_spec_v1.json",
"v2/openapi_spec_v2.json",
- "rust_locker_open_api_spec.yml"
+ "rust_locker_open_api_spec.yml",
+ "decision_engine_openapi-specs.json"
]
},
"background": {
diff --git a/api-reference/hyperswitch_intelligent_router_open_api_spec.yml b/api-reference/hyperswitch_intelligent_router_open_api_spec.yml
deleted file mode 100644
index c3c1d3458c..0000000000
--- a/api-reference/hyperswitch_intelligent_router_open_api_spec.yml
+++ /dev/null
@@ -1,1543 +0,0 @@
-openapi: 3.0.0
-info:
- title: Dynamic routing - OpenAPI 3.0
- description: This the the open API 3.0 specification for the dynamic routing.
- version: 1.0.0
-paths:
- /success_rate.SuccessRateCalculator/FetchSuccessRate:
- post:
- summary: Fetch success rate for an entity
- operationId: fetchSuccessRate
- description: Calculates success rate for an entity based on provided parameters and labels
- tags:
- - Success Rate
- parameters:
- - name: x-tenant-id
- in: header
- required: true
- schema:
- type: string
- example: public
- - name: x-profile-id
- in: header
- required: true
- schema:
- type: string
- example: pro_WX0giXQnzk2wQJjkKVBX
- - name: x-api-key
- in: header
- required: true
- schema:
- type: string
- example: dev_VLzQTxkPq3ALj2mlfiHL4mMtXca4uplOIOLaKEzmWAmNBXZjwsuv5bCLjnf0QYHm
- requestBody:
- required: true
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/CalSuccessRateRequest"
- example:
- id: "merchant1"
- params: "card"
- labels: ["stripe", "adyen"]
- config:
- min_aggregates_size: 5
- default_success_rate: 0.95
- specificity_level: ENTITY
- exploration_percent: 20.0
- shuffle_on_tie_during_exploitation: true
- responses:
- "200":
- description: Success rate calculated successfully
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/CalSuccessRateResponse"
- "400":
- description: Invalid request parameters
- "500":
- description: Internal server error
-
- /success_rate.SuccessRateCalculator/UpdateSuccessRateWindow:
- post:
- summary: Update success rate window
- operationId: updateSuccessRateWindow
- description: Updates the success rate calculation window with new data points
- tags:
- - Success Rate
- parameters:
- - name: x-tenant-id
- in: header
- required: true
- schema:
- type: string
- example: public
- - name: x-profile-id
- in: header
- required: true
- schema:
- type: string
- example: pro_WX0giXQnzk2wQJjkKVBX
- - name: x-api-key
- in: header
- required: true
- schema:
- type: string
- example: dev_VLzQTxkPq3ALj2mlfiHL4mMtXca4uplOIOLaKEzmWAmNBXZjwsuv5bCLjnf0QYHm
- requestBody:
- required: true
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/UpdateSuccessRateWindowRequest"
- example:
- id: "merchant1"
- params: "card"
- labels_with_status:
- - status: false
- label: stripe
- - status: true
- label: adyen
- global_labels_with_status:
- - status: false
- label: stripe
- - status: true
- label: adyen
- responses:
- "200":
- description: Window updated successfully
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/UpdateSuccessRateWindowResponse"
- "400":
- description: Invalid request parameters
- "500":
- description: Internal server error
-
- /success_rate.SuccessRateCalculator/InvalidateWindows:
- post:
- summary: Invalidate windows
- operationId: invalidateWindows
- description: Invalidates the success rate calculation windows for a specific ID
- tags:
- - Success Rate
- parameters:
- - name: x-tenant-id
- in: header
- required: true
- schema:
- type: string
- example: public
- - name: x-profile-id
- in: header
- required: true
- schema:
- type: string
- example: pro_WX0giXQnzk2wQJjkKVBX
- - name: x-api-key
- in: header
- required: true
- schema:
- type: string
- example: dev_VLzQTxkPq3ALj2mlfiHL4mMtXca4uplOIOLaKEzmWAmNBXZjwsuv5bCLjnf0QYHm
- requestBody:
- required: true
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/InvalidateWindowsRequest"
- responses:
- "200":
- description: Windows invalidated successfully
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/InvalidateWindowsResponse"
- "400":
- description: Invalid request parameters
- "500":
- description: Internal server error
-
- /success_rate.SuccessRateCalculator/FetchEntityAndGlobalSuccessRate:
- post:
- summary: Fetch entity and global success rates
- operationId: fetchEntityAndGlobalSuccessRate
- description: Calculates success rates for both entity-specific and global metrics
- tags:
- - Success Rate
- parameters:
- - name: x-tenant-id
- in: header
- required: true
- schema:
- type: string
- example: public
- - name: x-profile-id
- in: header
- required: true
- schema:
- type: string
- example: pro_WX0giXQnzk2wQJjkKVBX
- - name: x-api-key
- in: header
- required: true
- schema:
- type: string
- example: dev_VLzQTxkPq3ALj2mlfiHL4mMtXca4uplOIOLaKEzmWAmNBXZjwsuv5bCLjnf0QYHm
- requestBody:
- required: true
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/CalGlobalSuccessRateRequest"
- responses:
- "200":
- description: Success rates calculated successfully
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/CalGlobalSuccessRateResponse"
- "400":
- description: Invalid request parameters
- "500":
- description: Internal server error
-
- /elimination.EliminationAnalyser/GetEliminationStatus:
- post:
- summary: Fetch eliminated processor list
- operationId: GetEliminationStatus
- description: Determines which processors should be eliminated from routing consideration based on historical performance data.
- tags:
- - Elimination
- parameters:
- - name: x-tenant-id
- in: header
- required: true
- schema:
- type: string
- example: public
- - name: x-profile-id
- in: header
- required: true
- schema:
- type: string
- example: pro_WX0giXQnzk2wQJjkKVBX
- - name: x-api-key
- in: header
- required: true
- schema:
- type: string
- example: dev_VLzQTxkPq3ALj2mlfiHL4mMtXca4uplOIOLaKEzmWAmNBXZjwsuv5bCLjnf0QYHm
- requestBody:
- required: true
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/EliminationRequest"
- example:
- id: "merchant1"
- params: "card"
- labels: ["stripe", "adyen"]
- config:
- bucket_size: 5
- bucket_leak_interval_in_secs: 10
- responses:
- "200":
- description: Returns a eliminated processor list
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/EliminationResponse"
- "400":
- description: Invalid request parameters
- "500":
- description: Internal server error
-
- /elimination.EliminationAnalyser/UpdateEliminationBucket:
- post:
- summary: Update elimination bucket
- operationId: UpdateEliminationBucket
- description: Updates the failure records for specific processors, affecting future elimination decisions.
- tags:
- - Elimination
- parameters:
- - name: x-tenant-id
- in: header
- required: true
- schema:
- type: string
- example: public
- - name: x-profile-id
- in: header
- required: true
- schema:
- type: string
- example: pro_WX0giXQnzk2wQJjkKVBX
- - name: x-api-key
- in: header
- required: true
- schema:
- type: string
- example: dev_VLzQTxkPq3ALj2mlfiHL4mMtXca4uplOIOLaKEzmWAmNBXZjwsuv5bCLjnf0QYHm
- requestBody:
- required: true
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/UpdateEliminationBucketRequest"
- example:
- id: "merchant1"
- params: "card"
- labels_with_bucket_name:
- [{ "label": "stripe", "bucket_name": "bucket1" }]
- config:
- bucket_size: 5
- bucket_leak_interval_in_secs: 10
- responses:
- "200":
- description: Bucket updated successfully
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/UpdateEliminationBucketResponse"
- "400":
- description: Invalid request parameters
- "500":
- description: Internal server error
-
- /elimination.EliminationAnalyser/InvalidateBucket:
- post:
- summary: Invalidate elimination bucket
- operationId: InvalidateBucket
- description: Invalidates all elimination bucket data for a specific entity, effectively resetting its processor elimination history.
- tags:
- - Elimination
- parameters:
- - name: x-tenant-id
- in: header
- required: true
- schema:
- type: string
- example: public
- - name: x-profile-id
- in: header
- required: true
- schema:
- type: string
- example: pro_WX0giXQnzk2wQJjkKVBX
- - name: x-api-key
- in: header
- required: true
- schema:
- type: string
- example: dev_VLzQTxkPq3ALj2mlfiHL4mMtXca4uplOIOLaKEzmWAmNBXZjwsuv5bCLjnf0QYHm
- requestBody:
- required: true
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/InvalidateBucketRequest"
- responses:
- "200":
- description: Buckets invalidated successfully
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/InvalidateBucketResponse"
- "400":
- description: Invalid request parameters
- "500":
- description: Internal server error
-
- /contract_routing.ContractScoreCalculator/FetchContractScore:
- post:
- summary: Fetch contract scores for an entity
- operationId: fetchContractScore
- description: Calculates contract scores for an entity based on provided parameters and labels
- tags:
- - Contract Routing
- parameters:
- - name: x-tenant-id
- in: header
- required: true
- schema:
- type: string
- example: public
- - name: x-profile-id
- in: header
- required: true
- schema:
- type: string
- example: pro_WX0giXQnzk2wQJjkKVBX
- - name: x-api-key
- in: header
- required: true
- schema:
- type: string
- example: dev_VLzQTxkPq3ALj2mlfiHL4mMtXca4uplOIOLaKEzmWAmNBXZjwsuv5bCLjnf0QYHm
- requestBody:
- required: true
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/CalContractScoreRequest"
- example:
- id: "merchant1"
- params: "card"
- labels: ["stripe", "adyen"]
- config:
- constants: [0.7, 0.3]
- time_scale:
- time_scale: "Day"
- responses:
- "200":
- description: Success rate calculated successfully
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/CalContractScoreResponse"
- "400":
- description: Invalid request parameters
- "500":
- description: Internal server error
-
- /contract_routing.ContractScoreCalculator/UpdateContract:
- post:
- summary: Update contract information for an entity
- operationId: updateContract
- description: Updates the contract information for processors based on provided parameters
- tags:
- - Contract Routing
- parameters:
- - name: x-tenant-id
- in: header
- required: true
- schema:
- type: string
- example: public
- - name: x-profile-id
- in: header
- required: true
- schema:
- type: string
- example: pro_WX0giXQnzk2wQJjkKVBX
- - name: x-api-key
- in: header
- required: true
- schema:
- type: string
- example: dev_VLzQTxkPq3ALj2mlfiHL4mMtXca4uplOIOLaKEzmWAmNBXZjwsuv5bCLjnf0QYHm
- requestBody:
- required: true
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/UpdateContractRequest"
- example:
- id: "merchant1"
- params: "update"
- labels_information:
- - label: "stripe"
- target_count: 1000
- target_time: 86400
- current_count: 500
- - label: "adyen"
- target_count: 1500
- target_time: 86400
- current_count: 750
- responses:
- "200":
- description: Contract update succeeded
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/UpdateContractResponse"
- "400":
- description: Invalid request parameters
- "500":
- description: Internal server error
-
- /contract_routing.ContractScoreCalculator/InvalidateContract:
- post:
- summary: Invalidate contract information for an entity
- operationId: invalidateContract
- description: Invalidates the contract for a given entity identifier
- tags:
- - Contract Routing
- parameters:
- - name: x-tenant-id
- in: header
- required: true
- schema:
- type: string
- example: public
- - name: x-profile-id
- in: header
- required: true
- schema:
- type: string
- example: pro_WX0giXQnzk2wQJjkKVBX
- - name: x-api-key
- in: header
- required: true
- schema:
- type: string
- example: dev_VLzQTxkPq3ALj2mlfiHL4mMtXca4uplOIOLaKEzmWAmNBXZjwsuv5bCLjnf0QYHm
- requestBody:
- required: true
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/InvalidateContractRequest"
- example:
- id: "merchant1"
- responses:
- "200":
- description: Contract invalidation succeeded
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/InvalidateContractResponse"
- "400":
- description: Invalid request parameters
- "500":
- description: Internal server error
-
- /euclid.EuclidService/Create:
- post:
- operationId: CreateRule
- summary: Create a routing Rule
- description: Creates a routing rule with the given parameters
- tags:
- - Static Routing
- parameters:
- - name: x-tenant-id
- in: header
- required: true
- schema:
- type: string
- example: public
- - name: x-profile-id
- in: header
- required: true
- schema:
- type: string
- example: pro_WX0giXQnzk2wQJjkKVBX
- - name: x-api-key
- in: header
- required: true
- schema:
- type: string
- example: dev_VLzQTxkPq3ALj2mlfiHL4mMtXca4uplOIOLaKEzmWAmNBXZjwsuv5bCLjnf0QYHm
- requestBody:
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/RoutingRule"
- example:
- 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: {}
- responses:
- "200":
- description: Successful creation
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/CreateResponse"
- example:
- algorithm_id: "routing_ec1ac351-7944-440f-bdc7-6a500df1116f"
- name: "Test Routing Rule"
- created_at: "2025-04-09 8:03:44.85588"
- modified_at: "2025-04-09 8:03:44.85588"
- "400":
- description: Invalid request parameters
- "500":
- description: Internal server error
-
- /euclid.EuclidService/Evaluate:
- post:
- operationId: EvaluateRule
- summary: Evaluate an existing routing Rule
- description: Evaluates a given routing rule
- tags:
- - Static Routing
- parameters:
- - name: x-tenant-id
- in: header
- required: true
- schema:
- type: string
- example: public
- - name: x-profile-id
- in: header
- required: true
- schema:
- type: string
- example: pro_WX0giXQnzk2wQJjkKVBX
- - name: x-api-key
- in: header
- required: true
- schema:
- type: string
- example: dev_VLzQTxkPq3ALj2mlfiHL4mMtXca4uplOIOLaKEzmWAmNBXZjwsuv5bCLjnf0QYHm
- requestBody:
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/EvaluateRequest"
- example:
- algorithm_id: "routing_ec1ac351-7944-440f-bdc7-6a500df1116f"
- parameters:
- payment_method:
- type: enum_variant
- value: "card"
- amount:
- type: number
- value: 2000
- responses:
- "200":
- description: Evaluation result
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/EvaluateResponse"
- example:
- status: "success"
- output:
- priority:
- connectors: ["stripe", "adyen"]
- evaluated_output:
- - "stripe"
- eligible_connectors: []
- "400":
- description: Invalid request parameters
- "500":
- description: Internal server error
-
-components:
- schemas:
- LabelWithScoreList:
- type: object
- properties:
- score:
- type: number
- format: double
- example: 100.0
- description: Calculated success rate score
- label:
- type: string
- example: stripe
- description: Label identifier
- required:
- - score
- - label
-
- LabelWithScore:
- type: array
- items:
- $ref: "#/components/schemas/LabelWithScoreList"
- example:
- - score: 100.0
- label: stripe
- - score: 98.5
- label: adyen
-
- LabelWithStatusList:
- type: object
- properties:
- status:
- type: number
- format: boolean
- example: true
- description: Label status
- label:
- type: string
- example: stripe
- description: Label identifier
- required:
- - status
- - label
-
- LabelWithStatus:
- type: array
- items:
- $ref: "#/components/schemas/LabelWithStatusList"
- example:
- - status: false
- label: stripe
- - status: true
- label: adyen
-
- EliminationLabelWithStatus:
- type: object
- properties:
- label:
- type: string
- example: stripe
- elimination_information:
- items:
- $ref: "#/components/schemas/EliminationInformation"
-
- CalSuccessRateRequest:
- type: object
- properties:
- id:
- type: string
- example: merchant1
- description: Entity identifier
- params:
- type: string
- example: card
- description: Parameters on which success rate scores has to be maintained
- labels:
- type: array
- example: ["stripe", "adyen"]
- items:
- type: string
- description: Labels for which to calculate success rates
- config:
- $ref: "#/components/schemas/CalSuccessRateConfig"
- required:
- - id
- - params
- - labels
-
- CalSuccessRateConfig:
- type: object
- required:
- - min_aggregates_size
- - default_success_rate
- properties:
- min_aggregates_size:
- type: integer
- format: uint32
- example: 10
- default_success_rate:
- type: number
- format: double
- example: 0.95
- specificity_level:
- $ref: "#/components/schemas/SuccessRateSpecificityLevel"
-
- SuccessRateSpecificityLevel:
- type: string
- description: >
- Defines the specificity level to be used for calculating the success rate.
- enum:
- - ENTITY
- - GLOBAL
- example: ENTITY
-
- CalSuccessRateResponse:
- type: object
- properties:
- labels_with_score:
- type: array
- items:
- $ref: "#/components/schemas/LabelWithScore"
- description: List of labels with their calculated success rates
- routing_approach:
- $ref: "#/components/schemas/RoutingApproach"
-
- RoutingApproach:
- type: string
- description: >
- Defines the routing approach based on the success rate calculation.
- enum:
- - EXPLORATION
- - EXPLOITATION
- example: EXPLOITATION
-
- UpdateSuccessRateWindowRequest:
- type: object
- properties:
- id:
- type: string
- example: merchant1
- description: Entity identifier
- params:
- type: string
- example: card
- description: Additional parameters for window update
- labels_with_status:
- type: array
- items:
- $ref: "#/components/schemas/LabelWithStatus"
- description: Entity-specific labels with their success/failure status
- example:
- - status: false
- label: stripe
- - status: true
- label: adyen
- global_labels_with_status:
- type: array
- items:
- $ref: "#/components/schemas/LabelWithStatus"
- description: Global labels with their success/failure status
- example:
- - status: false
- label: stripe
- - status: true
- label: adyen
- required:
- - id
- - params
- - labels_with_status
-
- UpdateSuccessRateWindowResponse:
- type: object
- properties:
- status:
- type: string
- enum: [WINDOW_UPDATION_SUCCEEDED, WINDOW_UPDATION_FAILED]
- description: Status of the window update operation
- required:
- - status
-
- InvalidateWindowsRequest:
- type: object
- properties:
- id:
- type: string
- example: merchant1
- description: Entity identifier for which to invalidate windows
- required:
- - id
-
- InvalidateWindowsResponse:
- type: object
- properties:
- status:
- type: string
- enum: [WINDOW_INVALIDATION_SUCCEEDED, WINDOW_INVALIDATION_FAILED]
- description: Status of the window invalidation operation
- required:
- - status
-
- CalGlobalSuccessRateRequest:
- type: object
- example:
- entity_id: "merchant1"
- entity_params: "card"
- entity_labels: ["stripe", "adyen"]
- global_labels: ["visa", "mastercard"]
- config:
- entity_min_aggregates_size: 10
- entity_default_success_rate: 0.85
- properties:
- entity_id:
- type: string
- example: "merchant1"
- entity_params:
- type: string
- example: "card"
- entity_labels:
- type: array
- items:
- type: string
- example: ["stripe", "adyen"]
- global_labels:
- type: array
- items:
- type: string
- example: ["visa", "mastercard"]
- config:
- $ref: "#/components/schemas/CalGlobalSuccessRateConfig"
-
- CalGlobalSuccessRateConfig:
- type: object
- example:
- entity_min_aggregates_size: 10
- entity_default_success_rate: 0.85
- properties:
- entity_min_aggregates_size:
- type: integer
- format: uint32
- example: 10
- entity_default_success_rate:
- type: number
- format: double
- example: 0.85
-
- CalGlobalSuccessRateResponse:
- type: object
- properties:
- entity_scores_with_labels:
- type: array
- items:
- $ref: "#/components/schemas/LabelWithScore"
- description: Entity-specific labels with their calculated success rates
- global_scores_with_labels:
- type: array
- items:
- $ref: "#/components/schemas/LabelWithScore"
- description: Global labels with their calculated success rates
-
- EliminationRequest:
- type: object
- properties:
- id:
- type: string
- example: merchant1
- description: Entity identifier
- params:
- type: string
- example: card
- description: Additional parameters for elimination analysis
- labels:
- type: array
- example: ["stripe", "adyen"]
- items:
- type: string
- description: Labels (processors) to check for elimination
- config:
- $ref: "#/components/schemas/EliminationBucketConfig"
- required:
- - id
- - labels
- - config
-
- EliminationBucketConfig:
- type: object
- properties:
- bucket_size:
- type: integer
- format: uint64
- example: 5
- description: Maximum failures allowed before elimination
- bucket_leak_interval_in_secs:
- type: number
- format: uint64
- example: 300
- description: Time interval after which failures are "forgotten"
- required:
- - bucket_size
- - bucket_leak_interval_in_secs
-
- EliminationResponse:
- type: object
- properties:
- labels_with_status:
- type: array
- items:
- $ref: "#/components/schemas/EliminationLabelWithStatus"
- description: Elimination status for each label
- example:
- labelsWithStatus:
- - label: "stripe"
- eliminationInformation:
- entity:
- isEliminated: true
- bucketName:
- - "processor_decline"
- global:
- isEliminated: true
- bucketName:
- - "processor_decline"
-
- EliminationInformation:
- type: object
- properties:
- entity:
- $ref: "#/components/schemas/BucketInformation"
- global:
- $ref: "#/components/schemas/BucketInformation"
-
- BucketInformation:
- type: object
- properties:
- is_eliminated:
- type: boolean
- example: true
- description: Whether the processor should be eliminated
- bucket_name:
- type: array
- items:
- type: string
- description: Bucket identifiers that triggered elimination
-
- UpdateEliminationBucketRequest:
- type: object
- properties:
- id:
- type: string
- description: "Entity identifier"
- example: merchant1
- params:
- type: string
- description: "Additional parameters"
- example: card
- labels_with_bucket_name:
- type: array
- items:
- $ref: "#/components/schemas/LabelWithBucketName"
- example: [{ "label": "stripe", "bucket_name": "processor_decline" }]
- config:
- $ref: "#/components/schemas/EliminationBucketConfig"
- required:
- - id
- - labels_with_bucket_name
- - config
-
- LabelWithBucketName:
- type: object
- properties:
- label:
- type: string
- description: "Processor identifier"
- bucket_name:
- type: string
- description: "Bucket to update (failure type)"
- required:
- - label
- - bucket_name
-
- UpdateEliminationBucketResponse:
- type: object
- properties:
- status:
- type: string
- description: "Status of the update operation"
- enum:
- - BUCKET_UPDATION_SUCCEEDED
- - BUCKET_UPDATION_FAILED
- required:
- - status
-
- InvalidateBucketRequest:
- type: object
- properties:
- id:
- type: string
- example: merchant1
- description: "Entity identifier to invalidate the bucket"
- required:
- - id
-
- InvalidateBucketResponse:
- type: object
- properties:
- status:
- type: string
- description: "Status of the invalidate operation"
- enum:
- - BUCKET_INVALIDATION_SUCCEEDED
- - BUCKET_INVALIDATION_FAILED
- required:
- - status
-
- CalContractScoreRequest:
- type: object
- properties:
- id:
- type: string
- description: Entity identifier
- example: merchant1
- params:
- type: string
- description: Additional parameters for contract calculation
- example: card
- labels:
- type: array
- items:
- type: string
- description: Labels (processors) to calculate scores for
- example: ["stripe", "adyen"]
- config:
- $ref: "#/components/schemas/CalContractScoreConfig"
- description: Configuration for calculation
- required:
- - id
- - labels
- - config
-
- CalContractScoreConfig:
- type: object
- properties:
- constants:
- type: array
- items:
- type: number
- format: double
- description: Constants used in score calculation algorithm
- example: [0.7, 0.3]
- time_scale:
- $ref: "#/components/schemas/TimeScale"
- description: Time scale for contract calculation
- required:
- - constants
- - time_scale
-
- TimeScale:
- type: object
- properties:
- time_scale:
- type: string
- enum:
- - Day
- - Month
- description: Selected time scale for contract calculation
-
- CalContractScoreResponse:
- type: object
- properties:
- labels_with_score:
- type: array
- items:
- $ref: "#/components/schemas/ScoreData"
- description: Contract scores for each label
-
- ScoreData:
- type: object
- properties:
- score:
- type: number
- format: double
- description: Contract score (higher values indicate higher priority)
- example: 0.95
- label:
- type: string
- description: Label (processor) identifier
- example: stripe
- current_count:
- type: integer
- format: uint64
- description: Current transaction count for this processor
- example: 500
- required:
- - score
- - label
- - current_count
-
- UpdateContractRequest:
- type: object
- properties:
- id:
- type: string
- description: Entity identifier
- example: merchant1
- params:
- type: string
- description: Additional parameters
- example: card
- labels_information:
- type: array
- items:
- $ref: "#/components/schemas/LabelInformation"
- description: Contract information for processors
- example:
- - label: stripe
- target_count: 1000
- target_time: 86400
- current_count: 500
- - label: adyen
- target_count: 1500
- target_time: 86400
- current_count: 750
- required:
- - id
- - labels_information
-
- LabelInformation:
- type: object
- properties:
- label:
- type: string
- description: Processor identifier
- example: stripe
- target_count:
- type: integer
- format: uint64
- description: Target transaction count in contract
- example: 10000
- target_time:
- type: integer
- format: uint64
- description: Time period for the target (in seconds)
- example: 1744803903
- current_count:
- type: integer
- format: uint64
- description: Current transaction count
- example: 500
- required:
- - label
- - target_count
- - target_time
- - current_count
-
- UpdateContractResponse:
- type: object
- properties:
- status:
- type: string
- enum:
- - CONTRACT_UPDATION_SUCCEEDED
- - CONTRACT_UPDATION_FAILED
- description: Status of the update operation
- required:
- - status
-
- InvalidateContractRequest:
- type: object
- properties:
- id:
- type: string
- description: Entity identifier to invalidate
- example: merchant1
- required:
- - id
-
- InvalidateContractResponse:
- type: object
- properties:
- status:
- type: string
- enum:
- - CONTRACT_INVALIDATION_SUCCEEDED
- - CONTRACT_INVALIDATION_FAILED
- description: Status of the invalidation operation
- required:
- - status
-
- RoutingRule:
- type: object
- example:
- 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: {}
- properties:
- name:
- type: string
- example: Test Routing Rule
- algorithm:
- $ref: "#/components/schemas/Program"
-
- CreateResponse:
- type: object
- properties:
- algorithm_id:
- type: string
- description: Algorithm Id for the routing rule
- example: routing_ec1ac351-7944-440f-bdc7-6a500df1116f
- name:
- type: string
- description: name of the routing rule
- example: test routing rule
- created_at:
- type: string
- description: Timestamp for creation of routing rule
- example: "2025-04-09 8:03:44.85588"
- modified_at:
- type: string
- description: Timestamp for modification of routing rule
- example: "2025-04-09 8:03:44.85588"
-
- EvaluateRequest:
- type: object
- example:
- algorithm_id: routing_ec1ac351-7944-440f-bdc7-6a500df1116f
- parameters:
- payment_method:
- type: enum_variant
- value: "card"
- amount:
- type: number
- value: 1500
- properties:
- algorithm_id:
- type: string
- example: routing_ec1ac351-7944-440f-bdc7-6a500df1116f
- parameters:
- type: object
- example:
- payment_method:
- type: enum_variant
- value: "card"
- amount:
- type: number
- value: 1500
- additionalProperties:
- $ref: "#/components/schemas/ValueType"
-
- EvaluateResponse:
- type: object
- example:
- status: "success"
- output:
- priority:
- connectors: ["stripe", "adyen"]
- evaluated_output: ["stripe", "adyen"]
- eligible_connectors: ["stripe", "adyen", "checkout"]
- properties:
- status:
- type: string
- output:
- $ref: "#/components/schemas/Output"
- evaluated_output:
- type: array
- items:
- type: string
- eligible_connectors:
- type: array
- items:
- type: string
-
- Program:
- type: object
- example:
- globals: {}
- default_selection:
- priority:
- connectors: ["stripe", "checkout"]
- rules:
- - name: High Amount Card
- routing_type: priority
- output:
- priority:
- connectors: ["adyen"]
- statements:
- - condition:
- - lhs: "payment_method"
- comparison: equal
- value: "card"
- metadata: {}
- - lhs: "amount"
- comparison: greater_than
- value: 1000
- metadata: {}
- metadata: {}
- properties:
- globals:
- type: object
- additionalProperties:
- $ref: "#/components/schemas/ValueTypeList"
- default_selection:
- $ref: "#/components/schemas/Output"
- rules:
- type: array
- items:
- $ref: "#/components/schemas/Rule"
- metadata:
- type: object
- additionalProperties:
- $ref: "#/components/schemas/MetadataValue"
-
- Rule:
- type: object
- example:
- name: High Volume Transactions
- routing_type: priority
- output:
- priority:
- connectors: ["stripe", "adyen"]
- statements:
- - condition:
- - lhs: amount
- comparison: greater_than
- value: 5000
- metadata: {}
- properties:
- name:
- type: string
- routing_type:
- $ref: "#/components/schemas/RoutingType"
- output:
- $ref: "#/components/schemas/Output"
- statements:
- type: array
- items:
- $ref: "#/components/schemas/IfStatement"
-
- RoutingType:
- type: string
- enum: [priority, volume_split, volume_split_priority]
-
- Output:
- type: object
- oneOf:
- - $ref: "#/components/schemas/PriorityOutput"
- - $ref: "#/components/schemas/VolumeSplitOutput"
- - $ref: "#/components/schemas/VolumeSplitPriorityOutput"
-
- PriorityOutput:
- type: object
- example:
- connectors: ["stripe", "adyen"]
- properties:
- connectors:
- type: array
- items:
- type: string
-
- VolumeSplitOutput:
- type: object
- properties:
- connectors:
- type: array
- items:
- $ref: "#/components/schemas/VolumeSplit"
-
- VolumeSplitPriorityOutput:
- type: object
- example:
- groups:
- - split: 60
- output: ["stripe", "adyen"]
- - split: 40
- output: ["checkout"]
- properties:
- groups:
- type: array
- items:
- $ref: "#/components/schemas/VolumeSplitGroup"
-
- VolumeSplit:
- type: object
- example:
- split: 70
- output: "stripe"
- properties:
- split:
- type: integer
- output:
- type: string
-
- VolumeSplitGroup:
- type: object
- example:
- split: 50
- output: ["adyen", "checkout"]
- properties:
- split:
- type: integer
- output:
- type: array
- items:
- type: string
-
- IfStatement:
- type: object
- example:
- condition:
- - lhs: "currency"
- comparison: equal
- value: "USD"
- metadata: {}
- nested:
- - condition:
- - lhs: "amount"
- comparison: greater_than
- value: 1000
- metadata: {}
- properties:
- condition:
- type: array
- items:
- $ref: "#/components/schemas/Comparison"
- nested:
- type: array
- items:
- $ref: "#/components/schemas/IfStatement"
-
- Comparison:
- type: object
- example:
- lhs: "payment_method"
- comparison: equal
- value: "card"
- metadata: {}
- properties:
- lhs:
- type: string
- comparison:
- $ref: "#/components/schemas/ComparisonType"
- value:
- $ref: "#/components/schemas/ValueType"
- metadata:
- type: object
- additionalProperties:
- $ref: "#/components/schemas/MetadataValue"
-
- ComparisonType:
- type: string
- enum:
- [
- equal,
- not_equal,
- less_than,
- less_than_equal,
- greater_than,
- greater_than_equal,
- ]
-
- ValueTypeList:
- type: object
- example:
- values: ["card", "bank_transfer"]
- properties:
- values:
- type: array
- items:
- $ref: "#/components/schemas/ValueType"
-
- ValueType:
- type: object
- oneOf:
- - type: integer
- format: uint64
- - type: string
- - $ref: "#/components/schemas/MetadataValue"
-
- MetadataValue:
- type: object
- properties:
- key:
- type: string
- value:
- type: string
diff --git a/api-reference/intelligent-router-api-reference/contract-routing/fetch-contract-scores-for-an-entity.mdx b/api-reference/intelligent-router-api-reference/contract-routing/fetch-contract-scores-for-an-entity.mdx
deleted file mode 100644
index 2fcb03e7ce..0000000000
--- a/api-reference/intelligent-router-api-reference/contract-routing/fetch-contract-scores-for-an-entity.mdx
+++ /dev/null
@@ -1,3 +0,0 @@
----
-openapi: post /contract_routing.ContractScoreCalculator/FetchContractScore
----
\ No newline at end of file
diff --git a/api-reference/intelligent-router-api-reference/contract-routing/invalidate-contract-information-for-an-entity.mdx b/api-reference/intelligent-router-api-reference/contract-routing/invalidate-contract-information-for-an-entity.mdx
deleted file mode 100644
index a84626aacc..0000000000
--- a/api-reference/intelligent-router-api-reference/contract-routing/invalidate-contract-information-for-an-entity.mdx
+++ /dev/null
@@ -1,3 +0,0 @@
----
-openapi: post /contract_routing.ContractScoreCalculator/InvalidateContract
----
\ No newline at end of file
diff --git a/api-reference/intelligent-router-api-reference/contract-routing/update-contract-information-for-an-entity.mdx b/api-reference/intelligent-router-api-reference/contract-routing/update-contract-information-for-an-entity.mdx
deleted file mode 100644
index 12792226e7..0000000000
--- a/api-reference/intelligent-router-api-reference/contract-routing/update-contract-information-for-an-entity.mdx
+++ /dev/null
@@ -1,3 +0,0 @@
----
-openapi: post /contract_routing.ContractScoreCalculator/UpdateContract
----
\ No newline at end of file
diff --git a/api-reference/intelligent-router-api-reference/elimination/fetch-eliminated-processor-list.mdx b/api-reference/intelligent-router-api-reference/elimination/fetch-eliminated-processor-list.mdx
deleted file mode 100644
index a99b041479..0000000000
--- a/api-reference/intelligent-router-api-reference/elimination/fetch-eliminated-processor-list.mdx
+++ /dev/null
@@ -1,3 +0,0 @@
----
-openapi: post /elimination.EliminationAnalyser/GetEliminationStatus
----
\ No newline at end of file
diff --git a/api-reference/intelligent-router-api-reference/elimination/invalidate-elimination-bucket.mdx b/api-reference/intelligent-router-api-reference/elimination/invalidate-elimination-bucket.mdx
deleted file mode 100644
index 34edbb72e3..0000000000
--- a/api-reference/intelligent-router-api-reference/elimination/invalidate-elimination-bucket.mdx
+++ /dev/null
@@ -1,3 +0,0 @@
----
-openapi: post /elimination.EliminationAnalyser/InvalidateBucket
----
\ No newline at end of file
diff --git a/api-reference/intelligent-router-api-reference/elimination/update-elimination-bucket.mdx b/api-reference/intelligent-router-api-reference/elimination/update-elimination-bucket.mdx
deleted file mode 100644
index 2cb8d09867..0000000000
--- a/api-reference/intelligent-router-api-reference/elimination/update-elimination-bucket.mdx
+++ /dev/null
@@ -1,3 +0,0 @@
----
-openapi: post /elimination.EliminationAnalyser/UpdateEliminationBucket
----
\ No newline at end of file
diff --git a/api-reference/intelligent-router-api-reference/overview.mdx b/api-reference/intelligent-router-api-reference/overview.mdx
deleted file mode 100644
index 316e6799b3..0000000000
--- a/api-reference/intelligent-router-api-reference/overview.mdx
+++ /dev/null
@@ -1,111 +0,0 @@
-# Dynamo - Dynamic Routing System
-
-## Overview
-
-Dynamo is an open-source dynamic routing system designed for payment processing. It intelligently routes payments to different processors based on real-time metrics, helping to optimize payment flows and increase transaction success rates.
-
-## Why Dynamo?
-
-- 💸 **Increase Payment Success**: Automatically route to the best-performing processors
-- 📊 **Data-Driven Decisions**: Make routing choices based on real performance metrics
-- 🌐 **Multi-tenant Support**: Isolate routing data between different merchants
-- ⚡ **High Performance**: Built with Rust for maximum efficiency and reliability
-- 🔄 **Multiple Routing Strategies**: Choose from success-rate, elimination, or contract-based routing
-
-## Documentation
-
-- [Integration Guide](https://github.com/juspay/hyperswitch-intelligent-router/blob/main/docs/integration-guide.md)
-- [Installation Guide](https://github.com/juspay/hyperswitch-intelligent-router/blob/main/docs/installation.md)
-- [Configuration Guide](https://github.com/juspay/hyperswitch-intelligent-router/blob/main/docs/configuration.md)
-- [API Reference](https://api-reference.hyperswitch.io/intelligent-router-api-reference/overview)
-- [Contributing Guidelines](https://github.com/juspay/hyperswitch-intelligent-router/blob/main/CONTRIBUTING.md)
-
-## Quick Start
-
-### Local Setup
-
-```bash
-# Clone the repository
-git clone https://github.com/yourusername/dynamo.git
-cd dynamo
-
-# Configure Redis
-# Make sure Redis is running on localhost:6379 or update the config file
-
-# Build the core service
-cargo build --release
-
-# Run with development configuration
-./target/release/dynamo
-```
-
-### Docker Setup
-
-```bash
-# Clone the repository
-git clone https://github.com/yourusername/dynamo.git
-cd dynamo
-
-# Build the Docker image
-docker build -t dynamo:latest .
-
-# Run with default configuration
-docker run -p 8000:8000 -p 9000:9000 dynamo:latest
-
-# Run with custom configuration
-docker run -p 8000:8000 -p 9000:9000 -v $(pwd)/config:/app/config dynamo:latest
-```
-
-## Usage Examples
-
-### Success Rate Based Routing
-
-```bash
-# Make a routing decision based on success rates
-grpcurl -d '{"id": "merchant1", "params": "card", "labels": ["stripe", "adyen"], "config": {"min_aggregates_size": 5, "default_success_rate": 100}}' \
- -plaintext localhost:8000 success_rate.SuccessRateCalculator/FetchSuccessRate
-```
-
-### Update Payment Results
-
-```bash
-# Update success rate data with payment results
-grpcurl -d '{"id": "merchant1", "params": "card", "labels_with_status": [{"label": "stripe", "status": true}], "config": {"max_aggregates_size": 10, "current_block_threshold": {"max_total_count": 5}}}' \
- -plaintext localhost:8000 success_rate.SuccessRateCalculator/UpdateSuccessRateWindow
-```
-
-For more examples, see our [Examples Documentation](docs/examples.md).
-
-## Project Structure
-
-Dynamo consists of two main components:
-
-- **dynamo**: Core routing service with GRPC/HTTP APIs
-- **procesmo**: WebAssembly module for data processing and visualization
-
-The project uses a workspace structure:
-
-```
-crates/
-├── dynamo/ # Main routing service
-└── procesmo/ # WebAssembly data processing module
-```
-
-## Contributing
-
-We welcome contributions from everyone! Here's how you can help:
-
-1. Fork the repository
-2. Create your feature branch: `git checkout -b feature/amazing-feature`
-3. Commit your changes: `git commit -m 'Add some amazing feature'`
-4. Push to your branch: `git push origin feature/amazing-feature`
-5. Open a Pull Request
-
-See [https://github.com/juspay/hyperswitch-intelligent-router/blob/main/CONTRIBUTING.md](https://github.com/juspay/hyperswitch-intelligent-router/blob/main/CONTRIBUTING.md) for detailed guidelines.
-
-## Community
-
-- Join our [Discord server](https://discord.gg/wJZ7DVW8mm) for discussions
-- Join our [Slack channel](https://join.slack.com/t/hyperswitch-io/shared_invite/zt-2jqxmpsbm-WXUENx022HjNEy~Ark7Orw)
-- Report issues on [GitHub Issues](https://github.com/juspay/hyperswitch-dynamo/issues)
-- Follow updates on [Twitter](https://twitter.com/juspay)
\ No newline at end of file
diff --git a/api-reference/intelligent-router-api-reference/static-routing/create-a-routing-rule.mdx b/api-reference/intelligent-router-api-reference/static-routing/create-a-routing-rule.mdx
deleted file mode 100644
index ac990940c8..0000000000
--- a/api-reference/intelligent-router-api-reference/static-routing/create-a-routing-rule.mdx
+++ /dev/null
@@ -1,3 +0,0 @@
----
-openapi: post /euclid.EuclidService/Create
----
\ No newline at end of file
diff --git a/api-reference/intelligent-router-api-reference/static-routing/evaluate-routing-rule.mdx b/api-reference/intelligent-router-api-reference/static-routing/evaluate-routing-rule.mdx
deleted file mode 100644
index 02f78919f2..0000000000
--- a/api-reference/intelligent-router-api-reference/static-routing/evaluate-routing-rule.mdx
+++ /dev/null
@@ -1,3 +0,0 @@
----
-openapi: post /euclid.EuclidService/Evaluate
----
\ No newline at end of file
diff --git a/api-reference/intelligent-router-api-reference/success-rate/fetch-entity-and-global-success-rates.mdx b/api-reference/intelligent-router-api-reference/success-rate/fetch-entity-and-global-success-rates.mdx
deleted file mode 100644
index 882b95e71c..0000000000
--- a/api-reference/intelligent-router-api-reference/success-rate/fetch-entity-and-global-success-rates.mdx
+++ /dev/null
@@ -1,3 +0,0 @@
----
-openapi: post /success_rate.SuccessRateCalculator/FetchEntityAndGlobalSuccessRate
----
\ No newline at end of file
diff --git a/api-reference/intelligent-router-api-reference/success-rate/fetch-success-rate-for-an-entity.mdx b/api-reference/intelligent-router-api-reference/success-rate/fetch-success-rate-for-an-entity.mdx
deleted file mode 100644
index ad6bebae3d..0000000000
--- a/api-reference/intelligent-router-api-reference/success-rate/fetch-success-rate-for-an-entity.mdx
+++ /dev/null
@@ -1,3 +0,0 @@
----
-openapi: post /success_rate.SuccessRateCalculator/FetchSuccessRate
----
\ No newline at end of file
diff --git a/api-reference/intelligent-router-api-reference/success-rate/invalidate-windows.mdx b/api-reference/intelligent-router-api-reference/success-rate/invalidate-windows.mdx
deleted file mode 100644
index 0fcc102625..0000000000
--- a/api-reference/intelligent-router-api-reference/success-rate/invalidate-windows.mdx
+++ /dev/null
@@ -1,3 +0,0 @@
----
-openapi: post /success_rate.SuccessRateCalculator/InvalidateWindows
----
\ No newline at end of file
diff --git a/api-reference/intelligent-router-api-reference/success-rate/update-success-rate-window.mdx b/api-reference/intelligent-router-api-reference/success-rate/update-success-rate-window.mdx
deleted file mode 100644
index 28206a88c2..0000000000
--- a/api-reference/intelligent-router-api-reference/success-rate/update-success-rate-window.mdx
+++ /dev/null
@@ -1,3 +0,0 @@
----
-openapi: post /success_rate.SuccessRateCalculator/UpdateSuccessRateWindow
----
\ No newline at end of file