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

# Create prompt template

POST https://app.lumenia.net/api/v1/prompt-templates
Content-Type: application/json

Create a prompt template and its initial draft version.

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

## Authentication

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

## Request

### Body (application/json)

This endpoint expects an object.

- `name` (string, required) — Human-readable template name. Must be unique among the partner templates.
- `type` (enum, required) — The channel the template is written for. Fixed for the life of the template.
  - Allowed values: `chat`, `voice`
- `prompt` (string, required) — The system prompt of version 1. May contain \{\{placeholder}} variables — declare each one in variables before the version can be published.
- `description` (string, optional) — What the template is for.
- `firstMessage` (string, optional) — The call greeting of version 1. Only valid on voice templates; may also contain \{\{placeholder}} variables.
- `variables` (list of V1PromptTemplatesPostRequestBodyContentApplicationJsonSchemaVariablesItems, optional) — Definitions for the placeholders used in the prompt and firstMessage.
- `toolIds` (list of string, optional) — Partner tools used by this version, by ID. The tools become available when this version is assigned to a workspace.

## Response

### 201

The created template and its initial draft version.

- `template` (V1PromptTemplatesPostResponsesContentApplicationJsonSchemaTemplate, required) — The newly created template.
- `version` (V1PromptTemplatesPostResponsesContentApplicationJsonSchemaVersion, required) — The version 1 draft, in full detail.

## Errors

### 400 Bad Request Error

Missing or invalid fields (prompt, type, variables, firstMessage on a chat template, or a toolId that is not a partner tool)

- `any`

### 403 Forbidden Error

The API key is missing or invalid.

- `message` (string, optional)

### 409 Conflict Error

A template with this name already exists for this partner

- `any`

### 500 Internal Server Error

Internal Server Error

- `any`

## Types

### V1PromptTemplatesPostRequestBodyContentApplicationJsonSchemaVariablesItems

- `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` (V1PromptTemplatesPostRequestBodyContentApplicationJsonSchemaVariablesItemsDefaultValue, optional, nullable) — The value used when none is supplied. Its type must match the declared variable type.
- `validation` (V1PromptTemplatesPostRequestBodyContentApplicationJsonSchemaVariablesItemsValidation, optional, nullable) — Optional validation rules for supplied values: enum, pattern, min, max.

### V1PromptTemplatesPostResponsesContentApplicationJsonSchemaTemplate

The newly created template.

- `id` (string, optional) — The sole identifier for the template.
- `name` (string, optional) — Human-readable template name.
- `description` (string, optional, nullable) — What the template is for.
- `type` (enum, optional) — The channel the template is written for.
  - Allowed values: `chat`, `voice`
- `createdAt` (string, optional) — ISO 8601 timestamp of when the template was created.
- `updatedAt` (string, optional) — ISO 8601 timestamp of when the template was last updated.
- `versionsCount` (integer, optional) — How many versions the template has. Always 1 on creation.
- `latestPublishedVersion` (integer, optional, nullable) — The highest published version number. Null on creation — nothing is published yet.
- `pinnedWorkspacesCount` (integer, optional) — How many active workspaces are assigned one of the template versions. Always 0 on creation.

### V1PromptTemplatesPostResponsesContentApplicationJsonSchemaVersion

The version 1 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, assigned automatically.
- `status` (enum, optional) — The lifecycle status. Always draft on creation.
  - Allowed values: `draft`, `published`, `archived`
