> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.lumenia.net/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.lumenia.net/_mcp/server.

# Update template version (draft only)

PATCH https://app.lumenia.net/api/v1/prompt-template-versions/{versionId}
Content-Type: application/json

Update a draft template version.

Reference: https://docs.lumenia.net/api-reference/prompt-template-versions/update-template-version-draft-only

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <API_KEY>`, where `API_KEY` is your API key.

## Request

### Path parameters

- `versionId` (string, required) — Draft version to update.

### Body (application/json)

This endpoint expects an object.

- `prompt` (string, optional) — The system prompt. May contain \{\{placeholder}} variables — declare each one in variables before the version can be published.
- `firstMessage` (string, optional, nullable) — The call greeting. Only valid on voice templates; may also contain \{\{placeholder}} variables.
- `variables` (list of V1PromptTemplateVersionsVersionIdPatchRequestBodyContentApplicationJsonSchemaVariablesItems, optional) — Definitions for the placeholders used in the prompt and firstMessage. Sending this REPLACES the full set; omit it to leave the variables untouched.
- `toolIds` (list of string, optional) — Partner tools this version references, by id. Only tools owned by the same partner are accepted. Sending this REPLACES the full set; omit it to leave the tools untouched.

## Response

### 200

The updated draft version.

- `version` (V1PromptTemplateVersionsVersionIdPatchResponsesContentApplicationJsonSchemaVersion, required) — The updated draft, in full detail.

## Errors

### 400 Bad Request Error

Invalid fields (empty prompt, firstMessage on a chat template, bad variables, or a toolId that is not a partner tool)

- `any`

### 403 Forbidden Error

The API key is missing or invalid.

- `message` (string, optional)

### 404 Not Found Error

Version not found for this partner

- `any`

### 409 Conflict Error

The version is not a draft (published versions are immutable)

- `any`

### 500 Internal Server Error

Internal Server Error

- `any`

## Types

### V1PromptTemplateVersionsVersionIdPatchRequestBodyContentApplicationJsonSchemaVariablesItems

- `key` (string, optional) — The placeholder name as it appears in the prompt, without the braces.
- `description` (string, optional) — What the variable holds.
- `type` (enum, optional) — The value type. Defaults to string.
  - Allowed values: `string`, `number`, `boolean`
- `required` (boolean, optional) — Whether a value must be supplied at assignment time. To publish, every variable must be required or carry a defaultValue.
- `defaultValue` (V1PromptTemplateVersionsVersionIdPatchRequestBodyContentApplicationJsonSchemaVariablesItemsDefaultValue, optional, nullable) — The value used when none is supplied. Its type must match the declared variable type.
- `validation` (V1PromptTemplateVersionsVersionIdPatchRequestBodyContentApplicationJsonSchemaVariablesItemsValidation, optional, nullable) — Optional validation rules for supplied values: enum, pattern, min, max.

### V1PromptTemplateVersionsVersionIdPatchResponsesContentApplicationJsonSchemaVersion

The updated draft, in full detail.

- `id` (string, optional) — The sole identifier for the version.
- `templateId` (string, optional) — The owning template id.
- `version` (integer, optional) — The version number.
- `status` (string, optional) — The lifecycle status. Always draft here — only drafts are editable.
- `publishedAt` (string, optional, nullable) — Null while a draft.
- `archivedAt` (string, optional, nullable) — Null while a draft.
- `createdAt` (string, optional) — ISO 8601 timestamp of when the version was created.
- `prompt` (string, optional) — The system prompt, with its \{\{placeholder}} variables unrendered.
- `firstMessage` (string, optional, nullable) — The call greeting (voice templates only, null otherwise).
- `variables` (list of V1PromptTemplateVersionsVersionIdPatchResponsesContentApplicationJsonSchemaVersionVariablesItems, optional) — The variable definitions after the update.
- `tools` (list of V1PromptTemplateVersionsVersionIdPatchResponsesContentApplicationJsonSchemaVersionToolsItems, optional) — The partner tools this version references after the update.

### V1PromptTemplateVersionsVersionIdPatchRequestBodyContentApplicationJsonSchemaVariablesItemsDefaultValue

The value used when none is supplied. Its type must match the declared variable type.

### V1PromptTemplateVersionsVersionIdPatchRequestBodyContentApplicationJsonSchemaVariablesItemsValidation

Optional validation rules for supplied values: enum, pattern, min, max.

### V1PromptTemplateVersionsVersionIdPatchResponsesContentApplicationJsonSchemaVersionVariablesItems

- `key` (string, optional) — The placeholder name as it appears in the prompt.
- `description` (string, optional, nullable) — What the variable holds.
- `type` (string, optional) — The value type: string, number, or boolean.
- `required` (boolean, optional) — Whether a value must be supplied at assignment time.
- `defaultValue` (V1PromptTemplateVersionsVersionIdPatchResponsesContentApplicationJsonSchemaVersionVariablesItemsDefaultValue, optional, nullable) — The value used when none is supplied.
- `validation` (V1PromptTemplateVersionsVersionIdPatchResponsesContentApplicationJsonSchemaVersionVariablesItemsValidation, optional, nullable) — Validation rules for supplied values (enum, pattern, min, max), or null.

### V1PromptTemplateVersionsVersionIdPatchResponsesContentApplicationJsonSchemaVersionToolsItems

- `id` (string, optional) — The tool id.
- `name` (string, optional) — The tool name.

### V1PromptTemplateVersionsVersionIdPatchResponsesContentApplicationJsonSchemaVersionVariablesItemsDefaultValue

The value used when none is supplied.

### V1PromptTemplateVersionsVersionIdPatchResponsesContentApplicationJsonSchemaVersionVariablesItemsValidation

Validation rules for supplied values (enum, pattern, min, max), or null.

## Examples

### Change only the prompt

**Request**

```json
{
  "prompt": "You are the receptionist of {{company}}. Always answer in {{language}}."
}
```

**Response**

```json
{
  "version": {
    "id": "e5f6a7b8-9102-4d4e-bf50-6b7c8d9e0f1a",
    "templateId": "a1b2c3d4-5e6f-4a0b-8c1d-2e3f4a5b6c7d",
    "version": 3,
    "status": "draft",
    "publishedAt": null,
    "archivedAt": null,
    "createdAt": "2026-07-10T09:00:00.000Z",
    "prompt": "You are the receptionist of {{company}}. Always answer in {{language}}.",
    "firstMessage": "Thank you for calling {{company}}!",
    "variables": [
      {
        "key": "company",
        "description": null,
        "type": "string",
        "required": true,
        "defaultValue": null,
        "validation": null
      },
      {
        "key": "language",
        "description": null,
        "type": "string",
        "required": false,
        "defaultValue": "English",
        "validation": null
      }
    ],
    "tools": []
  }
}
```

**SDK Code**

```python Change only the prompt
import requests

