Text.lk provides two methods to integrate with the API:
- OAuth 2.0 (Recommended)
- HTTP API (Simple Token-Based Requests)
1️⃣ Send SMS #
Send a single SMS message.
🔐 OAuth 2.0 – Send SMS #
Endpoint (POST) #
https://app.text.lk/api/v3/sms/sendExample Request (cURL) #
curl -X POST https://app.text.lk/api/v3/sms/send \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"recipient": "94710000000",
"sender_id": "TextLKDemo",
"type": "plain",
"message": "This is a test message"
}'Request Parameters #
| 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. |
🌐 HTTP – Send SMS #
Endpoint (GET) #
https://app.text.lk/api/http/sms/sendExample Request #
https://app.text.lk/api/http/sms/send?recipient=94710000000&sender_id=TextLKDemo&type=plain&message=This%20is%20a%20test%20message&api_token=YOUR_API_TOKENHTTP Parameters #
| 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. |
Success & Error Responses (OAuth and HTTP) #
✅ Success Response #
{
"status": true,
"message": "SMS queued successfully",
"data": {
"sms_id": "abc123",
"recipient": "94710000000"
}
}❌ Error Response #
{
"status": false,
"message": "Invalid recipient number"
}View SMS #
View a single SMS message.
Read full documentation: https://text.lk/docs/view-sms/
🔐 OAuth 2.0 – View SMS #
Endpoint (POST) #
https://app.text.lk/api/v3/sms/{uid}🌐 HTTP – View SMS #
Endpoint (GET) #
https://app.text.lk/api/http/sms/{uid}