For the complete documentation index, see llms.txt. This page is also available as Markdown.

Simulations

List simulations

get
/api/v1/workspaces/{wsId}/simulations

Returns the workspace's simulation runs, newest first, whether they were started via this API, the UI, or an application. Cursor-paginated; pagination.total is the count matching the current filters. Result payloads are omitted — use /simulations/{id}/results or /simulations/{id}/export/{format}. Each run carries exportFormats: the formats /simulations/{id}/export/{format} accepts for it — ["json", "csv"] for a completed forecast-shaped run on a multi-environment (panel) model, ["json"] for any other completed run, [] while a run is unfinished. Single-environment models produce no panel forecast, so they never offer csv. A csv entry means the run is eligible by model and scenario shape; the export additionally requires the panel result artifacts to still be present in the data lake and returns 400 if they are not.

Authorizations
AuthorizationstringRequired

An API key (pk_...) created on the Organisation API page, or an OAuth access token. Every operation requires one.

Path parameters
wsIdstringRequired

Path parameter: wsId

Example: 123
Query parameters
limitnumber · min: 1 · max: 1000Optional

Page size (1-1000, default 50).

Example: 1
cursorstringOptional

Opaque cursor from a previous response's pagination.cursor.

Example: example
statusstringOptional

Filter by run status.

Example: example
digitalTwinIdstringOptional

Only return runs of this digital twin.

Example: 123
scenarioTypestring · enumOptionalPossible values:
Responses
200

Successful response

application/json
get/api/v1/workspaces/{wsId}/simulations
GET /api/v1/workspaces/{wsId}/simulations HTTP/1.1
Host: sandbox.rootcause.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "data": [],
  "pagination": {
    "cursor": "text",
    "hasMore": true,
    "total": 1
  }
}

Run simulation

post
/api/v1/workspaces/{wsId}/simulations

Runs a digital-twin simulation with a scenario. Body: digitalTwinId, digitalTwinVersionId, scenario (key-value inputs), optional environmentGroupIds, optional webhookUrl. Proxies to data-service POST /api/digital-twin/execute-run. Returns 202 with runId and links (self, results). Simulation runs asynchronously; poll GET /simulations/{runId} for status and GET /simulations/{runId}/results for outputs when ready.

Authorizations
AuthorizationstringRequired

An API key (pk_...) created on the Organisation API page, or an OAuth access token. Every operation requires one.

Path parameters
wsIdstringRequired

Path parameter: wsId

Example: 123
Body
digitalTwinIdstringRequired

Id of the digital twin to simulate

digitalTwinVersionIdstringRequired

Id of the trained version to run against

environmentGroupIdsstring[] · nullableOptional

Multi-environment (panel) twins: saved environment groups to scope the run to. The server resolves each group's membership against the version at submit time and narrows the run to it: when the scenario also names environments the two are intersected, never unioned, so a group can only ever shrink a scenario. An empty intersection is a 400. What it resolved is frozen onto the run as environmentGroupSnapshots. Ignored by single-environment twins.

webhookUrlstring · uri · nullableOptional

Optional URL called when the run completes

Responses
202

Accepted; poll the linked resource for completion

application/json
post/api/v1/workspaces/{wsId}/simulations
POST /api/v1/workspaces/{wsId}/simulations HTTP/1.1
Host: sandbox.rootcause.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 170

{
  "digitalTwinId": "text",
  "digitalTwinVersionId": "text",
  "scenario": {
    "ANY_ADDITIONAL_PROPERTY": "anything"
  },
  "environmentGroupIds": [
    "text"
  ],
  "webhookUrl": "https://example.com"
}
{
  "data": {
    "runId": "text",
    "status": "text",
    "createdAt": "text",
    "links": {
      "self": "text",
      "results": "text"
    }
  }
}

Get simulation

get
/api/v1/workspaces/{wsId}/simulations/{id}

Returns the simulation run by id. Read from platform MongoDB (digitalTwinRun collection). Must belong to the workspace. Includes status, inputs, metadata, and exportFormats (see the list endpoint); use /simulations/{id}/results for output data. A run submitted with environmentGroupIds also carries environmentGroupSnapshots: one entry per group ({id, name, envKeys, droppedEnvKeys, notice?}) recording the membership the server resolved at submit time. It is a frozen record, not a live read — editing or deleting the group afterwards leaves it untouched, and droppedEnvKeys names members the version could not honour.

