Skip to main content
POST
/
api
/
ai
/
nl-edit
Rewrite a selected prompt section via natural language
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"
  }
}
'
{
  "success": true,
  "rewrittenText": "Reply to all leads within 5 minutes during business hours (Mon-Fri, 9am-6pm local)."
}

Documentation Index

Fetch the complete documentation index at: https://docs.tetherai.ca/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
selectedText
string
required

The exact substring the user highlighted in the editor; the model rewrites only this slice and the caller splices the result back in.

instruction
string
required

Natural-language directive for how to rewrite the selection.

fullPrompt
string

The full surrounding XML prompt, supplied as read-only context so the rewrite stays consistent in tone and structure.

context
string

Optional hint about where the selection lives (e.g. goal section, rule list) to disambiguate the rewrite target.

variableContext
object

Available runtime variables and field scopes; constrains the rewrite to real @variables instead of inventing placeholders.

assistedMode
boolean

When true, editing uses the stronger battle-tested XML architecture system prompt; otherwise stays closer to the user request with lighter guardrails.

modelOverride
object

Pin to a specific provider/model (e.g. { provider: 'anthropic', model: 'claude-sonnet-4-6' }) overriding the org's default assignment.

Example:
{
"provider": "anthropic",
"model": "claude-sonnet-4-6"
}

Response

Selection rewritten

success
boolean
required
rewrittenText
string
required