API Documentation

  • Home
  • Getting Started

SMS API

  • Overview
  • Send SMS
  • Bulk SMS
  • Send Hashed SMS
  • Send OTP
  • Delivery Reports
  • Delivery Status
  • SMS Balance
  • Common Errors
  • Response Codes

Send OTP

The Send OTP API allows you to send One-Time Passwords (OTP) to your users for authentication and verification purposes. This endpoint is optimized for sending time-sensitive verification codes.

POST Method

Endpoint

https://send.macrologicsys.com/api/services/sendotp

Request Body

{
  "apikey": "{{apikey}}",
  "partnerID": "{{partnerID}}",
  "message": "Your OTP is: {{otp}}",
  "shortcode": "{{shortcode}}",
  "mobile": "{{mobile}}"
}

Sample Success Response

{
  "responses":[
    {
      "response-code": 200,
      "response-description": "Success",
      "mobile": "xxxxxxxxxxxxx",
      "messageid": "xxxxxxxxxxx",
      "networkid": 1
    }
  ]
}

Sample Error Response

{
  "response-code": 1006,
  "response-description": "Invalid credentials"
}

Code Examples

PHP

<?php
$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => "https://send.macrologicsys.com/api/services/sendotp",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => json_encode([
        "apikey" => "{{apikey}}",
        "partnerID" => "{{partnerID}}",
        "message" => "Your OTP is: {{otp}}",
        "shortcode" => "{{shortcode}}",
        "mobile" => "{{mobile}}"
    ]),
    CURLOPT_HTTPHEADER => ['Content-Type: application/json']
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>

Python

import requests
import json

url = "https://send.macrologicsys.com/api/services/sendotp"

# Generate or retrieve OTP
otp = "123456"

payload = {
    "apikey": "{{apikey}}",
    "partnerID": "{{partnerID}}",
    "message": f"Your OTP is: {otp}",
    "shortcode": "{{shortcode}}",
    "mobile": "{{mobile}}"
}

headers = {
    "Content-Type": "application/json"
}

response = requests.post(url, data=json.dumps(payload), headers=headers)
print(response.json())

Last Updated: 2/24/2025 | Contributors: Macrologic API Team

Related Endpoints

  • Send SMS
  • Send Hashed SMS
  • Response Codes

© 2025 All rights reserved | info@macrologicsys.com