Documentation

Routing Engine

High-performance orchestration engine for executing multi-stage workflows

Exceptionally FastMulti-stageReal-time Tracking

Introduction

The Corridorly Routing Engine (also known as the Orchestration Engine) is an exceptionally fast platform that executes complex, multi-stage workflows called Symphonies. It provides intelligent routing, decision-making, and real-time execution tracking.

Multi-stage

Execute sequences of steps with conditional logic

High Performance

Exceptionally fast rule evaluation and execution

Flexible

Connect to Lambda, HTTP APIs, EventBridge

Observable

Full tracking of every execution stage

Use Cases

Perfect for payment routing, compliance checks, risk assessment, quote generation, and any workflow requiring sequential decision-making with multiple integration points.


Core Concepts

Understanding the Routing Engine requires familiarity with a few key concepts that define how workflows are structured and executed.

Symphonies

A Symphony is a multi-stage workflow that orchestrates business logic across multiple steps. Each symphony defines:

  • Stages - Ordered sequence of execution steps
  • Recipes - Business logic to execute at each stage
  • Conditions - Optional criteria for stage execution
  • Requirements - Whether a stage is required or optional
Example Symphony Structure:
Symphony: "Payment Processing"
├─ Stage 1: Compliance Check (required)
│  └─ Recipe: KYC Verification
├─ Stage 2: Risk Assessment (required)
│  └─ Recipe: Fraud Detection
├─ Stage 3: Payment Routing (required)
│  └─ Recipe: Provider Selection
└─ Stage 4: Notification (optional)
   └─ Recipe: Customer Alert

Stages & Recipes

Stages are sequential execution steps within a symphony:

  • Execute in order (Stage 1, then Stage 2, etc.)
  • Reference a specific Recipe to execute
  • Can be marked as required (failure stops execution) or optional
  • Can have a run condition to skip based on context

Recipes are templates for business logic:

  • Define which solutions to execute
  • Specify rules and decision criteria
  • Reusable across multiple symphonies and stages
  • Support versioning for gradual rollouts

Context Flow

The Context is the data that flows through your symphony execution:

Initial Context:
{
  "amount": 1000,
  "currency": "USD",
  "customerId": "cust_123"
}
After Stage 1 (Compliance):
{
  "amount": 1000,
  "currency": "USD",
  "customerId": "cust_123",
  "stages": {
    "compliance": {
      "status": "approved",
      "riskLevel": "low"
    }
  }
}
After Stage 2 (Routing):
{
  "amount": 1000,
  "currency": "USD",
  "customerId": "cust_123",
  "stages": {
    "compliance": {
      "status": "approved",
      "riskLevel": "low"
    },
    "routing": {
      "provider": "stripe",
      "fee": 29
    }
  }
}

Getting Started

Authentication

All API requests require authentication via API key:

Header: X-Api-Key
Header: X-Tenant-Id
Obtain your API key from the Corridorly dashboard under Settings → API Keys

Quick Example

Execute a marketplace symphony with a simple request:

POST /symphony/execute/marketplace/:symphonyId
curl -X POST https://orchestrate.corridorly.com/symphony/execute/marketplace/symp_payment_flow \
  -H "X-Api-Key: your-api-key" \
  -H "X-Tenant-Id: your-tenant-id" \
  -H "Content-Type: application/json" \
  -d '{
    "context": {
      "amount": 1000,
      "currency": "USD",
      "paymentMethod": "card",
      "customerId": "cust_123"
    }
  }'

The response includes execution status, stage results, and final context:

Response
{
  "executionId": "exec_abc123",
  "symphonyId": "symp_payment_flow",
  "status": "success",
  "stages": [
    {
      "stageNumber": 1,
      "stageName": "compliance",
      "recipeId": "recipe_kyc",
      "status": "complete",
      "executionTimeMs": 245,
      "decisions": {
        "approved": true,
        "riskLevel": "low"
      }
    },
    {
      "stageNumber": 2,
      "stageName": "routing",
      "recipeId": "recipe_payment_routing",
      "status": "complete",
      "executionTimeMs": 156,
      "decisions": {
        "provider": "stripe",
        "fee": 29
      }
    }
  ],
  "context": {
    "amount": 1000,
    "currency": "USD",
    "stages": {
      "compliance": { "approved": true, "riskLevel": "low" },
      "routing": { "provider": "stripe", "fee": 29 }
    }
  },
  "totalExecutionMs": 401
}

Symphony Execution

Instance vs Marketplace

Symphonies can be executed from two sources:

Marketplace Symphonies

Pre-built symphonies created by Corridorly, available to all tenants.

POST /symphony/execute/marketplace/:symphonyId
  • Requires active subscription
  • Version management with auto-upgrade policies
  • Customizable via configuration overrides
