1Execute Natural Language Query

1Execute Natural Language Query

Overview

This API is used to execute a Natural Language Query on the specified entity.

Method: POST

Request URL: {kyvos-url}/rest/v2/dialogs/{name-or-id}/nl-query


Authorization

API Key: sessionid

This method authenticates requests using a session ID which acts like an API key.

BasicAuth: HTTP Authorization Scheme

This method authenticates requests using a username and password sent in the HTTP Authorization header.


Headers

Header Name

Type

Description

Possible Values

Header Name

Type

Description

Possible Values

Content-Type (Required)

String

Specifies media type of request body.

application/x-www-form-urlencoded

sessionid

String

The session ID is the token received from the login API.

Note: Session ID is required for token-based authentication.

–


Path Parameters

Parameter Name

Type

Description

Possible Values

Parameter Name

Type

Description

Possible Values

name-or-id (Required)

String

Name or ID of the Entity on which the Natural Language Query needs to be executed.

Note: If the Entity name is provided, then folderName must also be provided.

–


Query Parameters

Parameter Name

Type

Description

Possible Values

Parameter Name

Type

Description

Possible Values

by

String

Specifies whether the name-or-id parameter should be interpreted as Entity name or Entity ID.

If by=name, provide the Entity name in the name-or-id parameter.

If by=id, provide the Entity ID in the name-or-id parameter.

The default value is name.

–


Request Body

Parameter Name

Type

Description

Possible Values

Parameter Name

Type

Description

Possible Values

nlQuery (Required)

String

Natural Language Query that needs to be executed.

–

previousQuery

String

If the user has previously executed the API and wishes to continue from the same context, they can provide the query received in the previous response. If this parameter is not provided, the context of prior executions will not be preserved.

–

entityType (Required)

String

Type of the entity on which Natural Language Query is to be executed.

AISPACE

selectedAISpaceObjects

String

Specifies the AI Space entities to be used for NLP-based querying.

An AI Space can contain multiple entities that are eligible for querying. If this parameter is empty or not provided, all entities available in the AI Space are considered during query processing.

Users can optionally restrict the scope of querying by explicitly specifying one or more entities.

Note: An example is provided under the Resources section below.

–

additionalInfo

String

An AI Space can contain multiple entities. When submitting consecutive or follow-up queries, users may supply this parameter to preserve context and improve query resolution.

Note: This object can include previously executed query details.

Note: An example is provided under the Resources section below.

–

folderName

String

Name of the folder in which entity is present.

–

includeData

String

Specifies whether to include data in the response.

true/false

Default: true

includeSummary

String

Specifies whether to include a generated summary (key insights) in the response.

true/false

Default: false

summaryType

String

The length/detail level of the summary when includeSummary is true.

"BRIEF", "MODERATE", "DETAILED"

Default: "MODERATE"

maxRows

String

Maximum number of data rows to return. Must be a valid integer.

Default: "10000"

requestID

String

Custom request ID for logging and tracing. If provided, it overrides the auto-generated request ID in the logger context.

–

includeActivityLogs

String

Specifies whether to include activity logs in the response (used in Deep Dive Mode).

true/false

Default: true

ignoreFeedback

String

Specifies whether to ignore user feedback when generating the response.

true/false

Default: true


Responses

200 Success

