SMS API
Send SMS to Mozambique and Angola from your website, app or system, with a single HTTPS request.
- Home »
- Business SMS »
- SMS API
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 something happens in your system, the customer gets an SMS right away. Nobody has to remember to let them know.
Let customers know when an invoice is issued, when it is due or when the order leaves the warehouse.
Confirm the payment and the order as soon as the customer pays, at the counter or on your website.
Tell customers the job is done or remind them of the next service, without a phone call.
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.
90 requests per minute per key and 300 per account, shown in the X-RateLimit headers.
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: £40.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 sending 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 £40.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.