​Проверка одноразового кода

Этот вызов API используется для проверки того, что одноразовый пароль, который вы получили от пользователя, совпадает с отправленным BSG.

Чтобы проверить одноразовый код, отправьте запрос по этому URL:
POST https://one-api.notificore.ru/api/2fa/authentications/otp/{id}/verify



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.
access_code Yes integer No The one-time password received by the user through the specified channel or alternative channel (optional) in the generation request that needs to be validated. An integer from 3 to 9 digits.


Response parameters

Пример ответа в случае неверного кода:

{
  "errors": [
    {
      "message": "The code does not match the expected value"
    }
  ]
}

Если одноразовый код верный:

Parameter Type Description
id string The ID of the generated authentication.
recipient string Number of the recipient of the message with a one-time password.
status string Authentication status. Possible values: verified (the code was successfully verified, and the session was closed with a successful result).
channel string Channel for authentication.
sender string Sender name.
sender_alt string 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 (excluding the cost of sent messages).
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 Receiver’s country code according to ISO 3166-1 alpha-2.
expired_at string Date and time when the authentication session expires in ISO 8601 format.
created_at string The date and time of the authentication session were created in ISO 8601 format.
finished_at string Date and time when the authentication session was closed in ISO 8601 format.


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
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.
404 The code does not match the expected value The error occurs when the provided code does not match the value that was sent to the recipient’s number.
422 Access code expired Your OTP password has expired. OTP password is no longer valid.
422 Authentication verifying attempts limit This error can occur when attempts limit is exceeded for authentication session.