Transactional SMS
Payment confirmations, orders, receipts and transfers sent through our API the moment they happen.
- Home »
- Business SMS »
- Transactional SMS
Start with a Sandbox key, which validates requests without sending anything or using credits. When you are ready, switch to the Production key.
sandbox_ key in the API Center in My MozOut, with the sms:write permission.POST /v1/sms/messages request with the number and the text.prod_ key. The request stays the same.curl https://api.mozout.com/v1/sms/messages \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-4521-ready" \
-d '{"number": "+258841234567",
"text": "Your order 4521 is ready for pickup."}'<?php
$ch = curl_init('https://api.mozout.com/v1/sms/messages');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json',
'Idempotency-Key: order-4521-ready',
],
CURLOPT_POSTFIELDS => json_encode([
'number' => '+258841234567',
'text' => 'Your order 4521 is ready for pickup.',
]),
]);
$sms = json_decode(curl_exec($ch), true);
echo $sms['data']['status']; // sent, queued or failedimport requests
r = requests.post(
"https://api.mozout.com/v1/sms/messages",
headers={"Authorization": "Bearer YOUR_API_KEY",
"Idempotency-Key": "order-4521-ready"},
json={"number": "+258841234567",
"text": "Your order 4521 is ready for pickup."},
timeout=30,
)
print(r.json()["data"]["status"]) # sent, queued or failedconst r = await fetch("https://api.mozout.com/v1/sms/messages", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
"Idempotency-Key": "order-4521-ready",
},
body: JSON.stringify({
number: "+258841234567",
text: "Your order 4521 is ready for pickup.",
}),
});
console.log((await r.json()).data.status); // sent, queued or failed
One HTTPS request is enough. The API validates it, deducts the credits and hands the message to the operators; your system follows its status.
An order, an invoice or a booking triggers the request.
Checks the key, the number and the balance, and replies in JSON.
The message goes out with your Sender ID or with NETMSG.
Gets the SMS in Mozambique and Angola, on any phone.
The statuses of a message:
scheduledqueuedsendingsentfailedcancelledsimulated
They all start at https://api.mozout.com, with the key in the Authorization: Bearer header. The full list, with fields and responses, is in the documentation.
When a payment comes in, an order ships or a transfer is made, the customer gets the confirmation at once. Nobody has to remember to send it.
Send the receipt when a payment comes in and let customers know when an invoice is issued or due.
Confirm every payment and transfer the moment it happens, at the counter, on the website or in the app.
Let customers know the order has shipped, the job is done or everything is ready to collect.
Both keys use the same address and the same operations. The difference is what happens when you send.
sandbox_prod_simulated: true.sandboxproduction
Each key has its own permissions and can be revoked at any time. Requests always go over HTTPS.
sms:read to read and sms:write to send and change.
Optional: the key only works from the addresses you list.
30, 90 or 365 days, or no expiry. Revoke it whenever you like.
With Idempotency-Key, a repeated request never sends twice.
Register an HTTPS address and get a signed notice when each SMS is sent or fails.
Responses show the number as 25884****567, so it stays out of your logs.
SMS sent through the API use the same credit balance as the SMS Center. The tier price applies to the whole quantity you buy.
Minimum of 1,000 credits. 1 SMS of up to 160 characters = 1 credit. Sender ID: R900.00 per name and per country.
Articles to help you choose, set up and get the most from this service
The short answer: an API is the agreed way for one program to ask another for something. Instead of a person opening a page and clicking, your site sends…
Read the article
The short answer: if an API key, a token or a webhook secret has turned up somewhere it should not (a public repository, a file inside the site, a…
Read the article
To talk to an API from PHP you use cURL: open a request, send it, read the status code (200, 401, 404…) and only then decode the JSON in…
Read the article
The most frequent questions about transactional SMS through the API
An account with SMS activated, SMS credits and an API key with the sms:write permission. You create the key in the API Center in My MozOut. To test, a Sandbox key is enough, with no credits.
The send response already includes the status: sent, queued or failed. Later, call GET /v1/sms/messages/{id} or check the history. The possible statuses are scheduled, queued, sending, sent, simulated, failed and cancelled.
Yes. Put an approved Sender ID in the sender field. You can request one through the API or in My MozOut: it costs R900.00 per name and per country, and the review takes up to 48 business hours. Without sender, the free NETMSG is used.
No. Named senders, including NETMSG, cannot receive replies. If you need customers to contact you, include a phone number, an email or your website address in the message.
Any language that can make HTTPS requests: PHP, Python, JavaScript, Java, C# and more. The documentation has examples in cURL, PHP, Python and JavaScript, plus a Playground to try things out.
It is a value of your choice that you send in the request header. If the connection drops and your system repeats the same request with the same value, the API returns the first response and the SMS is not sent twice.
Up to 90 requests per minute per key and 300 per account, across all keys. The X-RateLimit-Limit and X-RateLimit-Remaining headers show how many are left. If you go over, the API answers 429 with the time to wait.
They come out of the same credit balance as the SMS Center. Each SMS part uses one credit: up to 160 characters is one part, or up to 70 with letters such as ã or ç. For a scheduled send, credits are only taken when the message goes out.