The issue you’re experiencing is a documented inconsistency in qual-2022.2’s risk management API that was addressed in later versions. Here’s the complete explanation:
Risk Score Calculation Logic:
The UI and API use different calculation engines in qual-2022.2. The UI applies a risk matrix configuration that may include weighted factors, impact categories, and custom multipliers. The API, however, uses a simplified calculation engine that was designed for backward compatibility with earlier API versions.
Enum vs Integer Mapping:
This is the critical issue. When you send integer values through the API:
- The UI interprets probability=3 as the third level in your configured risk matrix (which might have a weight of 3)
- The API interprets probability=3 as an enum index, where: 1=Very Low(1), 2=Low(2), 3=Medium(3), 4=High(4), 5=Very High(5)
But here’s the catch - if your risk matrix has custom probability labels or non-linear scoring, the API doesn’t access that configuration. It uses hardcoded enum-to-score mappings.
API/UI Formula Alignment:
To achieve consistent scoring, you need to:
- Use the risk matrix configuration endpoint to retrieve your organization’s actual scoring rules:
GET /api/v1/risk-management/matrix-config
- Apply the returned calculation formula in your API integration before submitting:
POST /api/v1/risks
{
"probability_level": "MEDIUM",
"severity_level": "HIGH",
"calculate_score": true
}
- Alternatively, submit with raw values and trigger recalculation:
POST /api/v1/risks/{risk_id}/recalculate-score
The reason you’re getting 7 instead of 12 is likely because your organization’s risk matrix uses a lookup table rather than simple multiplication. For example:
- Probability 3 (Medium) + Severity 4 (High) = Risk Score 7 (per your custom matrix)
- But the UI shows this as 12 because it’s displaying the raw calculation before applying matrix rules
In qual-2023.1 and later, the API was updated to automatically apply the configured risk matrix, making this alignment issue obsolete. If you’re stuck on qual-2022.2, the workaround is to always use the /recalculate-score endpoint after creating risks via API, or upgrade to qual-2023.1+ where the calculation engines are unified.
For immediate resolution: retrieve your risk matrix configuration, identify the actual score mappings, and either use string enum values (“MEDIUM”, “HIGH”) instead of integers, or implement the matrix lookup logic in your integration layer before calling the API.