Text2InsightQuery - Submit a Data Analysis Request

Submit a natural language question to Analytics Agent to initiate a data analysis task.

Interface Description

This interface is asynchronous. Upon a successful call, it returns a questionId and an initial status of running, indicating that the analysis task has started. The client must poll for analysis results via the SafeQuestionPoll interface.

Usage Notes

  • Questions are described in natural language; the Agent will automatically understand and perform the analysis.
  • Supports specifying the model to use via modelSettings.
  • Multiple questions can be submitted consecutively within the same Session, and the Agent retains conversational context.

Usage Recommendations

  • Make question descriptions as clear and specific as possible, including key information such as time ranges and dimensions.
  • If you need the knowledge base to assist with the analysis, you can prompt the Agent in the question to consult the knowledge base.

Request Method

POST /open/text2insight/query?tenantId={tenantId}&userId={userId}&loginToken={loginToken}

Request Parameters

ParameterLocationTypeRequiredDescription
tenantIdQuery + BodyIntegerYesTenant ID
userIdQuery + BodyIntegerYesUser ID
domainIdBodyIntegerYesData domain ID
sessionIdBodyIntegerYesConversation session ID, obtained via CreateSession or reusing an existing value
msgBodyStringYesQuestion content, an analysis request described in natural language
loginTokenQuery + BodyStringYesAuthentication Token
modelSettingsBodyObjectNoModel configuration
modelSettings.model_nameBodyStringNoSpecify the model name to use

Response Parameters

ParameterTypeDescription
successBooleanWhether the request was successful
data.questionIdIntegerQuestion ID, used for subsequent polling and stop operations
data.sessionIdIntegerSession ID
data.statusStringCurrent status; initial value is running

Request Example

POST /open/text2insight/query Content-Type: application/json { "tenantId": 10, "userId": 1, "domainId": 106, "sessionId": 4729, "msg": "Show me the second-hand housing sales in Beijing over the past 6 years, broken down by district", "loginToken": "eyJhbGciOiJIUzI1NiJ9...", "modelSettings": { "model_name": "qwen/qwen3.6-plus" } }

Response Example

Successful response:

{ "success": true, "data": { "questionId": 34339, "sessionId": 4729, "status": "running" } }

Next Steps

After a successful request, use the returned questionId to call SafeQuestionPoll and poll until the analysis is complete.

Error Codes

Error CodeDescription
success=falseToken is invalid, Session does not exist, parameters are missing, or model is unavailable