import requests
url = "https://app.langwatch.ai/api/scenarios"
payload = {
"name": "<string>",
"situation": "<string>"
}
headers = {
"X-Auth-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Auth-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', situation: '<string>'})
};
fetch('https://app.langwatch.ai/api/scenarios', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/scenarios \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '
{
"name": "<string>",
"situation": "<string>"
}
'{
"id": "<string>",
"name": "<string>",
"situation": "<string>",
"criteria": [
"<string>"
],
"labels": [
"<string>"
],
"parameters": [
{
"name": "<string>",
"description": "<string>",
"defaultValue": "<string>",
"secret": true
}
],
"folderId": "<string>",
"platformUrl": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}Create a new scenario
Create a new scenario
import requests
url = "https://app.langwatch.ai/api/scenarios"
payload = {
"name": "<string>",
"situation": "<string>"
}
headers = {
"X-Auth-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Auth-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', situation: '<string>'})
};
fetch('https://app.langwatch.ai/api/scenarios', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/scenarios \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '
{
"name": "<string>",
"situation": "<string>"
}
'{
"id": "<string>",
"name": "<string>",
"situation": "<string>",
"criteria": [
"<string>"
],
"labels": [
"<string>"
],
"parameters": [
{
"name": "<string>",
"description": "<string>",
"defaultValue": "<string>",
"secret": true
}
],
"folderId": "<string>",
"platformUrl": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}Authorizations
Project API key for sending traces and accessing project-scoped resources. Format: sk-lw-... (no underscore). Obtain one by creating a project via the Admin API or the LangWatch UI.
Body
1The parameters this scenario declares by name, each with an optional description and default. A run supplies values for these names, readable from the scenario's own text as params.NAME. A parameter marked secret carries no default: its value is supplied per run, encrypted, delivered to the target as secrets.NAME, and never readable from the scenario's own text.
20Show child attributes
Show child attributes
The test suite (folder) to file this scenario in. It must name a non-archived folder of the same project. null unfiles the scenario.
Response
Scenario created
Was this page helpful?