{"data":{"markdownRemark":{"html":"<div class=\"ui segment info message\">\nNote: if you wish to modify variables in Globals please make sure any inputs are prefaced with system. or are contained within a system object.\n</div>\n<h1 id=\"post\"><a href=\"#post\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>POST</h1>\n<p>Creates and runs a scenario simulation and returns an object with its various attributes.</p>\n<h2 id=\"request\"><a href=\"#request\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Request</h2>\n<p class=\"code-header\">Example request body</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\"><span class=\"token function\">curl</span> -X POST \\\n  http://localhost:8080/api/simulations/scenario \\\n  -H <span class=\"token string\">'Cache-Control: no-cache'</span> \\\n  -H <span class=\"token string\">'Content-Type: application/json'</span> \\\n  -d <span class=\"token string\">'{\n  \"modelName\": \"Simple Credit Card\", \n  \"output\": {\"uri\": \"scenarioFolder\" },\n  \"scenarios\":[{\n    \"name\": \"myScenario\", \n    \"runs\": 3,\n    \"seeds\": [1234, 2314, 4213]\n    \"scenarioData\": {\n        \"0\": {\"spending\": 200},\n        \"4\": {\"spending\": 100, \"interest\": 0.04}\n      }\n  }]\n}'</span></code></pre></div>\n<div class=\"ui segment warning message\">\n<h4>Windows user File</h4>\n Characters need to be escaped when using scenarios in windows on cmd.\n<p> <code class=\"language-text\">&#39;{&quot;name&quot;: &quot;Game of Life&quot;}&#39;</code> must become <code class=\"language-text\">&#39;{\\&quot;name\\&quot;: \\&quot;Game of Life\\&quot;}&#39;</code></p>\n</div>\n<h3 id=\"body-schema\"><a href=\"#body-schema\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Body Schema</h3>\n<table class=\"ui basic table\">\n<thead>\n<tr>\n<th>Parameter</th>\n<th>Type</th>\n<th>Required</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>modelName</td>\n<td>string</td>\n<td>true</td>\n<td>Name of model to run a scenario for. This is the name that the model is registered with when starting the server.</td>\n</tr>\n<tr>\n<td>scenarios</td>\n<td>[object]</td>\n<td></td>\n<td>List of objects describing scenarios to run for this model</td>\n</tr>\n<tr>\n<td>>name</td>\n<td>object</td>\n<td></td>\n<td>A user specified name for the scenario. If not provided, scenario_{id} will be used as the name, where id is the index of this scenario in the array of scenarios</td>\n</tr>\n<tr>\n<td>>runs</td>\n<td>integer</td>\n<td></td>\n<td>Number of times to run this scenario.</td>\n</tr>\n<tr>\n<td>>seeds</td>\n<td>[long]</td>\n<td></td>\n<td>A list of seeds to set for the runs of this simulation.</td>\n</tr>\n<tr>\n<td>>scenarioData</td>\n<td>object</td>\n<td>true</td>\n<td>Key value pairs of ticks to the inputs to set for those ticks. The tick `0` corrspond to the mode setup</td>\n</tr>\n<tr>\n<td>input</td>\n<td>object</td>\n<td></td>\n<td>\n<p>Details of input files to read the scenario data from. The name of the file will be used as the name of the scenarios.</p>\n \n <p>Required if scenarios field isn't present. If scenarios' fields are present, input will be ignored.</p>\n</td>\n</tr>\n<tr>\n<td>>uri</td>\n<td>string</td>\n<td>true</td>\n<td>Path to the files containing the scenario data</td>\n</tr>\n<tr>\n<td>output</td>\n<td>object</td>\n<td>true</td>\n<td>Details of the simulation's output</td>\n</tr>\n<tr>\n<td>>uri</td>\n<td>string</td>\n<td>true</td>\n<td>This is the root directory that the files generated by the model will be output to. Within this directory, a folder will be created for the entire run named using the uuid of the run (which is returned in the POST response, and a folder will be created for each run of the scenario</td>\n</tr>\n<tr>\n<td>customExportMetadata</td>\n<td>object</td>\n<td></td>\n<td>An object containing custom fields that will be included in the metadata.json file as part of the data output.</td>\n</tr>\n<tr>\n<td>config</td>\n<td>object</td>\n<td></td>\n<td>Key value object of config keys to update with values to update to.</td>\n</tr>\n</tbody>\n</table>\n<div class=\"ui segment info message\">\n<p>The parameters <strong>runs</strong> and <strong>seeds</strong> both controls the number of runs per defined scenarios. However, <strong>runs</strong> offer no control over the seeds generation.\nThe seeds will be generated using an internal prng. If you wish to control the specific seeds used, then provide the SDK with the <strong>seeds</strong> parameter. </p>\n<p>Only one should be provided. If both are provided but <strong>runs</strong> does not match <strong>seeds</strong>' size, an error will be thrown.</p>\n</div>\n<p class=\"code-header\">Example request body with inline scenario definition</p>\n<div class=\"gatsby-highlight\" data-language=\"json\"><pre class=\"language-json\"><code class=\"language-json\"><span class=\"token punctuation\">{</span><span class=\"token property\">\"modelName\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"Simple Credit Card\"</span><span class=\"token punctuation\">,</span> \n  <span class=\"token property\">\"output\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span><span class=\"token property\">\"uri\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"scenarioFolder\"</span> <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"scenarios\"</span><span class=\"token operator\">:</span><span class=\"token punctuation\">[</span><span class=\"token punctuation\">{</span>\n    <span class=\"token property\">\"name\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"myScenario\"</span><span class=\"token punctuation\">,</span> \n    <span class=\"token property\">\"runs\"</span><span class=\"token operator\">:</span> <span class=\"token number\">10</span><span class=\"token punctuation\">,</span> \n    <span class=\"token property\">\"ticks\"</span><span class=\"token operator\">:</span> <span class=\"token number\">20</span><span class=\"token punctuation\">,</span>\n    <span class=\"token property\">\"scenarioData\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n      <span class=\"token punctuation\">{</span>\n        <span class=\"token property\">\"0\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span><span class=\"token property\">\"spending\"</span><span class=\"token operator\">:</span> <span class=\"token number\">200</span><span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n        <span class=\"token property\">\"4\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span><span class=\"token property\">\"spending\"</span><span class=\"token operator\">:</span> <span class=\"token number\">100</span><span class=\"token punctuation\">,</span> <span class=\"token property\">\"interest\"</span><span class=\"token operator\">:</span> <span class=\"token number\">0.04</span><span class=\"token punctuation\">}</span>\n      <span class=\"token punctuation\">}</span>\n    <span class=\"token punctuation\">}</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">]</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<p class=\"code-header\">Example request body with scenario from input</p>\n<div class=\"gatsby-highlight\" data-language=\"json\"><pre class=\"language-json\"><code class=\"language-json\"><span class=\"token punctuation\">{</span><span class=\"token property\">\"modelName\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"Simple Credit Card\"</span><span class=\"token punctuation\">,</span> \n  <span class=\"token property\">\"output\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span><span class=\"token property\">\"uri\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"scenarioFolder\"</span> <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"input\"</span><span class=\"token operator\">:</span><span class=\"token punctuation\">{</span><span class=\"token property\">\"uri\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"/path/to/inputFiles\"</span><span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<div class=\"ui segment info message\">\nIf a request body has both inline scenario definition and and input path, the input path will be ignored.\n</div>\n<h2 id=\"response\"><a href=\"#response\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Response</h2>\n<table class=\"ui basic table\">\n<thead>\n<tr>\n<th>Status</th>\n<th>Meaning</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>200</td>\n<td><a href=\"https://tools.ietf.org/html/rfc7231#section-6.3.1\">OK</a></td>\n<td>Successfully created. The session ID is returned in a cookie named <code>simudyneSessionID</code>. You need to include this cookie in subsequent get requests.</td>\n</tr>\n<tr>\n<td>404</td>\n<td><a href=\"https://tools.ietf.org/html/rfc7231#section-6.5.4\">Not Found</a></td>\n<td>Simulation not found.</td>\n</tr>\n</tbody>\n</table>\n<h3 id=\"response-schema\"><a href=\"#response-schema\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Response Schema</h3>\n<p>Status Code <strong>200</strong></p>\n<table class=\"ui basic table\">\n<thead>\n<tr>\n<th>Name</th>\n<th>Type</th>\n<th>Required</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>id</td>\n<td>string(uuid)</td>\n<td>true</td>\n<td></td>\n</tr>\n<tr>\n<td>name</td>\n<td>string</td>\n<td>true</td>\n<td></td>\n</tr>\n<tr>\n<td>description</td>\n<td>string</td>\n<td>true</td>\n<td></td>\n</tr>\n<tr>\n<td>public</td>\n<td>boolean</td>\n<td>true</td>\n<td></td>\n</tr>\n<tr>\n<td>session</td>\n<td>string(uuid)</td>\n<td>true</td>\n<td>simudyneSessionID cookie</td>\n</tr>\n<tr>\n<td>kind</td>\n<td>string</td>\n<td>true</td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<p class=\"code-header\">Example 200 response body</p>\n<div class=\"gatsby-highlight\" data-language=\"json\"><pre class=\"language-json\"><code class=\"language-json\"><span class=\"token punctuation\">{</span>\n  <span class=\"token property\">\"id\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"d7558ad9-3405-4a4c-972a-531a87fdcd27\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"name\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"Game of Life\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"description\"</span><span class=\"token operator\">:</span>\n    <span class=\"token string\">\"The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970.\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"public\"</span><span class=\"token operator\">:</span> <span class=\"token boolean\">false</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"session\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"760b2d3e-20b2-42e6-9655-58e662e79e73\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"kind\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"pojo\"</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<br> \n<p>Status Code <strong>404</strong></p>\n<table class=\"ui basic table\">\n<thead>\n<tr>\n<th>Name</th>\n<th>Type</th>\n<th>Required</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>message</td>\n<td>string</td>\n<td>true</td>\n</tr>\n</tbody>\n</table>\n<p class=\"code-header\">Example 404 response body</p>\n<div class=\"gatsby-highlight\" data-language=\"json\"><pre class=\"language-json\"><code class=\"language-json\"><span class=\"token punctuation\">{</span>\n    <span class=\"token property\">\"message\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"SimulationRegistry: Could not find requested simulation default.\"</span>\n<span class=\"token punctuation\">}</span></code></pre></div>","headings":[{"value":"POST","depth":1},{"value":"Request","depth":2},{"value":"Body Schema","depth":3},{"value":"Response","depth":2},{"value":"Response Schema","depth":3}],"frontmatter":{"title":"/api/simulations/scenario","toc":null,"experimental":null}},"site":{"siteMetadata":{"title":"Simudyne Docs","latestVersion":"2.6"}}},"pageContext":{"absolutePath":"/home/vsts/work/1/s/content/2.5/rest_api/scenario/api_simulations_scenario.md","versioned":true,"version":"2.5","kind":"rest_api","pagePath":"/rest_api/scenario/api_simulations_scenario","chronology":{"prev":{"name":"Scenario Rest API","path":"/rest_api/scenario"},"next":{"name":"/api/simulations/scenario/{id}","path":"/rest_api/scenario/api_simulations_scenario_id"}},"lastUpdated":"2026-04-21T13:56:54.864Z"}}