---
metadata:
  - name: generator
    content: Diplodoc Platform v5.64.0
alternate:
  - https://yandex.ru/dev/api360/doc/ru/authentication/put-2fa.md
  - href: https://yandex.ru/dev/api360/doc/ru/authentication/put-2fa.md
    type: text/markdown
    title: Markdown version
  - href: https://yandex.ru/dev/api360/doc/ru/llms.txt?revision=r21934284
    rel: describedby
sourcePath: docs/dev/api360/concepts/gw/authentication/put-2fa.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.ru/dev/api360/doc/ru/llms.txt?revision=r21934284

<!-- source: ru/openapi/v1directoryorganizationsorg_idsettings2fa-put.md -->
<div class="openapi">

# Изменение статуса 2FA

<!-- markdownlint-disable-file -->

Включает или выключает обязательную двухфакторную аутентификацию для всех пользователей с доменными аккаунтами или для отдельных сотрудников.

{% note info "" %}

Для выполнения запроса требуется право `ya360_security:domain_2fa_write`.

{% endnote %}

## Request

<div class="openapi__requests">

<div class="openapi__request__wrapper" style="--method: var(--dc-openapi-methods-put);margin-bottom: 12px">

<div class="openapi__request">

PUT {.openapi__method}
```text translate=no
https://cloud-api.yandex.net/v1/directory/organizations/{org_id}/settings/2fa
```

</div>

</div>

</div>

### Path parameters

#|
|| **Name** | **Description** ||
||

_org_id_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: integer

Идентификатор организации.
{.table-cell}
||
|#{.json-schema-properties}

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "enabled": true,
  "setup_grace_period_seconds": 604800,
  "enforcement_mode": "per_domain",
  "second_factor_type": "phone",
  "preferred_phone_validation_method": "default"
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_enabled_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: boolean

Статус обязательной двухфакторной аутентификации:

- `true` — включена;
- `false` — выключена.

{.table-cell}
||
||

_enforcement_mode_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Режим обязательной двухфакторной аутентификации:

- `per_user` — для отдельных сотрудников;
- `per_domain` — для всех сотрудников с аккаунтами на домене организации.

Параметр обязателен при `enabled=true`.


_Enum:_{.json-schema-reset .json-schema-value} `per_user`, `per_domain`
{.table-cell}
||
||

_preferred_phone_validation_method_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Способ аутентификации через Яндекс ID, если в параметре `second_factor_type` выбран `phone`:

- `default` — определяется автоматически;
- `call` — звонок по номеру телефона.


_Enum:_{.json-schema-reset .json-schema-value} `default`, `call`
{.table-cell}
||
||

_second_factor_type_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Способ аутентификации:

- `phone` — через Яндекс ID;
- `totp` — через приложение для создания одноразовых паролей, например Яндекс Ключ.


_Enum:_{.json-schema-reset .json-schema-value} `phone`, `totp`
{.table-cell}
||
||

_setup_grace_period_seconds_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: integer

Период в секундах, в течение которого сотрудник может отложить настройку 2FA. Обязателен при `enabled=true`.

Максимальный период — шесть месяцев (`16070400` секунд).


_Min value:_{.json-schema-reset .json-schema-assertion} `1`

_Max value:_{.json-schema-reset .json-schema-assertion} `16070400`
{.table-cell}
||
|#{.json-schema-properties}

</div>

## Responses

<div class="openapi__response__code__200">

## 200 OK

Настройки обновлены.

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "enabled": true,
  "setup_grace_period_seconds": 604800,
  "enabled_at": "2026-05-01T10:00:00+00:00",
  "enforcement_mode": "per_domain",
  "second_factor_type": "phone",
  "preferred_phone_validation_method": "default"
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_enabled_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: boolean

Статус обязательной двухфакторной аутентификации:

- `true` — включена;
- `false` — выключена.

{.table-cell}
||
||

_enabled_at_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string&lt;date-time&gt;

Дата и время, когда была включена двухфакторная аутентификация, например `2026-04-22T07:52:11+00:00`, если в параметре `enforcement_mode` выбран `per_domain`.

_Example:_{.json-schema-reset .json-schema-example} `2026-05-01T10:00:00+00:00`
{.table-cell}
||
||

_enforcement_mode_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Режим двухфакторной аутентификации:

- `per_domain` — для всех сотрудников с аккаунтами на домене организации;
- `per_user` — для отдельных сотрудников.


_Enum:_{.json-schema-reset .json-schema-value} `per_user`, `per_domain`
{.table-cell}
||
||

_preferred_phone_validation_method_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Способ аутентификации через Яндекс ID, если в параметре `second_factor_type` выбран `phone`:

- `default` — определяется автоматически;
- `call` — звонок по номеру телефона.


_Enum:_{.json-schema-reset .json-schema-value} `default`, `call`
{.table-cell}
||
||

_second_factor_type_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Способ аутентификации:

- `phone` — через Яндекс ID;
- `totp` — через приложение для создания одноразовых паролей, например Яндекс Ключ.


_Enum:_{.json-schema-reset .json-schema-value} `phone`, `totp`
{.table-cell}
||
||

_setup_grace_period_seconds_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: integer

Период (в секундах), в течение которого у пользователя в процессе авторизации есть возможность отложить настройку двухфакторной аутентификации, например `3600`. По истечении этого периода возможность отложить настройку отключается.

Максимальный период — 6 месяцев (`16070400`).


_Min value:_{.json-schema-reset .json-schema-assertion} `1`

