Skip to content

Verification

To verify the One Time Password or Verification Token sent. Once the verification done the OTP or token will expire.

POST
/verify/v1/otp/verify-otp

Authentication

AUTHORIZATIONS: Bearer Token

Request parameters

Parameter Value / Pattern Example(s)
*otp_id the otp_id which was returned from Generate OTP endpoint 8d963dbf-d655-4fe6-9157-48885a036050
*otp_code the otp which is recieved on customers mobile phone 435986

Request

1
2
3
4
5
6
7
curl --location --request POST 'https://api.d7networks.com/verify/v1/otp/verify-otp' \
--header 'Authorization: Bearer {{api_access_token}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "otp_id":"{{otp_id}}",
    "otp_code":"{{otp}}"
}'
var axios = require('axios');
var data = JSON.stringify({
"otp_id": "{{otp_id}}",
"otp_code": "{{otp}}"
});

var config = {
method: 'post',
url: 'https://api.d7networks.com/verify/v1/otp/verify-otp',
headers: { 
    'Authorization': 'Bearer {{api_access_token}}', 
    'Content-Type': 'application/json'
},
data : data
};

axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
import requests
import json

url = "https://api.d7networks.com/verify/v1/otp/verify-otp"

payload = json.dumps({
"otp_id": "{{otp_id}}",
"otp_code": "{{otp}}"
})
headers = {
'Authorization': 'Bearer {{api_access_token}}',
'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.d7networks.com/verify/v1/otp/verify-otp',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
    "otp_id":"{{otp_id}}",
    "otp_code":"{{otp}}"
}',
CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer {{api_access_token}}',
    'Content-Type: application/json'
),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
package main

import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)

func main() {

url := "https://api.d7networks.com/verify/v1/otp/verify-otp"
method := "POST"

payload := strings.NewReader(`{
    "otp_id":"{{otp_id}}",
    "otp_code":"{{otp}}"
}`)

client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)

if err != nil {
    fmt.Println(err)
    return
}
req.Header.Add("Authorization", "Bearer {{api_access_token}}")
req.Header.Add("Content-Type", "application/json")

res, err := client.Do(req)
if err != nil {
    fmt.Println(err)
    return
}
defer res.Body.Close()

body, err := ioutil.ReadAll(res.Body)
if err != nil {
    fmt.Println(err)
    return
}
fmt.Println(string(body))
}
var settings = {
"url": "https://api.d7networks.com/verify/v1/otp/verify-otp",
"method": "POST",
"timeout": 0,
"headers": {
    "Authorization": "Bearer {{api_access_token}}",
    "Content-Type": "application/json"
},
"data": JSON.stringify({
    "otp_id": "{{otp_id}}",
    "otp_code": "{{otp}}"
}),
};

$.ajax(settings).done(function (response) {
console.log(response);
});
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"otp_id\":\"{{otp_id}}\",\n    \"otp_code\":\"{{otp}}\"\n}");
Request request = new Request.Builder()
.url("https://api.d7networks.com/verify/v1/otp/verify-otp")
.method("POST", body)
.addHeader("Authorization", "Bearer {{api_access_token}}")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
var headers = {
'Authorization': 'Bearer {{api_access_token}}',
'Content-Type': 'application/json'
};
var request = http.Request('POST', Uri.parse('https://api.d7networks.com/verify/v1/otp/verify-otp'));
request.body = json.encode({
"otp_id": "{{otp_id}}",
"otp_code": "{{otp}}"
});
request.headers.addAll(headers);

http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
print(await response.stream.bytesToString());
}
else {
print(response.reasonPhrase);
}
1
2
3
4
5
6
7
8
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", "Bearer {{api_access_token}}")
$headers.Add("Content-Type", "application/json")

$body = "{`n    `"otp_id`":`"{{otp_id}}`",`n    `"otp_code`":`"{{otp}}`"`n}"

$response = Invoke-RestMethod 'https://api.d7networks.com/verify/v1/otp/verify-otp' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
require "uri"
require "json"
require "net/http"

url = URI("https://api.d7networks.com/verify/v1/otp/verify-otp")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer {{api_access_token}}"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"otp_id": "{{otp_id}}",
"otp_code": "{{otp}}"
})

response = https.request(request)
puts response.read_body

Response

When the request is validated the status will be returned.

200 - Success
{
    "status": "APPROVED"
}
400 - Invalid OTP code
{
    "detail": {
        "code": "INVALID_OTP_CODE",
        "message": "Invalid OTP code or OTP code expired"
    }
}
422 - Validation Error
{
    "detail": [
        {
            "loc": [
                "string",
                0
            ],
            "msg": "string",
            "type": "string"
        }
    ]
}