Canso - ML Platform
  • 👋Introduction
  • 🏛️Canso Architecture
  • 💻Getting Started
    • 🏁Overview
    • 🌌Provison K8s Clusters
    • 🚢Install Canso Helm Charts
    • 🐍🔗 Canso Python Client & Web App
    • 📊Health Metrics for Features in the Data Plane
  • 💡Feature Store
    • Data Sources
      • Data Spans
    • Data Sinks
    • ML Features
      • Raw ML Batch Feature
      • Derived ML Batch Feature
      • Raw ML Streaming Feature
      • Custom User Defined Function
  • 💡AI Agents
    • Introduction
    • Getting Started
    • Quickstart
    • Use Cases
      • Fraud Analyst Agent
      • Agent with Memory
      • Memory command examples
    • Concepts
      • Task Server
      • Broker
      • Checkpoint DB
      • Conversation History
      • Memory
    • How Tos
      • Update the AI Agent
      • Delete the AI Agent
    • Toolkit
      • SQL Runner
      • Kubernetes Job
      • Text-to-SQL
    • API Documentation
      • Agent
      • Memory
  • 💡Risk
    • Overview
    • Workflows and Rules
    • Real Time Transaction Monitoring
    • API Documentation
  • 💡Fraud Investigation
    • API Documentation
  • 📝Guides
    • Registry
    • Dry Runs for Batch ML Features
    • Deployment
Powered by GitBook
On this page

Was this helpful?

  1. 💡Risk

API Documentation

PreviousReal Time Transaction MonitoringNextAPI Documentation

Last updated 4 months ago

Was this helpful?

Table of Contents

Rule Management Service

List all workflows

Create workflow

Get workflow by name

Update workflow status

List workflow rules

Create workflow rule

Get workflow rule details

Update workflow rule

Update rule status

Update rule stage


Transaction Monitoring and Evaluation

Workflow & Rule Management
Transaction Monitoring & Evaluation

Get Workflows

get

Get all workflows for a given tenant with optional status filtering.

Args: query_params: Query parameters including tenant_name and optional is_active flag service: Injected WorkflowService instance

Returns: List[Workflow]: List of workflows matching the criteria

Raises: HTTPException: For database errors or invalid input

Authorizations
Query parameters
is_activeany ofOptional
booleanOptional
or
nullOptional
Responses
200
Successful Response
application/json
422
Validation Error
application/json
get
GET /v1/risk/workflows HTTP/1.1
Host: 
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
[
  {
    "workflow_name": "text",
    "description": "text",
    "status": "ACTIVE",
    "deployments": [
      {
        "cluster_name": "text",
        "deployment_status": "PENDING",
        "last_synced_at": "2025-06-12T13:35:23.377Z"
      }
    ],
    "created_at": "2025-06-12T13:35:23.377Z",
    "updated_at": "2025-06-12T13:35:23.377Z"
  }
]

Get Workflow By Name

get

Get detailed workflow information by workflow name.

Args: workflow_name: Name of the workflow to retrieve service: Injected WorkflowService instance user_data: User context data including tenant information

Returns: WorkflowDetails: Detailed workflow information including rules and deployments

Raises: HTTPException: For database errors or if workflow is not found

Authorizations
Path parameters
workflow_namestringRequired
Responses
200
Successful Response
application/json
422
Validation Error
application/json
get
GET /v1/risk/workflows/{workflow_name} HTTP/1.1
Host: 
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
{
  "workflow_name": "text",
  "description": "text",
  "status": "ACTIVE",
  "rules": [
    {
      "rule_name": "text",
      "rule_definition": {},
      "stage": "REGISTERED",
      "status": "ACTIVE",
      "created_at": "2025-06-12T13:35:23.377Z",
      "updated_at": "2025-06-12T13:35:23.377Z"
    }
  ],
  "deployments": [
    {
      "cluster_name": "text",
      "deployment_status": "PENDING",
      "last_synced_at": "2025-06-12T13:35:23.377Z"
    }
  ],
  "created_at": "2025-06-12T13:35:23.377Z",
  "updated_at": "2025-06-12T13:35:23.377Z"
}

Get Workflow Rules