_Max value:_{.json-schema-reset .json-schema-assertion} `16070400`
{.table-cell}
||
|#{.json-schema-properties}

</div>

</div>

<div class="openapi__response__code__400">

## 400 Bad Request

Некорректный запрос.

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "error": "bad_request",
  "description": "Bad request",
  "message": "Bad request",
  "details": {}
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_description_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

Техническое описание ошибки.

_Example:_{.json-schema-reset .json-schema-example} `Bad request`
{.table-cell}
||
||

_error_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

Код ошибки

_Example:_{.json-schema-reset .json-schema-example} `bad_request`
{.table-cell}
||
||

_message_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

Сообщение об ошибке.

_Example:_{.json-schema-reset .json-schema-example} `Bad request`
{.table-cell}
||
||

_details_{.json-schema-reset .json-schema-property}
{.table-cell}|
{% cut "**Type**: object" %}

#|
|#{.json-schema-properties}

{% endcut %}

Дополнительные детали ошибки

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{}
```

{% endcut %}
{.table-cell}
||
|#{.json-schema-properties}

</div>

</div>

<div class="openapi__response__code__403">

## 403 Forbidden

Возможные ошибки:

- Authorization error
- SSO user default email change is prohibited
- SSO user personal info change is prohibited

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "error": "forbidden",
  "description": "Forbidden",
  "message": "Forbidden",
  "details": {}
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_description_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

Техническое описание ошибки.

_Example:_{.json-schema-reset .json-schema-example} `Forbidden`
{.table-cell}
||
||

_error_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

Код ошибки

_Example:_{.json-schema-reset .json-schema-example} `forbidden`
{.table-cell}
||
||

_message_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

Сообщение об ошибке.

_Example:_{.json-schema-reset .json-schema-example} `Forbidden`
{.table-cell}
||
||

_details_{.json-schema-reset .json-schema-property}
{.table-cell}|
{% cut "**Type**: object" %}

#|
|#{.json-schema-properties}

{% endcut %}

Дополнительные детали ошибки

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{}
```

{% endcut %}
{.table-cell}
||
|#{.json-schema-properties}

</div>

</div>

<div class="openapi__response__code__404">

## 404 Not Found

Запрашиваемый ресурс не найден.

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "error": "not_found",
  "description": "Not found",
  "message": "Not found",
  "details": {}
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_description_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

Техническое описание ошибки.

_Example:_{.json-schema-reset .json-schema-example} `Not found`
{.table-cell}
||
||

_error_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

Код ошибки

_Example:_{.json-schema-reset .json-schema-example} `not_found`
{.table-cell}
||
||

_message_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

Сообщение об ошибке.

_Example:_{.json-schema-reset .json-schema-example} `Not found`
{.table-cell}
||
||

_details_{.json-schema-reset .json-schema-property}
{.table-cell}|
{% cut "**Type**: object" %}

#|
|#{.json-schema-properties}

{% endcut %}

Дополнительные детали ошибки

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{}
```

{% endcut %}
{.table-cell}
||
|#{.json-schema-properties}

</div>

</div>

<div class="openapi__response__code__409">

## 409 Conflict

2FA management is not enabled for this organization

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "error": "feature_disabled",
  "description": "2FA management is not enabled for this organization",
  "message": "2FA management is not enabled for this organization",
  "details": {}
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_description_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

Техническое описание ошибки.

_Example:_{.json-schema-reset .json-schema-example} `2FA management is not enabled for this organization`
{.table-cell}
||
||

_error_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

Код ошибки

_Example:_{.json-schema-reset .json-schema-example} `feature_disabled`
{.table-cell}
||
||

_message_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

Сообщение об ошибке.

_Example:_{.json-schema-reset .json-schema-example} `2FA management is not enabled for this organization`
{.table-cell}
||
||

_details_{.json-schema-reset .json-schema-property}
{.table-cell}|
{% cut "**Type**: object" %}

#|
|#{.json-schema-properties}

{% endcut %}

Дополнительные детали ошибки

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{}
```

{% endcut %}
{.table-cell}
||
|#{.json-schema-properties}

</div>

</div>

<div class="openapi__response__code__422">

## 422 Unprocessable Entity

Возможные ошибки:

- Invalid data
- Missing required field
- Invalid field value
- Invalid request body
- Default email must be one of the user's existing emails
- Invalid default email
- Default email cannot be empty
- Invalid display name
- Display name cannot be empty
- Cannot disable 2FA while users with enabled 2FA remain

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "error": "invalid_data",
  "description": "Invalid data",
  "message": "Invalid data",
  "details": {}
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_description_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

Техническое описание ошибки.

_Example:_{.json-schema-reset .json-schema-example} `Invalid data`
{.table-cell}
||
||

_error_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

Код ошибки

_Example:_{.json-schema-reset .json-schema-example} `invalid_data`
{.table-cell}
||
||

_message_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

Сообщение об ошибке.

_Example:_{.json-schema-reset .json-schema-example} `Invalid data`
{.table-cell}
||
||

_details_{.json-schema-reset .json-schema-property}
{.table-cell}|
{% cut "**Type**: object" %}

#|
|#{.json-schema-properties}

{% endcut %}

Дополнительные детали ошибки

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{}
```

{% endcut %}
{.table-cell}
||
|#{.json-schema-properties}

</div>

</div>

</div>
<!-- endsource: ru/openapi/v1directoryorganizationsorg_idsettings2fa-put.md -->


[*Deprecated]: No longer supported, please use an alternative and newer version.