POST /simulations/{simulationKey}/runs

Executes a simulation run. This creates a new run instance with a unique index and initializes a Durable Object to handle the simulation execution.

Path Parameters

simulationKeyrequired

The unique key of the simulation to run.

Request

outputrequired

The output format for the simulation run. Currently, only stream is supported.

Success

Upon success, responds with a 201 Created with a simulation run body.

simulationrequired

The key of the simulation that was run.

indexrequired

The sequential index of this run. Each run for a given simulation gets a unique integer index starting from 1.

outputrequired

The output format for this simulation run.

createdAtrequired

The timestamp when the simulation run was created.

Failure

Responds with a 400 Bad Request if the simulation does not exist or the request body is invalid.

Responds with a 409 Conflict if multiple runs are created concurrently for the same simulation.

Example

Run a simulation:

POST /simulations/my-simulation/runs
Content-Type: application/json

{
  "output": "stream"
}

Response:

{
  "simulation": "my-simulation",
  "index": 1,
  "output": "stream",
  "createdAt": "2025-04-16T15:45:30.789Z"
}