curl --request POST \
--url https://your-instance.example.com/api/ai/nl-edit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"selectedText": "Reply promptly to all leads.",
"instruction": "Make this more specific — mention SLA of 5 minutes during business hours.",
"fullPrompt": "<prompt><role>Leasing assistant</role><goal>Reply promptly to all leads.</goal></prompt>",
"context": "goal section",
"assistedMode": false,
"modelOverride": {
"provider": "openai",
"model": "gpt-4o-mini"
}
}
'import requests
url = "https://your-instance.example.com/api/ai/nl-edit"
payload = {
"selectedText": "Reply promptly to all leads.",
"instruction": "Make this more specific — mention SLA of 5 minutes during business hours.",
"fullPrompt": "<prompt><role>Leasing assistant</role><goal>Reply promptly to all leads.</goal></prompt>",
"context": "goal section",
"assistedMode": False,
"modelOverride": {
"provider": "openai",
"model": "gpt-4o-mini"
}
}
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({
selectedText: 'Reply promptly to all leads.',
instruction: 'Make this more specific — mention SLA of 5 minutes during business hours.',
fullPrompt: '<prompt><role>Leasing assistant</role><goal>Reply promptly to all leads.</goal></prompt>',
context: 'goal section',
assistedMode: false,
modelOverride: {provider: 'openai', model: 'gpt-4o-mini'}
})
};
fetch('https://your-instance.example.com/api/ai/nl-edit', 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-edit",
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([
'selectedText' => 'Reply promptly to all leads.',
'instruction' => 'Make this more specific — mention SLA of 5 minutes during business hours.',
'fullPrompt' => '<prompt><role>Leasing assistant</role><goal>Reply promptly to all leads.</goal></prompt>',
'context' => 'goal section',
'assistedMode' => false,
'modelOverride' => [
'provider' => 'openai',
'model' => 'gpt-4o-mini'
]
]),
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-edit"
payload := strings.NewReader("{\n \"selectedText\": \"Reply promptly to all leads.\",\n \"instruction\": \"Make this more specific — mention SLA of 5 minutes during business hours.\",\n \"fullPrompt\": \"<prompt><role>Leasing assistant</role><goal>Reply promptly to all leads.</goal></prompt>\",\n \"context\": \"goal section\",\n \"assistedMode\": false,\n \"modelOverride\": {\n \"provider\": \"openai\",\n \"model\": \"gpt-4o-mini\"\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-edit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"selectedText\": \"Reply promptly to all leads.\",\n \"instruction\": \"Make this more specific — mention SLA of 5 minutes during business hours.\",\n \"fullPrompt\": \"<prompt><role>Leasing assistant</role><goal>Reply promptly to all leads.</goal></prompt>\",\n \"context\": \"goal section\",\n \"assistedMode\": false,\n \"modelOverride\": {\n \"provider\": \"openai\",\n \"model\": \"gpt-4o-mini\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/ai/nl-edit")
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 \"selectedText\": \"Reply promptly to all leads.\",\n \"instruction\": \"Make this more specific — mention SLA of 5 minutes during business hours.\",\n \"fullPrompt\": \"<prompt><role>Leasing assistant</role><goal>Reply promptly to all leads.</goal></prompt>\",\n \"context\": \"goal section\",\n \"assistedMode\": false,\n \"modelOverride\": {\n \"provider\": \"openai\",\n \"model\": \"gpt-4o-mini\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"rewrittenText": "Reply to all leads within 5 minutes during business hours (Mon-Fri, 9am-6pm local)."
}{
"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."
}Rewrite a selected prompt section via natural language
Rewrites a highlighted section of an XML prompt according to the user instruction while leaving the surrounding prompt untouched. Returns only the replacement text; the caller is responsible for splicing it back into the editor.
curl --request POST \
--url https://your-instance.example.com/api/ai/nl-edit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"selectedText": "Reply promptly to all leads.",
"instruction": "Make this more specific — mention SLA of 5 minutes during business hours.",
"fullPrompt": "<prompt><role>Leasing assistant</role><goal>Reply promptly to all leads.</goal></prompt>",
"context": "goal section",
"assistedMode": false,
"modelOverride": {
"provider": "openai",
"model": "gpt-4o-mini"
}
}
'import requests
url = "https://your-instance.example.com/api/ai/nl-edit"
payload = {
"selectedText": "Reply promptly to all leads.",
"instruction": "Make this more specific — mention SLA of 5 minutes during business hours.",
"fullPrompt": "<prompt><role>Leasing assistant</role><goal>Reply promptly to all leads.</goal></prompt>",
"context": "goal section",
"assistedMode": False,
"modelOverride": {
"provider": "openai",
"model": "gpt-4o-mini"
}
}
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({
selectedText: 'Reply promptly to all leads.',
instruction: 'Make this more specific — mention SLA of 5 minutes during business hours.',
fullPrompt: '<prompt><role>Leasing assistant</role><goal>Reply promptly to all leads.</goal></prompt>',
context: 'goal section',
assistedMode: false,
modelOverride: {provider: 'openai', model: 'gpt-4o-mini'}
})
};
fetch('https://your-instance.example.com/api/ai/nl-edit', 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-edit",
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([
'selectedText' => 'Reply promptly to all leads.',
'instruction' => 'Make this more specific — mention SLA of 5 minutes during business hours.',
'fullPrompt' => '<prompt><role>Leasing assistant</role><goal>Reply promptly to all leads.</goal></prompt>',
'context' => 'goal section',
'assistedMode' => false,
'modelOverride' => [
'provider' => 'openai',
'model' => 'gpt-4o-mini'
]
]),
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-edit"
payload := strings.NewReader("{\n \"selectedText\": \"Reply promptly to all leads.\",\n \"instruction\": \"Make this more specific — mention SLA of 5 minutes during business hours.\",\n \"fullPrompt\": \"<prompt><role>Leasing assistant</role><goal>Reply promptly to all leads.</goal></prompt>\",\n \"context\": \"goal section\",\n \"assistedMode\": false,\n \"modelOverride\": {\n \"provider\": \"openai\",\n \"model\": \"gpt-4o-mini\"\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-edit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"selectedText\": \"Reply promptly to all leads.\",\n \"instruction\": \"Make this more specific — mention SLA of 5 minutes during business hours.\",\n \"fullPrompt\": \"<prompt><role>Leasing assistant</role><goal>Reply promptly to all leads.</goal></prompt>\",\n \"context\": \"goal section\",\n \"assistedMode\": false,\n \"modelOverride\": {\n \"provider\": \"openai\",\n \"model\": \"gpt-4o-mini\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/ai/nl-edit")
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 \"selectedText\": \"Reply promptly to all leads.\",\n \"instruction\": \"Make this more specific — mention SLA of 5 minutes during business hours.\",\n \"fullPrompt\": \"<prompt><role>Leasing assistant</role><goal>Reply promptly to all leads.</goal></prompt>\",\n \"context\": \"goal section\",\n \"assistedMode\": false,\n \"modelOverride\": {\n \"provider\": \"openai\",\n \"model\": \"gpt-4o-mini\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"rewrittenText": "Reply to all leads within 5 minutes during business hours (Mon-Fri, 9am-6pm local)."
}{
"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
The exact substring the user highlighted in the editor; the model rewrites only this slice and the caller splices the result back in.
Natural-language directive for how to rewrite the selection.
The full surrounding XML prompt, supplied as read-only context so the rewrite stays consistent in tone and structure.
Optional hint about where the selection lives (e.g. goal section, rule list) to disambiguate the rewrite target.
Available runtime variables and field scopes; constrains the rewrite to real @variables instead of inventing placeholders.
When true, editing 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"
}