Welcome to the Text.lk API documentation – API Endpoints Introduction. This text.lk documentation guide explains the available Text.lk API endpoints, authentication methods, and how to integrate SMS functionality into your system using the Text.lk platform.
Text.lk REST API #
As the fastest SMS API in Sri Lanka, Text.lk provides secure and reliable SMS delivery through REST-based APIs that can be integrated into web applications, mobile apps, CRM systems, ERP platforms, and other software solutions.
Authentication Methods (There are two types) #
Text.lk provides two methods to integrate with the API. Because text.lk supports two authentication methods, but both do the same thing.
- OAuth 2.0 (Bearer Token) – Recommended
- HTTP (API Token in URL)
Below is an overview of both authentication methods, the differences between each method, and when to use each.
👉 Learn how to get your API Key / API Token
1. OAuth 2.0 (Bearer Token) – Recommended #
This is the modern and secure method for production environments.
- Uses Authorization: Bearer YOUR_API_TOKEN
- Uses the POST method
- Data is sent as JSON
- The API token is not exposed in the URL
- More secure for large-scale systems
- Recommended for enterprise applications
Endpoint for Send SMS #
https://app.text.lk/api/v3/sms/sendExample Request for Send SMS #
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"
}'When to Use #
- Web applications
- Mobile apps
- Backend systems
- Production environments
2. HTTP GET Method (API Token in URL) #
This is a simple method mainly for legacy systems or quick integrations.
- Uses the GET method
- API token is passed as the api_token parameter in the URL
- All parameters are included in the URL
- Easy & Quick to integrate
- Recommended for systems that cannot send headers
- Recommended for testing purposes
Learn more about: Is using a Api token in url or post/curl safe?
Endpoint for Send SMS #
https://app.text.lk/api/http/sms/sendExample Request for Send SMS #
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_TOKENWhen to Use #
- Systems that cannot send headers
- Simple integrations
- Quick testing via browser
👉 See also: How to send SMS via Text.lk API?
👉 See also: success response examples.
👉 See also: Error formats and status codes.
Why Are There Two Documentations (HTTP & OAuth 2.0)? #
Text.lk provides two integration methods to support different types of systems and technical requirements.
Both methods perform the same function (sending SMS), but they differ in security level, structure, and implementation style.
👉 Learn More about: Why Are There Two Documentations in Text.lk (HTTP & OAuth 2.0)?
Which One Should You Use? #
👉 For new integrations, always use OAuth 2.0 (Bearer Token method).
👉 Use the HTTP GET method only if your system does not support POST requests with headers.
Best Practice Recommendation #
For secure, scalable, and production-ready applications:
- ✔ Use OAuth 2.0 (Bearer Token)
- ✔ Avoid exposing API tokens in URLs
- ✔ Use HTTPS for all API calls