---
title: "Queue a Monte Carlo schedule risk run"
method: POST
path: "/scheduling/projects/{id}/risk-runs"
tags: ["scheduling"]
---

# Queue a Monte Carlo schedule risk run

`POST /scheduling/projects/{id}/risk-runs`

## Request

- Base URL: `https://api.onplana.com/api`
- URL: `https://api.onplana.com/api/scheduling/projects/{id}/risk-runs`
- Auth: one of:
  - HTTP bearer
  - API key in header `Authorization`

Samples every open task's duration from its three-point estimate (optimisticDurationMinutes / pessimisticDurationMinutes; tasks with none take defaultRange) and reschedules the project once per iteration. Runs in the background; poll GET .../risk-runs/{runId} until status is DONE or FAILED. The plan is read when the run starts. Needs task edit rights on the project. Bounds: iterations clamped to 100..5000 (default 1000), at most 5000 tasks, one queued run per project, 20 runs per workspace per hour; the last 20 finished runs per project are kept. Off unless the server switch schedule_risk_enabled is on (503 SCHEDULE_RISK_OFF).

## Path parameters

- `id` string, required

## Headers

- `X-Organization-Id` string, required

## Request body

- object
  - `iterations` integer: Clamped to 100..5000. Default 1000
  - `distribution` 'triangular' | 'pert'
  - `defaultRange` object: For tasks with no estimate of their own, as shares of the most likely duration. Default 0.9 / 1.25 (-10% / +25%)
    - `optimisticFactor` number, required
    - `pessimisticFactor` number, required
  - `targetDate` string, date, nullable: Report the chance of finishing by this day. Absent: the project end date. Null: no target
  - `seed` integer: Reproduce an earlier run. Drawn at random when absent

## Response `202`

Queued: the run as GET .../risk-runs lists it (status QUEUED)

## Other responses

- `400`: Invalid body, or TOO_MANY_TASKS
- `402`: Plan gate: feature scheduleRisk, Business and above. Also refused inside a downgrade's read-only window (grace: true)
- `403`: No task edit rights on the project
- `404`: Project not found, or not visible to the caller
- `409`: RUN_ALREADY_QUEUED, with the queued run's runId
- `429`: RATE_LIMITED: 20 runs per workspace per hour; Retry-After set
- `503`: SCHEDULE_RISK_OFF (the server switch is off) or QUEUE_UNAVAILABLE

---

[API](https://skmtc.dev/onplana/apis/onplana-api.md) · [All operations](https://skmtc.dev/onplana/apis/onplana-api/llms.txt) · [OpenAPI document](https://skmtc.dev/onplana/apis/onplana-api/revisions/c3d6c89e9dc8?raw)
