{ "queries": [ { "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "organization_id": "20000000-0000-4000-8000-000000000001", "title": "Monthly Order Value", "description": "Total order value grouped by month for a selected year", "prompt": "Summarize monthly order value and highlight notable changes.", "sql": "SELECT DATEFROMPARTS(YEAR(CreatedAt), MONTH(CreatedAt), 1) AS [Month], SUM(Amount) AS TotalAmount FROM dbo.Orders WHERE YEAR(CreatedAt) = {{year}} GROUP BY YEAR(CreatedAt), MONTH(CreatedAt) ORDER BY [Month]", "parameters": ["year"], "last_updated_by": "30000000-0000-4000-8000-000000000001", "last_updated_by_name": "John Doe", "created_at": "2026-08-01T10:00:00+00:00", "updated_at": "2026-08-02T15:30:00+00:00" } ]}
Saved Queries
List Saved Queries
Retrieve all saved queries for your organization
Saved queries store reusable, parameterized SQL Server queries paired with a natural-language formatting instruction. Run one as a chat turn over the WebSocket or the durable REST turn endpoint. The server executes the stored SQL through the same datasource permission gates used by the agent, emits synthetic tool_call and tool_result frames, then asks the model to format the result using the stored prompt. There is no standalone saved-query execution endpoint.The turn must have a datasource integration. Supply every parameter value as a string. The turn’s free-text message is persisted for display, but the stored saved-query prompt is the instruction passed to the model.This endpoint returns only user-visible queries (display = true), ordered by most recent update. It is not paginated.
The SQL Server statement stored for this query. It may contain {{param_name}} placeholders. Although the storage API accepts null, a saved query needs SQL to run as a chat turn.
{ "queries": [ { "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "organization_id": "20000000-0000-4000-8000-000000000001", "title": "Monthly Order Value", "description": "Total order value grouped by month for a selected year", "prompt": "Summarize monthly order value and highlight notable changes.", "sql": "SELECT DATEFROMPARTS(YEAR(CreatedAt), MONTH(CreatedAt), 1) AS [Month], SUM(Amount) AS TotalAmount FROM dbo.Orders WHERE YEAR(CreatedAt) = {{year}} GROUP BY YEAR(CreatedAt), MONTH(CreatedAt) ORDER BY [Month]", "parameters": ["year"], "last_updated_by": "30000000-0000-4000-8000-000000000001", "last_updated_by_name": "John Doe", "created_at": "2026-08-01T10:00:00+00:00", "updated_at": "2026-08-02T15:30:00+00:00" } ]}