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.
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.
Try this endpoint
app.langwatch.ai
API key · X-Auth-Token
Kept in this tab. Cleared when you reload.
This sends a live request to app.langwatch.ai.
Request and response examples
import osimport requestsorigin = "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())const url = "https://app.langwatch.ai/api/v1/prompts/<id>/versions/<versionId>/restore";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/prompts/<id>/versions/<versionId>/restore' \ --header "X-Auth-Token: $LANGWATCH_API_KEY"Call the LangWatch API from this project.Request: POST https://app.langwatch.ai/api/v1/prompts/<id>/versions/<versionId>/restoreReference: https://langwatch.ai/docs/api-reference/prompts/action-restore.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", "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"}Bad Request
application/json · Generated from schema
{ "error": "string", "message": "string"}Unauthorized
application/json · Generated from schema
{ "error": "string", "message": "string"}Prompt or version not found
application/json · Generated from schema
{ "error": "string", "message": "string"}Unprocessable Entity
application/json · Generated from schema
{ "error": "string", "message": "string"}Internal Server Error
application/json · Generated from schema
{ "error": "string", "message": "string"}Path parameters
idstringrequiredversionIdstringrequiredResponses
200Success
application/json
idstringrequiredhandlestring | nullrequiredscopestringrequired"PROJECT""ORGANIZATION"namestringrequiredupdatedAtstring (date-time)requiredprojectIdstringrequiredorganizationIdstringrequiredversionIdstringrequiredauthorIdstring | nullversionnumberrequiredcreatedAtstring (date-time)requiredcommitMessagestring | nullpromptstringrequiredmessagesobject[]required[]inputsobject[]required[]outputsobject[]requiredmodelstringrequiredtemperaturenumbermaxTokensnumberdemonstrationsobjectpromptingTechniqueobjectresponseFormatobjecttagsobject[]required[]parametersobjectrequired{}platformUrlstringrequired400Bad Request
application/json
errorstringrequiredmessagestring401Unauthorized
application/json
errorstringrequiredmessagestring404Prompt or version not found
application/json
errorstringrequiredmessagestring422Unprocessable Entity
application/json
errorstringrequiredmessagestring500Internal Server Error
application/json
errorstringrequiredmessagestring