REST API · v1 · Updated April 16, 2026

Nepal's Fastest SMS API. Integrate in Minutes.

One endpoint. Clean JSON. Under 10-second delivery to NTC, Ncell & SmartCell. SDKs for PHP, Python, Node.js, and Java.

Under 10s delivery
99.5% uptime SLA
Free sandbox mode
send-sms.js
// Send SMS — Node.js (fetch)
const res = await fetch(
  'https://app.bharosasms.com/api/v1/sms/send/',
  {
    method: 'POST',
    headers: {
      'X-API-KEY': process.env.BHAROSA_API_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      to: ['98XXXXXXXX'],
      text: 'Your OTP is 482910',
      sender_id: { NT: 'MYAPP', Ncell: 'MYAPP' },
      message_type: 'plain'
    })
  }
);
201 Created
{ "message": "SMS processed.",
  "batch_id": "sbat_8f3a1b",
  "cost": 1.5, "pages": 1,
  "failed_numbers": [] }

Endpoint

There is a single endpoint for sending SMS. All requests use POST.

POST https://app.bharosasms.com/api/v1/sms/send/

Authentication

Every request must include your secret API key in the X-API-KEY header.

X-API-KEY: YOUR_SECRET_API_KEY
Get your API key from the dashboard after creating a free account.
Store your key in an environment variable — process.env.BHAROSA_API_KEY / os.environ["BHAROSA_API_KEY"] / $_ENV['BHAROSA_API_KEY']. Never commit it to Git or expose it client-side.

Quick start

Paste this into your terminal, replace YOUR_API_KEY and YourSenderID, and run it. You'll get a 201 Created back.

# Quick start
curl -X POST https://app.bharosasms.com/api/v1/sms/send/ \
  -H "X-API-KEY: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": ["98XXXXXXXX"],
    "text": "Hello from Bharosa SMS!",
    "sender_id": { "NT": "YourSenderID", "Ncell": "YourSenderID" },
    "message_type": "plain"
  }'

Request payload

Send JSON in the request body with Content-Type: application/json. All fields except scheduled_at are required.

to
array[string]required
List of destination mobile numbers.
Accepts local format (98XXXXXXXX) or international (+97798XXXXXXXX). Up to 50,000 per request.
text
stringrequired
The SMS content to send.
160 chars = 1 page (plain). 70 chars = 1 page (unicode). Longer messages split automatically and billed per page.
sender_id
objectrequired
Map each operator to your approved sender ID. Recipients see this name instead of a number.
NT (NTC)
"YourSenderID"
Ncell
"YourSenderID"
Sender IDs must be pre-approved by each operator. Contact support to register yours.
message_type
enumrequired
Character encoding. Use unicode for Nepali / Devanagari text.
"plain" "unicode"
scheduled_at
stringoptional
Schedule the message for a future time. Omit to send immediately.
Format: YYYY-MM-DD HH:MM:SS  ·  Example: 2026-04-20 09:00:00

Response fields

A successful send returns 201 Created with this JSON body.

FieldTypeDescription
messagestringHuman-readable operation status.
batch_idShortIDUnique ID for this batch. Use for tracking and support.
costfloatTotal credits deducted from your balance.
pagesintegerSMS units per message. Longer messages use more pages.
failed_numbersarrayPartial failures — each item has number and reason. Empty on full success.

Status codes

The API uses standard HTTP codes. Errors return JSON with an error or detail field.