Coming Soon

Instance Symphonies

Custom symphonies created by your organization for specific use cases.

POST /symphony/execute/instance/:symphonyId
  • Tenant-specific configuration
  • Full control over stages and recipes
  • Can reference marketplace recipes

Stage Execution

Stages execute sequentially with the following behaviour:

  1. 1

    Condition Evaluation

    If a stage has a run condition, it's evaluated against the current context. If false, the stage is skipped.

  2. 2

    Recipe Execution

    The stage's recipe is executed with the current context.

  3. 3

    Context Enrichment

    Decisions from the stage are added to context.stages.stageName.

  4. 4

    Error Handling

    If a required stage fails, execution stops. Optional stages continue even on failure.

Stage Status Values

completeStage executed successfully
failedStage encountered an error
skippedStage skipped due to run condition

Error Handling

The Routing Engine provides detailed error information:

Error Response Format
{
  "error": {
    "code": "STAGE_EXECUTION_ERROR",
    "message": "Required stage 'compliance' failed",
    "request_id": "req_abc123"
  },
  "executionId": "exec_xyz789",
  "symphonyId": "symp_payment",
  "status": "failed",
  "stages": [
    {
      "stageNumber": 1,
      "status": "failed",
      "error": {
        "code": "EXTERNAL_SERVICE_ERROR",
        "message": "KYC provider timeout"
      }
    }
  ]
}
Common Error Codes
SUBSCRIPTION_REQUIRED

No active subscription for the requested marketplace item

SYMPHONY_NOT_FOUND

Symphony ID does not exist

STAGE_EXECUTION_ERROR

A required stage failed during execution

CONFIG_ERROR

Configuration override or validation error


API Reference

The Routing Engine provides several endpoints for different orchestration patterns. For complete API documentation with interactive examples, see the API Reference documentation.

Symphony Endpoints

POST /symphony/execute/marketplace/:symphonyId

Execute a marketplace symphony. Supports optional version query parameter.

POST /symphony/execute/instance/:symphonyId

Execute your custom symphony. Supports optional version query parameter.

Generic Orchestration Endpoints

POST /orchestrate

Generic orchestration for payment, quote, or verification workflows.

POST /payment

Payment-specific orchestration endpoint.

POST /quote

Generate quotes for payments or transfers.


Configuration & Customization

Subscriptions

To use marketplace symphonies, recipes, or solutions, you need an active subscription. Subscriptions provide:

  • Version Control - Pin to specific versions or auto-upgrade
  • Auto-Upgrade Policies - Choose from: none, patch, minor, major
  • Configuration Overrides - Customize behaviour without forking

Note: Subscriptions are managed via the Corridorly dashboard under Marketplace. The API automatically selects the appropriate subscription based on your request.

Configuration Overrides

Customize marketplace items without creating copies. Override actions include:

replace

Replace an entire value

merge

Deep merge objects

append

Add item to end of array

prepend

Add item to start of array

insert

Insert at specific index

remove

Remove item from array


Monitoring & Observability

Every symphony execution is tracked and stored for 30 days with comprehensive telemetry:

Execution Metrics
  • Total execution time
  • Per-stage timing
  • Success/failure rates
  • Context size tracking
Execution Records
  • Full stage-by-stage results
  • Complete context history
  • Error details with codes
  • Correlation IDs for tracing

Execution Tracking

View execution details in the dashboard under Executions, or query programmatically using the execution ID from the API response.


Best Practices

When to Use Symphonies

  • Multi-step workflows - Sequential execution with context sharing
  • Conditional logic - Stages that skip based on previous results
  • Complex orchestration - Coordinating multiple systems or decisions
  • Reusable patterns - Standardising workflows across your organisation

Performance Optimization

  • Minimise context size - Only include necessary data in initial context
  • Use test mode - Test symphonies without affecting production systems
  • Monitor execution times - Review stage timings to identify bottlenecks
  • Cache when possible - Use subscriptions to avoid repeated lookups

Error Handling

  • Mark critical stages as required - Ensure execution stops on critical failures
  • Use optional stages for non-critical ops - Continue execution even if they fail
  • Implement client-side retry logic - Engine does not auto-retry failed executions
  • Monitor error patterns - Track error codes to identify systemic issues

Testing Strategies

  • Use test mode - Set testMode: true in metadata to test without side effects
  • Version pinning - Pin to specific versions during testing, auto-upgrade in production
  • Mock external actions - Use overrides to replace external calls during testing
  • Review execution history - Analyse historical executions to understand behaviour

Complete API Documentation

Explore the full API reference with detailed request/response schemas, authentication details, and code examples for all endpoints.

View API Reference