Authorizations
AuthorizationstringRequired

An API key (pk_...) created on the Organisation API page, or an OAuth access token. Every operation requires one.

Path parameters
wsIdstringRequired

Path parameter: wsId

Example: 123
idstringRequired

Path parameter: id

Example: 123
Responses
200

Successful response

application/json
get/api/v1/workspaces/{wsId}/simulations/{id}
GET /api/v1/workspaces/{wsId}/simulations/{id} HTTP/1.1
Host: sandbox.rootcause.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "data": {
    "id": "text",
    "organisationId": "text",
    "workspaceId": "text",
    "digitalTwinId": "text",
    "digitalTwinVersionIds": [
      "text"
    ],
    "userQuery": null,
    "timeStarted": "text",
    "timeCompleted": null,
    "status": "pending",
    "error": null,
    "progress": {
      "percentage": 1,
      "state": "text",
      "eta": null
    },
    "scenario": {
      "type": "text",
      "objectives": [
        {
          "direction": "maximise",
          "variable": "text",
          "metricSqlQuery": "text",
          "unit": {},
          "weight": 1,
          "variablesRelevantToMetric": [
            "text"
          ],
          "target": {
            "type": "percentage",
            "value": null
          },
          "conceptId": null,
          "conceptEditVersion": 1
        }
      ],
      "conditions": [
        {
          "variable": "text",
          "operator": "eq",
          "value": 1
        }
      ],
      "decisionVars": [
        "text"
      ],
      "variableConstraints": [
        {
          "variable": "text",
          "type": "range",
          "minValue": null,
          "maxValue": null,
          "allowedValues": [
            "text"
          ],
          "maxChangePercent": 1,
          "conditionalAllowedValues": [
            {
              "condition": {
                "variable": "text",
                "operator": "eq",
                "value": 1
              },
              "allowedValues": [
                "text"
              ],
              "minValue": null,
              "maxValue": null
            }
          ]
        }
      ],
      "metricConstraints": [
        {
          "metricName": "text",
          "sqlQuery": "text",
          "constraintType": "min_value",
          "value": null,
          "booleanValue": null,
          "temporal": {
            "startDate": null,
            "endDate": null,
            "startTimestampMs": null,
            "endTimestampMs": null,
            "intervalSteps": null
          }
        }
      ],
      "segmentDefinitions": [
        {
          "id": "text",
          "description": null,
          "conditions": [
            {
              "variable": "text",
              "operator": "eq",
              "value": 1
            }
          ]
        }
      ],
      "enableSegmentInterventions": false,
      "interventionTypes": {
        "ANY_ADDITIONAL_PROPERTY": "text"
      },
      "interventionCountConfig": {
        "maxInterventions": 1,
        "optimizeCount": true
      }
    },
    "outputs": {
      "ANY_ADDITIONAL_PROPERTY": {
        "results": {
          "ANY_ADDITIONAL_PROPERTY": [
            {
              "timestamp": null,
              "prediction": null,
              "probabilities": [
                1
              ],
              "lowerBound": [
                1
              ],
              "upperBound": [
                1
              ],
              "confidenceLevel": null
            }
          ]
        },
        "changepoints": {
          "ANY_ADDITIONAL_PROPERTY": [
            {
              "stepIndex": 1,
              "timestamp": 1,
              "direction": "up",
              "magnitude": 1,
              "primaryDriver": "text",
              "driverContribution": 1
            }
          ]
        },
        "history": {
          "ANY_ADDITIONAL_PROPERTY": {
            "timestamps": [
              1
            ],
            "values": [
              null
            ]
          }
        }
      }
    },
    "outputsStorageType": "inline",
    "resultsSummary": {
      "summary": "text",
      "keyPoints": [
        "text"
      ]
    },
    "environmentGroupSnapshots": [
      {
        "id": "text",
        "name": "text",
        "envKeys": [
          "text"
        ],
        "droppedEnvKeys": [
          "text"
        ],
        "notice": null
      }
    ],
    "executedByUserId": null,
    "applicationExecutionId": null,
    "exportFormats": [
      "json"
    ]
  }
}

Get simulation results

get
/api/v1/workspaces/{wsId}/simulations/{id}/results

Returns the simulation outputs (run.outputs) from platform MongoDB. 404 if the run has no outputs yet (e.g. still running or failed before producing results). Use after GET /simulations/{id} shows completion.

Authorizations
AuthorizationstringRequired

