Save an experiment's setup
import requests
url = "https://app.langwatch.ai/api/experiments/{slug}/workbench-state"
payload = { "state": {} }
headers = {
"X-Auth-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-Auth-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({state: {}})
};
fetch('https://app.langwatch.ai/api/experiments/{slug}/workbench-state', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PUT \
--url https://app.langwatch.ai/api/experiments/{slug}/workbench-state \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '{
"state": {}
}'{
"version": 123
}{
"error": "<string>",
"message": "<string>",
"fault": "<string>",
"tips": [
"<string>"
],
"docsUrl": "<string>"
}{
"error": "<string>",
"message": "<string>",
"fault": "<string>",
"tips": [
"<string>"
],
"docsUrl": "<string>"
}{
"error": "<string>",
"message": "<string>",
"fault": "<string>",
"tips": [
"<string>"
],
"docsUrl": "<string>"
}{
"error": "<string>",
"currentVersion": 123,
"message": "<string>",
"fault": "<string>",
"tips": [
"<string>"
],
"docsUrl": "<string>"
}Experiments
Save an experiment's setup
Replace the experiment’s setup. Send expectedVersion with the version you read and the save is refused with a 409 when someone else wrote first, instead of overwriting their work.
PUT
/
api
/
experiments
/
{slug}
/
workbench-state
Save an experiment's setup
import requests
url = "https://app.langwatch.ai/api/experiments/{slug}/workbench-state"
payload = { "state": {} }
headers = {
"X-Auth-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-Auth-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({state: {}})
};
fetch('https://app.langwatch.ai/api/experiments/{slug}/workbench-state', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PUT \
--url https://app.langwatch.ai/api/experiments/{slug}/workbench-state \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '{
"state": {}
}'{
"version": 123
}{
"error": "<string>",
"message": "<string>",
"fault": "<string>",
"tips": [
"<string>"
],
"docsUrl": "<string>"
}{
"error": "<string>",
"message": "<string>",
"fault": "<string>",
"tips": [
"<string>"
],
"docsUrl": "<string>"
}{
"error": "<string>",
"message": "<string>",
"fault": "<string>",
"tips": [
"<string>"
],
"docsUrl": "<string>"
}{
"error": "<string>",
"currentVersion": 123,
"message": "<string>",
"fault": "<string>",
"tips": [
"<string>"
],
"docsUrl": "<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.
Path Parameters
Body
application/json
Response
Setup saved
The version the save produced
Last modified on August 24, 2026
Was this page helpful?
⌘I