Save an experiment's setup
import requests
url = "https://app.langwatch.ai/api/v1/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/v1/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/v1/experiments/{slug}/workbench-state \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '{
"state": {}
}'{
"version": 0
}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
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
/
v1
/
experiments
/
{slug}
/
workbench-state
Save an experiment's setup
import requests
url = "https://app.langwatch.ai/api/v1/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/v1/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/v1/experiments/{slug}/workbench-state \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '{
"state": {}
}'{
"version": 0
}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.
Path Parameters
The experiment's slug, or its id
Minimum string length:
1Body
application/json
Response
Success
The version the save produced
Required range:
-9007199254740991 <= x <= 9007199254740991Last modified on October 12, 2026
Was this page helpful?