> 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.

# Assign prompt template

PUT https://app.lumenia.net/api/v1/workspaces/{workspaceId}/prompt-templates/{mode}
Content-Type: application/json

Assign a published prompt template version to a workspace channel.

Reference: https://docs.lumenia.net/api-reference/workspace-prompt-templates/assign-prompt-template

## Authentication

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

## Request

### Path parameters

- `workspaceId` (string, required) — Workspace to configure.
- `mode` (string, required) — Channel to configure. Allowed values: chat or voice. The template type must match this value.

### Headers

- `X-Account-Id` (string, required) — Account that owns the workspace.

### Body (application/json)

This endpoint expects an object.

- `versionId` (string, required) — Published template version to assign. It must belong to your partner and match the channel.
- `variables` (V1WorkspacesWorkspaceIdPromptTemplatesModePutRequestBodyContentApplicationJsonSchemaVariables, optional) — The variable values, keyed by variable key. Validated against the version variable definitions: required variables must be present (unless they have a default), values must match the declared type, and unknown keys are rejected.

## Response

### 200

The template assignment for this channel.

- `promptTemplate` (V1WorkspacesWorkspaceIdPromptTemplatesModePutResponsesContentApplicationJsonSchemaPromptTemplate, required) — The active assignment on this slot — the same object the workspace detail inlines as chat.promptTemplate / voice.promptTemplate.

## Errors

### 400 Bad Request Error

Version is not published, template type does not match the slot, or the variables are invalid

- `any`

### 403 Forbidden Error

The API key is missing or invalid, or the X-Account-Id does not belong to the partner.

- `message` (string, optional)

### 404 Not Found Error

Workspace or version not found

- `any`

### 500 Internal Server Error

Internal Server Error

- `any`

## Types

### V1WorkspacesWorkspaceIdPromptTemplatesModePutRequestBodyContentApplicationJsonSchemaVariables

The variable values, keyed by variable key. Validated against the version variable definitions: required variables must be present (unless they have a default), values must match the declared type, and unknown keys are rejected.

### V1WorkspacesWorkspaceIdPromptTemplatesModePutResponsesContentApplicationJsonSchemaPromptTemplate

The active assignment on this slot — the same object the workspace detail inlines as chat.promptTemplate / voice.promptTemplate.

- `templateId` (string, optional) — Assigned template ID.
- `templateName` (string, optional) — The template name.
- `versionId` (string, optional) — The pinned version id.
- `version` (integer, optional) — The pinned version number.
- `status` (string, optional) — Status of the assigned version.
- `variables` (V1WorkspacesWorkspaceIdPromptTemplatesModePutResponsesContentApplicationJsonSchemaPromptTemplateVariables, optional) — Variable values used by this assignment, keyed by variable key.

### V1WorkspacesWorkspaceIdPromptTemplatesModePutResponsesContentApplicationJsonSchemaPromptTemplateVariables

Variable values used by this assignment, keyed by variable key.

## Examples

**Request**

```json
{
  "versionId": "d4e5f6a7-8091-4c3d-ae4f-5a6b7c8d9e0f",
  "variables": {
    "company": "Acme Dental",
    "tone": "friendly"
  }
}
```

**Response**

```json
{
  "promptTemplate": {
    "templateId": "a1b2c3d4-5e6f-4a0b-8c1d-2e3f4a5b6c7d",
    "templateName": "Dental clinic receptionist",
    "versionId": "d4e5f6a7-8091-4c3d-ae4f-5a6b7c8d9e0f",
    "version": 3,
    "status": "published",
    "variables": {
      "company": "Acme Dental",
      "tone": "friendly"
    }
  }
}
```

**SDK Code**

```python
import requests

url = "https://app.lumenia.net/api/v1/workspaces/workspaceId/prompt-templates/mode"

payload = {
    "versionId": "d4e5f6a7-8091-4c3d-ae4f-5a6b7c8d9e0f",
    "variables": {
        "company": "Acme Dental",
        "tone": "friendly"
    }
}
headers = {
    "X-Account-Id": "X-Account-Id",
    "Authorization": "Bearer <API_KEY>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://app.lumenia.net/api/v1/workspaces/workspaceId/prompt-templates/mode';
const options = {
  method: 'PUT',
  headers: {
    'X-Account-Id': 'X-Account-Id',
    Authorization: 'Bearer <API_KEY>',
    'Content-Type': 'application/json'
  },
  body: '{"versionId":"d4e5f6a7-8091-4c3d-ae4f-5a6b7c8d9e0f","variables":{"company":"Acme Dental","tone":"friendly"}}'
};

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

```go
package main

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

func main() {

	url := "https://app.lumenia.net/api/v1/workspaces/workspaceId/prompt-templates/mode"

	payload := strings.NewReader("{\n  \"versionId\": \"d4e5f6a7-8091-4c3d-ae4f-5a6b7c8d9e0f\",\n  \"variables\": {\n    \"company\": \"Acme Dental\",\n    \"tone\": \"friendly\"\n  }\n}")

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

	req.Header.Add("X-Account-Id", "X-Account-Id")
	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
require 'uri'
require 'net/http'

url = URI("https://app.lumenia.net/api/v1/workspaces/workspaceId/prompt-templates/mode")

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

request = Net::HTTP::Put.new(url)
request["X-Account-Id"] = 'X-Account-Id'
request["Authorization"] = 'Bearer <API_KEY>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"versionId\": \"d4e5f6a7-8091-4c3d-ae4f-5a6b7c8d9e0f\",\n  \"variables\": {\n    \"company\": \"Acme Dental\",\n    \"tone\": \"friendly\"\n  }\n}"

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

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://app.lumenia.net/api/v1/workspaces/workspaceId/prompt-templates/mode")
  .header("X-Account-Id", "X-Account-Id")
  .header("Authorization", "Bearer <API_KEY>")
  .header("Content-Type", "application/json")
  .body("{\n  \"versionId\": \"d4e5f6a7-8091-4c3d-ae4f-5a6b7c8d9e0f\",\n  \"variables\": {\n    \"company\": \"Acme Dental\",\n    \"tone\": \"friendly\"\n  }\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://app.lumenia.net/api/v1/workspaces/workspaceId/prompt-templates/mode', [
  'body' => '{
  "versionId": "d4e5f6a7-8091-4c3d-ae4f-5a6b7c8d9e0f",
  "variables": {
    "company": "Acme Dental",
    "tone": "friendly"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <API_KEY>',
    'Content-Type' => 'application/json',
    'X-Account-Id' => 'X-Account-Id',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://app.lumenia.net/api/v1/workspaces/workspaceId/prompt-templates/mode");
var request = new RestRequest(Method.PUT);
request.AddHeader("X-Account-Id", "X-Account-Id");
request.AddHeader("Authorization", "Bearer <API_KEY>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"versionId\": \"d4e5f6a7-8091-4c3d-ae4f-5a6b7c8d9e0f\",\n  \"variables\": {\n    \"company\": \"Acme Dental\",\n    \"tone\": \"friendly\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-Account-Id": "X-Account-Id",
  "Authorization": "Bearer <API_KEY>",
  "Content-Type": "application/json"
]
let parameters = [
  "versionId": "d4e5f6a7-8091-4c3d-ae4f-5a6b7c8d9e0f",
  "variables": [
    "company": "Acme Dental",
    "tone": "friendly"
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://app.lumenia.net/api/v1/workspaces/workspaceId/prompt-templates/mode")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
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()
```