Text.lk – SMS Gateway Sri Lanka’s Programmable SMS API enables you to programmatically send SMS messages from your web application. First, you need to create a new message object. Text.lk – SMS Gateway Sri Lanka returns the created message object with each request.
Send your first SMS message with this example request.
API Endpoint #
https://app.text.lk/api/v3/sms/send
HTTPParameters #
Parameter | Required | Type | Description |
---|---|---|---|
recipient | Yes | string | Number to send a message. Use comma (,) to send multiple numbers.Eg: 9476000000,94710000000 |
sender_id | Yes | string | The sender of the message. This can be a telephone number (including country code) or an alphanumeric string. In case of an alphanumeric string, the maximum length is 11 characters. |
type | Yes | string | The type of the message. For text message you have to insert plain as sms type. |
message | Yes | string | The body of the SMS message. |
schedule_time | No | datetime | The scheduled date and time of the message in RFC3339 format (Y-m-d H:i) |
dlt_template_id | No | string | The ID of your registered DLT (Distributed Ledger Technology) content template. |
Example request for Single Number #
Example request for Multiple Numbers #
curl -X POST https://app.text.lk/api/v3/sms/send \
-H 'Authorization: Bearer API_KEY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"recipient":"94710000000,94770000000",
"sender_id":"YourName",
"type":"plain",
"message":"This is a test message",
"schedule_time=2025-12-20 07:00"
}'
HTTPExample Response #
Returns a contact object if the request is successful.
{
"status": "success",
"data": "sms reports with all details",
}
HTTPIf the request fails, an error object will be returned.
{
"status": "error",
"message" : "A human-readable description of the error."
}
HTTP