curl --request POST \
--url https://your-instance.example.com/api/ai/nl-create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"instruction": "Draft a friendly follow-up agent that re-engages leads 24h after the last reply.",
"existingPrompt": "",
"conversationHistory": [],
"variableContext": {
"firstName": "Alex",
"propertyName": "Maple Court"
},
"assistedMode": true,
"modelOverride": {
"provider": "anthropic",
"model": "claude-sonnet-4-6"
}
}
'import requests
url = "https://your-instance.example.com/api/ai/nl-create"
payload = {
"instruction": "Draft a friendly follow-up agent that re-engages leads 24h after the last reply.",
"existingPrompt": "",
"conversationHistory": [],
"variableContext": {
"firstName": "Alex",
"propertyName": "Maple Court"
},
"assistedMode": True,
"modelOverride": {
"provider": "anthropic",
"model": "claude-sonnet-4-6"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
instruction: 'Draft a friendly follow-up agent that re-engages leads 24h after the last reply.',
existingPrompt: '',
conversationHistory: [],
variableContext: {firstName: 'Alex', propertyName: 'Maple Court'},
assistedMode: true,
modelOverride: {provider: 'anthropic', model: 'claude-sonnet-4-6'}
})
};
fetch('https://your-instance.example.com/api/ai/nl-create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-instance.example.com/api/ai/nl-create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'instruction' => 'Draft a friendly follow-up agent that re-engages leads 24h after the last reply.',
'existingPrompt' => '',
'conversationHistory' => [
],
'variableContext' => [
'firstName' => 'Alex',
'propertyName' => 'Maple Court'
],
'assistedMode' => true,
'modelOverride' => [
'provider' => 'anthropic',
'model' => 'claude-sonnet-4-6'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-instance.example.com/api/ai/nl-create"
payload := strings.NewReader("{\n \"instruction\": \"Draft a friendly follow-up agent that re-engages leads 24h after the last reply.\",\n \"existingPrompt\": \"\",\n \"conversationHistory\": [],\n \"variableContext\": {\n \"firstName\": \"Alex\",\n \"propertyName\": \"Maple Court\"\n },\n \"assistedMode\": true,\n \"modelOverride\": {\n \"provider\": \"anthropic\",\n \"model\": \"claude-sonnet-4-6\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://your-instance.example.com/api/ai/nl-create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"instruction\": \"Draft a friendly follow-up agent that re-engages leads 24h after the last reply.\",\n \"existingPrompt\": \"\",\n \"conversationHistory\": [],\n \"variableContext\": {\n \"firstName\": \"Alex\",\n \"propertyName\": \"Maple Court\"\n },\n \"assistedMode\": true,\n \"modelOverride\": {\n \"provider\": \"anthropic\",\n \"model\": \"claude-sonnet-4-6\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/ai/nl-create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"instruction\": \"Draft a friendly follow-up agent that re-engages leads 24h after the last reply.\",\n \"existingPrompt\": \"\",\n \"conversationHistory\": [],\n \"variableContext\": {\n \"firstName\": \"Alex\",\n \"propertyName\": \"Maple Court\"\n },\n \"assistedMode\": true,\n \"modelOverride\": {\n \"provider\": \"anthropic\",\n \"model\": \"claude-sonnet-4-6\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"prompt": "<prompt><role>Friendly leasing follow-up agent</role><goal>Re-engage leads 24h after their last reply.</goal></prompt>"
}{
"success": false,
"error": "approval_expired",
"message": "This approval request has expired or was already handled. Please send a new playground message to retry."
}{
"success": false,
"error": "approval_expired",
"message": "This approval request has expired or was already handled. Please send a new playground message to retry."
}{
"success": false,
"error": "approval_expired",
"message": "This approval request has expired or was already handled. Please send a new playground message to retry."
}Generate XML prompt from natural language
Generates a full XML prompt from a natural language instruction, or iteratively refines an existing prompt when conversationHistory and existingPrompt are supplied. Does not persist anything; the returned prompt text is meant to be saved by the caller.
curl --request POST \
--url https://your-instance.example.com/api/ai/nl-create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"instruction": "Draft a friendly follow-up agent that re-engages leads 24h after the last reply.",
"existingPrompt": "",
"conversationHistory": [],
"variableContext": {
"firstName": "Alex",
"propertyName": "Maple Court"
},
"assistedMode": true,
"modelOverride": {
"provider": "anthropic",
"model": "claude-sonnet-4-6"
}
}
'import requests
url = "https://your-instance.example.com/api/ai/nl-create"
payload = {
"instruction": "Draft a friendly follow-up agent that re-engages leads 24h after the last reply.",
"existingPrompt": "",
"conversationHistory": [],
"variableContext": {
"firstName": "Alex",
"propertyName": "Maple Court"
},
"assistedMode": True,
"modelOverride": {
"provider": "anthropic",
"model": "claude-sonnet-4-6"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
instruction: 'Draft a friendly follow-up agent that re-engages leads 24h after the last reply.',
existingPrompt: '',
conversationHistory: [],
variableContext: {firstName: 'Alex', propertyName: 'Maple Court'},
assistedMode: true,
modelOverride: {provider: 'anthropic', model: 'claude-sonnet-4-6'}
})
};
fetch('https://your-instance.example.com/api/ai/nl-create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-instance.example.com/api/ai/nl-create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'instruction' => 'Draft a friendly follow-up agent that re-engages leads 24h after the last reply.',
'existingPrompt' => '',
'conversationHistory' => [
],
'variableContext' => [
'firstName' => 'Alex',
'propertyName' => 'Maple Court'
],
'assistedMode' => true,
'modelOverride' => [
'provider' => 'anthropic',
'model' => 'claude-sonnet-4-6'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-instance.example.com/api/ai/nl-create"
payload := strings.NewReader("{\n \"instruction\": \"Draft a friendly follow-up agent that re-engages leads 24h after the last reply.\",\n \"existingPrompt\": \"\",\n \"conversationHistory\": [],\n \"variableContext\": {\n \"firstName\": \"Alex\",\n \"propertyName\": \"Maple Court\"\n },\n \"assistedMode\": true,\n \"modelOverride\": {\n \"provider\": \"anthropic\",\n \"model\": \"claude-sonnet-4-6\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://your-instance.example.com/api/ai/nl-create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"instruction\": \"Draft a friendly follow-up agent that re-engages leads 24h after the last reply.\",\n \"existingPrompt\": \"\",\n \"conversationHistory\": [],\n \"variableContext\": {\n \"firstName\": \"Alex\",\n \"propertyName\": \"Maple Court\"\n },\n \"assistedMode\": true,\n \"modelOverride\": {\n \"provider\": \"anthropic\",\n \"model\": \"claude-sonnet-4-6\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/ai/nl-create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"instruction\": \"Draft a friendly follow-up agent that re-engages leads 24h after the last reply.\",\n \"existingPrompt\": \"\",\n \"conversationHistory\": [],\n \"variableContext\": {\n \"firstName\": \"Alex\",\n \"propertyName\": \"Maple Court\"\n },\n \"assistedMode\": true,\n \"modelOverride\": {\n \"provider\": \"anthropic\",\n \"model\": \"claude-sonnet-4-6\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"prompt": "<prompt><role>Friendly leasing follow-up agent</role><goal>Re-engage leads 24h after their last reply.</goal></prompt>"
}{
"success": false,
"error": "approval_expired",
"message": "This approval request has expired or was already handled. Please send a new playground message to retry."
}{
"success": false,
"error": "approval_expired",
"message": "This approval request has expired or was already handled. Please send a new playground message to retry."
}{
"success": false,
"error": "approval_expired",
"message": "This approval request has expired or was already handled. Please send a new playground message to retry."
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Natural-language ask describing what the prompt should accomplish.
Optional current prompt XML to iteratively refine; absent for first-draft generation.
Prior turns in this prompt-drafting session, replayed so the model can continue an iterative refinement thread.
Show child attributes
Show child attributes
Available runtime variables and field scopes (grouped) the editor exposes; constrains the model to real @variables instead of inventing placeholders.
When true, drafting uses the stronger battle-tested XML architecture system prompt; otherwise stays closer to the user request with lighter guardrails.
Pin to a specific provider/model (e.g. { provider: 'anthropic', model: 'claude-sonnet-4-6' }) overriding the org's default assignment.
Show child attributes
Show child attributes
{
"provider": "anthropic",
"model": "claude-sonnet-4-6"
}