# API

For integration with external systems (if necessary), Sherpa AI Server offers a set of tools for data exchange via API.

The "API" section serves as a reference for available API methods in Swagger format. This section includes the following tabs:

1. [Key](#id-1.-key-api-key)
2. [Storage](#id-2.-storage)
3. [Log](#id-3.-log)
4. [Accounts](#id-4.-accounts)
5. [AI Server](#id-5.-ai-server)

## 1. Key (API Key)

In this section, the user can see their unique API access key in the Key field. Also, when changing this field, it is necessary to confirm the action by pressing one of the buttons:

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXcn2NquemwBIg2sr1a7Cuznn7UnutiFVKuMP0VatOn3eohYdHchb2P6ZzjbWKLiHXjo3iXEpizExtwWc1Re-FpbDNCHcL5xkgnXboe_Dx3j4-cIStBOhwqw1MXsisDQL7rw4WHlJQ?key=uiwU7hKhsXZnEihZUEsDW2IP)(Assignment) - Assign a new key;

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXd_N-8js0FyzrxL41Nt98rMZiWVzywt4UQr7xGxXKbmMn3bKWuL3tO2yIHh1S9MwESFDIvkkaOi643AdHTBev51GLc-7lCpyDfblTMI5mHniU9sO1lYbhKVrdexjjxwskmGmqRIGQ?key=uiwU7hKhsXZnEihZUEsDW2IP) (Refresh) - Refresh the current key.

Below is the information field "Authorization," which is used to provide the access token confirming that the User has the right to perform the requested action.

Example:

<figure><img src="https://3237142148-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FscP4BXwl9ufpJr5mfVln%2Fuploads%2Fgit-blob-992b3ec50b6467d6b2ba22527526a7ab4df21307%2Funnamed%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

“Bearer” — token type,

“Y2Y5M2U3OGUtMDk1ZC00MGNjLTkwNWUtZTYyNjUwM\_\_\_\_\_\_\_” — the token itself, which the server will use to identify the User.

API requests are made with the mandatory transmission of the API Key, which is stored in the Account settings. Detailed examples of requests are provided in the section for each block separately.

Response codes:

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcksX19BmAGA_M1-s6E21P5ntadj4BJO49TRqpomZmAH3FVRztISXbZhW50cFtBTzyI0Q2OcuKXa8qB0zc4Y71JAtpES-4AcjrI9SWOT-_famgB8kYwA-fQ7SF5pOr0u4bIcOGJ?key=uiwU7hKhsXZnEihZUEsDW2IP" alt=""><figcaption></figcaption></figure>

## 2. Storage

Allows managing the Storage. The user can create new folders and files, retrieve information about folders and files, update information about folders and files, and delete folders and files.

This page contains tabs with methods:

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXf0LPeW7G3-SrDQhTUUBUWBeHxCNJtfb__GDSkCCCu9oaR3Pr2NbsLtvFqJvAaqHrXMTyPsM8WI5qbEBby5ms3HxLbxpaHCmqNIHyz3ko_SHKJ1DMUoqc-2fbtQHj2a0OfqiTV9?key=uiwU7hKhsXZnEihZUEsDW2IP" alt=""><figcaption></figcaption></figure>

By clicking on the icon ![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXc-aqpnIbv0y24wAoXIMcS0SCIZtQ3ttBrV8lnZw5ciOIhyT4H4tR1OZXqSS6N8wJHuZ8nMCTiE5YbwYDI5hPoxncZIRjH6WYi5-PZfmOretSWmz9BmrnZe1isbcMfKHhw95N5mFQ?key=uiwU7hKhsXZnEihZUEsDW2IP) to the right of the desired method, the corresponding page opens:

### 1. Creating a New Folder

* Endpoint: /api/folders/create
* Method: POST;
* Authorization: required;
* Parameters:
  * Name: Name of the new folder;
  * Description: Description for the new folder.
* Example:

<table data-header-hidden><thead><tr><th width="289"></th><th></th></tr></thead><tbody><tr><td>Request</td><td>Response</td></tr><tr><td><p>```json</p><p>{</p><p>"Name": "New Folder 1",</p><p>}</p><p>```</p></td><td><p>[</p><p>"guid": "16f94238-ede9-435b-a001-1489b32e7dc2",</p><p>]</p></td></tr></tbody></table>

### 2. Retrieving Information About a Folder by GUID

* Endpoint: /api/folders/read/{guid}
* Method: GET;
* Authorization: required;
* Parameters:
  * Guid (required): Guid of the new folder.
* Example:

| Request                                                | Response                                                                                                                                                                                                                                                                                                             |
| ------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| /api/folders/read/4dd6abf4-daa3-45d0-9347-6780c2b46b0c | `json</p><p> {</p><p> "id": 1,</p><p> "guid": "4dd6abf4-daa3-45d0-9347-6780c2b46b0c",</p><p> "name": "Test Folder 1",</p><p> "description": "My new test Folder",</p><p> "created": "2023-01-29 10:29:25",</p><p> "updated": "2023-01-29 10:44:09",</p><p> "is_deleted": 0,</p><p> "account_id": 1,</p><p> }</p><p>` |

### 3. Retrieving a List of Folders Associated with GUID

* Endpoint: /api/folders/list
* Method: GET;
* Authorization: required;
* Parameters: none;
* Example:

<table data-header-hidden><thead><tr><th width="246"></th><th></th></tr></thead><tbody><tr><td>Request</td><td>Response</td></tr><tr><td>/api/folders/list</td><td><p>```json</p><p>[</p><p>{</p><p>"id": 1,</p><p>"guid": "4dd6abf4-daa3-45d0-9347-6780c2b46b0c",</p><p>"name": "Test Folder 1",</p><p>"description": "My new test Folder",</p><p>"created": "2023-01-29 10:29:25",</p><p>"updated": "2023-01-29 10:44:09",</p><p>"is_deleted": 0,</p><p>"account_id": 1,</p><p>},</p><p>{</p><p>"id": 2,</p><p>"guid": "4dd6abf4-daa3-45d0-9347-6780c2b46a3c",</p><p>"name": "Test Folder 2",</p><p>"description": "My another new test Folder",</p><p>"created": "2023-10-05 10:59:41",</p><p>"updated": "2023-10-05 10:59:41",</p><p>"is_deleted": 0,</p><p>"account_id": 1,</p><p>}</p><p>]</p><p>```</p></td></tr></tbody></table>

### 4. Updating Information About a Folder by GUID

* Endpoint: /api/folders/update
* Method: PUT;
* Authorization: required;
* Parameters:
  * Guid (required): Guid of the folder;
  * Name: Name of the new folder;
  * Description: Description for the new folder.
* Example:

<table data-header-hidden><thead><tr><th width="300"></th><th></th></tr></thead><tbody><tr><td>Request</td><td>Response</td></tr><tr><td><p>```json</p><p>{</p><p>"Guid": "554ab883-1f82-48e1-bb12-5049002e7d70",</p><p>"Name": "New Folder Name",</p><p>}</p><p>```</p></td><td>[]</td></tr></tbody></table>

### 5. Creating a New File

* Endpoint: /api/files/create
* Method: POST;
* Authorization: required;
* Parameters:
  * name (required): File name;
  * name\_new (required): New file name;
  * description (required): File description;
  * folder\_id (required): GUID or path to the folder where the file will be added;
  * Metadata (required): File metadata;
  * file (required): File in binary format, or in Base16 / Base32 encodings.
* Example:

<table data-header-hidden><thead><tr><th width="320"></th><th></th></tr></thead><tbody><tr><td>Request</td><td>Response</td></tr><tr><td><p>```json</p><p>{</p><p>"name": "example.txt",</p><p>"name_new": "example_new.txt",</p><p>"description": "File description",</p><p>"folder_id": "123e4567-e89b-12d3-a456-426614174000",</p><p>"Metadata": {},</p><p>"file": "file_content",</p><p>}</p><p>```</p></td><td>[]</td></tr></tbody></table>

### 6. Retrieving Information About a File by GUID

* Endpoint: /api/files/read/{guid}
* Method: GET;
* Authorization: required;
* Parameters:
  * Name (required): Name of the new file.
* Example:

| Request                                                       | Response |
| ------------------------------------------------------------- | -------- |
| `json</p><p> {</p><p> "Name": "example.txt",</p><p> }</p><p>` | \[]      |

### 7. Updating Information About a File by GUID

* Endpoint: /api/files/update
* Method: PUT;
* Authorization: required;
* Parameters:
  * Name (required): Name of the new file;
  * folder\_guid: ID of the folder to which the file needs to be added;
  * file: File in binary format, or in Base16 / Base32 encodings;
* Example:

| Request                                                       | Response |
| ------------------------------------------------------------- | -------- |
| `json</p><p> {</p><p> "Name": "example.txt",</p><p> }</p><p>` | \[]      |

### 8. Deleting a File/Folder

* Endpoint: /api/files/delete
* Method: DELETE;
* Authorization: required;
* Parameters:
  * file\_folder\_guid (required): GUID or path to the file or folder;
  * type\_processing (required): Type of processing. Possible values:\
    0 = Auto, 1 = File, 2 = Directory.
* Example:

<table data-header-hidden><thead><tr><th width="361"></th><th></th></tr></thead><tbody><tr><td>Request</td><td>Response</td></tr><tr><td><p>```json</p><p>{</p><p>"file_folder_guid": "123e4567-e89b-12d3-a456-426614174000",</p><p>"type_processing": 0,</p><p>}</p><p>```</p></td><td>[]</td></tr></tbody></table>

### 9. Uploading a File

* Endpoint: /api/files/uploadfile
* Method: POST;
* Authorization: required;
* Parameters:
  * file (required): File to upload;
  * folder\_id: ID of the folder to which the file needs to be added;
  * metadata: File metadata.
* Example:

<table data-header-hidden><thead><tr><th width="334"></th><th></th></tr></thead><tbody><tr><td>Request</td><td>Response</td></tr><tr><td><p>```json</p><p>[</p><p>"file": "@/path/to/Document.pdf",</p><p>"folder_id=4b5f2f2e-1c8a-4d3c-9b2a-b0f7d9a0a123",</p><p>"metadata":</p><p>{</p><p>"source": "kb",</p><p>"tags": ["policy","2025"]</p><p>}<br>]</p><p>```</p></td><td><p>```json</p><p>{</p><p>"id": 123,</p><p>"object": "file",</p><p>"purpose": "assistants",</p><p>"filename": "Document.pdf",</p><p>"bytes": 1048576,</p><p>"created_at": 1726742400,</p><p>"status": "processed",</p><p>"status_details": "Indexed",</p><p>"tools_type": "retrieval"</p><p>}<br>```</p></td></tr></tbody></table>

### 10. Downloading a File by GUID

* Endpoint: /api/files/download/{guid}
* Method: GET;
* Authorization: required;
* Parameters:
  * filename (required): File name.
* Example:

| Request                                                  | Response                                             |
| -------------------------------------------------------- | ---------------------------------------------------- |
| `json</p><p> {<br> "filename": "example.txt",<br> }<br>` | `json</p><p> {</p><p> "result": "0"</p><p> }</p><p>` |

## 3. Log

Allows managing Logs. The user can create a new Log, retrieve information about the Log, update information about the Log, and delete the Log.

At the top of the page, there is a table with all logging levels:

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdIIY5-xwiuQCZPPBjvj-3Ptj5o5rlrWeuY_Xnvik6zk3JU1Bfn6ScIQz-l1DzMary3DTuuSaeZW12uJJaKtz3hZkWKBcBtRy8-yrsYxj-N92mTAajC5s85H3FMCyjSR9u1KEt7wg?key=uiwU7hKhsXZnEihZUEsDW2IP" alt=""><figcaption></figcaption></figure>

At the bottom, there are tabs with methods:

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdQda0ERXKGtO4Ko1am7Nokmvf3OP0VbCbk7Unz7A398-zDjJxv9NpnUvjlRV1RBh9K7VPsAe_87fpkjCf5O2CgK6E4_RREdydSLEMOgFrmPKdNFj9idlT_OmICro_Fo6soi-K4Xg?key=uiwU7hKhsXZnEihZUEsDW2IP" alt=""><figcaption></figcaption></figure>

By clicking on the icon ![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXc-aqpnIbv0y24wAoXIMcS0SCIZtQ3ttBrV8lnZw5ciOIhyT4H4tR1OZXqSS6N8wJHuZ8nMCTiE5YbwYDI5hPoxncZIRjH6WYi5-PZfmOretSWmz9BmrnZe1isbcMfKHhw95N5mFQ?key=uiwU7hKhsXZnEihZUEsDW2IP) to the right of the desired method, the corresponding page opens:

### 1. Creating a Log

* Endpoint: /api/log/create
* Method: POST;
* Authorization: required;
* Parameters:
  * RobotGUID: GUID of the Robot;
  * ProcessVersionGUID: GUID of the Process version;
  * JobGUID: GUID of the Job;
  * Level: logging level;

Message (required): log text.

* Example:

<table data-header-hidden><thead><tr><th width="365"></th><th></th></tr></thead><tbody><tr><td>Request</td><td>Response</td></tr><tr><td><p>```json</p><p>{</p><p>"RobotGUID": "16f94238-ede9-435b-a001-1489b32e7dc2",</p><p>"ProcessVersionGUID": "c39713ea-d8b9-4669-976e-5ff39677dc64",</p><p>"JobGUID": "70ce211b-3c9a-48f6-8e71-11088b41b825",</p><p>"Level": 1,</p><p>"Message": "no message",</p><p>}</p><p>```</p></td><td>[]</td></tr></tbody></table>

### 2. Retrieving Information About a Log by GUID

* Endpoint: /api/log/read/{guid}
* Method: GET;
* Authorization: required;
* Parameters:
  * Guid (required): Guid of the Log.
* Example:

<table data-header-hidden><thead><tr><th width="288"></th><th></th></tr></thead><tbody><tr><td>Request</td><td>Response</td></tr><tr><td>/api/log/read/c39713ea-d8b9-4669-976e-5ff39677dc64</td><td><p>```json</p><p>{</p><p>"id": "1",</p><p>"guid": "16f94238-ede9-435b-a001-1489b32e7dc2",</p><p>"robot_id": "16",</p><p>"process_version_id": "39",</p><p>"job_id": "70",</p><p>"Level": 1,</p><p>"Message": "no message",</p><p>"created_at": "2023-09-17 15:39:06",</p><p>"updated_at": "2023-09-17 16:39:06",</p><p>}</p><p>```</p></td></tr></tbody></table>

### 3. Retrieving a List of Files Associated with GUID

* Endpoint: /api/log/list
* Method: POST;
* Authorization: required;
* Parameters: none.
* Example:

| Request       | Response |
| ------------- | -------- |
| /api/log/list | \[]      |

### 4. Deleting Logs Belonging to the Current Account Created Before the Selected Time

* Endpoint: /api/log/purge
* Method: DELETE;
* Authorization: required;
* Parameters:
  * Time (required): timestamp in Unix format (Unix timestamp);
* Example:

| Request                                                      | Response |
| ------------------------------------------------------------ | -------- |
| `json</p><p> {</p><p> "Time": "1590481487",</p><p> }</p><p>` | \[]      |

## 4. Accounts

Allows managing Accounts. The user can create a new Account, retrieve information about the Account, update information about the Account, and delete the Account.

This page contains tabs with methods:

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdDTSQXe5IoyrHUS52Td2gzmMKdi7mr_ku4yvJDZtzP7bGwr5mC2JBqSL9GtVGX1hC4Qwa42ksS6gTqYOhQznfWUTVOd2mO6uPYDIqBPmXB4ou9r4PCRcWiDtkI_Rldm-y_JYOX7w?key=uiwU7hKhsXZnEihZUEsDW2IP" alt=""><figcaption></figcaption></figure>

By clicking on the icon ![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXc-aqpnIbv0y24wAoXIMcS0SCIZtQ3ttBrV8lnZw5ciOIhyT4H4tR1OZXqSS6N8wJHuZ8nMCTiE5YbwYDI5hPoxncZIRjH6WYi5-PZfmOretSWmz9BmrnZe1isbcMfKHhw95N5mFQ?key=uiwU7hKhsXZnEihZUEsDW2IP) to the right of the desired method, the corresponding page opens:

* Endpoint: /api/account/create
* Method: POST;
* Authorization: required;
* Parameters:
  * Login (required) — Login for the new Account;
  * Password (required) — Password for the new Account;
  * FirstName — First name for the new Account;
  * LastName — Last name for the new Account;
  * Email — Email for the new Account;
  * Phone — Phone for the new Account;
  * Company — Company for the new Account;
  * Department — Department for the new Account.
* Example:

| Request                                                                                                  | Response                                          |
| -------------------------------------------------------------------------------------------------------- | ------------------------------------------------- |
| `json</p><p> {</p><p> "Login": "New Test Account",</p><p> "Password": "newPassword123",</p><p> }</p><p>` | \["guid": "c39713ea-d8b9-4669-976e-5ff39677dc64"] |

### 2. Retrieving Information About an Account by GUID

* Endpoint: /api/account/read/{guid}
* Method: GET;
* Authorization: required;
* Parameters:
  * GUID (required): GUID of the Account.
* Example:

| Request                                                | Response                                                                                                                                                                                                                            |
| ------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| /api/account/read/c39713ea-d8b9-4669-976e-5ff39677dc64 | `json</p><p> {</p><p> "id": "5",</p><p> "guid": "554ab883-1f82-48e1-bb12-5049002e7d70",</p><p> "login": "new Account",</p><p> "password": "123455678",</p><p> "first name": "Vasya",</p><p> "last name": "Ivanov",</p><p> }</p><p>` |

### 3. Updating Information About an Account by GUID

* Endpoint: /api/account/update
* Method: PUT;
* Authorization: required;
* Parameters:
  * Guid (required) — GUID of the Account to update;
  * Login — Login of the Account to update;
  * Password — Password of the Account to update;
  * FirstName — First name in the Account to update;
  * LastName — Last name of the Account to update;
  * Email — Email of the Account to update;
  * Phone — Phone in the Account to update;
  * Company — Company of the Account to update;
  * Department — Department of the Account to update.
* Example:

| Request                                                                                                                 | Response |
| ----------------------------------------------------------------------------------------------------------------------- | -------- |
| `json</p><p> {</p><p> "Guid": "554ab883-1f82-48e1-bb12-5049002e7d70", </p><p> "Login": "Test Account",</p><p> }</p><p>` | \[]      |

### 4. Deleting an Account by GUID

* Endpoint: /api/account/delete/{guid}
* Method: DELETE;
* Authorization: required;
* Parameters:
  * Guid (required): Guid of the Account;
* Example:

| Request                                                  | Response |
| -------------------------------------------------------- | -------- |
| /api/account/delete/554ab883-1f82-48e1-bb12-5049002e7d70 | \[]      |

## 5. AI Server

Allows managing neural networks. The user can accept a JSON object and return a response from the neural network, retrieve information about the currently used model, get a response from the Assistant, or send a message in the chat.

By clicking on the icon ![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXc-aqpnIbv0y24wAoXIMcS0SCIZtQ3ttBrV8lnZw5ciOIhyT4H4tR1OZXqSS6N8wJHuZ8nMCTiE5YbwYDI5hPoxncZIRjH6WYi5-PZfmOretSWmz9BmrnZe1isbcMfKHhw95N5mFQ?key=uiwU7hKhsXZnEihZUEsDW2IP) to the right of the desired method, the corresponding page opens:

### 1. Adding Text Chunks to an Existing File

* Endpoint: /api/files/addchunk
* Method: POST;
* Authorization: required;
* Parameters:
  * text\_chunk (required): Text chunk;
  * guid\_file (required): GUID of the file or path to the file;
  * metadata (required): Metadata of the chunk.
* Example:

<table data-header-hidden><thead><tr><th width="357"></th><th></th></tr></thead><tbody><tr><td>Request</td><td>Response</td></tr><tr><td><p>```json</p><p>{</p><p>"text_chunk": "Text chunk",</p><p>"guid_file": "123e4567-e89b-12d3-a456-426614174000",</p><p>"metadata": {},</p><p>}</p><p>```</p></td><td>[]</td></tr></tbody></table>

### 2. Finding Embeddings by Given Text

* Endpoint: /api/files/search
* Method: GET;
* Authorization: required;
* Parameters:
  * text\_for\_search (required): Text for search;
  * n\_top (required): Number of top results;
  * files\_ids (required): JSON string with a list of GUIDs or paths to files;
  * folder\_ids (required): JSON string with a list of GUIDs or paths to folders;
  * enable\_subfolders (required): Enable subfolders. Possible values: 0 = False, 1 = True.
* Example:

<table data-header-hidden><thead><tr><th width="357"></th><th></th></tr></thead><tbody><tr><td>Request</td><td>Response</td></tr><tr><td><p>```json</p><p>{</p><p>"text_for_search": "example text",</p><p>"n_top": 5,</p><p>"files_ids": "[\"123e4567-e89b-12d3-a456-426614174000\", \"123e4567-e89b-12d3-a456-426614174001\"]",</p><p>"folder_ids": "[\"123e4567-e89b-12d3-a456-426614174002\", \"123e4567-e89b-12d3-a456-426614174003\"]",</p><p>"enable_subfolders": 1</p><p>}</p><p>```</p></td><td>[]</td></tr></tbody></table>

### 3. Retrieving a Response from the Neural Network

* Endpoint: /api/threads/message
* Method: POST;
* Authorization: required;
* Parameters:
  * messages (required): Array of objects, each representing a message;
  * content: Text of the message;
  * role: Role of the message sender. Possible values: system, user;
  * name: Name of the message sender;
  * temperature: Floating-point number determining the degree of randomness in the neural network's responses. Default value: 0.7;
  * model (required): String indicating the path to the model, e.g., /model-store/meta-llama/Meta-Llama-3-8B-Instruct;
  * assistant\_id: Identifier of the assistant;
  * thread\_id: Identifier of the chat;
  * info: System information.
* Example:

<table data-header-hidden><thead><tr><th width="364"></th><th></th></tr></thead><tbody><tr><td>Request</td><td>Response</td></tr><tr><td><p>```json</p><p>{</p><p>"messages": [</p><p>{</p><p>"content": "Hello, how are you?",</p><p>"role": "user",</p><p>"name": "Ivan"</p><p>},</p><p>{</p><p>"content": "All good, thank you!",</p><p>"role": "system",</p><p>"name": "System"</p><p>}</p><p>]</p><p>"model": "/model-store/meta-llama/Meta-Llama-3-8B-Instruct",</p><p>"temperature": 0.7,</p><p>"assistant_id": "123e4567-e89b-12d3-a456-426614174000",</p><p>"thread_id": 200</p><p>}</p><p>```</p></td><td>[]</td></tr></tbody></table>

### 4. Retrieving Information About the Currently Used Model

* Endpoint: /api/threads/models
* Method: GET;
* Authorization: required;
* Parameters: none.
* Example:

<table data-header-hidden><thead><tr><th width="255"></th><th></th></tr></thead><tbody><tr><td>Request</td><td>Response</td></tr><tr><td>/api/threads/models</td><td><p>```json</p><p>{</p><p>"object": "list",</p><p>"data": [</p><p>{</p><p>"id": "/model-store/meta-llama/Meta-Llama-3-8B-Instruct",</p><p>"object": "model",</p><p>"created": 1735113788,</p><p>"owned_by": "vllm",</p><p>"root": "/model-store/meta-llama/Meta-Llama-3-8B-Instruct",</p><p>"parent": null,</p><p>"permission": [</p><p>{</p><p>"id": "modelperm-d7ddf889e9aa423b9949d1cdc551ff21",</p><p>"object": "model_permission",</p><p>"created": 1735113788,</p><p>"allow_create_engine": false,</p><p>"allow_sampling": true,</p><p>"allow_logprobs": true,</p><p>"allow_search_indices": false,</p><p>"allow_view": true,</p><p>"allow_fine_tuning": false,</p><p>"organization": "*",</p><p>"group": null,</p><p>"is_blocking": false</p><p>}</p><p>]</p><p>}</p><p>]</p><p>}</p><p>```</p></td></tr></tbody></table>

### 5. Retrieving a Message from the Assistant

* Endpoint: /api/threads/getUpdates
* Method: GET;
* Authorization: required;
* Parameters:
  * assistant\_id (required): Identifier of the assistant;
  * offset: Identifier of the message from which to retrieve the list of messages;
  * thread\_id (required): Identifier of the chat.
* Example:

<table data-header-hidden><thead><tr><th width="249"></th><th></th></tr></thead><tbody><tr><td>Request</td><td>Response</td></tr><tr><td>/api/threads/getUpdates?assistant_id=123e4567-e89b-12d3-a456-426614174000&#x26;offset=0&#x26;thread_id=221</td><td><p>```json</p><p>{</p><p>"error": "Licensing error: license is absent, expired, not activated or limits are reached"</p><p>}</p><p>or</p><p>{</p><p>"result": 1,</p><p>"data": [</p><p>{</p><p>"id": "1195",</p><p>"content": "{\"type\":\"text\",\"text\":{\"value\":\"hello\",\"annotations\":[]}}",</p><p>"account_id": "1",</p><p>"is_deleted": "0",</p><p>"role": "user",</p><p>"thread_id": "221",</p><p>"created": "2024-09-11 09:08:48",</p><p>"updated": "2024-09-11 09:08:48",</p><p>"assistant_id":"123e4567-e89b-12d3-a456-426614174000",</p><p>"info": "{\"TestPrm\":\"TestData\"}",</p><p>"folder_id": "[]",</p><p>"file_id": "[]",</p><p>"update_id": null</p><p>},</p><p>{</p><p>"id": "1196",</p><p>"thread_id": "221",</p><p>"created": "2024-09-11 09:08:49",</p><p>"updated": "2024-09-11 09:08:49",</p><p>"content": "{\"type\":\"text\",\"text\":{\"value\":\"Hello! Glad to see you! How can I help you today?\",\"annotations\":[]}}",</p><p>"role": "assistant",</p><p>"account_id": "1",</p><p>"is_deleted": "0",</p><p>"folder_id": null,</p><p>"file_id": null,</p><p>"update_id": null</p><p>}</p><p>]</p><p>}</p><p>```</p></td></tr></tbody></table>

### 6. Sending a Message in the Chat

* Endpoint: /api/threads/chat
* Method: POST;
* Authorization: required;
* Parameters:
  * thread\_id (required): Identifier of the chat;
  * role (required): Role of the message sender (e.g., assistant);
  * content (required): Text of the message;
  * assistant\_id: Identifier of the assistant;
  * model\_id: Identifier of the model group;
  * temperature: Floating-point number determining the degree of randomness in the neural network's responses. Default value: 0.7;
  * prompt: Initial context or instruction for the model;
  * title: Title of the chat;
  * file\_id: List of file IDs attached to the message (JSON array);
  * folder\_id: List of folder IDs (or objects with id) attached to the message (JSON array),
  * info: System information.
* Example:

| Request                                                                                                                                                                                             | Response                                                                                                                                                                                           |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `json</p><p>{<br> "thread_id": 200,<br> "role": "assistant",<br> "content": "Hello! How can I help you today?",<br> "file_id": [101, 102],<br> "folder_id": [201, 202],</p><p> "info": ""<br>}<br>` | `json</p><p> [</p><p> "result": 1,<br> "data": {<br> "message_id": 1234,</p><p> "thread_id": 200,<br> "file_id": [101, 102],<br> "folder_id": [201, 202],</p><p> "info": ""<br> }</p><p> ]</p><p>` |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sherparpa.ru/en/sherpa-ai/sherpa-ai-server/rabota-v-sherpa-ai-server/api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
