# Аутентификация

**Аутентификация пользователя:**

**`POST /auth/login`**

Параметры тела запроса:

`auth` - имя аутентификатора, тип: *string* \
`username` - имя пользователя, тип: *string* \
`password` - пароль пользователя, тип: *string*

Пример ответа в случае успешной аутентификации:

```
{'result': 'ok', 'token': 'token_value', 'version': '3.0.0', 'scrambler': 'scrambler_value'}
```

Пример ответа в случае неуспешной аутентификации:

```
{'result': 'error', 'token': None, 'version': '3.0.0', 'error': 'Invalid credentials'}
```

> **Важно:** значение параметра `token` используется в качестве значения HTTP заголовка `X-Auth-Token`, передаваемого во всех последующих запросах к API в рамках текущей сессии.

**Завершение сессии:**

**`GET /auth/logout`**


---

# 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://kb.pvhostvm.ru/hostvm-vdi/rest-api-guide/3.5/authentication.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.
