1Save AI Space Queries

1Save AI Space Queries

Overview

This API saves verified queries for an AI Space. It supports adding new queries, updating existing queries, or deleting existing queries.

Method: POST

Request URL: {kyvos-url}/rest/v2/ai-spaces/{name-or-id}/verified-queries


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 the media type of the 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 AI Space where the verified queries will be saved.

Note: If the AI Space name is provided, then either folderName or folderId 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 an AI Space name or an AI Space ID.

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

If by=id, provide the AI Space 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

folderName

String

Name of the folder containing the AI Space. If the AI Space is present in the root directory, specify [Root].

Note: If neither folderName nor folderId is provided, the AI Space is treated as a root-level entity by default.

–

folderId

String

ID of the folder containing the AI Space.

–

queryJson (Required)

String

JSON array used to manage verified queries associated with an AI Space. Supports adding new queries, updating existing queries, or deleting existing queries based on the specified action.

Note: Refer to the Resources section for an example JSON payload.

–


Responses

200 Success

{ "code": 0, "message": "Changes saved successfully" }

Status Code

Description

Status Code

Description

401

Authorization information is missing or invalid.

404

No matching record found.

412

Precondition failed. Required parameter missing.

500

Internal Server Error


Resources

Below is an example of JSON structure which can be used as a reference for the queryJson parameter in the request body.

[ { "question": "show me total sales of Afghanistan from orderdate arabic", "visibility": { "groups": [], "users": [] }, "isSampleQuestion": 0, "origin": 0, "context": "nothing", "id": "17817666962421127049051193920120", "sql": "select * from afghanishtan from orderdate arabic", "action":"update" }, { "question":"Query 2", "visibility":{ "groups":[], "users":[] }, "isSampleQuestion":0, "origin":0, "context":"nothing", "id":"17785047444169127036041122886867", "sql":"SUM(`gbp_rt`)", "action":"add" } ]

JSON Fields Defintion

Field

Type

Description

Possible Values

Example

(root)

Array

Array of verified query objects. Each object represents a natural language question with its corresponding SQL answer that helps improve AI response accuracy in Kyvos Dialogs

Array of query objects

[{"action": "add", ...}]

action

String

Required. Operation to perform on the verified query. Determines whether to create a new query, modify an existing one, or remove it from the AI Space

add,update,delete

"add"

id

String

System-generated alphanumeric ID

System-generated alphanumeric ID

"vq_17768558564508127068"

question

String

Required. The natural language question that users might ask in Kyvos Dialogs. This is the query text that the AI will match against user inputs to provide verified answers

Any valid question text

"What are the total sales by region?"

sql

String

Required. The verified SQL query or MDX expression that correctly answers the question. This pre-validated query ensures accurate results when users ask similar questions

Valid SQL or MDX query

"SELECT region, SUM(sales) FROM sales_data GROUP BY region"

context

String

Additional context or notes about the verified query. Helps provide supplementary information about when or how this query should be used

Free text (can be empty)

"Use this for quarterly sales reports"

isSampleQuestion

Number

Flag indicating whether this query should be displayed as a sample/suggested question to users in Kyvos Dialogs interface

0,1

1

origin

Number

Indicates the source of the verified query. Helps track whether the query was created manually or generated by the system

0(User created) ,1 (System generated)

0

visibility

Object

Controls which users and groups can see and use this verified query. Enables fine-grained access control for sensitive queries

JSON Object with users and groups arrays

{"users": [], "groups": []}

visibility.users

Array

List of usernames who have access to this verified query. When empty, query is visible based on group settings or to all users

Array of username strings

["john.doe", "jane.smith"]

visibility.groups

Array

List of group names that have access to this verified query. When empty, query is visible based on user settings or to all users

Array of group name strings

["Sales Team", "Analysts"]

Copyright Kyvos, Inc. 2026. All rights reserved.