Updated 2 min read

Maroc Telecom (IAM) Full SMS API

Technical guide on sending SMS to the Maroc Telecom (IAM) network: prefixes (+212661, +212670), local routing, REST API, DLR webhooks and ANRT regulations.

Introduction: The place of Maroc Telecom (IAM) in the mobile landscape

Itissalat Al-Maghrib (Maroc Telecom) remains the historic operator and the undisputed leader in telecommunications in Morocco. With a predominant mobile market share, the deliverability of your transactional messages (OTP validation codes, payment alerts, logistics notifications) to IAM subscribers is the central pillar of any communication strategy in the Kingdom. On EnvoiSMS traffic, 91.2% of SMS to Maroc Telecom were confirmed delivered (October 2026), over local routes with automatic failover between routes.

List of Maroc Telecom Prefixes (+212) for Standardization

Before submitting a number to the API, it is essential to validate its format. Maroc Telecom operates a range of specific prefixes. Map this list into your validation functions to qualify your contacts and instantly identify the original operator:

Type de Préfixe Plages de Numéros (E.164) Exemple Local
Mobiles IAM (Historiques) +212 661, +212 662, +212 666, +212 667, +212 668 0661-XXXXXX
Mobiles IAM (Récents) +212 670, +212 671, +212 672, +212 673, +212 676, +212 677, +212 678 0670-XXXXXX
Nouvelles Plages Mobiles +212 700, +212 701, +212 707, +212 708 0700-XXXXXX

Note : Tous les numéros marocains doivent être normalisés à la norme internationale E.164 (ex: +212661XXXXXX) en retirant le "0" initial du préfixe local.

The Risks of Indirect Routing (Gray Routes) vs Legitimate Local Routes

Many low-cost international gateways offer SMS sending to Morocco via "gray routes" or indirect transit. These channels pose three major problems: high latency (sometimes greater than 30 seconds, which expires your 2FA codes), a high loss rate, and Sender IDs rewritten by random mobile numbers (eg: +44...). EnvoiSMS.ma avoids these problems by using legitimate local routes to Moroccan operators, with registered sender IDs and automatic failover between routes. Your messages travel over a legitimate, fast route.

Rapid Technical Integration (cURL & PHP)

Here is how to initiate a send to a validated Maroc Telecom number using the EnvoiSMS.ma API.

// Exemple en PHP (cURL natif) pour envoyer un SMS OTP vers Maroc Telecom <?php $apiKey = "YOUR_API_KEY"; $payload = json_encode([ "to" => "+212661234567", // Destinataire IAM normalisé "body" => "Votre code de vérification IAM est 408291. Valable 5 minutes.", "sender" => "EnvoiSMS" ]); $ch = curl_init("https://api.envoisms.ma/v1/messages"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, [ "Authorization: Bearer " . $apiKey, "Content-Type: application/json" ]); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($httpCode === 200) { $result = json_decode($response, true); echo "SMS envoyé avec succès ! ID: " . $result["id"]; } else { echo "Erreur d'envoi. Code HTTP: " . $httpCode; } ?>

ANRT and CNDP regulations in Morocco

Sending commercial or marketing SMS messages in Morocco is regulated by law 09-08 of the CNDP relating to the protection of personal data. To remain in absolute compliance on the Maroc Telecom network, you must: 1) Obtain prior consent from the user (Opt-in). 2) Mandatory include the words “STOP SMS” or a simple unsubscribe mechanism. 3) Declare your customer files and process unsubscriptions in real time to avoid possible administrative proceedings.

Frequently asked questions

How can you be sure that a number belongs to Maroc Telecom?

Under ANRT's numbering plan, Maroc Telecom (IAM) mobiles start with, among others, +212661, +212662, +212666, +212667, +212668, +212670 to +212673 and +212676 to +212678 in the 06 range, and +212750 to +212755 and +212760 to +212769 in the 07 range. The +212700 to +212728 ranges are allocated to Inwi, not Maroc Telecom. A range tells you the original operator: about 2.7% of Moroccan mobiles have switched operator through number portability (ANRT, Q2 2025).

What is the delivery latency of an OTP on the IAM network?

With the local routes used by EnvoiSMS.ma, the median time to carrier confirmation is 11–17 s (measured in October 2026).

Is personalized Sender ID supported on Maroc Telecom?

Yes. The personalized Sender ID (sender name up to 11 alphanumeric characters) is fully supported after registration and validation of the mandate document with Moroccan operators via our console.