Skip to contentSkip to page list

Docs

Restore a prompt to a previous version

Restore a prompt to a previous version. Creates a new version with the same config data as the specified version.

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

Success

application/json · Generated from schema

{  "id": "string",  "handle": "string",  "scope": "PROJECT",  "name": "string",  "updatedAt": "2026-01-01T00:00:00Z",  "projectId": "string",  "organizationId": "string",  "versionId": "string",  "authorId": "string",  "version": 0,  "createdAt": "2026-01-01T00:00:00Z",  "commitMessage": "string",  "prompt": "string",  "messages": [],  "inputs": [],  "outputs": [    {      "identifier": "string",      "type": "str",      "json_schema": {        "type": "string"      }    }  ],  "model": "string",  "temperature": 0,  "maxTokens": 0,  "demonstrations": {    "id": "string",    "name": "string",    "inline": {      "records": {},      "columnTypes": [        {          "id": "string",          "name": "string",          "type": "string"        }      ]    }  },  "promptingTechnique": {    "type": "few_shot",    "demonstrations": {      "id": "string",      "name": "string",      "inline": {        "records": {},        "columnTypes": [          {            "id": null,            "name": null,            "type": null          }        ]      }    }  },  "responseFormat": {    "type": "json_schema",    "json_schema": {      "name": "string",      "schema": {}    }  },  "tags": [],  "parameters": {},  "platformUrl": "string"}
api-reference/prompts/action-restore

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

idstringrequired
versionIdstringrequired

Responses

200

Success

application/json

idstringrequired
handlestring | nullrequired
scopestringrequired
One of"PROJECT""ORGANIZATION"
namestringrequired
updatedAtstring (date-time)required
projectIdstringrequired
organizationIdstringrequired
versionIdstringrequired
authorIdstring | null
versionnumberrequired
createdAtstring (date-time)required
commitMessagestring | null
promptstringrequired
messagesobject[]required
rolestringrequired
One of"user""assistant""system"
contentstringrequired
Default: []
inputsobject[]required
identifierstringrequired
At least 1 character
typestringrequired
One of"str""float""bool""image""file""list""list[str]""list[float]""list[int]""list[bool]""dict""chat_messages"
Default: []
outputsobject[]required
identifierstringrequired
At least 1 character
typestringrequired
One of"str""float""bool""json_schema"
json_schemaobject
modelstringrequired
At least 1 character
temperaturenumber
maxTokensnumber
demonstrationsobject
idstring
namestring
inlineobject
promptingTechniqueobject
typestringrequired
One of"few_shot""in_context""chain_of_thought"
demonstrationsobject
responseFormatobject
typestringrequired
One of"json_schema"
json_schemaobject | nullrequired
tagsobject[]required
namestringrequired
versionIdstringrequired
Default: []
parametersobjectrequired
Default: {}
platformUrlstringrequired
400

Bad Request

application/json

errorstringrequired
messagestring
401

Unauthorized

application/json

errorstringrequired
messagestring
404

Prompt or version not found

application/json

errorstringrequired
messagestring
422

Unprocessable Entity

application/json

errorstringrequired
messagestring
500

Internal Server Error

application/json

errorstringrequired
messagestring

Documentation