- `publishedAt` (string, optional, nullable) — When the version was published, null while a draft.
- `archivedAt` (string, optional, nullable) — When the version was archived, null before that.
- `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 V1PromptTemplatesPostResponsesContentApplicationJsonSchemaVersionVariablesItems, optional) — The variable definitions of this version.
- `tools` (list of V1PromptTemplatesPostResponsesContentApplicationJsonSchemaVersionToolsItems, optional) — The partner tools this version references.

### V1PromptTemplatesPostRequestBodyContentApplicationJsonSchemaVariablesItemsDefaultValue

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

### V1PromptTemplatesPostRequestBodyContentApplicationJsonSchemaVariablesItemsValidation

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

### V1PromptTemplatesPostResponsesContentApplicationJsonSchemaVersionVariablesItems

- `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` (V1PromptTemplatesPostResponsesContentApplicationJsonSchemaVersionVariablesItemsDefaultValue, optional, nullable) — The value used when none is supplied.
- `validation` (V1PromptTemplatesPostResponsesContentApplicationJsonSchemaVersionVariablesItemsValidation, optional, nullable) — Validation rules for supplied values (enum, pattern, min, max), or null.

### V1PromptTemplatesPostResponsesContentApplicationJsonSchemaVersionToolsItems

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

### V1PromptTemplatesPostResponsesContentApplicationJsonSchemaVersionVariablesItemsDefaultValue

The value used when none is supplied.

### V1PromptTemplatesPostResponsesContentApplicationJsonSchemaVersionVariablesItemsValidation

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

## Examples

**Request**

```json
{
  "name": "Dental clinic receptionist",
  "type": "voice",
  "prompt": "You are the receptionist of {{company}}. Keep answers short and {{tone}}.",
  "description": "Voice receptionist for dental clinics",
  "firstMessage": "Thank you for calling {{company}}! How can I help you today?",
  "variables": [
    {
      "key": "company",
      "description": "The clinic name",
      "type": "string",
      "required": true
    },
    {
      "key": "tone",
      "type": "string",
      "required": false,
      "defaultValue": "friendly",
      "validation": {
        "enum": [
          "friendly",
          "formal"
        ]
      }
    }
  ],
  "toolIds": [
    "b2c3d4e5-6f70-4a1b-8c2d-3e4f5a6b7c8d"
  ]
}
```

**Response**

```json
{
  "template": {
    "id": "a1b2c3d4-5e6f-4a0b-8c1d-2e3f4a5b6c7d",
    "name": "Dental clinic receptionist",
    "description": "Voice receptionist for dental clinics",
    "type": "voice",
    "createdAt": "2026-07-01T09:00:00.000Z",
    "updatedAt": "2026-07-01T09:00:00.000Z",
    "versionsCount": 1,
    "latestPublishedVersion": null,
    "pinnedWorkspacesCount": 0
  },
  "version": {
    "id": "d4e5f6a7-8091-4c3d-ae4f-5a6b7c8d9e0f",
    "templateId": "a1b2c3d4-5e6f-4a0b-8c1d-2e3f4a5b6c7d",
    "version": 1,
    "status": "draft",
    "publishedAt": null,
    "archivedAt": null,
    "createdAt": "2026-07-01T09:00:00.000Z",
    "prompt": "You are the receptionist of {{company}}. Keep answers short and {{tone}}.",
    "firstMessage": "Thank you for calling {{company}}! How can I help you today?",
    "variables": [
      {
        "key": "company",
        "description": "The clinic name",
        "type": "string",
        "required": true,
        "defaultValue": null,
        "validation": null
      },
      {
        "key": "tone",
        "description": null,
        "type": "string",
        "required": false,
        "defaultValue": "friendly",
        "validation": {
          "enum": [
            "friendly",
            "formal"
          ]
        }
      }
    ],
    "tools": [
      {
        "id": "b2c3d4e5-6f70-4a1b-8c2d-3e4f5a6b7c8d",
        "name": "get_order_status"
      }
    ]
  }
}
```

**SDK Code**

```python
import requests

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

