Overview

Аккаунты в API и сессии авторизации

Все запросы требуют bearer-токен, см. Авторизацию.

Сессии авторизации#

POST/v2/accounts/auth-sessions

Открыть сессию авторизации по номеру телефона. Возвращает идентификатор сессии, к которому дальше привязываются код и пароль. Тело запроса — JSON.

Authorization
Authorizationstring

Sent as the Authorization header. Your key is used only by your browser for this request — it is never sent to Docsbook or stored.

POST/v2/accounts/auth-sessions/qr

Открыть сессию авторизации по QR-коду — альтернатива коду из сообщения. Тело запроса — JSON.

Authorization
Authorizationstring

Sent as the Authorization header. Your key is used only by your browser for this request — it is never sent to Docsbook or stored.

GET/v2/accounts/auth-sessions/{auth_id}

Состояние сессии: ждёт код, ждёт пароль, завершена, отклонена. Опрашивайте эту операцию между шагами подключения.

Authorization
Authorizationstring

Sent as the Authorization header. Your key is used only by your browser for this request — it is never sent to Docsbook or stored.

Path
auth_idstringrequired

UUID сессии авторизации

POST/v2/accounts/auth-sessions/{auth_id}/code

Передать код подтверждения, который мессенджер прислал на номер. Тело запроса — JSON.

Authorization
Authorizationstring

Sent as the Authorization header. Your key is used only by your browser for this request — it is never sent to Docsbook or stored.

Path
auth_idstringrequired

UUID сессии авторизации

POST/v2/accounts/auth-sessions/{auth_id}/password

Передать облачный пароль, если у аккаунта включена двухфакторная защита. Тело запроса — JSON.

Authorization
Authorizationstring

Sent as the Authorization header. Your key is used only by your browser for this request — it is never sent to Docsbook or stored.

Path
auth_idstringrequired

UUID сессии авторизации

POST/v2/accounts/auth-sessions/{auth_id}/resend-code

Запросить повторную отправку кода подтверждения.

Authorization
Authorizationstring

Sent as the Authorization header. Your key is used only by your browser for this request — it is never sent to Docsbook or stored.

Path
auth_idstringrequired

UUID сессии авторизации

DELETE/v2/accounts/auth-sessions/{auth_id}

Прервать незавершённую сессию авторизации.

Authorization
Authorizationstring

Sent as the Authorization header. Your key is used only by your browser for this request — it is never sent to Docsbook or stored.

Path
auth_idstringrequired

UUID сессии авторизации

Пошаговый разбор этой последовательности — Подключить аккаунт по API.

Аккаунты#

GET/v2/accounts

Список подключённых аккаунтов клиента. Клиент определяется по токену.

Authorization
Authorizationstring

Sent as the Authorization header. Your key is used only by your browser for this request — it is never sent to Docsbook or stored.

GET/v2/accounts/{account_id}

Карточка одного аккаунта.

Authorization
Authorizationstring

Sent as the Authorization header. Your key is used only by your browser for this request — it is never sent to Docsbook or stored.

Path
account_idstringrequired

UUID аккаунта

POST/v2/accounts/{account_id}/update

Изменить параметры аккаунта. Тело запроса — JSON.

Authorization
Authorizationstring

Sent as the Authorization header. Your key is used only by your browser for this request — it is never sent to Docsbook or stored.

Path
account_idstringrequired

UUID аккаунта

DELETE/v2/accounts/{account_id}

Отключить аккаунт от NN Agent.

Authorization
Authorizationstring

Sent as the Authorization header. Your key is used only by your browser for this request — it is never sent to Docsbook or stored.

Path
account_idstringrequired

UUID аккаунта

Привязка аккаунтов к кампании#

Аккаунты сами по себе ничего не рассылают — они привязываются к кампании. Операции привязки и отвязки описаны на странице Кампании и контакты.

Дальше#

Аккаунты в API и сессии авторизации — NN Agent