SMS API
Send OTP codes and notifications straight from your system
One HTTPS GET request from your backend. Use the SMS API to send OTP codes and transactional notifications from your own backend, inside Egypt.
Available inside Egypt only
What you can build
Messages your system sends at exactly the right moment
-
OTP verification codes
A login or confirmation code that reaches the customer seconds after they ask for it.
-
Order confirmations
An automatic message when an order completes or changes state in your store.
-
Shipment updates
A notice when a shipment leaves, or when the courier is close.
-
Internal system alerts
An appointment reminder, a renewal alert or an invoice notice, straight from your system.
Who this is for
- Developers and software companies
- E-commerce stores
- Mobile applications
- Internal business systems
- Shipping and delivery companies
- OTP verification codes
- Banking and ATM transaction alerts
- Loyalty and rewards program notifications
- Web transaction confirmations
In every case the API sends alerts and notifications requested by the customer’s own software. It does not carry out any transaction and does not connect to ATM hardware.
How it works
Four steps from event to message
-
An event happens in your system
A signup, an order confirmation, a shipment leaving.
-
Your server builds the request
It assembles the numbers, message and language, URL-encoding every value.
-
An HTTPS GET goes to the gateway
From the backend only — never the browser, never the app.
-
The gateway replies in plain text
You match the response strictly before treating it as success.
The integration
One request from your server
https://sms.masrbokra.com/sendsms.php
- Protocol
- HTTPS
- Method
- GET
- Request format
- URL-encoded query parameters
- Response
- Plain text, not JSON
- Encoding
- UTF-8
Required send parameters
| Field | Type | Description |
|---|---|---|
user | String | API account username |
password | String | API account password |
numbers | String | One international number, or a comma-separated list |
sender | String | The sender name approved on the account |
message | String | The message text, UTF-8 |
lang | Enum | Message language: en or ar |
Request acknowledgement
11:<valid-recipient-list>
The gateway replies in plain text: 1 when the request is accepted, or 1 followed by the accepted recipient list. The full response tables are in the integration guide.
Balance query
The same endpoint with user, password and action=get. The gateway returns a numeric value as plain text, which may include decimals.
Implementation note: Keep your API credentials on the server. The call is made from your backend — not from the browser, and not from inside a mobile app.
Code examples
Server-side integration examples
Your account credentials are supplied separately through a secure channel after activation.
# Credentials come from the environment, never from the command line
# (a literal password would land in your shell history).
curl --get "https://sms.masrbokra.com/sendsms.php" \
--data-urlencode "user=$MASRBOKRA_SMS_USER" \
--data-urlencode "password=$MASRBOKRA_SMS_PASSWORD" \
--data-urlencode "numbers=201001234567" \
--data-urlencode "sender=YOUR_SENDER" \
--data-urlencode "message=Your order has shipped." \
--data-urlencode "lang=en" \
--connect-timeout 10 \
--max-time 20 \
--no-retry-all-errors
# The reply is plain text: "1", or "1:201001234567", or an error string. <?php
// Server-side only. Never call this endpoint from browser JavaScript.
$params = [
'user' => getenv('MASRBOKRA_SMS_USER'),
'password' => getenv('MASRBOKRA_SMS_PASSWORD'),
'numbers' => '201001234567',
'sender' => getenv('MASRBOKRA_SMS_SENDER'),
'message' => 'Your order has shipped.',
'lang' => 'en',
];
// http_build_query URL-encodes every value, including the Arabic ones.
$url = 'https://sms.masrbokra.com/sendsms.php?' . http_build_query($params);
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_TIMEOUT => 20,
]);
$body = curl_exec($ch);
curl_close($ch);
$reply = trim((string) $body);
// Strict match. startsWith('1') would also accept "10" and "11:...".
$accepted = $reply === '1'
|| preg_match('/^1:[1-9]\d{7,14}(,[1-9]\d{7,14})*$/', $reply) === 1;
// Log the reply, never $url — it contains the password and the message text.
error_log('MasrBokra reply: ' . $reply);
// Acceptance is not delivery. Do not resend automatically on a timeout:
// the gateway may already have accepted the request. // Server-side only (an API route, a worker, a cron job) — never the browser.
const ACCEPTED = /^1:[1-9]\d{7,14}(?:,[1-9]\d{7,14})*$/;
export async function sendSms({ numbers, message, lang = 'en' }) {
// URLSearchParams encodes every value for us.
const params = new URLSearchParams({
user: process.env.MASRBOKRA_SMS_USER,
password: process.env.MASRBOKRA_SMS_PASSWORD,
numbers,
sender: process.env.MASRBOKRA_SMS_SENDER,
message,
lang,
});
const controller = new AbortController();
const timer = setTimeout(() => controller.abort(), 20_000);
let reply;
try {
const res = await fetch(
`https://sms.masrbokra.com/sendsms.php?${params}`,
{ signal: controller.signal },
);
reply = (await res.text()).trim();
} finally {
clearTimeout(timer);
}
// Log the reply only. The URL carries the password and the message body.
console.log('MasrBokra reply:', reply);
// Accepted by the gateway — which is not the same as delivered to a handset.
return { accepted: reply === '1' || ACCEPTED.test(reply), reply };
}
// On AbortError, surface it for a human to check the balance or the account
// log. Do not retry on a schedule: the send may already have gone through. import os
import re
import requests
ACCEPTED = re.compile(r"^1:[1-9]\d{7,14}(?:,[1-9]\d{7,14})*$")
def send_sms(numbers: str, message: str, lang: str = "en") -> tuple[bool, str]:
"""Send through the MasrBokra gateway. Server-side use only."""
params = {
"user": os.environ["MASRBOKRA_SMS_USER"],
"password": os.environ["MASRBOKRA_SMS_PASSWORD"],
"numbers": numbers,
"sender": os.environ["MASRBOKRA_SMS_SENDER"],
"message": message,
"lang": lang,
}
# requests URL-encodes params, including UTF-8 Arabic text.
response = requests.get(
"https://sms.masrbokra.com/sendsms.php",
params=params,
timeout=(10, 20), # connect, read
)
reply = response.text.strip()
# Log the reply, never response.url — it contains the password.
print("MasrBokra reply:", reply)
# Strict match, not reply.startswith("1").
accepted = reply == "1" or bool(ACCEPTED.match(reply))
# Accepted != delivered. Let a requests.Timeout raise rather than retrying
# in a loop, because the gateway may already have taken the request.
return accepted, reply Number format
International digits only — no plus sign, no spaces, no dashes. Supported Egyptian prefixes: 010, 011, 012, 015.
| Local input | Value sent |
|---|---|
01001234567 | 201001234567 |
01112345678 | 201112345678 |
01212345678 | 201212345678 |
01512345678 | 201512345678 |
SMS packages
The larger the package, the lower the per-message price
The same packages cover Bulk SMS and the API. It is one balance on your account.
| SMS units | Price | Per message |
|---|---|---|
| 1,000 | 270 EGP | 0.270 EGP |
| 5,000 | 1,350 EGP | 0.270 EGP |
| 10,000 | 2,650 EGP | 0.265 EGP |
| 20,000 | 5,200 EGP | 0.260 EGP |
| 50,000 | 12,750 EGP | 0.255 EGP |
| 100,000 | 25,000 EGP | 0.250 EGP |
| 150,000 Lowest unit price | 36,750 EGP | 0.245 EGP |
All prices exclude VAT at 14%.
Request your packageSender Name activation
Your company’s name on the message, not an unknown number
One sender-name activation serves both Bulk SMS and the API.
- Activation fee
- 2,150 EGP
- Activation time
- 7–10 business days
- Documents required
-
- Commercial Register
- Tax Card
The activation fee excludes VAT. Terms and conditions apply.
Talk to the technical teamStart your integration with our team
Our technical team helps you set the account up, walks through the testing steps and follows up on any sending issue once you are live.
- Lightweight HTTPS GET integration
- Plain-text response handling
- Direct SMS sending and balance lookup
- Account credentials supplied separately and securely
Common questions
Questions about the SMS API
What do I need to get started?
An API account, an activated Sender Name and an SMS balance. We set the account up and send your technical team the credentials and the integration guide.
Which programming languages are supported?
Any language that can make an HTTPS request. The guide includes ready examples in cURL, PHP, Node.js and Python.
Is the balance shared with Bulk SMS?
Yes. The same packages and the same balance cover the platform and the API, and you can use both in parallel on one account.
Can I schedule sends?
Scheduling is available in the Bulk SMS platform. With the API, your own system schedules on its side and calls the endpoint at the moment you choose.
Start the integration
Tell us about your system and your expected volume; we will set up the account and sender name and send your team the full guide.