Verify PIN

Use this method to verify the PIN code provided by a user. Submit the number (msisdn) along the PIN code that was previously delivered to them via SMS with the 'Request' method to verify against our records.

In order for verification to succeed, you must provide a valid MSISDN-PIN pair that has not expired nor exhausted its allowed maximum validation attempts, as per the settings specified with the 'Request' method.

If verification fails a number of times greater than was specified with the max_tries setting (3 by default), the PIN code wil be rendered invalid.

Endpoint

https://api.gateway360.com/api/2fa/verify

Request

api_key Your API Key.
msisdn A mobile number that has previously requested verification.
pin The verification pin received by the user.
Mandatory
Optional
{
    "api_key":"399d2b438a53ebed3db8a7d52107f846",
    "msisdn":"34666666111",
    "pin":"581365"
}
curl -X POST \
 -H 'Content-Type: application/json' \
 -H 'Accept: application/json' \
 -d '{
    "api_key":"399d2b438a53ebed3db8a7d52107f846",
    "msisdn":"34666666111",
    "pin":"581365"
}' https://api.gateway360.com/api/2fa/verify
$request = '{
    "api_key":"399d2b438a53ebed3db8a7d52107f846",
    "msisdn":"34666666111",
    "pin":"581365"
}';
        	
$headers = array('Content-Type: application/json');        	

$ch = curl_init('https://api.gateway360.com/api/2fa/verify');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);

$result = curl_exec($ch);
 
if (curl_errno($ch) != 0 ){
	die("curl error: ".curl_errno($ch));
}        	
/** Imports */
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
/** End imports */


HttpClient httpClient = HttpClientBuilder.create().build();
HttpPost request = new HttpPost("https://api.gateway360.com/api/2fa/verify");

StringEntity params = new StringEntity(
"{" +
"    \"api_key\":\"399d2b438a53ebed3db8a7d52107f846\"," +
"    \"msisdn\":\"34666666111\"," +
"    \"pin\":\"581365\"" +
"}");

request.addHeader("content-type", "application/json");
request.addHeader("Accept","application/json");
request.setEntity(params);
HttpResponse response = httpClient.execute(request);
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.gateway360.com/api/2fa/verify")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["accept"] = 'application/json'

request.body = '{
    "api_key":"399d2b438a53ebed3db8a7d52107f846",
    "msisdn":"34666666111",
    "pin":"581365"
}'

response = http.request(request)
puts response.read_body
conn = http.client.HTTPSConnection("api.gateway360.com")

payload = '{
    "api_key":"399d2b438a53ebed3db8a7d52107f846",
    "msisdn":"34666666111",
    "pin":"581365"
}'

headers = {
    'content-type': "application/json",
    'accept': "application/json"
    }

conn.request("POST", "/api/3.0/2fa/verify", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
var client = new RestClient("https://api.gateway360.com/api/2fa/verify");

var request = new RestRequest(Method.POST);
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", '{
    "api_key":"399d2b438a53ebed3db8a7d52107f846",
    "msisdn":"34666666111",
    "pin":"581365"
}', ParameterType.RequestBody);

IRestResponse response = client.Execute(request);
Private Sub Command1_Click()
Dim objHTTP As Object
Dim Json As String
Dim result As String


    Json = fJSON
    Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
    URl = "https://api.gateway360.com/api/2fa/verify"
    objHTTP.Open "POST", URl, False
    objHTTP.setRequestHeader "Content-type", "application/json"
    objHTTP.send (Json)
    result = objHTTP.responseText
   Set objHTTP = Nothing
End Sub

Private Function fJSON() As String
    fJSON = "{"
    fJSON = fJSON & """api_key"":""399d2b438a53ebed3db8a7d52107f846"","
    fJSON = fJSON & """msisdn"":""34666666667"","
    fJSON = fJSON & """pin"":""581365"""
    fJSON = fJSON & "}"
End Function

Response

status Final request status - either "ok" or "error"
result

In case of status being "ok", result will contain details about the operation

verifiedtrue or false
previously_verifiedOnly if verified is true. Indicates whether the PIN has already been verified at least once.
tries_remainingOnly if verified is false and the max_tries setting is not 0. Indicates the number of attempts remaining to verify the specified msisdn.
messageA human readable message explaining the obtained result.
error_id In case of status being "error", this param will contain the error id.
error_msg In case of status being "error", this param will contain additional information. Should only be used for debugging.
200 OK
{
	"status":"ok",
	"result":
	{
	"verified":true,
	"previously_verified":false,
	"message":"PIN code verified."
   }
}
User successfully verified
200 OK
{
	"status":"ok",
	"result":
	{
	"verified":false,
	"tries_remaining":2,
	"message":"Invalid PIN code."
   }
}
Unsuccesful verification. 2 Tries remaining.
401 Unauthorized
{
    "status":"error",
    "error_id":"UNAUTHORIZED",
    "error_msg":"Your API key may be invalid or your IP is blocked."
}
We didn't continue processing your request because your API Key wasn't valid.
400 Bad Request
{
    "status":"error",
    "error_id":"INVALID_CONTENT_TYPE",
    "error_msg":"Invalid Content-Type; must be application/json."
}
We couldn't process your request.

Errors

Error ID Explanation
INVALID_CONTENT_TYPE The content type must be: Content-Type: application/json
JSON_PARSE_ERROR Your JSON was formatted incorrectly or was considered otherwise improper or incomplete. Check it here.
MISSING_PARAMS Your request is incomplete and missing some mandatory parameters.
BAD_PARAMS One or more of your parameters has incorrect format or value.
UNAUTHORIZED Your API key may be invalid, double-check that your API key was input correctly or see if the IP is blocked in your account API settings.
RECORD_NOT_FOUND No valid record found for the specified MSISDN-PIN pair.
NOT_VERIFIED The verification pin is invalid.