11 Routes Overview

The threat modelling module exposes 11 routes under /threat-models/*. All routes require Bearer JWT authentication and the X-Tenant-Id header.

#MethodRouteDescription
1GET/threat-modelsList all threat models for the tenant (paginated)
2POST/threat-modelsCreate a new threat model
3GET/threat-models/:idGet full threat model detail (single-endpoint pattern)
4PUT/threat-models/:idUpdate threat model metadata
5DELETE/threat-models/:idSoft-delete a threat model
6POST/threat-models/:id/componentsAdd DFD components (processes, data stores, external entities)
7POST/threat-models/:id/threatsAdd STRIDE threats to the model
8POST/threat-models/:id/mitigationsAdd mitigations linked to threats
9POST/threat-models/:id/pasta-stagesMap PASTA stage analysis (stages 1–7)
10POST/threat-models/:id/regulatory-mapGenerate regulatory mapping for the model
11GET/threat-models/:id/exportExport threat model as PDF or JSON

Single-Endpoint Detail Pattern

The GET /threat-models/:id endpoint returns the complete threat model with all nested arrays in a single response. This avoids N+1 queries and simplifies client-side rendering.

GET /threat-models/tm_9x8y7z6w
Authorization: Bearer <token>
X-Tenant-Id: acme-bank

// Response 200 — single object with all nested data
{
  "id":          "tm_9x8y7z6w",
  "name":        "Core Banking UPI Module",
  "status":      "IN_PROGRESS",
  "methodology": "STRIDE_PASTA",
  "createdAt":   "2026-04-01T09:00:00+05:30",

  // All nested arrays included in single response
  "components":     [/* DFD components */],
  "threats":        [/* STRIDE-categorised threats */],
  "mitigations":    [/* linked mitigations */],
  "pastaStages":    [/* 7-stage PASTA analysis */],
  "regulatoryMap":  [/* RBI, SEBI, IRDAI mappings */],
  "summary": {
    "totalThreats":     18,
    "mitigatedThreats": 12,
    "openThreats":      6,
    "components":       9,
    "regulatoryGaps":   2
  }
}
Why Single-Endpoint? Threat models are typically rendered in full — a DFD diagram with threats overlaid, mitigations linked, and regulatory gaps highlighted. Fetching this data across multiple endpoints introduces latency and complexity. The single-endpoint pattern returns everything needed in one round-trip.

Enum Exactness

The API enforces exact enum values. Abbreviated or informal values will be rejected with a 422 VALIDATION_ERROR. This is a common source of integration errors.

STRIDE Threat Categories

Always use the full enum value, not abbreviations:

// STRIDE category enums — use EXACTLY these values
"SPOOFING"              // NOT "S" or "Spoofing"
"TAMPERING"             // NOT "T" or "Tampering"
"REPUDIATION"           // NOT "R" or "Repudiation"
"INFORMATION_DISCLOSURE" // NOT "I" or "Info Disclosure"
"DENIAL_OF_SERVICE"     // NOT "D" or "DoS"
"ELEVATION_OF_PRIVILEGE" // NOT "E" or "EoP"

DFD Component Types

DFD components must use the exact type enum:

// DFD component type enums
"PROCESS"           // A processing element (circle in DFD)
"DATA_STORE"        // A data store (parallel lines in DFD)
"EXTERNAL_ENTITY"   // An external entity (rectangle in DFD)
"DATA_FLOW"         // A data flow between components (arrow in DFD)
"TRUST_BOUNDARY"    // A trust boundary (dashed line in DFD)
Common Mistake Using "S" instead of "SPOOFING" or "DataStore" instead of "DATA_STORE" will return a 422 error. All enums are UPPER_SNAKE_CASE. Your client-side validation should enforce this before making API calls.

Creating a threat with STRIDE category

POST /threat-models/tm_9x8y7z6w/threats
Content-Type: application/json

{
  "title":          "Spoofed UPI callback from unverified merchant",
  "strideCategory": "SPOOFING",
  "description":    "Attacker sends forged UPI callback to simulate successful payment...",
  "componentId":    "comp_upi_callback_handler",
  "severity":       "HIGH",
  "likelihood":     "PROBABLE",
  "pastaStage":     5                        // Stage 5: Vulnerability Analysis
}

Regulatory Mapping

RiskSage automatically maps threat model findings to Indian regulatory requirements. The POST /threat-models/:id/regulatory-map endpoint generates mappings based on the threats and mitigations in the model.

RegulatorFrameworkRequirementMaps To
RBIThreat Risk Assessment (TRA)Annual TRA for critical applicationsThreat model completeness, STRIDE coverage per component
SEBICSCRF SDLCThreat modelling in SDLC for market infrastructurePASTA stage completion, mitigation coverage ratio
IRDAIIS Audit GuidelinesApplication-level threat assessmentComponent-level threat enumeration, risk acceptance documentation
POST /threat-models/tm_9x8y7z6w/regulatory-map
Content-Type: application/json

{
  "frameworks": ["RBI_TRA", "SEBI_CSCRF_SDLC", "IRDAI_IS_AUDIT"]
}

// Response 200
{
  "regulatoryMap": [
    {
      "framework":    "RBI_TRA",
      "controlRef":   "RBI.TRA.4.2",
      "requirement":  "Threat assessment for internet-facing applications",
      "status":       "COMPLIANT",
      "evidence":     "18 threats identified across 9 DFD components with STRIDE coverage"
    },
    {
      "framework":    "SEBI_CSCRF_SDLC",
      "controlRef":   "SEBI.SDLC.3.1",
      "requirement":  "Threat modelling during design phase",
      "status":       "GAP",
      "gap":          "PASTA Stage 7 (Risk & Impact Analysis) not completed"
    },
    {
      "framework":    "IRDAI_IS_AUDIT",
      "controlRef":   "IRDAI.APP.2.1",
      "requirement":  "Application-level threat enumeration",
      "status":       "COMPLIANT",
      "evidence":     "All EXTERNAL_ENTITY components have associated SPOOFING threats"
    }
  ]
}

PASTA 7-Stage Mapping

PASTA (Process for Attack Simulation and Threat Analysis) has 7 stages. RiskSage tracks completion of each stage within the threat model.

StageNameAPI FieldDescription
1Definition of ObjectivesOBJECTIVESBusiness objectives, security requirements, compliance drivers
2Definition of Technical ScopeTECHNICAL_SCOPESystem architecture, technology stack, DFD components
3Application DecompositionDECOMPOSITIONTrust boundaries, entry points, assets, data flows
4Threat AnalysisTHREAT_ANALYSISThreat actors, attack patterns, threat intelligence
5Vulnerability AnalysisVULNERABILITY_ANALYSISKnown CVEs, weakness enumeration, VAPT correlation
6Attack ModellingATTACK_MODELLINGAttack trees, kill chains, exploitation scenarios
7Risk & Impact AnalysisRISK_IMPACTResidual risk, business impact, CRQ integration
PASTA + CRQ Integration Stage 7 (Risk & Impact Analysis) can be linked directly to a CRQ analysis via the crqAnalysisId field. This connects qualitative threat modelling to quantitative risk output — a powerful combination for board-level reporting.

See CRQ Engine Developer Guide →

Export Options

Export the complete threat model for stakeholder review or regulatory submission:

// Export as PDF (for board/audit submission)
GET /threat-models/tm_9x8y7z6w/export?format=pdf

// Export as JSON (for CI/CD integration)
GET /threat-models/tm_9x8y7z6w/export?format=json

// Response headers for PDF:
Content-Type: application/pdf
Content-Disposition: attachment; filename="threat-model-tm_9x8y7z6w.pdf"