LANA SMS API
Send SMS to any network in Uganda and buy SMS credits with MTN or Airtel Mobile Money, straight from your own website, app or system. No need to sign in to LANA to send or to top up.
Quick start
- Create a free LANA SMS account, or sign in.
- Open API keys and create a key. Copy it: it is shown only once.
- Buy credits in the app, or through the API.
- Send your first message:
curl -X POST "https://api.lanasms.com/v1/send" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d "phone=0772123456" \ -d "message=Hello from LANA SMS"
$ch = curl_init('https://api.lanasms.com/v1/send');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('LANA_API_KEY')],
CURLOPT_POSTFIELDS => ['phone' => '0772123456', 'message' => 'Hello from LANA SMS'],
]);
$result = json_decode(curl_exec($ch), true);
echo $result['status'] === 'success' ? "Sent\n" : $result['message'] . "\n";const res = await fetch('https://api.lanasms.com/v1/send', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.LANA_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ phone: '0772123456', message: 'Hello from LANA SMS' }),
});
console.log(await res.json());import os, requests
r = requests.post(
"https://api.lanasms.com/v1/send",
headers={"Authorization": f"Bearer {os.environ['LANA_API_KEY']}"},
data={"phone": "0772123456", "message": "Hello from LANA SMS"},
timeout=30,
)
print(r.json())Authentication
Every request carries your API key as a bearer token:
Authorization: Bearer YOUR_API_KEY
Each account can have up to 2 keys. Create and revoke them under API keys in the app. A revoked key stops working immediately.
Requests and responses
The base URL for every endpoint is:
https://api.lanasms.com/v1
- Use HTTPS. Send fields as a form (
application/x-www-form-urlencodedormultipart/form-data) or as JSON (application/json). - Every response is JSON with a
statusof"success"or"failed"and a human-readablemessage. The HTTP status code tells you what kind of error it was (see Errors). - Every response has an
X-Request-Idheader. Quote it when you contact support, and we can find the exact request. - Amounts are in Uganda shillings (UGX), as whole numbers.
Sending messages
One call sends the same message to one number or to thousands (up to 10,000 per call). Put the numbers in phone, separated by commas.
- Duplicate numbers are sent once.
- Numbers you've blacklisted in the app are skipped and not charged.
- Invalid numbers are left out and listed in
invalidin the response. They are not charged. - Credits are taken when the message is accepted. If the SMS gateway refuses the message, the credits go straight back and the response is
502.
Send personalised messages (different text per person) as separate calls. Stay within the rate limit.
Buying credits by API
Your system can buy SMS credits with Mobile Money, without anyone signing in to LANA. The payment turns into credits automatically as soon as it is approved.
GET /packages?amount=20000 shows the rate and the credits that amount buys.POST /topup with the payer's phone and the amount. You get an orderId.POST /order_status until it is Completed. The credits are already on your account.Mobile Money payments powered by 
1. Get a quote (optional)
curl "https://api.lanasms.com/v1/packages?amount=20000" -H "Authorization: Bearer YOUR_API_KEY"
{ "status": "success", "currency": "UGX", "min_topup": 500, "max_topup": 5000000,
"packages": [ ... ],
"quote": { "amount": 20000, "rate": 35, "credits": 571 } }2. Start the payment
curl -X POST "https://api.lanasms.com/v1/topup" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d "phone=+256772123456" \ -d "amount=20000"
function lana(string $endpoint, array $fields = []): array
{
$ch = curl_init('https://api.lanasms.com/v1/' . $endpoint);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('LANA_API_KEY')],
CURLOPT_TIMEOUT => 30,
] + ($fields ? [CURLOPT_POST => true, CURLOPT_POSTFIELDS => $fields] : []));
$body = json_decode((string) curl_exec($ch), true) ?? [];
$body['http'] = curl_getinfo($ch, CURLINFO_HTTP_CODE);
return $body;
}
$order = lana('topup', ['phone' => '+256772123456', 'amount' => 20000]);
if ($order['status'] !== 'success') {
exit('Top-up not started: ' . $order['message']);
}
$orderId = $order['orderId']; // save this with your own recordsasync function lana(endpoint, body) {
const res = await fetch(`https://api.lanasms.com/v1/${endpoint}`, {
method: body ? 'POST' : 'GET',
headers: {
'Authorization': `Bearer ${process.env.LANA_API_KEY}`,
'Content-Type': 'application/json',
},
body: body ? JSON.stringify(body) : undefined,
});
return { http: res.status, ...(await res.json()) };
}
const order = await lana('topup', { phone: '+256772123456', amount: 20000 });
if (order.status !== 'success') throw new Error(order.message);
const orderId = order.orderId; // save this with your own recordsimport os, requests
API = "https://api.lanasms.com/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['LANA_API_KEY']}"}
def lana(endpoint, data=None):
if data is None:
r = requests.get(f"https://api.lanasms.com/v1/{endpoint}", headers=HEADERS, timeout=30)
else:
r = requests.post(f"https://api.lanasms.com/v1/{endpoint}", headers=HEADERS, data=data, timeout=30)
return {"http": r.status_code, **r.json()}
order = lana("topup", {"phone": "+256772123456", "amount": 20000})
if order["status"] != "success":
raise RuntimeError(order["message"])
order_id = order["orderId"] # save this with your own records{ "status": "success", "message": "SMS Order Initiated", "orderId": "1761905400123",
"amount": 20000, "rate": 35, "credits": 571 }3. Wait for approval
Check the order every 5–10 seconds. Most payments complete within a minute of the PIN being entered. Stop after about 3 minutes and show "still pending": LANA keeps checking in the background and adds the credits whenever the payment completes, up to 3 days later.
$deadline = time() + 180;
do {
sleep(6);
$status = lana('order_status', ['orderId' => $orderId]);
} while ($status['statuscode'] === 0 && time() < $deadline);
match ($status['statuscode']) {
1 => print("Paid: {$status['credits']} credits added, balance {$status['balance']}\n"),
2 => print("Payment declined or cancelled\n"),
default => print("Still pending; credits will be added when it completes\n"),
};const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
const deadline = Date.now() + 180_000;
let status;
do {
await sleep(6000);
status = await lana('order_status', { orderId });
} while (status.statuscode === 0 && Date.now() < deadline);
if (status.statuscode === 1) console.log(`Paid: ${status.credits} credits added`);
else if (status.statuscode === 2) console.log('Payment declined or cancelled');
else console.log('Still pending; credits will be added when it completes');import time
deadline = time.time() + 180
while True:
time.sleep(6)
status = lana("order_status", {"orderId": order_id})
if status["statuscode"] != 0 or time.time() > deadline:
break
if status["statuscode"] == 1:
print(f"Paid: {status['credits']} credits added")
elif status["statuscode"] == 2:
print("Payment declined or cancelled")
else:
print("Still pending; credits will be added when it completes")Good to know
- Credits are added once per payment, however many times you check the order.
- A failed or cancelled payment costs nothing. Start a new
/topupto try again. - Only orders created with your account's keys are visible to you.
- Payments made by API also appear under Credits in the app.
Automatic top-up
Check your credits on a schedule (for example every hour, or before a big send). When they fall below a level you choose, start a top-up from your company's Mobile Money number. Whoever holds that phone just approves the prompt.
// Run hourly from cron. Uses lana() from the top-up guide above.
const MIN_CREDITS = 500; // top up when we drop below this
const TOPUP_AMOUNT = 50000; // UGX
const PAYER_PHONE = '+256772123456';
$info = lana('info');
if ($info['credits'] < MIN_CREDITS && !file_exists('/tmp/lana-topup.lock')) {
touch('/tmp/lana-topup.lock'); // don't ask the payer twice
$order = lana('topup', ['phone' => PAYER_PHONE, 'amount' => TOPUP_AMOUNT]);
// Notify your team: "Approve the LANA SMS payment on PAYER_PHONE"
// ...then poll order_status as shown above, and delete the lock when done.
}// Run on a schedule. Uses lana() from the top-up guide above.
const MIN_CREDITS = 500;
const TOPUP_AMOUNT = 50000; // UGX
const PAYER_PHONE = '+256772123456';
const info = await lana('info');
if (info.credits < MIN_CREDITS && !(await hasPendingTopup())) {
const order = await lana('topup', { phone: PAYER_PHONE, amount: TOPUP_AMOUNT });
await savePendingTopup(order.orderId); // your own storage
// Notify your team to approve the prompt, then poll order_status.
}Message length and credits
One credit sends one SMS part to one number. How many parts a message needs depends on its characters:
| Message uses | 1 part | Longer messages (per part) |
|---|---|---|
| Plain text (A–Z, 0–9, common punctuation) | up to 160 characters | 153 characters |
| Emoji or other special characters | up to 70 characters | 67 characters |
A few symbols count as two characters in plain text: ^ { } \ [ ] ~ | €. Messages can be up to 1,530 characters. The send response tells you credits per recipient and total_credits charged.
Prices
| Package | When you pay | Price per SMS |
|---|---|---|
| Starter | UGX 35 – 350,000 | UGX 35 |
| Basic | UGX 300,030 – 1,500,000 | UGX 30 |
| Standard | UGX 1,350,027 – 2,700,000 | UGX 27 |
| Premium | UGX 2,500,025 – 7,500,000 | UGX 25 |
| Premium 2 | UGX 6,000,020 – 10,000,000 | UGX 20 |
| Enterprise | UGX 7,500,015 – 15,000,000 | UGX 15 |
| Large Enterprise | UGX 10,000,010 – 100,000,000 | UGX 10 |
Live prices. Your system can read them with GET /packages.
Send SMS
| Field | Description | |
|---|---|---|
phone | required | One or more numbers, comma separated. Up to 10,000. See formats. |
message | required | Text, up to 1,530 characters. |
{
"status": "success",
"message": "Message sent successfully",
"credits": 1, // credits per recipient
"total_credits": 2, // credits charged for this call
"recipients": 2,
"balance": 498, // credits left
"batch": "A2610311215304F2A9C",
"invalid": ["0123"], // numbers left out (not charged)
"skipped_blacklisted": 0
}Errors: 400 missing or invalid fields, 402 not enough credits, 502 the gateway refused the message (credits refunded).
Account info
Your remaining credits. Use it to show a balance, or to decide when to top up.
{ "status": "success", "credits": 498, "balance": 0, "api_keys": 1, "message": "Fetched Successfully" }balance is always 0. It is kept for older integrations, because payments now turn straight into credits.
Packages and quote
To show the price list on a public page, use GET /pricing. It returns the same list without the quote and needs no API key. Tiers can overlap, so use from_amount and to_amount for the amounts that really get each rate. If your account has a fixed price, /packages also returns it as your_rate, and quotes and top-ups use it.
| Field | Description | |
|---|---|---|
amount | optional | UGX. Adds a quote with the rate and the credits that amount buys. |
{
"status": "success",
"currency": "UGX",
"min_topup": 500,
"max_topup": 5000000,
"packages": [
{ "name": "Starter", "rate": 35, "min_sms": 1, "max_sms": 10000, "min_amount": 35, "max_amount": 350000 },
...
],
"quote": { "amount": 20000, "rate": 35, "credits": 571 }
}Top up
Sends a Mobile Money payment prompt to phone. When the payer approves, the amount becomes credits on your account. See the guide.
| Field | Description | |
|---|---|---|
phone | required | MTN or Airtel Uganda number that pays, e.g. +256772123456 or 0772123456. |
amount | required | UGX, whole number, 500 – 5,000,000. |
{ "status": "success", "message": "SMS Order Initiated", "orderId": "1761905400123", "amount": 20000, "rate": 35, "credits": 571 }credits is what the payment will add once completed.
Order status
| Field | Description | |
|---|---|---|
orderId | required | The orderId from /topup. |
{ "status": "success", "message": "Completed", "statuscode": 1, "credits": 571, "amount": 20000, "balance": 1069, "reason": null }| statuscode | message | Meaning |
|---|---|---|
| 0 | Pending | Waiting for the payer to approve. |
| 1 | Completed | Paid. credits were added and balance is your new total. |
| 2 | Failed | Declined, not enough money, or not registered. Nothing was charged. reason says why. |
Verify phone
Looks up the registered name of a Mobile Money number before you charge it, so you can show "Pay as JOHN DOE?" to your user.
| Field | Description | |
|---|---|---|
phone | required | MTN or Airtel Uganda number. |
{
"status": "success",
"phone": "+256772123456",
"valid": true,
"network": "MTN",
"can_pay": true, // that network is taking payments right now
"registered_name": "Jane Namuli", // null when the name is not known
"notice": null // e.g. a maintenance message for the network
}A 503 means the lookup is unavailable right now; you can still use the number.
Errors
{ "status": "failed", "message": "Not enough credits: this send needs 11, you have 2." }| HTTP | Meaning | What to do |
|---|---|---|
| 400 | A field is missing or invalid | Show message to your user, or fix the request. |
| 401 | No API key sent | Add the Authorization: Bearer header. |
| 403 | Key is wrong or revoked, or the account is locked | Check the key in the app; contact support if the account is locked. |
| 402 | Not enough credits | Top up, then retry. The message also waits under Failed messages in the app for 24 hours; a retry from either place removes it there, so it isn't sent twice. |
| 404 | Unknown endpoint or order | Check the URL or the orderId. |
| 429 | Rate limit reached | Wait for the number of seconds in Retry-After, then retry. |
| 500 | Server error | Retry later. Quote the X-Request-Id to support. |
| 502 / 503 | SMS gateway or lookup service unavailable | Retry after a short wait. Credits for refused messages are refunded automatically. |
Rate limits
Each account can make 120 requests per minute across all its keys. Over the limit you get 429 with a Retry-After header. To reach many people, send one message to many numbers in a single /send call instead of one call per number.
Your recent requests, their status and timing are listed under API keys in the app.
Phone number formats
All of these mean the same number:
0772123456 772123456 256772123456 +256 772 123 456
Ugandan numbers must start with 7 or 3 after the country code. Numbers in other countries must be written in full international format.
OpenAPI specification
A machine-readable description of the API, for Postman, code generators and AI assistants:
https://docs.lanasms.com/openapi.json
Changelog
October 2026
- New
GET /packageswith an optionalquotefor an amount. - Mobile Money payments move to Cashmora.
/topupreturnsamount,rateandcredits;/order_statusreturnsamount, the newbalanceand areasonwhen a payment fails. /verifyphonereturns a fixed shape:valid,network,can_pay,registered_name./sendreturnstotal_credits,recipients,batchandinvalid. It accepts JSON bodies and up to 10,000 numbers.- Payments turn straight into credits.
balancein/infois always 0. - Clear HTTP status codes (402, 429, 502), an
X-Request-Idon every response, and a request log in the app. - SMS parts are counted per carrier rules (153 characters per part for long plain messages; 70/67 with emoji).
Support
WhatsApp +256 778 948 580 · Call +256 768 308 854 · Email support@lanasms.com
Include the X-Request-Id of the request you're asking about.