An API key (pk_...) created on the Organisation API page, or an OAuth access token. Every operation requires one.

Path parameters
wsIdstringRequired

Path parameter: wsId

Example: 123
idstringRequired

Path parameter: id

Example: 123
Responses
200

Successful response

application/json
dataany of · nullableRequired

Payload not declared in this repo

stringOptional
or
numberOptional
or
booleanOptional
or
or
get/api/v1/workspaces/{wsId}/simulations/{id}/results
GET /api/v1/workspaces/{wsId}/simulations/{id}/results HTTP/1.1
Host: sandbox.rootcause.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "data": "text"
}

Read scoring verdicts and per-row changes

get
/api/v1/workspaces/{wsId}/simulations/{id}/score

Reads a completed batch-scoring run back: digest (verdict counts, top drivers, row summaries) plus one page of per-row detail with each row's full change list. Query params: limit (default 50), cursor. 409 while the run is still executing; 404 when the run carries no counterfactual results (it was not a scoring run).

Authorizations
AuthorizationstringRequired

An API key (pk_...) created on the Organisation API page, or an OAuth access token. Every operation requires one.

Path parameters
wsIdstringRequired

Path parameter: wsId

Example: 123
idstringRequired

Path parameter: id

Example: 123
Query parameters
limitnumber · min: 1 · max: 1000Optional

Page size (1-1000, default 50).

Example: 1
cursorstringOptional

Opaque cursor from a previous response's pagination.cursor.

Example: example
Responses
200

Successful response

application/json
get/api/v1/workspaces/{wsId}/simulations/{id}/score
GET /api/v1/workspaces/{wsId}/simulations/{id}/score HTTP/1.1
Host: sandbox.rootcause.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "data": [],
  "pagination": {
    "cursor": "text",
    "hasMore": true,
    "total": 1
  }
}

Read a sweep curve

get
/api/v1/workspaces/{wsId}/simulations/{id}/sweep

Reads the full dose-response curve of a completed range-intervention (sweep) run, one metric per call. Query param metric selects the curve; omit it to list the available metrics plus the sweep digest. Each point carries the swept value, mean, standard deviation, and confidence interval. 409 while the run is still executing; 404 when the run carries no sweep.

Authorizations
AuthorizationstringRequired

An API key (pk_...) created on the Organisation API page, or an OAuth access token. Every operation requires one.

Path parameters
wsIdstringRequired

Path parameter: wsId

Example: 123
idstringRequired

Path parameter: id

Example: 123
Query parameters
metricstringOptional

Which metric's curve to return; required when the run carries several.

Example: example
environmentstringOptional

Which environment's curve to return on a multi-environment (panel) run. Required there: without it the response lists the available environments instead of picking one.

Example: example
environmentFilterstringOptional

Narrows the environment listing on a panel run to keys containing this text.

Example: example
Responses
200

Successful response

application/json
dataany of · nullableRequired

Payload not declared in this repo

stringOptional
or
numberOptional
or
booleanOptional
or
or
get/api/v1/workspaces/{wsId}/simulations/{id}/sweep
GET /api/v1/workspaces/{wsId}/simulations/{id}/sweep HTTP/1.1
Host: sandbox.rootcause.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "data": "text"
}

Export simulation

get
/api/v1/workspaces/{wsId}/simulations/{id}/export/{format}

Downloads a completed simulation as a file. format=json returns a self-contained bundle (run metadata, scenario, and full outputs) and works for every scenario type. format=csv streams the server-side wide forecast CSV and is only available for forecast-shaped simulations (forecast, panel_forecast, prediction) that ran against a multi-environment (panel) model with parquet-backed results; anything else gets a 400 pointing at format=json. Check exportFormats on the run to know in advance. 400 if the run has not completed. Requires the exports:read scope.

Authorizations
AuthorizationstringRequired

An API key (pk_...) created on the Organisation API page, or an OAuth access token. Every operation requires one.

Path parameters
formatstring · enumRequired

Export format

Example: csvPossible values:
Responses
200

Successful response

application/octet-stream
dataany of · nullableRequired

Payload not declared in this repo

stringOptional
or
numberOptional
or
booleanOptional
or
or
get/api/v1/workspaces/{wsId}/simulations/{id}/export/{format}
GET /api/v1/workspaces/{wsId}/simulations/{id}/export/{format} HTTP/1.1
Host: sandbox.rootcause.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "data": "text"
}

Last updated