get
Authorizations
Path parameters
workflow_namestringRequired
Query parameters
stageany ofOptional
stringOptional
or
nullOptional
statusany ofOptional
stringOptional
or
nullOptional
Responses
200
Successful Response
application/json
422
Validation Error
application/json
get
GET /v1/risk/workflows/{workflow_name}/rules HTTP/1.1
Host: 
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
[
  {
    "rule_name": "text",
    "rule_definition": {},
    "stage": "REGISTERED",
    "status": "ACTIVE",
    "created_at": "2025-06-12T13:35:23.377Z",
    "updated_at": "2025-06-12T13:35:23.377Z"
  }
]

Get Workflow Rule

get
Authorizations
Path parameters
workflow_namestringRequired
rule_namestringRequired
Responses
200
Successful Response
application/json
422
Validation Error
application/json
get
GET /v1/risk/workflows/{workflow_name}/rules/{rule_name} HTTP/1.1
Host: 
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
{
  "rule_name": "text",
  "rule_definition": {},
  "stage": "REGISTERED",
  "status": "ACTIVE",
  "created_at": "2025-06-12T13:35:23.377Z",
  "updated_at": "2025-06-12T13:35:23.377Z"
}

Create Workflow

post

Create a new workflow with initial rules.

Authorizations
Body

Request model for creating a new workflow with initial rules

workflow_namestringRequired

Name of the workflow

descriptionany ofOptional

Optional workflow description

stringOptional
or
nullOptional
Responses
200
Successful Response
application/json
422
Validation Error
application/json
post
POST /v1/risk/workflows HTTP/1.1
Host: 
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 204

{
  "workflow_name": "text",
  "description": "text",
  "initial_rules": [
    {
      "rule_name": "text",
      "operator": "AND",
      "sub_rules": [
        {
          "field": "text",
          "operator": "<",
          "value": null,
          "storage_key": "text",
          "storage_field": "text"
        }
      ]
    }
  ]
}
{
  "workflow_name": "text",
  "description": "text",
  "status": "ACTIVE",
  "rules": [
    {
      "rule_name": "text",
      "rule_definition": {},
      "stage": "REGISTERED",
      "status": "ACTIVE",
      "created_at": "2025-06-12T13:35:23.377Z",
      "updated_at": "2025-06-12T13:35:23.377Z"
    }
  ],
  "deployments": [
    {
      "cluster_name": "text",
      "deployment_status": "PENDING",
      "last_synced_at": "2025-06-12T13:35:23.377Z"
    }
  ],
  "created_at": "2025-06-12T13:35:23.377Z",
  "updated_at": "2025-06-12T13:35:23.377Z"
}

Update Workflow Status

patch

Update workflow status.

Args: workflow_name: Name of the workflow to update service: Injected WorkflowService instance user_data: User context data including tenant information

Returns: Workflow: Updated workflow information (without rules)

Raises: HTTPException: For validation or database errors

Authorizations
Path parameters
workflow_namestringRequired
Body

Request model for updating workflow status

new_statusstring · enumRequired

New status to set for the workflow

Possible values:
Responses
200
Successful Response
application/json
422
Validation Error
application/json
patch
PATCH /v1/risk/workflows/{workflow_name}/status HTTP/1.1
Host: 
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 23

{
  "new_status": "ACTIVE"
}
{
  "workflow_name": "text",
  "description": "text",
  "status": "ACTIVE",
  "created_at": "2025-06-12T13:35:23.377Z",
  "updated_at": "2025-06-12T13:35:23.377Z"
}

Create Workflow Rule

post

Create a new rule for a specific workflow.

Authorizations
Path parameters
workflow_namestringRequired
Body

Model for creating a new rule

operatorstring · enumRequiredPossible values:
rule_namestringRequired
Responses
200
Successful Response
application/json
422
Validation Error
application/json
post
POST /v1/risk/workflows/{workflow_name}/rules HTTP/1.1
Host: 
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 136

{
  "operator": "AND",
  "sub_rules": [
    {
      "field": "text",
      "operator": "<",
      "value": null,
      "redis_key": "text",
      "redis_field": "text"
    }
  ],
  "rule_name": "text"
}
{
  "rule_name": "text",
  "rule_definition": {},
  "stage": "REGISTERED",
  "status": "ACTIVE",
  "created_at": "2025-06-12T13:35:23.377Z",
  "updated_at": "2025-06-12T13:35:23.377Z"
}

Update Workflow Rule

put

Update an existing rule in a workflow.

