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

# Estimate Causal Effect

> Estimate the average effect of `do(treatment = treatment_action)` vs `do(treatment = control_action)` for a **causal** model, by g-computation over the model's training dataset (the causal frame is rebuilt from the labels frozen at training time).

Always asynchronous: returns a `job_id` immediately (202). Poll `GET /jobs/{job_id}` until `succeeded`, then fetch the scalar results (`estimand`, `effect`, `n_rows`, `n_extrapolated`, `tau_summary`) from the `summary` of `GET /jobs/{job_id}/results`; the per-row effects (tau — the CATE surface) are served by `GET /jobs/{job_id}/results/rows`.

`estimand`:
- `ate`: average treatment effect over every training row.
- `att`: average effect on the treated (rows whose observed treatment equals `treatment_action`). Categorical treatments only — ATT for continuous treatments requires a dose band and is not yet supported (422).

Unanswerable requests fail with 422 up front: a categorical action the model never saw at training, or a non-numeric action for a continuous treatment. Identical requests return the previously dispatched job.



## OpenAPI

````yaml /openapi.json post /models/{model_id}/estimate-causal-effect
openapi: 3.1.0
info:
  title: Woodwide API
  description: API service for the Woodwide platform
  version: 0.1.0
servers:
  - url: https://api.woodwide.ai
    description: Production
security: []
paths:
  /models/{model_id}/estimate-causal-effect:
    post:
      tags:
        - Inference
      summary: Estimate Causal Effect
      description: >-
        Estimate the average effect of `do(treatment = treatment_action)` vs
        `do(treatment = control_action)` for a **causal** model, by
        g-computation over the model's training dataset (the causal frame is
        rebuilt from the labels frozen at training time).


        Always asynchronous: returns a `job_id` immediately (202). Poll `GET
        /jobs/{job_id}` until `succeeded`, then fetch the scalar results
        (`estimand`, `effect`, `n_rows`, `n_extrapolated`, `tau_summary`) from
        the `summary` of `GET /jobs/{job_id}/results`; the per-row effects (tau
        — the CATE surface) are served by `GET /jobs/{job_id}/results/rows`.


        `estimand`:

        - `ate`: average treatment effect over every training row.

        - `att`: average effect on the treated (rows whose observed treatment
        equals `treatment_action`). Categorical treatments only — ATT for
        continuous treatments requires a dose band and is not yet supported
        (422).


        Unanswerable requests fail with 422 up front: a categorical action the
        model never saw at training, or a non-numeric action for a continuous
        treatment. Identical requests return the previously dispatched job.
      operationId: estimate_effect_models__model_id__estimate_causal_effect_post
      parameters:
        - name: model_id
          in: path
          required: true
          schema:
            type: string
            title: Model Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EffectRequest'
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InferBatchResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    EffectRequest:
      properties:
        estimand:
          $ref: '#/components/schemas/Estimand'
          description: 'Which effect to estimate: ate or att.'
        treatment_action:
          anyOf:
            - type: number
            - type: integer
            - type: boolean
            - type: string
          title: Treatment Action
          description: Counterfactual treatment value for the 'treated' arm.
        control_action:
          anyOf:
            - type: number
            - type: integer
            - type: boolean
            - type: string
          title: Control Action
          description: Counterfactual treatment value for the control arm.
        model_version_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Model Version Id
          description: >-
            Public ID of a specific model version (e.g. mdlv_A8K2P9QX). If
            omitted, the latest ready version is used.
      type: object
      required:
        - estimand
        - treatment_action
        - control_action
      title: EffectRequest
      description: |-
        Request body for causal effect estimation
        (``POST /models/{id}/estimate-causal-effect``).

        Estimates the average effect of ``do(treatment = treatment_action)`` vs
        ``do(treatment = control_action)`` by g-computation over the model's
        training dataset (the frame is rebuilt from the frozen causal labels).
        Always asynchronous: returns a job to poll; scalar results land in the
        job's results ``summary``, per-row effects (tau) via
        ``GET /jobs/{id}/results/rows``.
    InferBatchResponse:
      properties:
        job_id:
          type: string
          title: Job Id
          description: Public ID of the inference job (e.g. job_A8K2P9QX).
        status:
          type: string
          title: Status
        model_version_id:
          type: string
          title: Model Version Id
          description: Public ID of the model version used (e.g. mdlv_A8K2P9QX).
      type: object
      required:
        - job_id
        - status
        - model_version_id
      title: InferBatchResponse
      description: Async inference submission response.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    Estimand:
      type: string
      enum:
        - ate
        - att
      title: Estimand
      description: |-
        Supported causal estimands.

        - ``ate``: average treatment effect over every training row.
        - ``att``: average effect on the treated (rows whose observed treatment
          equals ``treatment_action``). Categorical treatments only — ATT for a
          continuous treatment requires a dose band, which is not yet supported.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````