Create scenario - Cognigy Documentation

Documentation Index

Fetch the complete documentation index at: /llms.txt

Use this file to discover all available pages before exploring further.

Create scenario

POST /simulations

cURL

curl --request POST \
  --url https://api-trial.cognigy.ai/testing/simulations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "projectReference": "<string>",
  "name": "<string>",
  "persona": "<string>",
  "personaName": "<string>",
  "mission": "<string>",
  "successCriteria": [
    {
      "type": "<string>",
      "params": {}
    }
  ],
  "maxTurns": 123,
  "timeout": 123,
  "aiAgentReferenceId": "<string>",
  "flowReferenceId": "<string>",
  "jobNodeId": "<string>"
}
'
import requests

url = "https://api-trial.cognigy.ai/testing/simulations"

payload = {
    "projectReference": "<string>",
    "name": "<string>",
    "persona": "<string>",
    "personaName": "<string>",
    "mission": "<string>",
    "successCriteria": [
        {
            "type": "<string>",
            "params": {}
        }
    ],
    "maxTurns": 123,
    "timeout": 123,
    "aiAgentReferenceId": "<string>",
    "flowReferenceId": "<string>",
    "jobNodeId": "<string>"
}
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({
    projectReference: '<string>',
    name: '<string>',
    persona: '<string>',
    personaName: '<string>',
    mission: '<string>',
    successCriteria: [{type: '<string>', params: {}}],
    maxTurns: 123,
    timeout: 123,
    aiAgentReferenceId: '<string>',
    flowReferenceId: '<string>',
    jobNodeId: '<string>'
  })
};

fetch('https://api-trial.cognigy.ai/testing/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-trial.cognigy.ai/testing/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([
    'projectReference' => '<string>',
    'name' => '<string>',
    'persona' => '<string>',
    'personaName' => '<string>',
    'mission' => '<string>',
    'successCriteria' => [
        [
                'type' => '<string>',
                'params' => [
                ]
        ]
    ],
    'maxTurns' => 123,
    'timeout' => 123,
    'aiAgentReferenceId' => '<string>',
    'flowReferenceId' => '<string>',
    'jobNodeId' => '<string>'
    ]),
  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;
}
?>

Response

201 Application JSON

{
  "id": "<string>",
  "referenceId": "<string>",
  "name": "<string>",
  "persona": "<string>",
  "personaName": "<string>",
  "mission": "<string>",
  "successCriteria": [
    {
      "type": "<string>",
      "params": {}
    }
  ],
  "organisationReference": "<string>",
  "projectReference": "<string>",
  "createdAt": 123,
  "createdBy": "<string>",
  "lastChanged": 123,
  "lastChangedBy": "<string>",
  "maxTurns": 123,
  "timeout": 123,
  "aiAgentReferenceId": "<string>",
  "aiAgentId": "<string>",
  "flowReferenceId": "<string>",
  "flowId": "<string>",
  "jobNodeId": "<string>",
  "updatedAt": 123,
  "updatedBy": "<string>"
}
{
  "error": "<string>",
  "field": "<string>",
  "code": "<string>",
  "traceId": "<string>"
}

Authorizations

bearerAuth

Name Type Description
Authorization string JWT Bearer Token for authentication

Query Parameters

Name Type Required Description
projectId string yes Project identifier

Body

Name Type Required Description
projectReference string yes Project reference (required in body)
name string yes Name of the scenario
persona string yes Persona description
personaName string yes Name of the persona
mission string yes Mission description
successCriteria object[] yes List of success criteria (structured objects)
maxTurns integer no Maximum number of turns
timeout integer no Timeout in seconds
aiAgentReferenceId string no Reference ID of the AI Agent
flowReferenceId string no Reference ID of Flow
jobNodeId string no Job Node ID for precise tool context tracking