Args: rule_request: Rule update request data workflow_name: Name of the workflow rule_name: Name of the rule to update service: Injected RuleService instance user_data: User context data including tenant information

Returns: RiskRule: Updated rule data

Raises: HTTPException: For validation errors or if rule/workflow not found

Authorizations
Path parameters
workflow_namestringRequired
rule_namestringRequired
Body

Model for updating an existing rule

operatorstring · enumRequiredPossible values:
Responses
200
Successful Response
application/json
422
Validation Error
application/json
put
PUT /v1/risk/workflows/{workflow_name}/rules/{rule_name} HTTP/1.1
Host: 
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 117

{
  "operator": "AND",
  "sub_rules": [
    {
      "field": "text",
      "operator": "<",
      "value": null,
      "redis_key": "text",
      "redis_field": "text"
    }
  ]
}
{
  "rule_name": "text",
  "rule_definition": {},
  "stage": "REGISTERED",
  "status": "ACTIVE",
  "created_at": "2025-06-12T13:35:23.377Z",
  "updated_at": "2025-06-12T13:35:23.377Z"
}

Update Rule Status

patch

Update rule status and sync to Redis if deployed.

Authorizations
Path parameters
workflow_namestringRequired
rule_namestringRequired
Body

Request model for updating Rule status

new_statusstring · enumRequiredPossible values:
Responses
200
Successful Response
application/json
422
Validation Error
application/json
patch
PATCH /v1/risk/workflows/{workflow_name}/rules/{rule_name}/status HTTP/1.1
Host: 
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 23

{
  "new_status": "ACTIVE"
}
{
  "rule_name": "text",
  "rule_definition": {},
  "stage": "REGISTERED",
  "status": "ACTIVE",
  "created_at": "2025-06-12T13:35:23.377Z",
  "updated_at": "2025-06-12T13:35:23.377Z"
}

Update Rule Stage

patch

Update the stage of a specific rule.

Args: stage_update: Stage update request workflow_name: Name of the workflow rule_name: Name of the rule service: Injected RuleService instance user_data: User context data including tenant information

Returns: RiskRule: Updated rule data

Authorizations
Path parameters
workflow_namestringRequired
rule_namestringRequired
Body

Request model for updating Rule stage

stagestring · enumRequiredPossible values:
Responses
200
Successful Response
application/json
422
Validation Error
application/json
patch
PATCH /v1/risk/workflows/{workflow_name}/rules/{rule_name}/stage HTTP/1.1
Host: 
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 22

{
  "stage": "REGISTERED"
}
{
  "rule_name": "text",
  "rule_definition": {},
  "stage": "REGISTERED",
  "status": "ACTIVE",
  "created_at": "2025-06-12T13:35:23.377Z",
  "updated_at": "2025-06-12T13:35:23.377Z"
}
  • Table of Contents
  • Rule Management Service
  • GETGet Workflows
  • POSTCreate Workflow
  • GETGet Workflow By Name
  • PATCHUpdate Workflow Status
  • GETGet Workflow Rules
  • POSTCreate Workflow Rule
  • GETGet Workflow Rule
  • PUTUpdate Workflow Rule
  • PATCHUpdate Rule Status
  • PATCHUpdate Rule Stage
  • Transaction Monitoring and Evaluation
  • POSTEvaluate Risk

Evaluate Risk

post

Evaluate risk for a transaction using specified workflow

Body

Request model for evaluating a transaction against a workflow's rules

workflow_idstringRequired

ID of the workflow to evaluate

transaction_idstringRequired

Unique identifier for the transaction

transaction_dataobject · TransactionDataRequired

Transaction data to be evaluated

evaluation_timestring · date-timeOptional

Timestamp when evaluation was requested

contextobject · ContextOptional

Additional context for evaluation

Responses
200
Successful Response
application/json
422
Validation Error
application/json
post
POST /v1/risk/evaluate-risk HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 126

{
  "workflow_id": "text",
  "transaction_id": "text",
  "transaction_data": {},
  "evaluation_time": "2025-06-12T13:35:23.377Z",
  "context": {}
}
{
  "transaction_id": "text",
  "workflow_id": "text",
  "evaluation_results": [
    {
      "rule_id": "text",
      "rule_name": "text",
      "result": "SUCCESS",
      "error_message": "text"
    }
  ],
  "evaluation_timestamp": "2025-06-12T13:35:23.377Z"
}