SMS API Sri Lanka

A simple SMS API for Sri Lankan apps and websites

Send SMS from your own software with a single HTTP POST request. Works with PHP, Node.js, Python, Java, .NET or anything that can make a web request.

Add SMS to your system without the complexity

The SageSMS API lets your website, mobile app, POS, ERP or internal tool send SMS automatically — order confirmations, OTP codes, payment reminders, appointment alerts and more. There are no SDKs to install: you send a standard form-encoded POST request and get a JSON response back.

Every account gets free API access. Your User ID and API key are shown in the client dashboard under Settings → Integrations, alongside ready-to-copy code samples. If a key is ever exposed, you can generate a new one there instantly.

Transactional and promotional traffic use separate endpoints, so your critical alerts are never mixed up with marketing messages, and messages are charged from the same prepaid balance you use in the dashboard.

API essentials

  • HTTP POST with form-encoded parameters, JSON responses
  • Separate endpoints for transactional and promotional SMS
  • Balance-check endpoint for monitoring
  • Free API access on every plan
  • Regenerate your API key at any time
  • WooCommerce / WordPress plugin for no-code stores
Features

Built for developers who just want it to work

Clear endpoints, clear errors, and the same delivery infrastructure as the SageSMS dashboard.

Transactional endpoint

POST /api/sms/send delivers alerts, OTPs and notifications from a Transactional Sender ID — available around the clock.

Promotional endpoint

POST /api/sms/sendpromo sends marketing messages from a Promotional Sender ID, within the 8:00 AM–8:00 PM Sri Lanka time window. Promotional SMS include the LKR 0.25 government levy.

Balance check

POST /api/sms/balance returns your current account balance and status, so you can alert your team before credits run low.

Clear error responses

Invalid credentials, an inactive Sender ID or insufficient balance each return a specific error message you can log and act on.

Unicode out of the box

Send Sinhala and Tamil text in the message parameter as UTF-8 — page counting and billing handle Unicode automatically.

Logs in the dashboard

Every API message appears in your message history and delivery reports, so support and finance teams see the same data.

How It Works

From sign-up to first API call

  1. 01

    Create an account

    Register and choose a plan. API access is included free.

  2. 02

    Get a Sender ID approved

    Request a Transactional (and optionally Promotional) Sender ID for your brand.

  3. 03

    Copy your credentials

    Find your User ID and API key under Settings → Integrations.

  4. 04

    Send a request

    POST the sender ID, number and message to the API and read the JSON response.

Example

Send an SMS in a few lines of code

A transactional SMS request in PHP using cURL. The same parameters work from any language.

<?php
$data = [
    'api_key'   => 'YOUR_API_KEY',
    'user_id'   => YOUR_USER_ID,
    'sender_id' => 'YOUR_SENDER_ID',  // an approved Transactional Sender ID
    'to'        => '0771234567',
    'message'   => 'Your order #1024 has been shipped.',
];

$ch = curl_init('https://api.sagesms.com/api/sms/send');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$response = curl_exec($ch);
curl_close($ch);

// Success: {"status":"success","result":"sent","serverRef":"..."}
echo $response;

Each request sends to one mobile number. To message a list, loop over your numbers, or use the dashboard's bulk send with contact groups.

FAQ

SMS API questions

Is the SageSMS API free to use?

Yes. API access is included on every plan at no extra cost. You only pay for the SMS you send, at your plan's per-SMS rate.

Which programming languages does the SMS API support?

Any language that can make an HTTP POST request — PHP, JavaScript/Node.js, Python, Java, C#/.NET, Go, Ruby and others. Ready-made examples in 15 languages, including Android and Flutter, are in our SMS API integration guide and in your dashboard.

Can I send promotional SMS through the API?

Yes, using the promotional endpoint with an approved Promotional Sender ID. Promotional API messages are accepted between 8:00 AM and 8:00 PM Sri Lanka time; transactional messages can be sent at any time.

Where do I find my API key?

Log in to the SageSMS client dashboard and open Settings → Integrations. Your User ID and API key are shown there, and you can regenerate the key if needed — remember to update it in your application afterwards.

Do you have a WooCommerce or WordPress integration?

Yes. A free WooCommerce plugin is available from the Integrations page. It sends automatic SMS when an order's status changes, using your API credentials and a Transactional Sender ID.

Start building with the SageSMS API

Create an account, grab your API key and send your first SMS in minutes. Our team can help with integration if you need it.