ExperimentsCompute experiment

Compute experiment

Run the weighted-synthetic-control diff-in-diff inference for this experiment against the location's BigQuery dataset, store the metrics on the experiment's result, and set status to computed. Requires an agency (ak_) key. Compute is gated on the measured window (test window + cooldown): before it closes the endpoint returns 409 window_not_complete. Pass { "allow_partial": true } for a provisional mid-window read — it is stamped result.partial: true and excluded from /coefficients until a full compute overwrites it. Compute also refuses to produce silently-wrong numbers: no revenue in the test or control regions (422 no_revenue_in_regions / no_revenue_in_controls), a truncated BigQuery page (422 result_truncated), a missing Meta insights table (422 spend_table_missing), mixed account currencies (422 mixed_currencies — set spend.account_id), or Meta spend data that ends well before the measured window (409 stale_spend_data — wait for the next Airbyte sync).

curl -X POST "https://mythic-analytics.gulp.workers.dev/client/v1/incrementality/experiments/123e4567-e89b-12d3-a456-426614174000/compute" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -d '{
  "allow_partial": true
}'
{
  "success": true,
  "data": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "location_id": "example_string",
    "name": "John Doe",
    "channel": "meta",
    "status": "draft",
    "definition": {
      "test_regions": [
        "California",
        "Texas"
      ],
      "control_regions": [
        "Ohio",
        "Georgia"
      ],
      "pre_window": {
        "from": "2026-05-01",
        "to": "2026-05-31"
      },
      "test_window": {
        "from": "2026-05-01",
        "to": "2026-05-31"
      },
      "revenue": {
        "source": "event",
        "measure": "revenue",
        "event_name": "purchase",
        "json_path": "$.value",
        "timezone": "America/New_York",
        "table": "transactions",
        "column": "amount",
        "region_col": "state",
        "date_col": "created_date"
      },
      "spend": {
        "source": "geo_stream",
        "region_col": "region",
        "table": "example_string",
        "campaign_ids": [
          "example_string"
        ],
        "name_pattern": "John Doe",
        "account_id": "example_string",
        "purchase_action_type": "lead"
      },
      "geo_inherit": true,
      "daily_budget": 500,
      "mde_iroas": 3.14,
      "design_lookback_days": 42,
      "cooldown_days": 42,
      "exclude_dates": [
        "2024-12-25"
      ],
      "alert_webhook_url": "example_string"
    },
    "design": {
      "ok": true,
      "reason": "example_string",
      "recommended_days": 28,
      "raw_days": 42,
      "sigma_daily": 3.14,
      "scaling_k": 3.14,
      "baseline_days": 42,
      "baseline_window": {
        "from": "2026-05-01",
        "to": "2026-05-31"
      },
      "assumptions": {
        "daily_budget": 3.14,
        "mde_iroas": 3.14,
        "alpha": 3.14,
        "power": 3.14
      }
    },
    "progress": {
      "phase": "pending",
      "days_total": 42,
      "test_days": 42,
      "cooldown_days": 42,
      "days_elapsed": 42,
      "days_remaining": 42,
      "percent": 42,
      "recommended_days": 42,
      "underpowered": true
    },
    "result": {
      "incremental_revenue": 3.14,
      "test_spend": 3.14,
      "platform_revenue": 3.14,
      "iroas": 3.14,
      "platform_roas": 3.14,
      "coefficient": 1.15,
      "ci_width": 3.14,
      "se_lift": 3.14,
      "sigma_daily": 3.14,
      "se_iroas": 3.14,
      "se_coefficient": 3.14,
      "z_score": 3.14,
      "confidence": 0.97,
      "p_value": 3.14,
      "significant": true,
      "two_sided_significant": true,
      "iroas_ci": [
        3.14
      ],
      "coefficient_ci": [
        3.14
      ],
      "partial": true,
      "series_key": "example_string",
      "spend_currency": "example_string",
      "spend_data_through": "2024-12-25",
      "pre_days": 42,
      "post_days": 42,
      "control_weights": {},
      "fit_r2": 3.14,
      "outlier_days": [
        "2024-12-25"
      ],
      "excluded_dates": [
        "2024-12-25"
      ],
      "control_shift_z": 3.14,
      "warnings": [
        "example_string"
      ],
      "test_pre": 3.14,
      "test_post": 3.14,
      "control_pre": 3.14,
      "control_post": 3.14,
      "computed_at": "2024-12-25T10:00:00Z"
    },
    "created_at": "2024-12-25T10:00:00Z",
    "updated_at": "2024-12-25T10:00:00Z"
  }
}
POST
/client/v1/incrementality/experiments/{id}/compute
POST
Base URLstring

Target server for requests. Edit to use your own host.

Bearer Token
Bearer Tokenstring
Required

Client key as bearer token. Use an agency key (Bearer ak_...) for read-write access or a location secret key (Bearer sk_...) for read-only access. Scoped keys (mcp_) are accepted too and need incrementality:read or incrementality:write. See Using an mcp_ key over HTTP.

Client key as bearer token. Use an agency key (Bearer ak_...) for read-write access or a location secret key (Bearer sk_...) for read-only access. Scoped keys (mcp_) are accepted too and need incrementality:read or incrementality:write. See Using an mcp_ key over HTTP.
path
idstring
Required

Experiment identifier.

Format: uuid
Content-Typestring
Required

The media type of the request body

Options: application/json
allow_partialboolean

Compute before the measured window closes (provisional; excluded from /coefficients).

Request Preview
Response

Response will appear here after sending the request

Authentication

header
Authorizationstring
Required

Bearer token. Client key as bearer token. Use an agency key (Bearer ak_...) for read-write access or a location secret key (Bearer sk_...) for read-only access. Scoped keys (mcp_) are accepted too and need incrementality:read or incrementality:write. See Using an mcp_ key over HTTP.

Path Parameters

idstring
Required

Experiment identifier.

Body

application/json
allow_partialboolean

Compute before the measured window closes (provisional; excluded from /coefficients).

Responses

successboolean
dataobject