/api/agent

POST /api/agent/v1/construct-native-query

Changed on

Construct a native (raw SQL) query against a database.

Wraps sql into a serialized native query and returns it base64-encoded — the same {"query": <base64>} shape as /v2/construct-query — so it can be saved as a question via /v1/question (the MCP layer swaps the base64 for a query_handle).

This endpoint does NOT execute the SQL; to run native SQL ad hoc use /v1/execute-sql. The MBQL execution endpoints (/v1/execute, /v2/query) reject native queries by design, so a handle produced here is for saving, not for /v2/query execution.

post/api/agent/v1/construct-native-query

Request

  • Base URL
    (relative, and the document was published on a file host, not at the API’s origin)
  • Auth
    API key in header X-API-Key

Request body

database_idinteger required

value must be an integer greater than zero.

sqlstring required

value must be a non-blank string.

Response

Successful response

promptstring nullable

value must be a non-blank string.

querystring required

value must be a non-blank string.

Changes