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.
Create an experiment and its setup
Create an evaluations experiment. Send a setup to start from, or send none and get a blank workbench with one inline dataset. The slug it answers with is what every other experiment endpoint takes.
Try this endpoint
app.langwatch.ai
API key · X-Auth-Token
Kept in this tab. Cleared when you reload.
Name for the experiment. A draft name is picked when omitted.
Setup to start from. Omit for a blank workbench with one inline dataset.
This sends a live request to app.langwatch.ai.
Request and response examples
import osimport requestsorigin = "https://app.langwatch.ai"path = "/api/v1/experiments"api_key = os.environ["LANGWATCH_API_KEY"]headers = { "X-Auth-Token": api_key,}response = requests.post( origin + path, headers=headers,)print(response.json())const url = "https://app.langwatch.ai/api/v1/experiments";const response = await fetch(url, { method: "POST", headers: { "X-Auth-Token": process.env.LANGWATCH_API_KEY!, },});const data = await response.json();curl --request POST \ --url 'https://app.langwatch.ai/api/v1/experiments' \ --header "X-Auth-Token: $LANGWATCH_API_KEY"Call the LangWatch API from this project: Create an experiment and its setup.Request: POST https://app.langwatch.ai/api/v1/experimentsReference: https://langwatch.ai/docs/api-reference/experiments/post-create-an-experiment.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", "slug": "string", "version": 0}The setup did not match the schema (experiment_invalid_workbench_state) or points at something that no longer exists (experiment_workbench_missing_reference)
Request body
application/json
namestringName for the experiment. A draft name is picked when omitted.
stateobjectSetup to start from. Omit for a blank workbench with one inline dataset.
Responses
200Success
application/json
idstringrequiredIdentifier of the created experiment
slugstringrequiredSlug to address the experiment by
versionnumberrequiredVersion of the saved setup, starting at 1