Skip to content

Generate

Generate the One Time Password or Verifiaction Token and send to the recipient.

POST /verify/v1/otp/send-otp

AUTHORIZATIONS: Bearer Token

Request parameters

Parameter Value / Pattern
*originator The Sender/Header of a message. We can use your brand name with a maximum character limit of 11 or your mobile number with your country code.
*recipients Mobile Numbers to send OTP code.
*content OTP Message Content with {} placeholder
*expiry OTP Expiry time in seconds
data_coding Set as text for normal GSM 03.38 characters(English, normal characters). Set as unicode for non GSM 03.38 characters (Arabic, Chinese, Hebrew, Greek like regional languages and Unicode characters). Set as auto so we will find the data_coding based on your content.

Request

curl --location --request POST 'https://api.d7networks.com/verify/v1/otp/send-otp' \
--header 'Authorization: Bearer {{api_access_token}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "originator": "SignOTP",
    "recipient": "{{recipient1}}",
    "content": "Greetings from D7 API, your mobile verification code is: {}",
    "expiry": "600",
    "data_coding": "text"
}'
var axios = require('axios');
var data = JSON.stringify({
"originator": "SignOTP",
"recipient": "{{recipient1}}",
"content": "Greetings from D7 API, your mobile verification code is: {}",
"expiry": "600",
"data_coding": "text"
});

var config = {
method: 'post',
url: 'https://api.d7networks.com/verify/v1/otp/send-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/send-otp"

payload = json.dumps({
"originator": "SignOTP",
"recipient": "{{recipient1}}",
"content": "Greetings from D7 API, your mobile verification code is: {}",
"expiry": "600",
"data_coding": "text"
})
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/send-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 =>'{
    "originator": "SignOTP",
    "recipient": "{{recipient1}}",
    "content": "Greetings from D7 API, your mobile verification code is: {}",
    "expiry": "600",
    "data_coding": "text"
}',
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/send-otp"
method := "POST"

payload := strings.NewReader(`{
    "originator": "SignOTP",
    "recipient": "{{recipient1}}",
    "content": "Greetings from D7 API, your mobile verification code is: {}",
    "expiry": "600",
    "data_coding": "text"
}`)

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/send-otp",
"method": "POST",
"timeout": 0,
"headers": {
    "Authorization": "Bearer {{api_access_token}}",
    "Content-Type": "application/json"
},
"data": JSON.stringify({
    "originator": "SignOTP",
    "recipient": "{{recipient1}}",
    "content": "Greetings from D7 API, your mobile verification code is: {}",
    "expiry": "600",
    "data_coding": "text"
}),
};

$.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    \"originator\": \"SignOTP\",\n    \"recipient\": \"{{recipient1}}\",\n    \"content\": \"Greetings from D7 API, your mobile verification code is: {}\",\n    \"expiry\": \"600\",\n    \"data_coding\": \"text\"\n}");
Request request = new Request.Builder()
.url("https://api.d7networks.com/verify/v1/otp/send-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/send-otp'));
request.body = json.encode({
"originator": "SignOTP",
"recipient": "{{recipient1}}",
"content": "Greetings from D7 API, your mobile verification code is: {}",
"expiry": "600",
"data_coding": "text"
});
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    `"originator`": `"SignOTP`",`n    `"recipient`": `"{{recipient1}}`",`n    `"content`": `"Greetings from D7 API, your mobile verification code is: {}`",`n    `"expiry`": `"600`",`n    `"data_coding`": `"text`"`n}"

$response = Invoke-RestMethod 'https://api.d7networks.com/verify/v1/otp/send-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/send-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({
"originator": "SignOTP",
"recipient": "{{recipient1}}",
"content": "Greetings from D7 API, your mobile verification code is: {}",
"expiry": "600",
"data_coding": "text"
})

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

Response

When the request is validated, otp_id, status and expiry will be returned. Users can use this otp_id to regenerate otp or verify otp

{
    "otp_id": "dfd31c0e-2cd2-494e-88d2-6cac05263a7f",
    "status": "OPEN",
    "expiry": 600
} 
{
    "detail": [
        {
            "loc": [
                "string",
                0
            ],
            "msg": "string",
            "type": "string"
        }
    ]
}