201 CreatedSuccess
{
  "message": "SMS processed successfully.",
  "batch_id": "sbat_8f3a1b",
  "cost": 1.5,
  "pages": 1,
  "failed_numbers": [
    {"number": "12345", "reason": "Unknown operator"}
  ]
}
400Insufficient balance
{ "error": "Insufficient balance." }
400Invalid scheduled_at
{ "error": "Invalid date format for
'scheduled_at'. Please use
'YYYY-MM-DD HH:MM:SS'." }
400Service restriction
{ "error": "Service temporarily
unavailable. Please contact
support." }
401 UnauthorizedInvalid or inactive key
{ "detail": "Invalid or inactive API key." }

Code examples

Production-ready snippets in every major language. Each includes a plain send, a scheduled send, and a Nepali unicode example.

# ── Plain send ────────────────────────────────────────
curl -X POST https://app.bharosasms.com/api/v1/sms/send/ \
  -H "X-API-KEY: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": ["98XXXXXXXX", "97XXXXXXXX"],
    "text": "Hello from Bharosa SMS!",
    "sender_id": { "NT": "YourSenderID", "Ncell": "YourSenderID" },
    "message_type": "plain"
  }'

# ── Scheduled send ────────────────────────────────────
curl -X POST https://app.bharosasms.com/api/v1/sms/send/ \
  -H "X-API-KEY: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": ["98XXXXXXXX"],
    "text": "Your appointment is tomorrow at 10am.",
    "sender_id": { "NT": "CLINIC", "Ncell": "CLINIC" },
    "message_type": "plain",
    "scheduled_at": "2026-04-20 09:00:00"
  }'

# ── Nepali unicode ────────────────────────────────────
curl -X POST https://app.bharosasms.com/api/v1/sms/send/ \
  -H "X-API-KEY: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": ["98XXXXXXXX"],
    "text": "नमस्ते! हाम्रो सेवामा स्वागत छ।",
    "sender_id": { "NT": "MYAPP", "Ncell": "MYAPP" },
    "message_type": "unicode"
  }'
// Node 18+ has built-in fetch. For older versions: npm install node-fetch
const API_KEY  = process.env.BHAROSA_API_KEY;
const ENDPOINT = 'https://app.bharosasms.com/api/v1/sms/send/';

async function sendSMS({ to, text, senderNT, senderNcell, messageType = 'plain', scheduledAt = null }) {
  const body = {
    to: Array.isArray(to) ? to : [to],
    text,
    sender_id:    { NT: senderNT, Ncell: senderNcell },
    message_type: messageType,
    ...(scheduledAt && { scheduled_at: scheduledAt }),
  };

  const res = await fetch(ENDPOINT, {
    method:  'POST',
    headers: { 'X-API-KEY': API_KEY, 'Content-Type': 'application/json' },
    body:    JSON.stringify(body),
  });

  if (!res.ok) {
    const err = await res.json();
    throw new Error(err.error || err.detail);
  }
  return res.json();
  // → { message, batch_id, cost, pages, failed_numbers }
}

// ── Plain send ────────────────────────────────────────
const result = await sendSMS({
  to: ['98XXXXXXXX', '97XXXXXXXX'],
  text: 'Hello from Node.js!',
  senderNT: 'MYAPP', senderNcell: 'MYAPP',
});
console.log(`Batch: ${result.batch_id} | Cost: ${result.cost}`);

// ── Scheduled send ────────────────────────────────────
await sendSMS({
  to: '98XXXXXXXX',
  text: 'Reminder: appointment tomorrow at 10am.',
  senderNT: 'CLINIC', senderNcell: 'CLINIC',
  scheduledAt: '2026-04-20 09:00:00',
});

// ── Nepali unicode ────────────────────────────────────
await sendSMS({
  to: '98XXXXXXXX',
  text: 'नमस्ते! हाम्रो सेवामा स्वागत छ।',
  senderNT: 'MYAPP', senderNcell: 'MYAPP',
  messageType: 'unicode',
});
import os
import requests

API_KEY  = os.environ["BHAROSA_API_KEY"]
ENDPOINT = "https://app.bharosasms.com/api/v1/sms/send/"
HEADERS  = {"X-API-KEY": API_KEY, "Content-Type": "application/json"}


def send_sms(to, text, sender_nt, sender_ncell,
           message_type="plain", scheduled_at=None):
    """
    to           : str | list[str]
    text         : str
    sender_nt    : str   NTC sender ID
    sender_ncell : str   Ncell sender ID
    message_type : "plain" | "unicode"  (unicode for Nepali text)
    scheduled_at : str | None  "YYYY-MM-DD HH:MM:SS"
    """
    payload = {
        "to":           [to] if isinstance(to, str) else to,
        "text":         text,
        "sender_id":    {"NT": sender_nt, "Ncell": sender_ncell},
        "message_type": message_type,
    }
    if scheduled_at:
        payload["scheduled_at"] = scheduled_at

    r = requests.post(ENDPOINT, json=payload, headers=HEADERS)
    r.raise_for_status()  # raises HTTPError on 4xx / 5xx
    return r.json()


