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.
Update an existing scenario
Update an existing scenario
Try this endpoint
app.langwatch.ai
API key · X-Auth-Token
Kept in this tab. Cleared when you reload.
The 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.
Model for the simulated user, e.g. openai/gpt-6-luna. Null uses the project default.
Model for the judge, e.g. openai/gpt-6-luna. Null uses the project default.
Milliseconds (0 to 60000) the agent's trace must stay unchanged before the judge reads it. Null uses the project's recommendation.
Milliseconds (1000 to 300000) the judge waits for the agent's trace before a verdict. Null uses the project's recommendation.
Maximum conversation turns for a run of this scenario. Null uses the default.
Minimum conversation turns before the judge may end the run. Null uses the default.
The test suite to file this scenario in. It must name a non-archived test suite of the same project. null files the scenario into the project's Default test suite.
The value for each field the test suite declares, keyed by field identifier: text, a number or a boolean, in the field's own type. A field the suite does not declare answers 422 scenario_field_unknown; a value of the wrong type answers 422 scenario_field_type_invalid. An empty value clears the field. Send the full record; an empty record clears every value.
This sends a live request to app.langwatch.ai.
Request and response examples
import osimport requestsorigin = "https://app.langwatch.ai"path = "/api/v1/scenarios/<id>"api_key = os.environ["LANGWATCH_API_KEY"]headers = { "X-Auth-Token": api_key,}response = requests.put( origin + path, headers=headers,)print(response.json())const url = "https://app.langwatch.ai/api/v1/scenarios/<id>";const response = await fetch(url, { method: "PUT", headers: { "X-Auth-Token": process.env.LANGWATCH_API_KEY!, },});const data = await response.json();curl --request PUT \ --url 'https://app.langwatch.ai/api/v1/scenarios/<id>' \ --header "X-Auth-Token: $LANGWATCH_API_KEY"Call the LangWatch API from this project.Request: PUT https://app.langwatch.ai/api/v1/scenarios/<id>Reference: https://langwatch.ai/docs/api-reference/scenarios/update-scenarios.mdAuthentication: send the X-Auth-Token header, read from the LANGWATCH_API_KEY environment variable. Never hard-code the key.Use the HTTP client this project already uses, handle non-2xx responses, and show me the parsed result.Success
application/json · Generated from schema
{ "id": "string", "name": "string", "situation": "string", "criteria": [ "string" ], "labels": [ "string" ], "parameters": [ { "name": "string", "description": "string", "defaultValue": "string", "secret": false, "type": "string", "options": [ "string" ], "required": false } ], "simulatorModel": "string", "judgeModel": "string", "traceQuietPeriodMs": -9007199254740991, "traceWaitTimeoutMs": -9007199254740991, "maxTurns": -9007199254740991, "minTurns": -9007199254740991, "testSuiteId": "string", "fields": {}, "platformUrl": "string"}Scenario not found
application/json · Generated from schema
{ "error": "string"}Path parameters
idstringrequiredRequest body
application/json
namestringsituationstringcriteriastring[]labelsstring[]parametersobject[]The 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.
simulatorModelstring | nullModel for the simulated user, e.g. openai/gpt-6-luna. Null uses the project default.
judgeModelstring | nullModel for the judge, e.g. openai/gpt-6-luna. Null uses the project default.
traceQuietPeriodMsinteger | nullMilliseconds (0 to 60000) the agent's trace must stay unchanged before the judge reads it. Null uses the project's recommendation.
traceWaitTimeoutMsinteger | nullMilliseconds (1000 to 300000) the judge waits for the agent's trace before a verdict. Null uses the project's recommendation.
maxTurnsinteger | nullMaximum conversation turns for a run of this scenario. Null uses the default.
minTurnsinteger | nullMinimum conversation turns before the judge may end the run. Null uses the default.
testSuiteIdstring | nullThe test suite to file this scenario in. It must name a non-archived test suite of the same project. null files the scenario into the project's Default test suite.
fieldsobjectThe value for each field the test suite declares, keyed by field identifier: text, a number or a boolean, in the field's own type. A field the suite does not declare answers 422 scenario_field_unknown; a value of the wrong type answers 422 scenario_field_type_invalid. An empty value clears the field. Send the full record; an empty record clears every value.
Responses
200Success
application/json
idstringrequirednamestringrequiredsituationstringrequiredcriteriastring[]requiredlabelsstring[]requiredparametersobject[]requiredsimulatorModelstring | nullThe model that plays the user, or null for the project default. Absent on servers that predate model overrides on this family.
judgeModelstring | nullThe model that judges the run, or null for the project default. Absent on servers that predate model overrides on this family.
traceQuietPeriodMsinteger | nullMilliseconds the agent's trace must stay unchanged before the judge reads it, or null for the project's recommendation. Absent on servers that predate judge trace settings.
traceWaitTimeoutMsinteger | nullMilliseconds the judge waits for the agent's trace before a verdict, or null for the project's recommendation. Absent on servers that predate judge trace settings.
maxTurnsinteger | nullThe most conversation turns a run of this scenario takes, or null for the default. Absent on servers that predate turn limits on this family.
minTurnsinteger | nullThe fewest conversation turns before the judge may end a run, or null for the default. Absent on servers that predate turn limits on this family.
testSuiteIdstring | nullThe test suite this scenario is filed in, or null when unfiled. Absent on servers that predate test suites.
fieldsobjectThe value this scenario carries for each field its test suite declares, keyed by field identifier. A field with no value has no key. Absent on servers that predate suite fields.
platformUrlstring (uri)required404Scenario not found
application/json
errorstringrequired