Create an experiment
import requests
url = "https://app.langwatch.ai/api/v1/experiment/init"
payload = {}
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({})
};
fetch('https://app.langwatch.ai/api/v1/experiment/init', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/v1/experiment/init \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '{}'{
"slug": "<string>",
"path": "<string>"
}This response has no body data.This response has no body data.This response has no body data.This response has no body data.This response has no body data.Experiments
Create an experiment
Create an experiment, or return the existing one when the slug is already taken. This is the first call in an experiment run: take the slug back, report results against it, and every run under that slug groups together in the app. The SDKs call this endpoint for you. The body carries experiment_type and at least one of experiment_slug (the stable slug you choose, which is what makes repeated runs land together) or experiment_id; experiment_name names it on creation and workflowId ties it to an Optimization Studio workflow.
POST
/
api
/
v1
/
experiment
/
init
Create an experiment
import requests
url = "https://app.langwatch.ai/api/v1/experiment/init"
payload = {}
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({})
};
fetch('https://app.langwatch.ai/api/v1/experiment/init', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.langwatch.ai/api/v1/experiment/init \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '{}'{
"slug": "<string>",
"path": "<string>"
}This response has no body data.This response has no body data.This response has no body data.This response has no body data.This response has no body data.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
application/json
Last modified on October 12, 2026
Was this page helpful?