cURL
curl --request POST \
--url https://api.crunchz.app/api/otp/link/global \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contact_id": "xxx@c.us",
"expires": 1800,
"name": "Your Company Name"
}
'import requests
url = "https://api.crunchz.app/api/otp/link/global"
payload = {
"contact_id": "xxx@c.us",
"expires": 1800,
"name": "Your Company Name"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({contact_id: 'xxx@c.us', expires: 1800, name: 'Your Company Name'})
};
fetch('https://api.crunchz.app/api/otp/link/global', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.crunchz.app/api/otp/link/global",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'contact_id' => 'xxx@c.us',
'expires' => 1800,
'name' => 'Your Company Name'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.crunchz.app/api/otp/link/global"
payload := strings.NewReader("{\n \"contact_id\": \"xxx@c.us\",\n \"expires\": 1800,\n \"name\": \"Your Company Name\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.crunchz.app/api/otp/link/global")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contact_id\": \"xxx@c.us\",\n \"expires\": 1800,\n \"name\": \"Your Company Name\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.crunchz.app/api/otp/link/global")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contact_id\": \"xxx@c.us\",\n \"expires\": 1800,\n \"name\": \"Your Company Name\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "<string>",
"data": {
"id": "<string>",
"code": "<string>",
"contact_id": "<string>",
"link": "<string>",
"app_uri": "<string>",
"expired_at": "<string>",
"timestamp": "<string>"
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>"
}One Time Password - Global
Request - Link
Generate authentication links globally with randomized channel selection for initiating WhatsApp chats and callback verification using Global Token.
POST
/
otp
/
link
/
global
cURL
curl --request POST \
--url https://api.crunchz.app/api/otp/link/global \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contact_id": "xxx@c.us",
"expires": 1800,
"name": "Your Company Name"
}
'import requests
url = "https://api.crunchz.app/api/otp/link/global"
payload = {
"contact_id": "xxx@c.us",
"expires": 1800,
"name": "Your Company Name"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({contact_id: 'xxx@c.us', expires: 1800, name: 'Your Company Name'})
};
fetch('https://api.crunchz.app/api/otp/link/global', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.crunchz.app/api/otp/link/global",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'contact_id' => 'xxx@c.us',
'expires' => 1800,
'name' => 'Your Company Name'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.crunchz.app/api/otp/link/global"
payload := strings.NewReader("{\n \"contact_id\": \"xxx@c.us\",\n \"expires\": 1800,\n \"name\": \"Your Company Name\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.crunchz.app/api/otp/link/global")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contact_id\": \"xxx@c.us\",\n \"expires\": 1800,\n \"name\": \"Your Company Name\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.crunchz.app/api/otp/link/global")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contact_id\": \"xxx@c.us\",\n \"expires\": 1800,\n \"name\": \"Your Company Name\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "<string>",
"data": {
"id": "<string>",
"code": "<string>",
"contact_id": "<string>",
"link": "<string>",
"app_uri": "<string>",
"expired_at": "<string>",
"timestamp": "<string>"
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>"
}Overview
This endpoint allows you to request a one-time password (OTP) link for global use. The OTP link can be used for authentication or verification purposes.Request Parameters
string
required
The contact ID to send the OTP link to. Format:
xxx@c.usnumber
required
Expiration time in seconds. For example, 1800 seconds (30 minutes).
string
Application name that will be displayed to the user.
object
Show Message Object
Show Message Object
string
required
Prompt message to channel from user. Example: “Give me link to login at TARGET App”
string
required
Success message to user. Example: “Here is your login link bit.ly/any”
string
required
Failed message to user. Example: “Login failed, please try again later.”
string
required
Message to user when the OTP has expired. Example: “The link has been expired, please try another one.”
object
Show Callback Object
Show Callback Object
string
required
Callback URL for successful verification (GET Method). Example: “https://domain.com/callback/success”
string
required
Callback URL for failed verification (GET Method). Example: “https://domain.com/callback/failed”
Response
boolean
Indicates whether the request was successful.
string
A message describing the result of the operation.
object
Error Codes
object
Authorization Exception - Occurs when the request is not properly authorized.
object
Validation Exception - Occurs when the request parameters fail validation.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Was this page helpful?