TXT MSG .lk
FAST • RELIABLE • EVERYTIME
star

SMS API Sri Lanka — REST API & SDKs for Developers

Integrate reliable SMS into your app in minutes. v3 REST API with 8 SDKs, 140ms average latency, and 99.99% uptime.

The TXTMSG v3 REST API lets you send, schedule, and track SMS messages programmatically from your application. With 140ms average latency, 99.99% uptime, and SDKs for PHP, Python, Node.js, Java, Go, Ruby, Flutter, and Laravel, you can integrate reliable SMS into any stack in minutes.

140ms Avg. Latency
99.99% Uptime SLA
8 SDK Languages
v3 Latest API

How the SMS API Works

  1. Get your API credentials — Sign up for a free account and retrieve your API key from the TXTMSG dashboard. Ready in under a minute.
  2. Choose your integration method — Use one of our 8 SDKs (PHP, Python, Node.js, Java, Go, Ruby, Flutter, Laravel) or call the REST API directly with cURL.
  3. Send your first message — With 100 complimentary trial credits and a demo sender ID pre-configured, send your first test message and see TXTMSG in action.
  4. Scale up — Move to a production plan, register your branded sender ID, and start sending at scale with webhooks for delivery callbacks.

API Features for Developers

RESTful Endpoints

Clean, RESTful design with JSON request/response. Send SMS, check delivery status, manage sender IDs, and retrieve account balance — all via simple HTTP calls.

SDKs in 8 Languages

Official SDKs for PHP, Python, Node.js, Java, Go, Ruby, Flutter, and Laravel. Each SDK includes typed methods, error handling, and inline documentation. Browse SDKs ->

Webhook Delivery Callbacks

Receive real-time delivery status updates via HTTP POST webhooks. Know the moment each message is delivered, failed, or queued — no polling required.

Sub-Second OTP Delivery

Time-sensitive OTP messages are routed through the fastest carrier path with automatic retry logic. Average delivery: 0.82 seconds. See OTP features ->

Bulk & Batch Sending

Send to thousands of recipients in a single API call. Our platform handles intelligent batching, carrier splitting, and parallel delivery. See bulk SMS features ->

Comprehensive Documentation

Full API reference with request/response examples, error codes, rate limits, and best practices. Visit documentation.txtmsg.lk to get started.

Quick Start — Send Your First SMS

cURL Example

curl -X POST https://sms.txtmsg.lk/api/v3/sms/send \
  -H "Authorization: Bearer TXTMSG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "recipient": "+947XXXXXXXX",
    "sender_id": "YourBrand",
    "type": "plain",
    "message": "Hello from TXTMSG!"
  }'

PHP SDK Example

$client = new Txtmsg\Client("API_KEY");
$response = $client->messages->create([
    'to' => '+947XXXXXXXX',
    'body' => 'Your code: 8821',
    'priority' => 'high'
]);
echo $response->status; // "delivered"

API Pricing

Plan API Access Rate Limit Per SMS (API) Webhooks
Pay As You Go Full 60 req/min Variable Yes
Starter Full 60 req/min LKR 1.00 Yes
Growth Full 120 req/min LKR 0.85 Yes
Business Full 300 req/min LKR 0.70 Yes
Enterprise Full Custom LKR 0.59 Yes

Who Uses the TXTMSG API?

SaaS Platforms

Integrate SMS notifications, alerts, and verification into your multi-tenant SaaS product. See platform solutions ->

Mobile Apps

OTP verification, push notification fallback, and in-app SMS triggers for Android and iOS applications.

E-Commerce Platforms

Order confirmations, shipping updates, and abandoned cart recovery via API integration with WooCommerce, Shopify, or custom builds.

Enterprise Systems

ERP, CRM, and HRMS integration for automated alerts, approval workflows, and employee notifications.

Frequently Asked Questions

What authentication does the API use?

API Key authentication via Bearer token in the Authorization header. Each account generates a unique API key from the TXTMSG dashboard.

What are the API rate limits?

Rate limits vary by plan: 60 req/min on Starter, 120 req/min on Growth, 300 req/min on Business, and custom limits for Enterprise. Contact sales for higher throughput.

Do you offer a test/sandbox environment?

Yes. Every new account receives complimentary trial credits and a demo sender ID to test the API in production-like conditions before purchasing.

Can I receive delivery status via webhook?

Absolutely. Configure a webhook URL in your dashboard, and we will POST delivery status updates for every message you send — delivered, failed, queued, or bounced.

Which SDKs are available?

Official SDKs for PHP, Python, Node.js, Java, Go, Ruby, Flutter, and Laravel. All SDKs are open-source and available on GitHub. View all SDKs ->

Start Building with the TXTMSG API

Sign up free and get 100 complimentary trial credits plus a demo sender ID. No credit card required.

Create Free Account Read API Docs

View Pricing

Get started with SMS API Sri Lanka — REST API & SDKs for Developers today. No hidden fees, no long-term contracts.

View Pricing arrow_forward
send
Need Help? Chat With Us