Menu

Send SMS OTP

POST https://examplebaseURL.com/v1/api/apps/{appID}/send_otp

Response Format

Parameter Type Description
serviceID String The service account ID
status Boolean True/False
transactionID String Transaction ID

Path Params

appID string required
App ID

Body Params

senderNumber (Required) string
Alphanumeric sender ID only

recipientNumber (Required) string
Destination phone number. Format: Country code + phone number.

text (Required) string
Content of the message including the PIN value. Please make sure to insert the variable name = %s in the text content to display the one-time-password. Note: A single (1) SMS contains 160 chars for English while 70 chars for Chinese. CINNOX bills for every SMS sent.

pin (Required) string
The One-time-password. Max 10 digits. Variable name = %s

Headers

Content-Type string
application/json

Authorization string
Bearer AppToken

Responses

200
Response body
json

400
Response body
object
code integer Defaults to 0
message string

Language

LANGUAGE: Shell

Shell: cURL Request Copy
curl --request POST \
     --url https://examplebaseurl.com/v1/api/apps/appID/send_otp \
     --header 'Authorization: Bearer AppToken' \
     --header 'Content-Type: application/json' \
     --header 'accept: application/json'
Shell: HTTPie Request Copy
$ brew install httpie
http POST https://examplebaseurl.com/v1/api/apps/appID/send_otp \
  Authorization:'Bearer AppToken' \
  Content-Type:application/json \
  accept:application/json

LANGUAGE: Node

Node: Axios Request Copy
$ npm install axios --save
import axios from 'axios';

const options = {
  method: 'POST',
  url: 'https://examplebaseurl.com/v1/api/apps/appID/send_otp',
  headers: {
    accept: 'application/json',
    'Content-Type': 'application/json',
    Authorization: 'Bearer AppToken'
  }
};

axios
  .request(options)
  .then(res => console.log(res.data))
  .catch(err => console.error(err));
Node: fetch Request Copy
const url = 'https://examplebaseurl.com/v1/api/apps/appID/send_otp';
const options = {
  method: 'POST',
  headers: {
    accept: 'application/json',
    'Content-Type': 'application/json',
    Authorization: 'Bearer AppToken'
  }
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
Node: http Request Copy
const http = require('https');

const options = {
  method: 'POST',
  hostname: 'examplebaseurl.com',
  port: null,
  path: '/v1/api/apps/appID/send_otp',
  headers: {
    accept: 'application/json',
    'Content-Type': 'application/json',
    Authorization: 'Bearer AppToken'
  }
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on('data', function (chunk) {
    chunks.push(chunk);
  });

  res.on('end', function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
Node: API Request Copy
$ npx api install "@cinnox2021/v7.3#45i1wk2km9l1e4hf"
import cinnox2021 from '@api/cinnox2021';

cinnox2021.sendOtpSms({appID: 'appID', Authorization: 'Bearer AppToken'})
  .then(({ data }) => console.log(data))
  .catch(err => console.error(err));

LANGUAGE: Ruby

Request Copy
require 'uri'
require 'net/http'

url = URI("https://examplebaseurl.com/v1/api/apps/appID/send_otp")

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

request = Net::HTTP::Post.new(url)
request["accept"] = 'application/json'
request["Content-Type"] = 'application/json'
request["Authorization"] = 'Bearer AppToken'

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

LANGUAGE: PHP

PHP: cURL Request Copy
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://examplebaseurl.com/v1/api/apps/appID/send_otp",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer AppToken",
    "Content-Type: application/json",
    "accept: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
PHP: Guzzle Request Copy
$ composer require guzzlehttp/guzzle
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://examplebaseurl.com/v1/api/apps/appID/send_otp', [
  'headers' => [
    'Authorization' => 'Bearer AppToken',
    'Content-Type' => 'application/json',
    'accept' => 'application/json',
  ],
]);

echo $response->getBody();

LANGUAGE: Python

Request Copy
$ python -m pip install requests
import requests

url = "https://examplebaseurl.com/v1/api/apps/appID/send_otp"

headers = {
    "accept": "application/json",
    "Content-Type": "application/json",
    "Authorization": "Bearer AppToken"
}

response = requests.post(url, headers=headers)

print(response.text)

LANGUAGE: C

Request Copy
CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://examplebaseurl.com/v1/api/apps/appID/send_otp");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "accept: application/json");
headers = curl_slist_append(headers, "Content-Type: application/json");
headers = curl_slist_append(headers, "Authorization: Bearer AppToken");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

CURLcode ret = curl_easy_perform(hnd);

LANGUAGE: C#

C#: HttpClient Request Copy
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Post,
    RequestUri = new Uri("https://examplebaseurl.com/v1/api/apps/appID/send_otp"),
    Headers =
    {
        { "accept", "application/json" },
        { "Authorization", "Bearer AppToken" },
    },
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}
C#: RestSharp Request Copy
$ dotnet add package RestSharp
using RestSharp;