{ "summary": { "data": { "nlQueryLanguage": "English", "dataSummaryGenerationTimeFromLLM": 3627, "value": "<title>Overall Sales Performance Overview</title>\n<summary>\n### 📈 Global Sales Performance Summary\n\nThe analysis shows a strong top-line performance across all regions and product categories captured in the current dataset. \n\nBased on the aggregated data, the total sales volume has reached a significant milestone:\n\n| Metric | Aggregate Value |\n| :--- | :--- |\n| **Total Sales Revenue** | **$7,705,612.32** |\n\n### Key Business Insights\n\n* **Strong Revenue Base:** The business is maintaining a solid revenue stream exceeding **$7.7M**. This figure serves as the primary benchmark for assessing overall growth and comparing against historical performance or sales targets.\n* **Scale of Operations:** Reaching this volume suggests a healthy level of market penetration and customer demand across the product portfolio.\n\n### Executive Takeaway\nThe total sales revenue stands at **$7.7M**, reflecting a robust commercial output. This aggregate figure provides the foundation for deeper analysis into profitability margins and regional performance to ensure this volume is being converted into bottom-line growth effectively.</summary>\n<followUpQuestions>[]</followUpQuestions>" }, "status": "success" }, "contextInfo": { "lastResolvedQuestion": "Show the sum of sales.", "valueDisambiguationContext": "[]" }, "data": { "metadata": { "semanticModelInfo": { "16824961003893127050022117446024": { "measures": [ { "uniqueName": "MEASURE_11", "dataType": "NUMBER", "format": "#,##0.00", "name": "Sum Sales", "description": "", "formatType": "2" } ], "measure": [], "name": "YMD", "id": "16824961003893127050022117446024", "folderName": "KyvosAutomation", "modelType": "BASE", "folderId": "folder_15475302005884127014080117452635", "dimensions": [] } }, "columns": [ { "metaData": { "dimId": "", "dimName": "", "hierName": "", "hierId": "", "name": "Sum Sales", "format": "#,##0.00", "semanticModelId": "16824961003893127050022117446024", "id": "MEASURE_11", "type": "MEASURE", "fieldId": "MEASURE_11" }, "caption": "Total Sales", "hasDate": false, "type": "DOUBLE" } ], "misc": { "sortInfo": {} } }, "rows": [ [ { "dv": "7,705,612.32", "av": "7705612.319939999" } ] ] }, "query": "SELECT SUM(`sum sales`) AS `total_sales`\nFROM `KyvosAutomation`.`YMD`", "status": "success" }

Status Code

Description

Status Code

Description

401

Authorization information is missing or invalid.

404

No matching record found.

412

Precondition failed. Parameter missing.

500

Internal Server Error

Resources

Below are examples of JSON structure which can be used as a reference for the selectedAISpaceObjects and additionalInfo parameters in the request body.

1. selectedAISpaceObjects

[ { "entityName": "entityName", "entityType": "SEMANTIC_MODEL", "folderName": "folderName" }, { "entityType": "SEMANTIC_MODEL", "entityId": "12AB5678-1B3-1234-ABCD-CC316D1F1FBB" } ]

JSON Field Definitions

Field

Type

Description

Possible Values

Example

entityName

String

Name of the entity within the AI Space. Matched case-insensitively against the AI Space's entity names. Takes priority over entityId if both are provided.

Any valid entity name within the AI Space

entityName

entityType

String

Type of the entity within the AI Space.

SEMANTIC_MODEL

SEMANTIC_MODEL

folderName

String

Folder name of the entity. Used together with entityName for lookup. Matched case-insensitively. If not provided, defaults to empty string.

Any valid folder name, or empty string

folderName

entityId

String

ID of the entity within the AI Space. Used as fallback when entityName + folderName match fails.

Any valid entity ID (UUID format)

12AB5678-1B3-1234-ABCD-CC316D1F1FBB

2. additionalInfo

{ "context": { "lastResolvedQuestion": "last quey that was asked", "valueDisambiguationContext": "[]", "previouslyUsedEntities": [ { "name": "entity name", "id": "entity ID", "folderName": "folder name", "type": "SEMANTIC_MODEL" } ] } }

JSON Field Definitions

Field

Type

Description

Possible Values

Example

context

Object

Additional context data that is merged into the query request sent to the backend.

—

{ "lastResolvedQuestion": "...", "previouslyUsedEntities": [...] }

context.lastResolvedQuestion

String

The last natural language question that was resolved, used for conversational context in follow-up queries.

Any string

last query that was asked

context.valueDisambiguationContext

String

JSON array string representing disambiguation context for resolving ambiguous values in the current query.

A valid JSON array string

[]

context.previouslyUsedEntities

Array<Object>

List of entities previously used in the conversation, helping the backend resolve entity references in follow-up queries.

—

[{ "name": "...", "id": "...", "folderName": "...", "type": "..." }]

context.previouslyUsedEntities[].name

String

Name of the previously used entity.

Any valid entity name

entity name

context.previouslyUsedEntities[].id

String

ID of the previously used entity.

Any valid entity ID

entity ID

context.previouslyUsedEntities[].folderName

String

Folder name where the previously used entity resides.

Any valid folder name

folder name

context.previouslyUsedEntities[].type

String

Type of the previously used entity.

SEMANTIC_MODEL, "WORKBOOK", "WORKSHEET"

SEMANTIC_MODEL

Copyright Kyvos, Inc. 2026. All rights reserved.