Skip to content
Home Β» Octopush Gateway SMS API Β» (2FA) Two Factor Authentication Β» OTP / MFA – Code Validation

OTP / MFA – Code Validation

POST
https://api.octopush.com/v1/public/service/otp/validate

Encodage : UTF-8

Authentification

Your β€œapi-key” and β€œapi-login” identifiers must be added in the headers.

Definition

Allows you to validate an OTP code generated on Octopush.

Special parameters

NameTypeDescription
phone_numberstring(optional, required if otp_request_token is absent) International phone number +XXZZZZZ: β€œ+33611223344”.
codestringOTP code typed by your visitor/user.
otp_request_tokenstring(optional, required if phone_number is missing) Token of the OTP you are trying to validate. If this value is missing, Octopush will try to validate the last code sent to this recipient.

Curl Example

curl -X POST \ 
'https://api.octopush.com/v1/public/service/otp/validate' \ 
-H 'Content-Type: application/json' \ 
-H 'api-login: ******@email.org' \ 
-H 'api-key: ************' \ 
-H 'cache-control: no-cache' \ 
-d '
{
  "code": "TRQXSDYNJY",
  "otp_request_token": "otp_111111dab2222222aaa33333"
}'

Command to copy/paste

curl -X POST 'https://api.octopush.com/v1/public/service/otp/validate' -H 'Content-Type: application/json' -H 'api-login: ******@email.org' -H 'api-key: ************' -H 'cache-control: no-cache' -d '{"code": "TRQXSDYNJY", "otp_request_token": "otp_111111dab2222222aaa33333"}'

JSON Server Response

Success : 200 Created

{
  "code": 0,
  "message": "success"
}

Error : 400 BAD REQUEST

{
  "code": 199,
  "message": "Wrong OTP code.",
  "remaining_number_of_attempts": 3
}

Failure : 400 BAD REQUEST

{
  "code": 194,
  "message": "At least phone number or request token is mandatory."
}

Examples of return codes

CodeDescription
194At least phone number or request token is mandatory.
195The code field is mandatory.
196Maximum amount of wrong attempts has been reached.
197OTP Request expired.
198OTP Request not found.
199Wrong otp code.