Skip to main content
POST
/
api
/
scenario-events
Python
import requests

url = "https://app.langwatch.ai/api/scenario-events"

payload = {
    "type": "<string>",
    "timestamp": 123,
    "batchRunId": "<string>",
    "scenarioId": "<string>",
    "scenarioRunId": "<string>",
    "metadata": {
        "name": "<string>",
        "description": "<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({
type: '<string>',
timestamp: 123,
batchRunId: '<string>',
scenarioId: '<string>',
scenarioRunId: '<string>',
metadata: {name: '<string>', description: '<string>'}
})
};

fetch('https://app.langwatch.ai/api/scenario-events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
curl --request POST \
--url https://app.langwatch.ai/api/scenario-events \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '
{
"type": "<string>",
"timestamp": 123,
"batchRunId": "<string>",
"scenarioId": "<string>",
"scenarioRunId": "<string>",
"metadata": {
"name": "<string>",
"description": "<string>"
}
}
'
{
  "success": true,
  "url": "<string>"
}
{
"error": "<string>"
}
{
"error": "<string>",
"message": "<string>"
}
{
"error": "<string>",
"message": "<string>"
}
{
"error": "<string>",
"message": "<string>"
}

Authorizations

X-Auth-Token
string
header
required

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

application/json
type
string
required
Allowed value: "SCENARIO_RUN_STARTED"
timestamp
number
required
batchRunId
string
required
scenarioId
string
required
scenarioRunId
string
required
metadata
object
required
rawEvent
any
scenarioSetId
string
default:default

Response

Event created successfully

success
boolean
required
url
string | null