var options = new RestClientOptions("https://examplebaseurl.com/v1/api/apps/appID/send_otp");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("accept", "application/json");
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer AppToken");
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);

LANGUAGE: C++

Request Copy
CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://examplebaseurl.com/v1/api/apps/appID/send_otp");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "accept: application/json");
headers = curl_slist_append(headers, "Content-Type: application/json");
headers = curl_slist_append(headers, "Authorization: Bearer AppToken");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

CURLcode ret = curl_easy_perform(hnd);

LANGUAGE: Clojure

Request Copy
(require '[clj-http.client :as client])

(client/post "https://examplebaseurl.com/v1/api/apps/appID/send_otp" {:headers {:Content-Type "application/json"
                                                                                :Authorization "Bearer AppToken"}
                                                                      :accept :json})

LANGUAGE: Go

Request Copy
package main

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

func main() {

	url := "https://examplebaseurl.com/v1/api/apps/appID/send_otp"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("accept", "application/json")
	req.Header.Add("Content-Type", "application/json")
	req.Header.Add("Authorization", "Bearer AppToken")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}

LANGUAGE: HTTP

Request Copy
POST /v1/api/apps/appID/send_otp HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer AppToken
Host: examplebaseurl.com

LANGUAGE: Java

Java: AsyncHttp Request Copy
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "https://examplebaseurl.com/v1/api/apps/appID/send_otp")
  .setHeader("accept", "application/json")
  .setHeader("Content-Type", "application/json")
  .setHeader("Authorization", "Bearer AppToken")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
Java: java.net.http. Request Copy
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://examplebaseurl.com/v1/api/apps/appID/send_otp"))
    .header("accept", "application/json")
    .header("Content-Type", "application/json")
    .header("Authorization", "Bearer AppToken")
    .method("POST", HttpRequest.BodyPublishers.noBody())
    .build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
Java: OkHttp. Request Copy
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://examplebaseurl.com/v1/api/apps/appID/send_otp")
  .post(null)
  .addHeader("accept", "application/json")
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer AppToken")
  .build();

Response response = client.newCall(request).execute();
Java: Unirest Request Copy
HttpResponse<String> response = Unirest.post("https://examplebaseurl.com/v1/api/apps/appID/send_otp")
  .header("accept", "application/json")
  .header("Content-Type", "application/json")
  .header("Authorization", "Bearer AppToken")
  .asString();

LANGUAGE: JavaScript

JavaScript: Axios Request Copy
$ npm install axios --save
import axios from 'axios';

const options = {
  method: 'POST',
  url: 'https://examplebaseurl.com/v1/api/apps/appID/send_otp',
  headers: {
    accept: 'application/json',
    'Content-Type': 'application/json',
    Authorization: 'Bearer AppToken'
  }
};

axios
  .request(options)
  .then(res => console.log(res.data))
  .catch(err => console.error(err));
JavaScript: fetch Request Copy
const options = {
  method: 'POST',
  headers: {
    accept: 'application/json',
    'Content-Type': 'application/json',
    Authorization: 'Bearer AppToken'
  }
};

