OTP – Verify OTP

OTP – Verify OTP

Verify one-time-password from user supplied data. Requires “otp” API permission.GET https://androidapi.net/api/get/otp

Parameter #

FieldTypeDescription
secretStringThe API secret you copied from (Tools -> API Keys) page
otpStringThe otp you got from a user supplied input or data

Success Response Format #

FieldTypeDescription
statusNumberList of Codes
200 = Success
messageStringResponse message
dataArrayArray of data

Error Response Format #

NameTypeDescription
statusNumberList of Codes
400 = Invalid parameters
401 = Invalid API secret
403 = Access denied
500 = Something went wrong
messageStringResponse message
dataArrayArray of data

PHP Sample #

<?php

  $apiSecret = "API_SECRET"; // your API secret from (Tools -> API Keys) page
  $otp = "123456"; // otp from a user supplied input or data

  $cURL = curl_init();
  curl_setopt($cURL, CURLOPT_URL, "https://androidapi.net/api/get/otp?secret={$apiSecret}&otp={$otp}");
  curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
  $response = curl_exec($cURL);
  curl_close($cURL);

  $result = json_decode($response, true);

  // do something with response
  print_r($result);

Python Sample #

import requests

# your API secret from (Tools -> API Keys) page
apiSecret = "API_SECRET"

# otp from a user supplied input or data
otpCode = "123456"

r = requests.get(url = "https://androidapi.net/api/get/otp", params = {
    "secret": apiSecret,
    "otp": otpCode
})
  
# do something with response object
result = r.json()

Successful Response #

{
  "status": 200,
  "message": "OTP has been verified!",
  "data": false
}

Error Response #

{
  "status": 403,
  "message": "OTP is invalid or expired!",
  "data": false
}

Leave A Comment