Resend
OTP can be re-generated using the otp_id
which was returned from Send OTP
endpoint.
Endpoint
POST
/verify/v1/resend-otp
POSTMAN
AUTHORIZATION: Bearer Token
Body
Object
{
"otp_id" : "86b24910-2d1e-4257-b6d4-e6b829e50e84"
}
Body parameters
Parameter
Value / Pattern
*otp_id
The otp_id which was returned as a response parameter from send OTP endpoint
Response
When the resend request is validated, otp_id, status and expiry will be returned. Users can use this otp_id to regenerate otp and verify otp
200 - Success
{
"otp_id" : "84864e9c-81f5-41af-9483-c90dffd97e4a" ,
"status" : "OPEN" ,
"expiry" : 600 ,
"resend_count" : 1
}
400 - Frequent Request
{
"detail" : "Frequent resend request, resend request need minimum 60 seconds delay"
}
400 - Time limit expired
{
"detail" : "Resend Failed. OTP time limit expired."
}
422 - Validation Error
{
"detail" : [
{
"loc" : [
"string" ,
0
],
"msg" : "string" ,
"type" : "string"
}
]
}
Response Parameters
Parameter
Value / Pattern
otp_id
Unique id for each OTP generated. This otp_id is required to resend and verify OTP.
status
The status of OTP request. Possible request status are OPEN and FAILED.
expiry
Time in seconds from now until the expiry of OTP.
resend_count
Number of times, resend OTP request has been made with one otp_id.
Programming Examples
Curl Node.Js Python PHP Go Java Dart PowerShell Ruby
curl --location --request POST 'https://api.d7networks.com/verify/v1/otp/resend-otp' \
--header 'Authorization: Bearer {{api_access_token}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"otp_id":"{{otp_id}}"
}'
const Client = require ( 'direct7' )
const client = new Client ( apiToken = "Your API token" )
const response = await client . verify . resendOTP ({ otp_id : "bc4f5e29-dcfa-4d81-9cb1-d6c5002a96bd" })
console . log ( response );
from direct7 import Client
client = Client ( api_token = "Your API token" )
client . verify . resend_otp ( otp_id = "0012c7f5-2ba5-49db-8901-4ee9be6dc8d1" )
composer require direct7/direct7-php
require_once 'vendor/autoload.php';
require_once __DIR__ . '/vendor/autoload.php' ;
use direct7\D irect7\C lient;
$client = new Client( api_token = "Your API token" )
$response = $direct7 ->verify->resendOtp( otpId:'9c476ed0-c1ce-43e2-8576-ec505902e987' ) ;
var_dump( $response ) ;
go get -u github.com/d7networks/direct7-go-sdk
import (
"github.com/d7networks/direct7-go-sdk/direct7"
)
apiToken := "Your Api Token"
client := direct7 . NewClient ( apiToken )
verify := direct7 . NewVerify ( client )
otpID := "aeffa23f-1204-4e17-bb91-adf6de2cf826"
response , err := verify . ResendOTP ( otpID )
OkHttpClient client = new OkHttpClient (). newBuilder ()
. build ();
MediaType mediaType = MediaType . parse ( "application/json" );
RequestBody body = RequestBody . create ( mediaType , "{\n \"otp_id\":\"{{otp_id}}\"\n}" );
Request request = new Request . Builder ()
. url ( "https://api.d7networks.com/verify/v1/otp/resend-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/resend-otp' ));
request . body = json . encode ({
"otp_id" : "{{otp_id}}"
});
request . headers . addAll ( headers );
http . StreamedResponse response = await request . send ();
if ( response . statusCode == 200 ) {
print ( await response . stream . bytesToString ());
}
else {
print ( response . reasonPhrase );
}
$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 }"
$response = Invoke-RestMethod 'https://api.d7networks.com/verify/v1/otp/resend-otp' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
require 'direct7'
client = Direct7 :: Client . new ( 'Your API token' )
client . verify . resend_otp ( otp_id = "0012c7f5-2ba5-49db-8901-4ee9be6dc8d1" )