url = "https://app.lumenia.net/api/v1/prompt-template-versions/versionId"

payload = { "prompt": "You are the receptionist of {{company}}. Always answer in {{language}}." }
headers = {
    "Authorization": "Bearer <API_KEY>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript Change only the prompt
const url = 'https://app.lumenia.net/api/v1/prompt-template-versions/versionId';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <API_KEY>', 'Content-Type': 'application/json'},
  body: '{"prompt":"You are the receptionist of {{company}}. Always answer in {{language}}."}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Change only the prompt
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://app.lumenia.net/api/v1/prompt-template-versions/versionId"

	payload := strings.NewReader("{\n  \"prompt\": \"You are the receptionist of {{company}}. Always answer in {{language}}.\"\n}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("Authorization", "Bearer <API_KEY>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Change only the prompt
require 'uri'
require 'net/http'

url = URI("https://app.lumenia.net/api/v1/prompt-template-versions/versionId")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <API_KEY>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"prompt\": \"You are the receptionist of {{company}}. Always answer in {{language}}.\"\n}"

response = http.request(request)
puts response.read_body
```

```java Change only the prompt
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://app.lumenia.net/api/v1/prompt-template-versions/versionId")
  .header("Authorization", "Bearer <API_KEY>")
  .header("Content-Type", "application/json")
  .body("{\n  \"prompt\": \"You are the receptionist of {{company}}. Always answer in {{language}}.\"\n}")
  .asString();
```

```php Change only the prompt
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://app.lumenia.net/api/v1/prompt-template-versions/versionId', [
  'body' => '{
  "prompt": "You are the receptionist of {{company}}. Always answer in {{language}}."
}',
  'headers' => [
    'Authorization' => 'Bearer <API_KEY>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Change only the prompt
using RestSharp;

var client = new RestClient("https://app.lumenia.net/api/v1/prompt-template-versions/versionId");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <API_KEY>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"prompt\": \"You are the receptionist of {{company}}. Always answer in {{language}}.\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Change only the prompt
import Foundation

let headers = [
  "Authorization": "Bearer <API_KEY>",
  "Content-Type": "application/json"
]
let parameters = ["prompt": "You are the receptionist of {{company}}. Always answer in {{language}}."] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://app.lumenia.net/api/v1/prompt-template-versions/versionId")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Replace the variable definitions

**Request**

```json
{
  "variables": [
    {
      "key": "company",
      "type": "string",
      "required": true
    },
    {
      "key": "language",
      "type": "string",
      "required": false,
      "defaultValue": "English"
    }
  ]
}
```

**Response**

```json
{
  "version": {
    "id": "e5f6a7b8-9102-4d4e-bf50-6b7c8d9e0f1a",
    "templateId": "a1b2c3d4-5e6f-4a0b-8c1d-2e3f4a5b6c7d",
    "version": 3,
    "status": "draft",
    "publishedAt": null,
    "archivedAt": null,
    "createdAt": "2026-07-10T09:00:00.000Z",
    "prompt": "You are the receptionist of {{company}}. Always answer in {{language}}.",
    "firstMessage": "Thank you for calling {{company}}!",
    "variables": [
      {
        "key": "company",
        "description": null,
        "type": "string",
        "required": true,
        "defaultValue": null,
        "validation": null
      },
      {
        "key": "language",
        "description": null,
        "type": "string",
        "required": false,
        "defaultValue": "English",
        "validation": null
      }
    ],
    "tools": []
  }
}
```

**SDK Code**

```python Replace the variable definitions
import requests

url = "https://app.lumenia.net/api/v1/prompt-template-versions/versionId"

payload = { "variables": [
        {
            "key": "company",
            "type": "string",
            "required": True
        },
        {
            "key": "language",
            "type": "string",
            "required": False,
            "defaultValue": "English"
        }
    ] }
headers = {
    "Authorization": "Bearer <API_KEY>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript Replace the variable definitions
const url = 'https://app.lumenia.net/api/v1/prompt-template-versions/versionId';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <API_KEY>', 'Content-Type': 'application/json'},
  body: '{"variables":[{"key":"company","type":"string","required":true},{"key":"language","type":"string","required":false,"defaultValue":"English"}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Replace the variable definitions
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://app.lumenia.net/api/v1/prompt-template-versions/versionId"

	payload := strings.NewReader("{\n  \"variables\": [\n    {\n      \"key\": \"company\",\n      \"type\": \"string\",\n      \"required\": true\n    },\n    {\n      \"key\": \"language\",\n      \"type\": \"string\",\n      \"required\": false,\n      \"defaultValue\": \"English\"\n    }\n  ]\n}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("Authorization", "Bearer <API_KEY>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Replace the variable definitions
require 'uri'
require 'net/http'

url = URI("https://app.lumenia.net/api/v1/prompt-template-versions/versionId")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <API_KEY>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"variables\": [\n    {\n      \"key\": \"company\",\n      \"type\": \"string\",\n      \"required\": true\n    },\n    {\n      \"key\": \"language\",\n      \"type\": \"string\",\n      \"required\": false,\n      \"defaultValue\": \"English\"\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java Replace the variable definitions
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://app.lumenia.net/api/v1/prompt-template-versions/versionId")
  .header("Authorization", "Bearer <API_KEY>")
  .header("Content-Type", "application/json")
  .body("{\n  \"variables\": [\n    {\n      \"key\": \"company\",\n      \"type\": \"string\",\n      \"required\": true\n    },\n    {\n      \"key\": \"language\",\n      \"type\": \"string\",\n      \"required\": false,\n      \"defaultValue\": \"English\"\n    }\n  ]\n}")
  .asString();
```

```php Replace the variable definitions
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://app.lumenia.net/api/v1/prompt-template-versions/versionId', [
  'body' => '{
  "variables": [
    {
      "key": "company",
      "type": "string",
      "required": true
    },
    {
      "key": "language",
      "type": "string",
      "required": false,
      "defaultValue": "English"
    }
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <API_KEY>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Replace the variable definitions
using RestSharp;

var client = new RestClient("https://app.lumenia.net/api/v1/prompt-template-versions/versionId");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <API_KEY>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"variables\": [\n    {\n      \"key\": \"company\",\n      \"type\": \"string\",\n      \"required\": true\n    },\n    {\n      \"key\": \"language\",\n      \"type\": \"string\",\n      \"required\": false,\n      \"defaultValue\": \"English\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Replace the variable definitions
import Foundation

let headers = [
  "Authorization": "Bearer <API_KEY>",
  "Content-Type": "application/json"
]
let parameters = ["variables": [
    [
      "key": "company",
      "type": "string",
      "required": true
    ],
    [
      "key": "language",
      "type": "string",
      "required": false,
      "defaultValue": "English"
    ]
  ]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://app.lumenia.net/api/v1/prompt-template-versions/versionId")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```