AI

Rewrite a selected prompt section via natural language

POST
/api/ai/nl-edit

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.

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/api/ai/nl-edit" \  -H "Content-Type: application/json" \  -d '{    "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)."}