API Reference

API Documentation

Send SMS programmatically with one REST endpoint. Authenticate with your API key, pass a sender ID and phone number — that's it.

Quick Start

  1. 1Create an account and get verified via WhatsApp.
  2. 2Generate your API key from the dashboard.
  3. 3Request an approved sender ID (masking or non-masking).
  4. 4Top up your balance, then POST to https://api.smsprovider.net/api/send-sms.

Authentication

All API requests must use HTTPS. Authenticate by including your API key in the JSON request body as api_key.

No OAuth, HMAC signatures, or extra headers required — keep it simple. Never expose your API key in client-side JavaScript or public repositories.

API Key

Each account gets one API key. Generate it fromDashboard → API Key. The full key is shown once at creation — copy and store it securely.

Keys are prefixed with sp_. After creation, only the prefix is visible in the dashboard (e.g. sp_7LdYijpmn..).

To rotate a key, delete the existing one and generate a new key from the dashboard.

Send SMS

POSThttps://api.smsprovider.net/api/send-sms

Queues an SMS for delivery. Balance is deducted immediately. On gateway failure after retries, the cost is refunded automatically.

Parameters

Send as JSON in the request body with Content-Type: application/json.

ParameterTypeRequiredDescription
api_keystringYesYour API key (starts with sp_)
sender_idstringYesApproved sender ID name (e.g. YourBrand or 88017)
phonestringYesBangladesh mobile: 01XXXXXXXXX or 8801XXXXXXXXX
messagestringYesSMS content (max 1000 characters)

Phone format: Must be a valid Bangladesh mobile number. Use 01712345678 or international format 8801712345678.

Sender ID: Must belong to your account and be approved by an admin. Masking IDs show your brand name; non-masking IDs use a numeric sender.

Response

Success — 200 OK

Success response
json
{
  "success": true,
  "message_id": "msg_a1b2c3d4e5f6g7h8",
  "status": "queued"
}
FieldDescription
successAlways true on success
message_idUnique ID to track this message (e.g. msg_a1b2c3d4e5f6g7h8)
statusInitial status — typically queued, then sent/delivered/failed

Delivery statuses

queuedsentdeliveredfailed

View delivery reports in your SMS Logs dashboard.

Error Responses

All errors return success: false with a message field.

401Invalid API key
{
  "success": false,
  "message": "Invalid API key."
}
402Insufficient balance
{
  "success": false,
  "message": "Insufficient balance. Please top up your account."
}
403Account not verified
{
  "success": false,
  "message": "Your account is not verified. Contact us on WhatsApp to verify."
}
400Invalid parameters
{
  "success": false,
  "message": "Invalid phone number. Use format: 01712345678"
}
429Rate limit exceeded
{
  "success": false,
  "message": "Too many requests. Please slow down."
}

Rate Limits

60 requests per minute per API key. If exceeded, you'll receive a 429 response. Implement exponential backoff in your integration for high-volume sending.

Billing

SMS cost is calculated per message segment (150 characters per segment) using the rate assigned to your sender ID. New accounts receive a platform default non-masking sender ID. Once a custom sender ID is assigned to your account, the platform default is disabled. Check your dashboard Sender IDs page for current rates.

Code Examples

cURL
curl
curl -X POST https://api.smsprovider.net/api/send-sms \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "api_key": "sp_your_api_key_here",
    "sender_id": "YourBrand",
    "phone": "01712345678",
    "message": "Hello from SMS Provider!"
  }'
PHP
php
<?php

$payload = [
    'api_key' => 'sp_your_api_key_here',
    'sender_id' => 'YourBrand',
    'phone' => '01712345678',
    'message' => 'Your OTP is 482910',
];

$ch = curl_init('https://api.smsprovider.net/api/send-sms');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        'Accept: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode($payload),
]);

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

$data = json_decode($response, true);

if ($status === 200 && ($data['success'] ?? false)) {
    echo "Sent! Message ID: {$data['message_id']}";
} else {
    echo "Error: " . ($data['message'] ?? 'Unknown error');
}
Laravel
php
use Illuminate\Support\Facades\Http;

$response = Http::acceptJson()->post('https://api.smsprovider.net/api/send-sms', [
    'api_key' => config('services.sms.api_key'),
    'sender_id' => 'YourBrand',
    'phone' => '01712345678',
    'message' => 'Your OTP is 482910',
]);

if ($response->successful() && $response->json('success')) {
    $messageId = $response->json('message_id');
    // store $messageId for delivery tracking
} else {
    $error = $response->json('message');
    // handle: invalid key, low balance, unverified account, etc.
}
JavaScript (Node.js)
javascript
const response = await fetch('https://api.smsprovider.net/api/send-sms', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
  },
  body: JSON.stringify({
    api_key: process.env.SMS_API_KEY,
    sender_id: 'YourBrand',
    phone: '01712345678',
    message: 'Your OTP is 482910',
  }),
});

const data = await response.json();

if (response.ok && data.success) {
  console.log('Message ID:', data.message_id);
} else {
  console.error('SMS failed:', data.message);
}

Need help integrating? Read our SMS integration guides, contact us onWhatsAppor email[email protected].