# ── Plain send ────────────────────────────────────────
result = send_sms(
    to=["98XXXXXXXX", "97XXXXXXXX"],
    text="Hello from Python!",
    sender_nt="MYAPP", sender_ncell="MYAPP",
)
print(f"Batch {result['batch_id']} | Cost: {result['cost']}")

# ── Scheduled send ────────────────────────────────────
send_sms(
    to="98XXXXXXXX",
    text="Reminder: your appointment is tomorrow.",
    sender_nt="CLINIC", sender_ncell="CLINIC",
    scheduled_at="2026-04-20 09:00:00",
)

# ── Nepali unicode ────────────────────────────────────
send_sms(
    to="98XXXXXXXX",
    text="नमस्ते! हाम्रो सेवामा स्वागत छ।",
    sender_nt="MYAPP", sender_ncell="MYAPP",
    message_type="unicode",
)
<?php
// Store your key in .env — never hardcode it
$apiKey   = $_ENV['BHAROSA_API_KEY'];
$endpoint = 'https://app.bharosasms.com/api/v1/sms/send/';

function sendSMS(
  array   $to,
  string  $text,
  string  $senderNT,
  string  $senderNcell,
  string  $messageType = 'plain',
  ?string $scheduledAt = null
): array {
  global $apiKey, $endpoint;

  $payload = [
    'to'           => $to,
    'text'         => $text,
    'sender_id'    => ['NT' => $senderNT, 'Ncell' => $senderNcell],
    'message_type' => $messageType,
  ];
  if ($scheduledAt) $payload['scheduled_at'] = $scheduledAt;

  $ch = curl_init($endpoint);
  curl_setopt_array($ch, [
    CURLOPT_POST           => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => [
      'X-API-KEY: ' . $apiKey,
      'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode($payload),
  ]);

  $body   = curl_exec($ch);
  $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  curl_close($ch);

  $data = json_decode($body, true);
  if ($status >= 400) throw new Exception($data['error'] ?? $data['detail']);
  return $data;
}

// ── Plain send ────────────────────────────────────────
$r = sendSMS(['98XXXXXXXX', '97XXXXXXXX'], 'Hello from PHP!', 'MYAPP', 'MYAPP');
echo "Batch: {$r['batch_id']} | Cost: {$r['cost']}";

// ── Scheduled send ────────────────────────────────────
sendSMS(['98XXXXXXXX'], 'Appointment tomorrow 10am.',
        'CLINIC', 'CLINIC', 'plain', '2026-04-20 09:00:00');

// ── Nepali unicode ────────────────────────────────────
sendSMS(['98XXXXXXXX'], 'नमस्ते! हाम्रो सेवामा स्वागत छ।',
        'MYAPP', 'MYAPP', 'unicode');
?>

SDKs

Official SDKs wrap the API so you don't need to handle HTTP yourself. Don't see your language? The REST API works with any HTTP client.

PHP / Laravel
composer require bharosasms/php
Python / Django
pip install bharosasms
Node.js
npm install bharosasms
Java / Spring
com.bharosasms:sdk
What's Included

Everything a Developer Needs.

No surprises. No hidden limits. Here's what you get with every API account.

Free Sandbox Mode
Test without spending credits. Sandbox simulates real delivery responses including failures and retries.
Real-Time Webhooks
Instant delivery receipts to your endpoint. Know the exact moment your SMS is delivered, failed, or pending.
Scheduled Sending
Queue messages with a future timestamp. Schedule your Dashain campaign at midnight — the API handles the rest.
Delivery Reports
Per-message status with timestamps, network carrier, retry count, and failure reason codes.
Network Auto-Routing
Send to any number — the API auto-routes to NTC, Ncell, or SmartCell with the optimal delivery path.
Unicode / Nepali Support
Send in Nepali Devanagari, Hindi, or English. Set message_type: "unicode" and the API handles encoding.

Start Building in Minutes.

Free sandbox. Free trial credits. Developer support replies in under 2 hours.

Get Free API Key → View API Pricing