Save Semantic Model Verified Queries

Save Semantic Model Verified Queries

This documentation is for Kyvos 2026.6.x. To view documentation for other Kyvos versions, click here.

This documentation is for Kyvos 2026.6.x. To view documentation for other Kyvos versions, click here.

Overview

This API saves verified queries for a Semantic Model.

Method: POST

Request URL: {kyvos-url}/rest/v2/semantic-models/{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 Semantic Model for which the verified queries will be saved.

Note: If the Semantic Model name is provided, 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 a Semantic Model name or Semantic Model ID.

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

If by=id, provide the Semantic Model 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 Semantic Model. If the Semantic Model is present in the root directory, specify [Root].

Note: If neither folderName nor folderId is provided, the Semantic Model will be treated as a root-level entity by default.

–

folderId

String

ID of the folder containing the Semantic Model.

–

queryJson (Required)

String

A JSON array used to manage verified queries for a Semantic Model, supporting the addition, update, or deletion of queries based on the specified action.

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

–


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. 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":"What is the total amount for Germany?", "visibility":{ "groups":[ ], "users":[ ] }, "isSampleQuestion":1, "origin":0, "context":"", "id":"5D31F0D2-419B-8272-1E92-97333080E5D8?", "sql":"SELECT SUM(`amount`) AS `total_amount` FROM `Sales`.`Orders` WHERE LOWER(`country`) = LOWER('germany')", "action":"add" } ]

JSON Fields Description

Field

Type

Description

Possible Values

Example

(root)

Array

Root JSON array containing verified query definitions. Each object represents a verified query for AI/conversational interfaces

Array of VerifiedQuery objects

[{...}]

id

String

Unique identifier for this verified query. Required for UPDATE and DELETE actions. Auto-generated for new queries if not provided

GUID or empty for new queries

"query_17764122062715"

question

String

The natural language question that users might ask. This is the query text that the AI will recognize and match against user questions. Must be unique within the semantic model

Any natural language question

"What are the total sales by region?"

sql

String

The SQL query that should be executed when this question is asked. This is the verified/approved SQL that produces the correct answer for the question

Valid SQL query

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

context

String

Additional context or description for the query. Helps AI understand when to use this query and provides metadata for documentation. Can be empty

Free-form text or empty

"Use this for regional sales analysis"

action

String

The action to perform on this verified query. ADD creates a new query, UPDATE modifies an existing query, DELETE removes a query

"add","update","delete"

"add"

isSampleQuestion

Number

Whether this query should be shown as a sample question to users in the AI interface. 1=show as sample, 0=don't show as sample

0,1

1

origin

Number

Origin of the query. 0=user-created through API/UI, 1=system-generated or imported. System-generated queries may have different handling

0,1

0

visibility

JSON Object

Controls which users and groups can see and use this verified query. If not specified, query is visible to all users with access to the semantic model

-

{...}

visibility.users

Array

Array of user identifiers who can see this verified query. Empty array means no user-specific restrictions

Array of user ID strings

["user_123", "user_456"]

visibility.groups

Array

Array of group identifiers who can see this verified query. Empty array means no group-specific restrictions

Array of group ID strings

["group_789", "group_012"]

Copyright Kyvos, Inc. 2026. All rights reserved.