The phone number of the recipient. The recipient's phone number should have a country code prefix.
-
flow_id
String
The id of the verification flow created in the user dashboard. The flow decides the channel, content, OTP type, code length, expiry and retry settings for the OTP. See the user guide for how to create a flow from the dashboard.
-
success_url
String
The callback url to which the result is sent when the OTP is verified successfully (APPROVED). See Callback.
-
failure_url
String
The callback url to which the result is sent when the verification fails (FAILED) or the OTP has expired (EXPIRED). See Callback.
-
Response
When the request is validated, request_id, status and created time will be returned. Users can use this request_id to
query status using the Get status endpoint.
{"detail":{"code":"ACCESS_TOKEN_SIGNATURE_VERIFICATION_FAILED","message":"It looks like your requests were failed due to a missing or invalid 'Access Token'. Sign up at https://app.d7networks.com and create an authentication token in the developer section."}}
402 - Payment Required
{"detail":[{"code":"INSUFFICIENT_CREDIT","message":"It looks like your requests failed due to insufficient credit on our account. Sign in at https://app.d7networks.com and make a payment to resume the messaging service on your account or contact [email protected] to get more test credits."}]}
400 - Country Not Supported
{"detail":{"code":"COUNTRY_NOT_SUPPORTED","message":"Verify service is not available for the destination country. Please contact support."}}
Unique id for each OTP generated. This otp_id is required to resend and verify OTP.
status
String
The status of OTP request. Possible request status are OPEN and FAILED.
expiry
Integer
Time in seconds from now until the expiry of OTP.
Callback
If success_url or failure_url is passed in the request, D7 sends the verification result to that url once the Verify OTP request is processed. If they are not passed, the callback urls saved on your account are used.
Verify OTP result
Callback sent to
otp_status
Correct OTP code
success_url
APPROVED
Wrong OTP code
failure_url
FAILED
OTP expired
failure_url
EXPIRED
The callback is sent as a POST request with Content-Type: application/json.
Callback Attributes
Parameter
Value / Pattern
Example(s)
otp_id
The otp_id returned from the Send OTP endpoint
d9835609-a4e0-10ea-a26a-eeafbe700fef
otp_status
Verification result. Possible values are APPROVED, FAILED and EXPIRED
Your callback url should respond with HTTP status 200. Any other response is retried up to 5 times with an increasing delay. The request times out after 10 seconds.
constClient=require('direct7')constclient=newClient(apiToken="Your API token")constresponse=awaitclient.verify.v2.sendOTP({recipient:"+9199999XXXXX",flow_id:"login_otp"})console.log(response);
require_once__DIR__.'/vendor/autoload.php';usedirect7\Direct7\Client;$client=newClient(api_token="Your API token")$response=$direct7->verify->v2->sendOtp(recipient:'+91999999XXXX',flowId:'login_otp');var_dump($response);
import("github.com/d7networks/direct7-go-sdk/direct7")apiToken:="Your Api Token"client:=direct7.NewClient(apiToken)verify:=direct7.NewVerify(client)recipient:="{{recipient}}"flowID:="login_otp"response,err:=verify.V2.SendOTP(recipient,flowID)