AI

Generate playground AI response

POST
/api/ai/playground

Runs a one-off playground turn against the specified prompt using the caller-supplied conversation history. Used by the prompt editor to preview replies; does not persist conversation state. ADMIN and SUPERADMIN callers also receive the captured MessageMetric for the turn.

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/playground" \  -H "Content-Type: application/json" \  -d '{    "message": "Hi, I was hoping to book a tour for next Tuesday.",    "promptId": "5f7b1c2e8a1d4e0012c3b4a5",    "conversationId": "64d2f9c5e8a1d4e001a0b1c2",    "conversation": [      {        "role": "user",        "content": "Hello there"      },      {        "role": "assistant",        "content": "Hi! How can I help today?"      }    ]  }'
{  "success": true,  "response": "Great - I can book you for Friday at 2pm. Want me to send a confirmation text?",  "messageMetric": {    "organizationId": "64a1b2c3d4e5f60012345678",    "metricRunId": "run_64d2f9c5e8a1d4e001a0b1c2",    "aiAgentName": "Leasing Specialist",    "aiCalls": [],    "toolCalls": []  }}