Повторная отправка одноразового кода

Используется для повторной отправки одноразового пароля получателю: генерируется новый одноразовый пароль и отправляется в сообщении, а предыдущий становится недействительным. При повторной отправке используются уже сохраненные данные для генерации OTP из запроса https://one-api.notificore.ru/api/2fa/authentications/otp. Этот вызов API доступен только если текущая аутентификация не завершена до ее даты истечения (срок действия аутентификации указан в каждом ответе API 2FA).

Чтобы повторно отправить одноразовый код, отправьте запрос по этому URL:

POST https://one-api.notificore.ru/api/2fa/authentications/otp/{id}/resend



Request parameters

Parameter Requires Type Default Description
id Yes string No Authentication ID received in response to https://one-api.notificore.ru/api/2fa/authentications/otp. The maximum length is 36 characters.


Response parameters

Parameter Type Description
id string The ID of the generated authentication.
recipient string Number of the recipient of the message with a one-time code.
status string Authentication status. Possible values: pending (authentication session successfully created and pending).
channel string Authentication channel selected for sending the one-time code.
sender string Sender name.
sender_alt string/null SMS sender name.
message_text string Message text.
code_lifetime integer OTP expiration date.
code_max_tries integer The number of OTP check attempts.
code_digits integer The number of digits in the OTP.
price float Authentication cost. At the time of creating the authentication, 0 is indicated.
currency string The three-letter code of the currency in which the value is indicated. Corresponds to the user’s account currency.
country_code string The country code of the recipient of the one-time password according to the ISO 3166-1 alpha-2 standard.
expired_at string Date and time when the authentication expires in ISO 8601 format.
created_at string The date and time of the authentication session were created in ISO 8601 format.
finished_at null Date and time when the authentication session was closed. At the time of creating the authentication, the value “null” is indicated.


Response example

Ответ в случае успешного запроса:

{
  "data": {
    "id": "bf4381c8-9d4a-4705-bd28-f89a830b7f96",
    "recipient": "792979965073",
    "status": "pending",
    "channel": "sms",
    "sender": "SENDER",
    "sender_alt": "SENDER_ALT",
    "message_text": "Your verification code: {code}",
    "code_lifetime": 300,
    "code_max_tries": 3,
    "code_digits": 5,
    "price": "0,02",
    "currency": "USD",
    "country_code": "RU",
    "expired_at": "2023-01-04 18:37:06",
    "created_at": "2023-01-04 17:37:06",
    "finished_at": "2023-01-04 17:37:06"
  }
}


Codes of errors

Code Error Description
422 Authentication failed status This error can occur when attempting to resend the OTP code for an authentication session that has already been completed with a ‘failed’ status. Resending the OTP code is only possible when the authentication session is in the ‘pending’ status.
422 Authentication canceled status This error can occur when attempting to resend the OTP code for an authentication session that has already been completed with a ‘canceled’ status. Resending the OTP code is only possible when the authentication session is in the ‘pending’ status.
422 Authentication expired This error can occur when attempting to resend the OTP code for an authentication session that has already been completed with an ‘expired’ status. Resending the OTP code is only possible when the authentication session is in the ‘pending’ status.
404 Authentication not found This error can occur when the authentication identifier is specified incorrectly or the specified authentication is not present in the system. Please ensure that you are using the correct authentication identifier and try again.