> ## Documentation Index
> Fetch the complete documentation index at: https://wuweism.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Intervention validation

> Validate whether a causal intervention is identifiable given your adjustment set and known confounders.

Before running a causal analysis, use this endpoint to check whether the effect of an intervention on an outcome is **identifiable** — that is, whether it can be estimated from observational data given your adjustment strategy. The endpoint checks your adjustment set against the SCM's causal graph and reports whether the back-door (or other) criterion is satisfied.

***

## Validate an intervention

```
POST /api/scm/intervention/validate
```

<Note>
  This endpoint requires authentication. Include your session token in the `Authorization` header.
</Note>

### Request body

<ParamField body="treatment" type="string" required>
  The variable you intend to intervene on (the "do" variable in Pearl's do-calculus). Must be a node in the target SCM.
</ParamField>

<ParamField body="outcome" type="string" required>
  The outcome variable whose causal response you want to estimate.
</ParamField>

<ParamField body="adjustmentSet" type="string[]">
  Variables you plan to control for (condition on) in your analysis. The endpoint checks whether this set is sufficient to block all back-door paths from `treatment` to `outcome`.
</ParamField>

<ParamField body="knownConfounders" type="string[]">
  Confounders you have identified from domain knowledge. Used alongside the SCM structure to assess completeness of your adjustment set.
</ParamField>

<ParamField body="modelKey" type="string">
  The SCM to validate against. If omitted, Wu-Weism selects the most relevant registered model based on the variable names you provide. See [SCM model registry](/api/scm/models) for available model keys.
</ParamField>

### Response fields

<ResponseField name="allowed" type="boolean" required>
  `true` if the intervention is identifiable with the provided adjustment set. `false` if the effect cannot be estimated without additional variables or structural assumptions.
</ResponseField>

<ResponseField name="allowedOutputClass" type="string" required>
  The output class permitted by the identifiability analysis. One of:

  * `interventional` — the effect of the do-intervention P(Y | do(X)) is estimable.
  * `observational` — only observational associations P(Y | X) are estimable; intervention is not identified.
  * `blocked` — the intervention violates structural constraints in the SCM and cannot proceed.
</ResponseField>

<ResponseField name="rationale" type="string" required>
  Human-readable explanation of the identifiability decision.
</ResponseField>

<ResponseField name="identifiability" type="object" required>
  Detailed identifiability analysis.

  <Expandable title="identifiability properties" defaultOpen={true}>
    <ResponseField name="identifiable" type="boolean">
      Whether the causal effect is identifiable from observational data.
    </ResponseField>

    <ResponseField name="requiredConfounders" type="string[]">
      The complete set of variables that must be adjusted for to identify the effect.
    </ResponseField>

    <ResponseField name="adjustmentSet" type="string[]">
      The valid adjustment set confirmed by the SCM analysis. May differ from the set you supplied if the SCM identifies a minimal sufficient set.
    </ResponseField>

    <ResponseField name="missingConfounders" type="string[]">
      Variables present in `requiredConfounders` that are absent from your supplied `adjustmentSet`. An empty array means your adjustment strategy is sufficient.
    </ResponseField>

    <ResponseField name="note" type="string">
      Additional notes on the criterion satisfied (e.g., back-door, front-door, IV) or the reason the effect is not identified.
    </ResponseField>
  </Expandable>
</ResponseField>

### Example

<CodeGroup>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://wuweism.com/api/scm/intervention/validate \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "treatment": "cortisol_level",
      "outcome": "hippocampal_volume",
      "knownConfounders": ["stress_exposure", "age"],
      "adjustmentSet": ["stress_exposure"],
      "modelKey": "neural_topology_v1"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://wuweism.com/api/scm/intervention/validate', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer <token>',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      treatment: 'cortisol_level',
      outcome: 'hippocampal_volume',
      knownConfounders: ['stress_exposure', 'age'],
      adjustmentSet: ['stress_exposure'],
      modelKey: 'neural_topology_v1',
    }),
  });

  const result = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://wuweism.com/api/scm/intervention/validate',
      headers={'Authorization': 'Bearer <token>'},
      json={
          'treatment': 'cortisol_level',
          'outcome': 'hippocampal_volume',
          'knownConfounders': ['stress_exposure', 'age'],
          'adjustmentSet': ['stress_exposure'],
          'modelKey': 'neural_topology_v1',
      },
  )

  result = response.json()
  ```
</CodeGroup>

<ResponseExample>
  ```json 200 — identifiable theme={null}
  {
    "allowed": true,
    "allowedOutputClass": "interventional",
    "rationale": "Sufficient adjustment set identified.",
    "identifiability": {
      "identifiable": true,
      "requiredConfounders": ["stress_exposure"],
      "adjustmentSet": ["stress_exposure"],
      "missingConfounders": [],
      "note": "Back-door criterion satisfied."
    }
  }
  ```

  ```json 200 — not identifiable theme={null}
  {
    "allowed": false,
    "allowedOutputClass": "observational",
    "rationale": "The adjustment set does not block all back-door paths. Conditioning on 'stress_exposure' alone is insufficient; 'age' must also be included.",
    "identifiability": {
      "identifiable": false,
      "requiredConfounders": ["stress_exposure", "age"],
      "adjustmentSet": ["stress_exposure"],
      "missingConfounders": ["age"],
      "note": "Open back-door path exists through 'age'. Add 'age' to your adjustmentSet to satisfy the back-door criterion."
    }
  }
  ```

  ```json 400 theme={null}
  {
    "error": "Treatment variable 'cortisol_level' is not a node in model 'alignment_bias_scm'."
  }
  ```
</ResponseExample>

<Warning>
  A response of `"allowed": false` does not mean the causal effect does not exist — it means the effect **cannot be estimated** from observational data with your current adjustment strategy. You may need to collect additional data, add variables to your adjustment set, or apply an alternative identification strategy (front-door criterion, instrumental variables, etc.).
</Warning>
