Rulesets API
Rulesets define the scoring factors, weights, and thresholds used to generate underwriting recommendations. Each organization can maintain multiple rulesets and designate one as the default for automatic evaluation.
Factor weights must sum to exactly 1.0. The server validates this constraint and will reject requests where the weights do not sum correctly.
List Rulesets
Returns all rulesets for the authenticated organization, including factor definitions and threshold configuration.
| Name | Type | Required | Description |
|---|---|---|---|
| page | integer | Default: 1 | Page number |
| per_page | integer | Default: 25 | Results per page (1-100) |
curl https://api.banklyze.com/v1/rulesets \
-H "Authorization: Bearer bkz_live_abc123"{
"data": [
{
"id": 1,
"name": "Standard MCA",
"description": "Default ruleset for merchant cash advance underwriting",
"is_default": true,
"factors": [
{ "name": "revenue_stability", "weight": 0.25, "threshold": 60 },
{ "name": "average_daily_balance", "weight": 0.20, "threshold": 50 },
{ "name": "deposit_consistency", "weight": 0.20, "threshold": 55 },
{ "name": "nsf_frequency", "weight": 0.15, "threshold": 40 },
{ "name": "negative_days", "weight": 0.10, "threshold": 30 },
{ "name": "high_risk_transactions", "weight": 0.10, "threshold": 35 }
],
"approval_threshold": 70,
"decline_threshold": 40,
"created_at": "2025-09-15T10:00:00Z",
"updated_at": "2025-09-15T10:00:00Z"
}
],
"meta": {
"page": 1,
"per_page": 25,
"total": 1,
"total_pages": 1
}
}Create Ruleset
Creates a new underwriting ruleset with the specified scoring factors and decision thresholds. Factor weights must sum to exactly 1.0.
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | Required | Unique name for the ruleset |
| description | string | Optional | Human-readable description |
| factors | array | Required | Array of factor objects with name, weight (0-1), and threshold (0-100) |
| factors[].name | string | Required | Factor identifier (e.g. revenue_stability, nsf_frequency) |
| factors[].weight | number | Required | Relative weight (all weights must sum to 1.0) |
| factors[].threshold | integer | Required | Minimum score threshold for this factor (0-100) |
| approval_threshold | number | Required | Composite score at or above which deals are auto-approved |
| decline_threshold | number | Required | Composite score at or below which deals are auto-declined |
curl -X POST https://api.banklyze.com/v1/rulesets \
-H "Authorization: Bearer bkz_live_abc123" \
-H "Content-Type: application/json" \
-d '{
"name": "Conservative MCA",
"description": "Stricter thresholds for high-risk verticals",
"factors": [
{ "name": "revenue_stability", "weight": 0.30, "threshold": 70 },
{ "name": "average_daily_balance", "weight": 0.20, "threshold": 60 },
{ "name": "deposit_consistency", "weight": 0.20, "threshold": 65 },
{ "name": "nsf_frequency", "weight": 0.15, "threshold": 50 },
{ "name": "negative_days", "weight": 0.10, "threshold": 40 },
{ "name": "high_risk_transactions", "weight": 0.05, "threshold": 45 }
],
"approval_threshold": 75,
"decline_threshold": 45
}'{
"data": {
"id": 2,
"name": "Conservative MCA",
"description": "Stricter thresholds for high-risk verticals",
"is_default": false,
"factors": [
{ "name": "revenue_stability", "weight": 0.30, "threshold": 70 },
{ "name": "average_daily_balance", "weight": 0.20, "threshold": 60 },
{ "name": "deposit_consistency", "weight": 0.20, "threshold": 65 },
{ "name": "nsf_frequency", "weight": 0.15, "threshold": 50 },
{ "name": "negative_days", "weight": 0.10, "threshold": 40 },
{ "name": "high_risk_transactions", "weight": 0.05, "threshold": 45 }
],
"approval_threshold": 75,
"decline_threshold": 45,
"created_at": "2025-11-01T14:30:00Z",
"updated_at": "2025-11-01T14:30:00Z"
}
}Get Ruleset
Returns the full details of a single ruleset, including all factor definitions and threshold configuration.
| Name | Type | Required | Description |
|---|---|---|---|
| ruleset_id | integer | Required | The ruleset ID |
curl https://api.banklyze.com/v1/rulesets/2 \
-H "Authorization: Bearer bkz_live_abc123"{
"data": {
"id": 2,
"name": "Conservative MCA",
"description": "Stricter thresholds for high-risk verticals",
"is_default": false,
"factors": [
{ "name": "revenue_stability", "weight": 0.30, "threshold": 70 },
{ "name": "average_daily_balance", "weight": 0.20, "threshold": 60 },
{ "name": "deposit_consistency", "weight": 0.20, "threshold": 65 },
{ "name": "nsf_frequency", "weight": 0.15, "threshold": 50 },
{ "name": "negative_days", "weight": 0.10, "threshold": 40 },
{ "name": "high_risk_transactions", "weight": 0.05, "threshold": 45 }
],
"approval_threshold": 75,
"decline_threshold": 45,
"created_at": "2025-11-01T14:30:00Z",
"updated_at": "2025-11-01T14:30:00Z"
}
}Update Ruleset
Partially updates a ruleset. You can update any combination of fields. If you update factors, the new weights must still sum to exactly 1.0.
| Name | Type | Required | Description |
|---|---|---|---|
| ruleset_id | integer | Required | The ruleset ID |
| name | string | Optional | Updated ruleset name |
| description | string | Optional | Updated description |
| factors | array | Optional | Replacement factor array (weights must sum to 1.0) |
| approval_threshold | number | Optional | Updated approval threshold |
| decline_threshold | number | Optional | Updated decline threshold |
curl -X PATCH https://api.banklyze.com/v1/rulesets/2 \
-H "Authorization: Bearer bkz_live_abc123" \
-H "Content-Type: application/json" \
-d '{
"description": "Updated thresholds for Q1 2026",
"approval_threshold": 72,
"decline_threshold": 42
}'{
"data": {
"id": 2,
"name": "Conservative MCA",
"description": "Updated thresholds for Q1 2026",
"is_default": false,
"factors": [
{ "name": "revenue_stability", "weight": 0.30, "threshold": 70 },
{ "name": "average_daily_balance", "weight": 0.20, "threshold": 60 },
{ "name": "deposit_consistency", "weight": 0.20, "threshold": 65 },
{ "name": "nsf_frequency", "weight": 0.15, "threshold": 50 },
{ "name": "negative_days", "weight": 0.10, "threshold": 40 },
{ "name": "high_risk_transactions", "weight": 0.05, "threshold": 45 }
],
"approval_threshold": 72,
"decline_threshold": 42,
"created_at": "2025-11-01T14:30:00Z",
"updated_at": "2025-12-10T09:15:00Z"
}
}Delete Ruleset
Permanently deletes a ruleset. The default ruleset cannot be deleted — assign a different default first. Existing recommendations that were generated with this ruleset retain their snapshot and are not affected.
| Name | Type | Required | Description |
|---|---|---|---|
| ruleset_id | integer | Required | The ruleset ID |
curl -X DELETE https://api.banklyze.com/v1/rulesets/2 \
-H "Authorization: Bearer bkz_live_abc123"{
"success": true,
"message": "Ruleset deleted"
}Set Default Ruleset
Designates this ruleset as the organization's default. The previously default ruleset is automatically unset. New deals will use the default ruleset for automatic underwriting evaluation.
| Name | Type | Required | Description |
|---|---|---|---|
| ruleset_id | integer | Required | The ruleset ID to set as default |
curl -X POST https://api.banklyze.com/v1/rulesets/2/set-default \
-H "Authorization: Bearer bkz_live_abc123"{
"data": {
"id": 2,
"name": "Conservative MCA",
"description": "Updated thresholds for Q1 2026",
"is_default": true,
"factors": [
{ "name": "revenue_stability", "weight": 0.30, "threshold": 70 },
{ "name": "average_daily_balance", "weight": 0.20, "threshold": 60 },
{ "name": "deposit_consistency", "weight": 0.20, "threshold": 65 },
{ "name": "nsf_frequency", "weight": 0.15, "threshold": 50 },
{ "name": "negative_days", "weight": 0.10, "threshold": 40 },
{ "name": "high_risk_transactions", "weight": 0.05, "threshold": 45 }
],
"approval_threshold": 72,
"decline_threshold": 42,
"created_at": "2025-11-01T14:30:00Z",
"updated_at": "2025-12-10T09:20:00Z"
}
}