Run a Monte Carlo simulation
run_simulationRuns a Monte Carlo simulation over a graph of probabilistic root and calculated nodes, returning the full output distribution instead of one guessed number. Use this when you need the range and likelihood of outcomes for a plan driven by uncertain inputs, not just its average case. Both tiers run to completion and return the full result in this same call, never a run_id to poll. Example: {"graph":{"root_nodes":[{"id":"root","distribution_type":"normal","distribution_params":{"mean":100,"std":15}}],"calc_nodes":[{"id":"out","formula":"{e1}"}],"edges":[{"id":"e1","source":"root","target":"out"}],"run_params":{"trials":1000,"time_periods":12}}}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| seed | No | Optional RNG seed; reproducible only on the small/inline path. | |
| graph | Yes | The full simulation graph (root_nodes, calc_nodes, edges, run_params). See GET /api/v1/contract for valid distribution types. | |
| api_key | No | Your API key from POST /api/v1/accounts. Debits credits per run. Omit to run anonymously (free, but no credit accounting). | |
| include_histogram | No | Include a per-element histogram in each summary element. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tier | Yes | 'small' or 'large'. | |
| result | Yes | The summarised result with aggregations. | |
| run_id | Yes | ||
| status | Yes | Always 'completed' on a 2xx response. A run that fails propagates as an error response (non-2xx + error envelope), not a 'failed' result. | |
| total_trials | Yes | ||
| credits_debited | No | Credits charged to the account (0 for anonymous). |