fetch('https://examplebaseurl.com/v1/api/apps/appID/send_otp', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
JavaScript: jQuery Request Copy
const settings = {
  async: true,
  crossDomain: true,
  url: 'https://examplebaseurl.com/v1/api/apps/appID/send_otp',
  method: 'POST',
  headers: {
    accept: 'application/json',
    'Content-Type': 'application/json',
    Authorization: 'Bearer AppToken'
  }
};

$.ajax(settings).done(res => {
  console.log(res);
});
JavaScript: XMLHttpRequest Request Copy
const data = null;

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener('readystatechange', function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open('POST', 'https://examplebaseurl.com/v1/api/apps/appID/send_otp');
xhr.setRequestHeader('accept', 'application/json');
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.setRequestHeader('Authorization', 'Bearer AppToken');

xhr.send(data);

LANGUAGE: JSON

Request Copy
No JSON body

LANGUAGE: Kotlin

Request Copy
val client = OkHttpClient()

val request = Request.Builder()
  .url("https://examplebaseurl.com/v1/api/apps/appID/send_otp")
  .post(null)
  .addHeader("accept", "application/json")
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer AppToken")
  .build()

val response = client.newCall(request).execute()

LANGUAGE: Objectve-C

Request Copy
#import <Foundation/Foundation.h>

NSDictionary *headers = @{ @"accept": @"application/json",
                           @"Content-Type": @"application/json",
                           @"Authorization": @"Bearer AppToken" };

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://examplebaseurl.com/v1/api/apps/appID/send_otp"]
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                   timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
                                                if (error) {
                                                    NSLog(@"%@", error);
                                                } else {
                                                    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
                                                    NSLog(@"%@", httpResponse);
                                                }
                                            }];
[dataTask resume];

LANGUAGE: OCaml

Request Copy
$ opam install cohttp-lwt-unix cohttp-async
open Cohttp_lwt_unix
open Cohttp
open Lwt

let uri = Uri.of_string "https://examplebaseurl.com/v1/api/apps/appID/send_otp" in
let headers = Header.add_list (Header.init ()) [
  ("accept", "application/json");
  ("Content-Type", "application/json");
  ("Authorization", "Bearer AppToken");
] in

Client.call ~headers `POST uri
>>= fun (res, body_stream) ->
  (* Do stuff with the result *)

LANGUAGE: PowerShell

PowerShell: Invoke-RestMethod Request Copy
$headers=@{}
$headers.Add("accept", "application/json")
$headers.Add("Content-Type", "application/json")
$headers.Add("Authorization", "Bearer AppToken")
$response = Invoke-RestMethod -Uri 'https://examplebaseurl.com/v1/api/apps/appID/send_otp' -Method POST -Headers $headers
PowerShell: Invoke-WebRequest Request Copy
$headers=@{}
$headers.Add("accept", "application/json")
$headers.Add("Content-Type", "application/json")
$headers.Add("Authorization", "Bearer AppToken")
$response = Invoke-WebRequest -Uri 'https://examplebaseurl.com/v1/api/apps/appID/send_otp' -Method POST -Headers $headers

LANGUAGE: R

Request Copy
library(httr)

url <- "https://examplebaseurl.com/v1/api/apps/appID/send_otp"

response <- VERB("POST", url, add_headers('Authorization' = 'Bearer AppToken'), content_type("application/octet-stream"), accept("application/json"))

content(response, "text")

LANGUAGE: Swift

Request Copy
import Foundation

let url = URL(string: "https://examplebaseurl.com/v1/api/apps/appID/send_otp")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = [
  "accept": "application/json",
  "Content-Type": "application/json",
  "Authorization": "Bearer AppToken"
]

let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))

Response Example

RESPONSE: 200-Result

200-Result Copy
{
  "code": number,
  "result": {
    "serviceID": "string",
    "status":Boolean ,
    "transactionID": [
      "string"
    ]
  }
}

RESPONSE: 400-Result

400-Result Copy
{
  "code": 400,
  "message": "The error message from the server. Please refer to the error table."
}
Previous
Send SMS
Next
Send WhatsApp OTP
Last modified: 2025-12-12