payload = {
    "name": "Dental clinic receptionist",
    "type": "voice",
    "prompt": "You are the receptionist of {{company}}. Keep answers short and {{tone}}.",
    "description": "Voice receptionist for dental clinics",
    "firstMessage": "Thank you for calling {{company}}! How can I help you today?",
    "variables": [
        {
            "key": "company",
            "description": "The clinic name",
            "type": "string",
            "required": True
        },
        {
            "key": "tone",
            "type": "string",
            "required": False,
            "defaultValue": "friendly",
            "validation": { "enum": ["friendly", "formal"] }
        }
    ],
    "toolIds": ["b2c3d4e5-6f70-4a1b-8c2d-3e4f5a6b7c8d"]
}
headers = {
    "Authorization": "Bearer <API_KEY>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://app.lumenia.net/api/v1/prompt-templates';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <API_KEY>', 'Content-Type': 'application/json'},
  body: '{"name":"Dental clinic receptionist","type":"voice","prompt":"You are the receptionist of {{company}}. Keep answers short and {{tone}}.","description":"Voice receptionist for dental clinics","firstMessage":"Thank you for calling {{company}}! How can I help you today?","variables":[{"key":"company","description":"The clinic name","type":"string","required":true},{"key":"tone","type":"string","required":false,"defaultValue":"friendly","validation":{"enum":["friendly","formal"]}}],"toolIds":["b2c3d4e5-6f70-4a1b-8c2d-3e4f5a6b7c8d"]}'
};

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/prompt-templates"

	payload := strings.NewReader("{\n  \"name\": \"Dental clinic receptionist\",\n  \"type\": \"voice\",\n  \"prompt\": \"You are the receptionist of {{company}}. Keep answers short and {{tone}}.\",\n  \"description\": \"Voice receptionist for dental clinics\",\n  \"firstMessage\": \"Thank you for calling {{company}}! How can I help you today?\",\n  \"variables\": [\n    {\n      \"key\": \"company\",\n      \"description\": \"The clinic name\",\n      \"type\": \"string\",\n      \"required\": true\n    },\n    {\n      \"key\": \"tone\",\n      \"type\": \"string\",\n      \"required\": false,\n      \"defaultValue\": \"friendly\",\n      \"validation\": {\n        \"enum\": [\n          \"friendly\",\n          \"formal\"\n        ]\n      }\n    }\n  ],\n  \"toolIds\": [\n    \"b2c3d4e5-6f70-4a1b-8c2d-3e4f5a6b7c8d\"\n  ]\n}")

	req, _ := http.NewRequest("POST", 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
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <API_KEY>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Dental clinic receptionist\",\n  \"type\": \"voice\",\n  \"prompt\": \"You are the receptionist of {{company}}. Keep answers short and {{tone}}.\",\n  \"description\": \"Voice receptionist for dental clinics\",\n  \"firstMessage\": \"Thank you for calling {{company}}! How can I help you today?\",\n  \"variables\": [\n    {\n      \"key\": \"company\",\n      \"description\": \"The clinic name\",\n      \"type\": \"string\",\n      \"required\": true\n    },\n    {\n      \"key\": \"tone\",\n      \"type\": \"string\",\n      \"required\": false,\n      \"defaultValue\": \"friendly\",\n      \"validation\": {\n        \"enum\": [\n          \"friendly\",\n          \"formal\"\n        ]\n      }\n    }\n  ],\n  \"toolIds\": [\n    \"b2c3d4e5-6f70-4a1b-8c2d-3e4f5a6b7c8d\"\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.post("https://app.lumenia.net/api/v1/prompt-templates")
  .header("Authorization", "Bearer <API_KEY>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Dental clinic receptionist\",\n  \"type\": \"voice\",\n  \"prompt\": \"You are the receptionist of {{company}}. Keep answers short and {{tone}}.\",\n  \"description\": \"Voice receptionist for dental clinics\",\n  \"firstMessage\": \"Thank you for calling {{company}}! How can I help you today?\",\n  \"variables\": [\n    {\n      \"key\": \"company\",\n      \"description\": \"The clinic name\",\n      \"type\": \"string\",\n      \"required\": true\n    },\n    {\n      \"key\": \"tone\",\n      \"type\": \"string\",\n      \"required\": false,\n      \"defaultValue\": \"friendly\",\n      \"validation\": {\n        \"enum\": [\n          \"friendly\",\n          \"formal\"\n        ]\n      }\n    }\n  ],\n  \"toolIds\": [\n    \"b2c3d4e5-6f70-4a1b-8c2d-3e4f5a6b7c8d\"\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://app.lumenia.net/api/v1/prompt-templates', [
  'body' => '{
  "name": "Dental clinic receptionist",
  "type": "voice",
  "prompt": "You are the receptionist of {{company}}. Keep answers short and {{tone}}.",
  "description": "Voice receptionist for dental clinics",
  "firstMessage": "Thank you for calling {{company}}! How can I help you today?",
  "variables": [
    {
      "key": "company",
      "description": "The clinic name",
      "type": "string",
      "required": true
    },
    {
      "key": "tone",
      "type": "string",
      "required": false,
      "defaultValue": "friendly",
      "validation": {
        "enum": [
          "friendly",
          "formal"
        ]
      }
    }
  ],
  "toolIds": [
    "b2c3d4e5-6f70-4a1b-8c2d-3e4f5a6b7c8d"
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <API_KEY>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://app.lumenia.net/api/v1/prompt-templates");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <API_KEY>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Dental clinic receptionist\",\n  \"type\": \"voice\",\n  \"prompt\": \"You are the receptionist of {{company}}. Keep answers short and {{tone}}.\",\n  \"description\": \"Voice receptionist for dental clinics\",\n  \"firstMessage\": \"Thank you for calling {{company}}! How can I help you today?\",\n  \"variables\": [\n    {\n      \"key\": \"company\",\n      \"description\": \"The clinic name\",\n      \"type\": \"string\",\n      \"required\": true\n    },\n    {\n      \"key\": \"tone\",\n      \"type\": \"string\",\n      \"required\": false,\n      \"defaultValue\": \"friendly\",\n      \"validation\": {\n        \"enum\": [\n          \"friendly\",\n          \"formal\"\n        ]\n      }\n    }\n  ],\n  \"toolIds\": [\n    \"b2c3d4e5-6f70-4a1b-8c2d-3e4f5a6b7c8d\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <API_KEY>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Dental clinic receptionist",
  "type": "voice",
  "prompt": "You are the receptionist of {{company}}. Keep answers short and {{tone}}.",
  "description": "Voice receptionist for dental clinics",
  "firstMessage": "Thank you for calling {{company}}! How can I help you today?",
  "variables": [
    [
      "key": "company",
      "description": "The clinic name",
      "type": "string",
      "required": true
    ],
    [
      "key": "tone",
      "type": "string",
      "required": false,
      "defaultValue": "friendly",
      "validation": ["enum": ["friendly", "formal"]]
    ]
  ],
  "toolIds": ["b2c3d4e5-6f70-4a1b-8c2d-3e4f5a6b7c8d"]
] as [String : Any]

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

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