Create a simulation
curl --request POST \
--url https://api.semilattice.ai/v1/simulations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"mode": "<string>",
"goal": "<string>",
"user_model_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"inputs": {},
"title": "<string>",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"survey_design": {
"stimulus": "<string>",
"item_sets": [
{
"ask": "<string>",
"items": [
"<string>"
],
"scale": [
"<string>"
]
}
],
"custom_questions": [
{
"question_text": "<string>",
"answer_options": [
"<string>"
]
}
]
},
"context_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"round_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.semilattice.ai/v1/simulations"
payload = {
"mode": "<string>",
"goal": "<string>",
"user_model_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"inputs": {},
"title": "<string>",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"survey_design": {
"stimulus": "<string>",
"item_sets": [
{
"ask": "<string>",
"items": ["<string>"],
"scale": ["<string>"]
}
],
"custom_questions": [
{
"question_text": "<string>",
"answer_options": ["<string>"]
}
]
},
"context_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"round_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
mode: '<string>',
goal: '<string>',
user_model_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
inputs: {},
title: '<string>',
project_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
survey_design: {
stimulus: '<string>',
item_sets: [{ask: '<string>', items: ['<string>'], scale: ['<string>']}],
custom_questions: [{question_text: '<string>', answer_options: ['<string>']}]
},
context_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
round_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://api.semilattice.ai/v1/simulations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.semilattice.ai/v1/simulations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'mode' => '<string>',
'goal' => '<string>',
'user_model_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'inputs' => [
],
'title' => '<string>',
'project_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'survey_design' => [
'stimulus' => '<string>',
'item_sets' => [
[
'ask' => '<string>',
'items' => [
'<string>'
],
'scale' => [
'<string>'
]
]
],
'custom_questions' => [
[
'question_text' => '<string>',
'answer_options' => [
'<string>'
]
]
]
],
'context_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'round_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.semilattice.ai/v1/simulations"
payload := strings.NewReader("{\n \"mode\": \"<string>\",\n \"goal\": \"<string>\",\n \"user_model_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inputs\": {},\n \"title\": \"<string>\",\n \"project_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"survey_design\": {\n \"stimulus\": \"<string>\",\n \"item_sets\": [\n {\n \"ask\": \"<string>\",\n \"items\": [\n \"<string>\"\n ],\n \"scale\": [\n \"<string>\"\n ]\n }\n ],\n \"custom_questions\": [\n {\n \"question_text\": \"<string>\",\n \"answer_options\": [\n \"<string>\"\n ]\n }\n ]\n },\n \"context_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"round_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.semilattice.ai/v1/simulations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"mode\": \"<string>\",\n \"goal\": \"<string>\",\n \"user_model_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inputs\": {},\n \"title\": \"<string>\",\n \"project_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"survey_design\": {\n \"stimulus\": \"<string>\",\n \"item_sets\": [\n {\n \"ask\": \"<string>\",\n \"items\": [\n \"<string>\"\n ],\n \"scale\": [\n \"<string>\"\n ]\n }\n ],\n \"custom_questions\": [\n {\n \"question_text\": \"<string>\",\n \"answer_options\": [\n \"<string>\"\n ]\n }\n ]\n },\n \"context_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"round_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.semilattice.ai/v1/simulations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"mode\": \"<string>\",\n \"goal\": \"<string>\",\n \"user_model_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inputs\": {},\n \"title\": \"<string>\",\n \"project_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"survey_design\": {\n \"stimulus\": \"<string>\",\n \"item_sets\": [\n {\n \"ask\": \"<string>\",\n \"items\": [\n \"<string>\"\n ],\n \"scale\": [\n \"<string>\"\n ]\n }\n ],\n \"custom_questions\": [\n {\n \"question_text\": \"<string>\",\n \"answer_options\": [\n \"<string>\"\n ]\n }\n ]\n },\n \"context_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"round_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Simulations
Create a simulation
Create a simulation from mode + goal + inputs + user_model_ids.
Returns immediately in status planning; the plan is generated in the
background. Poll GET /v1/simulations/{id} until status is planned or
failed.
With project_id it joins round_id, or the project’s latest round. Refused with 409 while the agent in the app is replying on that project.
POST
/
v1
/
simulations
Create a simulation
curl --request POST \
--url https://api.semilattice.ai/v1/simulations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"mode": "<string>",
"goal": "<string>",
"user_model_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"inputs": {},
"title": "<string>",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"survey_design": {
"stimulus": "<string>",
"item_sets": [
{
"ask": "<string>",
"items": [
"<string>"
],
"scale": [
"<string>"
]
}
],
"custom_questions": [
{
"question_text": "<string>",
"answer_options": [
"<string>"
]
}
]
},
"context_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"round_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.semilattice.ai/v1/simulations"
payload = {
"mode": "<string>",
"goal": "<string>",
"user_model_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"inputs": {},
"title": "<string>",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"survey_design": {
"stimulus": "<string>",
"item_sets": [
{
"ask": "<string>",
"items": ["<string>"],
"scale": ["<string>"]
}
],
"custom_questions": [
{
"question_text": "<string>",
"answer_options": ["<string>"]
}
]
},
"context_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"round_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
mode: '<string>',
goal: '<string>',
user_model_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
inputs: {},
title: '<string>',
project_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
survey_design: {
stimulus: '<string>',
item_sets: [{ask: '<string>', items: ['<string>'], scale: ['<string>']}],
custom_questions: [{question_text: '<string>', answer_options: ['<string>']}]
},
context_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
round_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://api.semilattice.ai/v1/simulations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.semilattice.ai/v1/simulations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'mode' => '<string>',
'goal' => '<string>',
'user_model_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'inputs' => [
],
'title' => '<string>',
'project_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'survey_design' => [
'stimulus' => '<string>',
'item_sets' => [
[
'ask' => '<string>',
'items' => [
'<string>'
],
'scale' => [
'<string>'
]
]
],
'custom_questions' => [
[
'question_text' => '<string>',
'answer_options' => [
'<string>'
]
]
]
],
'context_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'round_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.semilattice.ai/v1/simulations"
payload := strings.NewReader("{\n \"mode\": \"<string>\",\n \"goal\": \"<string>\",\n \"user_model_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inputs\": {},\n \"title\": \"<string>\",\n \"project_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"survey_design\": {\n \"stimulus\": \"<string>\",\n \"item_sets\": [\n {\n \"ask\": \"<string>\",\n \"items\": [\n \"<string>\"\n ],\n \"scale\": [\n \"<string>\"\n ]\n }\n ],\n \"custom_questions\": [\n {\n \"question_text\": \"<string>\",\n \"answer_options\": [\n \"<string>\"\n ]\n }\n ]\n },\n \"context_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"round_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.semilattice.ai/v1/simulations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"mode\": \"<string>\",\n \"goal\": \"<string>\",\n \"user_model_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inputs\": {},\n \"title\": \"<string>\",\n \"project_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"survey_design\": {\n \"stimulus\": \"<string>\",\n \"item_sets\": [\n {\n \"ask\": \"<string>\",\n \"items\": [\n \"<string>\"\n ],\n \"scale\": [\n \"<string>\"\n ]\n }\n ],\n \"custom_questions\": [\n {\n \"question_text\": \"<string>\",\n \"answer_options\": [\n \"<string>\"\n ]\n }\n ]\n },\n \"context_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"round_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.semilattice.ai/v1/simulations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"mode\": \"<string>\",\n \"goal\": \"<string>\",\n \"user_model_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inputs\": {},\n \"title\": \"<string>\",\n \"project_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"survey_design\": {\n \"stimulus\": \"<string>\",\n \"item_sets\": [\n {\n \"ask\": \"<string>\",\n \"items\": [\n \"<string>\"\n ],\n \"scale\": [\n \"<string>\"\n ]\n }\n ],\n \"custom_questions\": [\n {\n \"question_text\": \"<string>\",\n \"answer_options\": [\n \"<string>\"\n ]\n }\n ]\n },\n \"context_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"round_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Body
application/json
Research mode only. Fixes which questions are asked: one per item in each item set plus one per custom question. The question writer only words them. Leave out to let it decide what to ask. A malformed survey_design is a 422 like any other malformed field; a well-formed one that cannot be used (journey mode, nothing to ask, too many questions) is a 400.
Show child attributes
Show child attributes
Response
Successful Response