POST /api/v202609/workbench/query/generate

Writes a KQL query for the Workbench Data Explorer from a plain-language question, using the AI query assistant

GenerateWorkbenchQueryV202609
Use this endpoint to turn a question such as “total cost by vendor for last year” into KQL that can be reviewed and then run with POST workbench/query. The assistant knows the queryable tables and columns, may run small lookup queries of its own to resolve names (for example to find a vendor’s code), and checks the query it writes until it is valid. When the question is ambiguous it asks a clarifying question with suggested answers instead of guessing; send the chosen answer back as a new prompt. The query is not run. Restricted to ENC staff.

Request Headers

Header Value Required Description
ECI-ApiKey string Yes Your API key. See Authentication.
Content-Type application/json Yes All requests must specify JSON content type, including the request body.

Request Body

EdxAiGenerateRequestV202606
Property Description Type
prompt string
Example Request Body application/json
{  "prompt": "string"
}

Responses

200 OK The request succeeded and the response body contains the requested data.

Response Body Parameters

EdxAiGenerateResponseV202606
Property Description Type
attempts integer (int32)
clarificationOptions string[]
clarificationQuestion string
error string
errors string[]
explanation string
kql string
requiresClarification True when the model needs the user to disambiguate a referenced entity (no KQL yet). The UI presents EnergyCap.DTO.V202606.EdxAiGenerateResponse.ClarificationOptions and re-asks with the chosen value. boolean
resolutionSteps Human-readable trace of the entity-resolution lookups the model ran behind the scenes, surfaced for transparency. Empty for a straightforward single-shot generation. string[]
success boolean
valid boolean
Example Response application/json
{  "attempts": 1,  "clarificationOptions": [
    "string"
  ],  "clarificationQuestion": "string",  "error": "string",  "errors": [
    "string"
  ],  "explanation": "string",  "kql": "string",  "requiresClarification": false,  "resolutionSteps": [
    "string"
  ],  "success": false,  "valid": false
}