Skip to contentSkip to page list

Docs

List an experiment's versions

Every saved version of the experiment's setup, newest first. A commit, an agent write and a restore each add a numbered version. Ordinary typing rewrites one autosave row, which is the entry with autoSaved true. Page through them with limit and cursor.

GET/api/v1/experiments/{slug}/versions
Request and response examples
request.py
import osimport requests​origin = "https://app.langwatch.ai"path = "/api/v1/experiments/<slug>/versions"api_key = os.environ["LANGWATCH_API_KEY"]headers = {    "X-Auth-Token": api_key,}​response = requests.get(    origin + path,    headers=headers,)print(response.json())

Success

application/json · Generated from schema

{  "versions": [    {      "version": -9007199254740991,      "counterVersion": -9007199254740991,      "autoSaved": false,      "commitMessage": "string",      "authorLabel": "user",      "authorId": "string",      "createdAt": "string",      "updatedAt": "string"    }  ],  "nextCursor": -9007199254740991}
api-reference/experiments/list-an-experiment-s-versions

Authorization

X-Auth-Tokenstringheaderrequired

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

slugstringrequired

The experiment's slug, or its id

At least 1 character

Query parameters

limitinteger

Versions per page, capped at 100

Maximum 9007199254740991
cursorinteger

The nextCursor of the previous page

Maximum 9007199254740991

Responses

200

Success

application/json

versionsobject[]required

Newest first, by counterVersion

versionintegerrequired

Restore this version by this number. Named versions run 1, 2, 3 with no gaps. The autosave row also has a number, but it changes with every save, so read it as a handle and not as a place in the history.

Minimum -9007199254740991Maximum 9007199254740991
counterVersionintegerrequired

The setup version this row was written at. It says how recent the row is, and it equals the experiment's current version on the row holding the live setup.

Minimum -9007199254740991Maximum 9007199254740991
autoSavedbooleanrequired

True for the single autosave row, which every ordinary save rewrites in place

commitMessagestring | nullrequired
authorLabelstringrequired

Who wrote it: user, langy or api

authorIdstring | nullrequired

User id, when a person wrote it

createdAtstringrequired

ISO 8601 timestamp of the first write

updatedAtstringrequired

ISO 8601 timestamp of the last write. The autosave row is rewritten in place, so this is what says how old its content is.

nextCursorinteger | nullrequired

Pass as cursor to read the next page, null on the last one

Option 1integer
Option 2null
400

The experiment is not an evaluations workbench (experiment_type_mismatch)

401

Missing or invalid API key, or the key lacks the permission

404

No such experiment in this project

Documentation