Expertise market

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.

Maroc Telecom (IAM) Full SMS API
Table of Contents
  1. Introduction: The place of Maroc Telecom (IAM) in the mobile landscape
  2. List of Maroc Telecom Prefixes (+212) for Standardization
  3. The Risks of Indirect Routing (Gray Routes) vs Legitimate Local Routes
  4. Rapid Technical Integration (cURL & PHP)
  5. ANRT and CNDP regulations in Morocco

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, 84.8% of SMS to Maroc Telecom were confirmed delivered (September 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.

Why choose EnvoiSMS for your business?

Carrier Delivery

Local routes to IAM, Orange and Inwi, with automatic failover between routes and delivery status sent by webhook.

Cost Optimization

WhatsApp Business API from 0.65 MAD per message with optimal ROI.

Sovereign Data (CNDP)

Full compliance with Moroccan personal data protection regulations (CNDP).

How can you be sure that a number belongs to Maroc Telecom?
Number ranges starting with +212661, +212662, +212666, +212667, +212668, +212670, +212671, +212672, +212673, +212676, +212677, +212678 and +212700, +212701, +212707, +212708 are historically attributed to Maroc Telecom (IAM).
What is the delivery latency of an OTP on the IAM network?
With the local routes used by EnvoiSMS.ma, the delivery time of an SMS or OTP to Maroc Telecom is 2.8 to 3.9 seconds on average.
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.

Suggested Articles

Morocco Telecom Review: 12 Months of Enterprise Messaging Insights
market

Morocco Telecom Review: 12 Months of Enterprise Messaging Insights

Enterprise Messaging Trends in Morocco (2027 Outlook): SMS, RCS & AI
market

Enterprise Messaging Trends in Morocco (2027 Outlook): SMS, RCS & AI

Annual Report 2026: SMS APIs & Enterprise Messaging in Morocco
market

Annual Report 2026: SMS APIs & Enterprise Messaging in Morocco